Currently, continuing on my project to make an autonomous crazyflie 2.0, I am working on using a MaxBotics ultrasonic sensor to find range in the z direction as opposed to using the actual zranger, since I intend to use the zranger to find horizontal distance for collision mitigation.
Looking at the driver for the MaxBotics ultrasonic sensor that is integrated into the firmware made me somewhat confused, and so I instead thought it would be a good idea to instead take information from the files maxsonar.c, maxsonar.h, zranger.c, and zranger.h, and use them to build a custom driver for the ultrasonic sensor that I will force in config.mk and hope will cause the ultrasonic sensor (model: MaxSonar-EZ4) act more like the zranger in the firmware.
In doing this I have come upon a small issue, but I cannot seem to figure out how to solve it. The issue is an error in my C program, at the point where I declare the pins used by the deck.
Code: Select all
static const DeckDriver MaxSonarMathai_deck = {
/*
* this function tells the drone what the name of the deck is, what ports it uses
* and what the name in the makefile is for it. (I think.)
* -MK
*/
.vid = 0xBC,
.pid = 0x09,
.name = "MaxSonarMathai"
.usedGpio = DECK_GPIO_TX2,
.init = MaxSonarMathaiInit,
};
Code: Select all
#define MAXSONAR_DECK_GPIO DECK_GPIO_TX2
In the include file for the program.
I think it may have something to do with the deck API, such as the code here:
Code: Select all
typedef struct deck_driver {
/* Identification of the deck (written in the board) */
uint8_t vid;
uint8_t pid;
char *name;
/* Periphreal and Gpio used _dirrectly_ by the driver */
uint32_t usedPeriph;
uint32_t usedGpio;
/* Init and test functions */
void (*init)(struct deckInfo_s *);
bool (*test)(void);
} DeckDriver;
If anyone has any suggestions or fixes, any help would be greatly appreciated. Especially since at this point I have absolutely no idea what I've done wrong. Also, my apologies if this is a super simple fix. I'm still somewhat new to all of this.