mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
i2c no-ack fix (never actually worked properly, fixed now)
bumped config version, or else r198 crashed on update from recent version airplane mode config passed to drv_pwm git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@199 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
e6cb4a0b1c
commit
10570a6579
5 changed files with 2495 additions and 2490 deletions
4936
obj/baseflight.hex
4936
obj/baseflight.hex
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,7 @@ config_t cfg;
|
|||
const char rcChannelLetters[] = "AERT1234";
|
||||
|
||||
static uint32_t enabledSensors = 0;
|
||||
uint8_t checkNewConf = 25;
|
||||
uint8_t checkNewConf = 26;
|
||||
|
||||
void parseRcChannels(const char *input)
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ static void i2c_er_handler(void)
|
|||
/* Read the I2C1 status register */
|
||||
SR1Register = I2Cx->SR1;
|
||||
if (SR1Register & 0x0F00) { //an error
|
||||
error = true;
|
||||
// I2C1error.error = ((SR1Register & 0x0F00) >> 8); //save error
|
||||
// I2C1error.job = job; //the task
|
||||
}
|
||||
|
@ -89,6 +90,7 @@ bool i2cWriteBuffer(uint8_t addr_, uint8_t reg_, uint8_t len_, uint8_t *data)
|
|||
read_p = my_data;
|
||||
bytes = len_;
|
||||
busy = 1;
|
||||
error = false;
|
||||
|
||||
// too long
|
||||
if (len_ > 16)
|
||||
|
@ -113,7 +115,7 @@ bool i2cWriteBuffer(uint8_t addr_, uint8_t reg_, uint8_t len_, uint8_t *data)
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
|
||||
bool i2cWrite(uint8_t addr_, uint8_t reg_, uint8_t data)
|
||||
|
@ -133,6 +135,7 @@ bool i2cRead(uint8_t addr_, uint8_t reg_, uint8_t len, uint8_t* buf)
|
|||
write_p = buf;
|
||||
bytes = len;
|
||||
busy = 1;
|
||||
error = false;
|
||||
|
||||
if (!(I2Cx->CR2 & I2C_IT_EVT)) { //if we are restarting the driver
|
||||
if (!(I2Cx->CR1 & 0x0100)) { // ensure sending a start
|
||||
|
@ -150,7 +153,7 @@ bool i2cRead(uint8_t addr_, uint8_t reg_, uint8_t len, uint8_t* buf)
|
|||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
|
||||
void i2c_ev_handler(void)
|
||||
|
|
|
@ -23,7 +23,6 @@ int main(void)
|
|||
GPIOA->BRR = 0x8000; // set low 15
|
||||
GPIOC->CRH = 0x44434444; // PIN 12 Output 50MHz
|
||||
GPIOC->BRR = 0x1000; // set low 12
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
@ -52,7 +51,9 @@ int main(void)
|
|||
#endif
|
||||
|
||||
mixerInit(); // this will set useServo var depending on mixer type
|
||||
// pwmInit returns true if throttle calibration is requested. if so, do it here. throttleCalibration() does NOT return - for safety.
|
||||
// when using airplane/wing mixer, servo/motor outputs are remapped
|
||||
if (cfg.mixerConfiguration == MULTITYPE_AIRPLANE || cfg.mixerConfiguration == MULTITYPE_FLYING_WING)
|
||||
pwm_params.airplane = true;
|
||||
pwm_params.usePPM = feature(FEATURE_PPM);
|
||||
pwm_params.enableInput = !feature(FEATURE_SPEKTRUM); // disable inputs if using spektrum
|
||||
pwm_params.useServos = useServo;
|
||||
|
@ -92,8 +93,7 @@ int main(void)
|
|||
} else {
|
||||
// spektrum and GPS are mutually exclusive
|
||||
// Optional GPS - available only when using PPM, otherwise required pins won't be usable
|
||||
if (feature(FEATURE_PPM))
|
||||
{
|
||||
if (feature(FEATURE_PPM)) {
|
||||
if (feature(FEATURE_GPS))
|
||||
gpsInit(cfg.gps_baudrate);
|
||||
#ifdef SONAR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue