Adding a custom driver to Betaflight not working #13432
Closed
Lennart-Lutz
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am new to Betaflight and a programmer. I want to use a board that I built myself some time ago. But to do this, I need to add a gyro driver for the a3g4250d. I am using Betaflight 4.5.0-RC2 and have tried the following so far:
I added accgyro_a3g4250d.c/h in src/main/drivers/accgyro and added the neccessary define
USE_GYRO_A3G4250D
. In these files there are 3 functions. a3g4250dInit, a3g4250dRead and a3g4250dDetect.My a3g4250dInit function looks like this:
Since I don't want to add this target to the repository and only use it for myself, I statically defined the I2CDEV_1 in here.
My a3g4250dDetect function looks like this:
In gyro_init.c I added a switch case in the
gyroDetect
function in order to call the a3g4250dDetect function for my driver:I also added
USE_GYRO_A3G4250D
in the enum of the supported gyros.This is my config.h for my custom board:
There is not much there at the moment, just the necessary instructions to make the gyro work. (I think so :D) I left the define for the MPU6000 in there because if I remove it, I get build errors:
The next question is, how can I set a specific pin to low? On my board is a STM32F411RET6 and I want to set PORTC 11 to low. I have tryed that:
GPIO_WriteBit(GPIOC, GPIO_Pin_11, Bit_RESET);
so far (as you can see above in the a3g4250dInit function). I need to do this because a mosfet is turning the a3g4250d on if this pin is low. If it's high, it is off.Building the project runs without errors, but the gyroscope is not recognised in Betaflight. What am I doing wrong, or what am I overlooking? Maybe the problem is just switching on the pin and then everything works... Any help is very appreciated.
Beta Was this translation helpful? Give feedback.
All reactions