mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
replace TRUE/FALSE by stdbool true/false
This commit is contained in:
committed by
Gautier Hattenberger
parent
5c1e4260fe
commit
8edab84dd4
@@ -44,7 +44,7 @@ void i2c_setbitrate(struct i2c_periph *p __attribute__((unused)), int bitrate _
|
|||||||
|
|
||||||
bool i2c_idle(struct i2c_periph *p __attribute__((unused)))
|
bool i2c_idle(struct i2c_periph *p __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
@@ -68,7 +68,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
/* if write failed, increment error counter queue_full_cnt */
|
/* if write failed, increment error counter queue_full_cnt */
|
||||||
p->errors->queue_full_cnt++;
|
p->errors->queue_full_cnt++;
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Just reading
|
// Just reading
|
||||||
@@ -79,7 +79,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
/* if read failed, increment error counter ack_fail_cnt */
|
/* if read failed, increment error counter ack_fail_cnt */
|
||||||
p->errors->ack_fail_cnt++;
|
p->errors->ack_fail_cnt++;
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// First Transmit and then read with repeated start
|
// First Transmit and then read with repeated start
|
||||||
@@ -96,7 +96,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
/* if write/read failed, increment error counter miss_start_stop_cnt */
|
/* if write/read failed, increment error counter miss_start_stop_cnt */
|
||||||
p->errors->miss_start_stop_cnt++;
|
p->errors->miss_start_stop_cnt++;
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -105,7 +105,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
|
|
||||||
// Successfull transfer
|
// Successfull transfer
|
||||||
t->status = I2CTransSuccess;
|
t->status = I2CTransSuccess;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
|
|
||||||
if (ioctl(fd, SPI_IOC_MESSAGE(1), &xfer) < 0) {
|
if (ioctl(fd, SPI_IOC_MESSAGE(1), &xfer) < 0) {
|
||||||
t->status = SPITransFailed;
|
t->status = SPITransFailed;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy recieved data if we had to use an extra rx_buffer */
|
/* copy recieved data if we had to use an extra rx_buffer */
|
||||||
@@ -98,20 +98,20 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
t->status = SPITransSuccess;
|
t->status = SPITransSuccess;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ static void sys_tick_handler(void)
|
|||||||
if (sys_time.timer[i].in_use &&
|
if (sys_time.timer[i].in_use &&
|
||||||
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
||||||
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
||||||
sys_time.timer[i].elapsed = TRUE;
|
sys_time.timer[i].elapsed = true;
|
||||||
/* call registered callbacks, WARNING: they will be executed in the sys_time thread! */
|
/* call registered callbacks, WARNING: they will be executed in the sys_time thread! */
|
||||||
if (sys_time.timer[i].cb) {
|
if (sys_time.timer[i].cb) {
|
||||||
sys_time.timer[i].cb(i);
|
sys_time.timer[i].cb(i);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ static uint8_t channel;
|
|||||||
void ADS8344_init(void)
|
void ADS8344_init(void)
|
||||||
{
|
{
|
||||||
channel = 0;
|
channel = 0;
|
||||||
ADS8344_available = FALSE;
|
ADS8344_available = false;
|
||||||
|
|
||||||
/* setup pins for SSP (SCK, MISO, MOSI) */
|
/* setup pins for SSP (SCK, MISO, MOSI) */
|
||||||
PINSEL1 |= 2 << 2 | 2 << 4 | 2 << 6;
|
PINSEL1 |= 2 << 2 | 2 << 4 | 2 << 6;
|
||||||
@@ -146,7 +146,7 @@ void SPI1_ISR(void)
|
|||||||
channel++;
|
channel++;
|
||||||
if (channel > 7) {
|
if (channel > 7) {
|
||||||
channel = 0;
|
channel = 0;
|
||||||
ADS8344_available = TRUE;
|
ADS8344_available = true;
|
||||||
}
|
}
|
||||||
send_request();
|
send_request();
|
||||||
SpiClearRti();
|
SpiClearRti();
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
/* queue full */
|
/* queue full */
|
||||||
p->errors->queue_full_cnt++;
|
p->errors->queue_full_cnt++;
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
t->status = I2CTransPending;
|
t->status = I2CTransPending;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
|||||||
//VICIntEnable = VIC_BIT(*vic);
|
//VICIntEnable = VIC_BIT(*vic);
|
||||||
enableIRQ();
|
enableIRQ();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void i2c_event(void) { }
|
void i2c_event(void) { }
|
||||||
|
|||||||
@@ -89,10 +89,10 @@ void pwm_input_isr1(void)
|
|||||||
T0CCR &= ~TCCR_CR3_F;
|
T0CCR &= ~TCCR_CR3_F;
|
||||||
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
pwm_input_duty_tics[0] = t_fall - t_rise;
|
pwm_input_duty_tics[0] = t_fall - t_rise;
|
||||||
pwm_input_duty_valid[0] = TRUE;
|
pwm_input_duty_valid[0] = true;
|
||||||
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
pwm_input_period_tics[0] = t_fall - t_oldfall;
|
pwm_input_period_tics[0] = t_fall - t_oldfall;
|
||||||
pwm_input_period_valid[0] = TRUE;
|
pwm_input_period_valid[0] = true;
|
||||||
t_oldfall = t_fall;
|
t_oldfall = t_fall;
|
||||||
#endif //ACTIVE_HIGH
|
#endif //ACTIVE_HIGH
|
||||||
} else if (T0CCR & TCCR_CR3_R) {
|
} else if (T0CCR & TCCR_CR3_R) {
|
||||||
@@ -101,10 +101,10 @@ void pwm_input_isr1(void)
|
|||||||
T0CCR &= ~TCCR_CR3_R;
|
T0CCR &= ~TCCR_CR3_R;
|
||||||
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
pwm_input_duty_tics[0] = t_rise - t_fall;
|
pwm_input_duty_tics[0] = t_rise - t_fall;
|
||||||
pwm_input_duty_valid[0] = TRUE;
|
pwm_input_duty_valid[0] = true;
|
||||||
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
pwm_input_period_tics[0] = t_rise - t_oldrise;
|
pwm_input_period_tics[0] = t_rise - t_oldrise;
|
||||||
pwm_input_period_valid[0] = TRUE;
|
pwm_input_period_valid[0] = true;
|
||||||
t_oldrise = t_rise;
|
t_oldrise = t_rise;
|
||||||
#endif //ACTIVE_LOW
|
#endif //ACTIVE_LOW
|
||||||
}
|
}
|
||||||
@@ -128,10 +128,10 @@ void pwm_input_isr2(void)
|
|||||||
T0CCR &= ~TCCR_CR0_F;
|
T0CCR &= ~TCCR_CR0_F;
|
||||||
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
pwm_input_duty_tics[1] = t_fall - t_rise;
|
pwm_input_duty_tics[1] = t_fall - t_rise;
|
||||||
pwm_input_duty_valid[1] = TRUE;
|
pwm_input_duty_valid[1] = true;
|
||||||
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
pwm_input_period_tics[1] = t_fall - t_oldfall;
|
pwm_input_period_tics[1] = t_fall - t_oldfall;
|
||||||
pwm_input_period_valid[1] = TRUE;
|
pwm_input_period_valid[1] = true;
|
||||||
t_oldfall = t_fall;
|
t_oldfall = t_fall;
|
||||||
#endif //ACTIVE_HIGH
|
#endif //ACTIVE_HIGH
|
||||||
} else if (T0CCR & TCCR_CR0_R) {
|
} else if (T0CCR & TCCR_CR0_R) {
|
||||||
@@ -140,10 +140,10 @@ void pwm_input_isr2(void)
|
|||||||
T0CCR &= ~TCCR_CR0_R;
|
T0CCR &= ~TCCR_CR0_R;
|
||||||
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
pwm_input_duty_tics[1] = t_rise - t_fall;
|
pwm_input_duty_tics[1] = t_rise - t_fall;
|
||||||
pwm_input_duty_valid[1] = TRUE;
|
pwm_input_duty_valid[1] = true;
|
||||||
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
pwm_input_period_tics[1] = t_rise - t_oldrise;
|
pwm_input_period_tics[1] = t_rise - t_oldrise;
|
||||||
pwm_input_period_valid[1] = TRUE;
|
pwm_input_period_valid[1] = true;
|
||||||
t_oldrise = t_rise;
|
t_oldrise = t_rise;
|
||||||
#endif //ACTIVE_LOW
|
#endif //ACTIVE_LOW
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
if (idx >= SPI_TRANSACTION_QUEUE_LEN) { idx = 0; }
|
if (idx >= SPI_TRANSACTION_QUEUE_LEN) { idx = 0; }
|
||||||
if (idx == p->trans_extract_idx) {
|
if (idx == p->trans_extract_idx) {
|
||||||
t->status = SPITransFailed;
|
t->status = SPITransFailed;
|
||||||
return FALSE; /* queue full */
|
return false; /* queue full */
|
||||||
}
|
}
|
||||||
t->status = SPITransPending;
|
t->status = SPITransPending;
|
||||||
|
|
||||||
@@ -521,7 +521,7 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
//VICIntEnable = VIC_BIT(*vic);
|
//VICIntEnable = VIC_BIT(*vic);
|
||||||
//restoreIRQ(cpsr); // restore global interrupts
|
//restoreIRQ(cpsr); // restore global interrupts
|
||||||
enableIRQ();
|
enableIRQ();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -567,10 +567,10 @@ bool spi_lock(struct spi_periph *p, uint8_t slave)
|
|||||||
if (slave < 254 && p->suspend == 0) {
|
if (slave < 254 && p->suspend == 0) {
|
||||||
p->suspend = slave + 1; // 0 is reserved for unlock state
|
p->suspend = slave + 1; // 0 is reserved for unlock state
|
||||||
VICIntEnable = VIC_BIT(*vic);
|
VICIntEnable = VIC_BIT(*vic);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
VICIntEnable = VIC_BIT(*vic);
|
VICIntEnable = VIC_BIT(*vic);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||||
@@ -584,10 +584,10 @@ bool spi_resume(struct spi_periph *p, uint8_t slave)
|
|||||||
SpiStart(p, p->trans[p->trans_extract_idx]);
|
SpiStart(p, p->trans[p->trans_extract_idx]);
|
||||||
}
|
}
|
||||||
VICIntEnable = VIC_BIT(*vic);
|
VICIntEnable = VIC_BIT(*vic);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
VICIntEnable = VIC_BIT(*vic);
|
VICIntEnable = VIC_BIT(*vic);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SPI_MASTER */
|
#endif /* SPI_MASTER */
|
||||||
@@ -681,7 +681,7 @@ bool spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
|
|
||||||
if (p->trans_insert_idx >= 1) {
|
if (p->trans_insert_idx >= 1) {
|
||||||
t->status = SPITransFailed;
|
t->status = SPITransFailed;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
t->status = SPITransPending;
|
t->status = SPITransPending;
|
||||||
p->status = SPIIdle;
|
p->status = SPIIdle;
|
||||||
@@ -697,18 +697,18 @@ bool spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
|
|
||||||
SpiSetDataSize(p, t->dss);
|
SpiSetDataSize(p, t->dss);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_slave_wait(struct spi_periph *p)
|
bool spi_slave_wait(struct spi_periph *p)
|
||||||
{
|
{
|
||||||
if (p->trans_insert_idx == 0) {
|
if (p->trans_insert_idx == 0) {
|
||||||
// no transaction registered
|
// no transaction registered
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
// Start waiting
|
// Start waiting
|
||||||
SpiSlaveStart(p, p->trans[p->trans_extract_idx]);
|
SpiSlaveStart(p, p->trans[p->trans_extract_idx]);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SPI_SLAVE */
|
#endif /* SPI_SLAVE */
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ static void SSP_ISR(void) __attribute__((naked));
|
|||||||
// Functions for the generic device API
|
// Functions for the generic device API
|
||||||
static int spi_slave_hs_check_free_space(struct spi_slave_hs *p __attribute__((unused)), uint8_t len __attribute__((unused)))
|
static int spi_slave_hs_check_free_space(struct spi_slave_hs *p __attribute__((unused)), uint8_t len __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spi_slave_hs_transmit(struct spi_slave_hs *p __attribute__((unused)), uint8_t byte)
|
static void spi_slave_hs_transmit(struct spi_slave_hs *p __attribute__((unused)), uint8_t byte)
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ static inline void sys_tick_irq_handler(void)
|
|||||||
if (sys_time.timer[i].in_use &&
|
if (sys_time.timer[i].in_use &&
|
||||||
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
||||||
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
||||||
sys_time.timer[i].elapsed = TRUE;
|
sys_time.timer[i].elapsed = true;
|
||||||
if (sys_time.timer[i].cb) {
|
if (sys_time.timer[i].cb) {
|
||||||
sys_time.timer[i].cb(i);
|
sys_time.timer[i].cb(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void TRIG_ISR()
|
|||||||
if (msec_of_cpu_ticks(delta_t0_temp) > 10) {
|
if (msec_of_cpu_ticks(delta_t0_temp) > 10) {
|
||||||
trigger_delta_t0 = delta_t0_temp;
|
trigger_delta_t0 = delta_t0_temp;
|
||||||
last = trigger_t0;
|
last = trigger_t0;
|
||||||
trigger_ext_valid = TRUE;
|
trigger_ext_valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +52,6 @@ void trigger_ext_init(void)
|
|||||||
#else
|
#else
|
||||||
#error "trig_ext_hw.h: Unknown PULSE_TYPE"
|
#error "trig_ext_hw.h: Unknown PULSE_TYPE"
|
||||||
#endif
|
#endif
|
||||||
trigger_ext_valid = FALSE;
|
trigger_ext_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ void TRIG_ISR()
|
|||||||
if (msec_of_cpu_ticks(delta_t0_temp) > 10) {
|
if (msec_of_cpu_ticks(delta_t0_temp) > 10) {
|
||||||
delta_t0 = delta_t0_temp;
|
delta_t0 = delta_t0_temp;
|
||||||
last = trigger_t0;
|
last = trigger_t0;
|
||||||
trig_ext_valid = TRUE;
|
trig_ext_valid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,6 +35,6 @@ void trig_ext_init(void)
|
|||||||
#else
|
#else
|
||||||
#error "trig_ext_hw.h: Unknown PULSE_TYPE"
|
#error "trig_ext_hw.h: Unknown PULSE_TYPE"
|
||||||
#endif
|
#endif
|
||||||
trig_ext_valid = FALSE;
|
trig_ext_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void exti15_10_irq_handler(void)
|
|||||||
// if(EXTI_GetITStatus(EXTI_Line14) != RESET)
|
// if(EXTI_GetITStatus(EXTI_Line14) != RESET)
|
||||||
// EXTI_ClearITPendingBit(EXTI_Line14);
|
// EXTI_ClearITPendingBit(EXTI_Line14);
|
||||||
|
|
||||||
//imu_aspirin.gyro_eoc = TRUE;
|
//imu_aspirin.gyro_eoc = true;
|
||||||
//imu_aspirin.status = AspirinStatusReadingGyro;
|
//imu_aspirin.status = AspirinStatusReadingGyro;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,5 +59,5 @@ void exti2_irq_handler(void)
|
|||||||
void dma1_c4_irq_handler(void)
|
void dma1_c4_irq_handler(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
//imu_aspirin.accel_available = TRUE;
|
//imu_aspirin.accel_available = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ void SPI1_ISR(void)
|
|||||||
channel++;
|
channel++;
|
||||||
if (channel > 7 - 1) {
|
if (channel > 7 - 1) {
|
||||||
channel = 0;
|
channel = 0;
|
||||||
ADS8344_available = TRUE;
|
ADS8344_available = true;
|
||||||
ADS8344Unselect();
|
ADS8344Unselect();
|
||||||
} else {
|
} else {
|
||||||
send_request();
|
send_request();
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
#include "mcu_periph/i2c.h"
|
#include "mcu_periph/i2c.h"
|
||||||
|
|
||||||
|
|
||||||
bool i2c_idle(struct i2c_periph *p __attribute__((unused))) { return TRUE; }
|
bool i2c_idle(struct i2c_periph *p __attribute__((unused))) { return true; }
|
||||||
bool i2c_submit(struct i2c_periph *p __attribute__((unused)), struct i2c_transaction *t __attribute__((unused))) { return TRUE;}
|
bool i2c_submit(struct i2c_periph *p __attribute__((unused)), struct i2c_transaction *t __attribute__((unused))) { return true;}
|
||||||
void i2c_event(void) { }
|
void i2c_event(void) { }
|
||||||
void i2c2_setbitrate(int bitrate __attribute__((unused))) { }
|
void i2c2_setbitrate(int bitrate __attribute__((unused))) { }
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "mcu_periph/spi.h"
|
#include "mcu_periph/spi.h"
|
||||||
|
|
||||||
|
|
||||||
bool spi_submit(struct spi_periph *p __attribute__((unused)), struct spi_transaction *t __attribute__((unused))) { return TRUE;}
|
bool spi_submit(struct spi_periph *p __attribute__((unused)), struct spi_transaction *t __attribute__((unused))) { return true;}
|
||||||
|
|
||||||
void spi_init_slaves(void) {}
|
void spi_init_slaves(void) {}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ void spi_slave_select(uint8_t slave __attribute__((unused))) {}
|
|||||||
|
|
||||||
void spi_slave_unselect(uint8_t slave __attribute__((unused))) {}
|
void spi_slave_unselect(uint8_t slave __attribute__((unused))) {}
|
||||||
|
|
||||||
bool spi_lock(struct spi_periph *p __attribute__((unused)), uint8_t slave __attribute__((unused))) { return TRUE; }
|
bool spi_lock(struct spi_periph *p __attribute__((unused)), uint8_t slave __attribute__((unused))) { return true; }
|
||||||
|
|
||||||
bool spi_resume(struct spi_periph *p __attribute__((unused)), uint8_t slave __attribute__((unused))) { return TRUE; }
|
bool spi_resume(struct spi_periph *p __attribute__((unused)), uint8_t slave __attribute__((unused))) { return true; }
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void sys_tick_handler(void)
|
|||||||
if (sys_time.timer[i].in_use &&
|
if (sys_time.timer[i].in_use &&
|
||||||
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
||||||
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
||||||
sys_time.timer[i].elapsed = TRUE;
|
sys_time.timer[i].elapsed = true;
|
||||||
if (sys_time.timer[i].cb) {
|
if (sys_time.timer[i].cb) {
|
||||||
sys_time.timer[i].cb(i);
|
sys_time.timer[i].cb(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,6 @@
|
|||||||
|
|
||||||
void trigger_ext_init(void)
|
void trigger_ext_init(void)
|
||||||
{
|
{
|
||||||
trigger_ext_valid = FALSE;
|
trigger_ext_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ value set_datalink_message(value s)
|
|||||||
dl_buffer[i] = ss[i];
|
dl_buffer[i] = ss[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
dl_msg_available = TRUE;
|
dl_msg_available = true;
|
||||||
DlCheckAndParse();
|
DlCheckAndParse();
|
||||||
|
|
||||||
return Val_unit;
|
return Val_unit;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void radio_control_feed(void)
|
|||||||
RADIO_MODE_NEUTRAL, \
|
RADIO_MODE_NEUTRAL, \
|
||||||
RADIO_MODE_MIN, \
|
RADIO_MODE_MIN, \
|
||||||
RADIO_MODE_MAX);
|
RADIO_MODE_MAX);
|
||||||
ppm_frame_available = TRUE;
|
ppm_frame_available = true;
|
||||||
}
|
}
|
||||||
#else //RADIO_CONTROL
|
#else //RADIO_CONTROL
|
||||||
void radio_control_feed(void) {}
|
void radio_control_feed(void) {}
|
||||||
@@ -84,7 +84,7 @@ value update_rc_channel(value c, value v)
|
|||||||
|
|
||||||
value send_ppm(value unit)
|
value send_ppm(value unit)
|
||||||
{
|
{
|
||||||
ppm_frame_available = TRUE;
|
ppm_frame_available = true;
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
#else // RADIO_CONTROL
|
#else // RADIO_CONTROL
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void radio_control_spektrum_try_bind(void) {}
|
|||||||
|
|
||||||
void radio_control_impl_init(void)
|
void radio_control_impl_init(void)
|
||||||
{
|
{
|
||||||
spektrum_available = FALSE;
|
spektrum_available = false;
|
||||||
}
|
}
|
||||||
void RadioControlEventImp(void (*frame_handler)(void))
|
void RadioControlEventImp(void (*frame_handler)(void))
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ void RadioControlEventImp(void (*frame_handler)(void))
|
|||||||
radio_control.status = RC_OK;
|
radio_control.status = RC_OK;
|
||||||
(*frame_handler)();
|
(*frame_handler)();
|
||||||
}
|
}
|
||||||
spektrum_available = FALSE;
|
spektrum_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_NPS
|
#if USE_NPS
|
||||||
@@ -65,7 +65,7 @@ void radio_control_feed(void)
|
|||||||
radio_control.values[RADIO_YAW] = nps_radio_control.yaw * MAX_PPRZ;
|
radio_control.values[RADIO_YAW] = nps_radio_control.yaw * MAX_PPRZ;
|
||||||
radio_control.values[RADIO_THROTTLE] = nps_radio_control.throttle * MAX_PPRZ;
|
radio_control.values[RADIO_THROTTLE] = nps_radio_control.throttle * MAX_PPRZ;
|
||||||
radio_control.values[RADIO_MODE] = nps_radio_control.mode * MAX_PPRZ;
|
radio_control.values[RADIO_MODE] = nps_radio_control.mode * MAX_PPRZ;
|
||||||
spektrum_available = TRUE;
|
spektrum_available = true;
|
||||||
}
|
}
|
||||||
#else //RADIO_CONTROL
|
#else //RADIO_CONTROL
|
||||||
void radio_control_feed(void) {}
|
void radio_control_feed(void) {}
|
||||||
@@ -89,7 +89,7 @@ value update_rc_channel(value c, value v)
|
|||||||
|
|
||||||
value send_ppm(value unit)
|
value send_ppm(value unit)
|
||||||
{
|
{
|
||||||
spektrum_available = TRUE;
|
spektrum_available = true;
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
#else // RADIO_CONTROL
|
#else // RADIO_CONTROL
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ extern uint8_t led_status[NB_LED];
|
|||||||
GPIO_CNF_OUTPUT_PUSHPULL, \
|
GPIO_CNF_OUTPUT_PUSHPULL, \
|
||||||
GPIO15); \
|
GPIO15); \
|
||||||
for(uint8_t _cnt=0; _cnt<NB_LED; _cnt++) \
|
for(uint8_t _cnt=0; _cnt<NB_LED; _cnt++) \
|
||||||
led_status[_cnt] = FALSE; \
|
led_status[_cnt] = false; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LED_ON(i) { led_status[i] = TRUE; }
|
#define LED_ON(i) { led_status[i] = true; }
|
||||||
#define LED_OFF(i) { led_status[i] = FALSE; }
|
#define LED_OFF(i) { led_status[i] = false; }
|
||||||
#define LED_TOGGLE(i) {led_status[i] = !led_status[i];}
|
#define LED_TOGGLE(i) {led_status[i] = !led_status[i];}
|
||||||
|
|
||||||
#define LED_PERIODIC() { \
|
#define LED_PERIODIC() { \
|
||||||
|
|||||||
@@ -1285,7 +1285,7 @@ static inline void i2c_scl_toggle(uint32_t i2c)
|
|||||||
|
|
||||||
static inline bool i2c_sda_get(uint32_t i2c)
|
static inline bool i2c_sda_get(uint32_t i2c)
|
||||||
{
|
{
|
||||||
bool res = FALSE;
|
bool res = false;
|
||||||
#if USE_I2C1
|
#if USE_I2C1
|
||||||
if (i2c == I2C1) {
|
if (i2c == I2C1) {
|
||||||
res = gpio_get(I2C1_GPIO_PORT, I2C1_GPIO_SDA);
|
res = gpio_get(I2C1_GPIO_PORT, I2C1_GPIO_SDA);
|
||||||
@@ -1418,7 +1418,7 @@ void i2c_event(void)
|
|||||||
bool i2c_submit(struct i2c_periph *periph, struct i2c_transaction *t)
|
bool i2c_submit(struct i2c_periph *periph, struct i2c_transaction *t)
|
||||||
{
|
{
|
||||||
if (periph->watchdog > WD_DELAY) {
|
if (periph->watchdog > WD_DELAY) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t temp;
|
uint8_t temp;
|
||||||
@@ -1428,7 +1428,7 @@ bool i2c_submit(struct i2c_periph *periph, struct i2c_transaction *t)
|
|||||||
// queue full
|
// queue full
|
||||||
periph->errors->queue_full_cnt++;
|
periph->errors->queue_full_cnt++;
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
t->status = I2CTransPending;
|
t->status = I2CTransPending;
|
||||||
@@ -1462,7 +1462,7 @@ bool i2c_submit(struct i2c_periph *periph, struct i2c_transaction *t)
|
|||||||
/* else it will be started by the interrupt handler when the previous transactions completes */
|
/* else it will be started by the interrupt handler when the previous transactions completes */
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool i2c_idle(struct i2c_periph *periph)
|
bool i2c_idle(struct i2c_periph *periph)
|
||||||
@@ -1475,7 +1475,7 @@ bool i2c_idle(struct i2c_periph *periph)
|
|||||||
#ifdef I2C_DEBUG_LED
|
#ifdef I2C_DEBUG_LED
|
||||||
#if USE_I2C1
|
#if USE_I2C1
|
||||||
if (periph == &i2c1) {
|
if (periph == &i2c1) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1484,6 +1484,6 @@ bool i2c_idle(struct i2c_periph *periph)
|
|||||||
if (periph->status == I2CIdle) {
|
if (periph->status == I2CIdle) {
|
||||||
return !(BIT_X_IS_SET_IN_REG(I2C_SR2_BUSY, I2C_SR2(i2c)));
|
return !(BIT_X_IS_SET_IN_REG(I2C_SR2_BUSY, I2C_SR2(i2c)));
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,12 +208,12 @@ void tim1_cc_isr(void) {
|
|||||||
if ((TIM1_SR & TIM1_CC_IF_PERIOD) != 0) {
|
if ((TIM1_SR & TIM1_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM1, TIM1_CC_IF_PERIOD);
|
timer_clear_flag(TIM1, TIM1_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_PERIOD;
|
pwm_input_period_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM1_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM1_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM1_SR & TIM1_CC_IF_DUTY) != 0) {
|
if ((TIM1_SR & TIM1_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM1, TIM1_CC_IF_DUTY);
|
timer_clear_flag(TIM1, TIM1_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_DUTY;
|
pwm_input_duty_tics[TIM1_PWM_INPUT_IDX] = TIM1_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM1_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM1_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,12 +225,12 @@ void tim2_isr(void) {
|
|||||||
if ((TIM2_SR & TIM2_CC_IF_PERIOD) != 0) {
|
if ((TIM2_SR & TIM2_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM2, TIM2_CC_IF_PERIOD);
|
timer_clear_flag(TIM2, TIM2_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_PERIOD;
|
pwm_input_period_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM2_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM2_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM2_SR & TIM2_CC_IF_DUTY) != 0) {
|
if ((TIM2_SR & TIM2_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM2, TIM2_CC_IF_DUTY);
|
timer_clear_flag(TIM2, TIM2_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_DUTY;
|
pwm_input_duty_tics[TIM2_PWM_INPUT_IDX] = TIM2_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM2_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM2_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM2_SR & TIM_SR_UIF) != 0) {
|
if ((TIM2_SR & TIM_SR_UIF) != 0) {
|
||||||
timer_clear_flag(TIM2, TIM_SR_UIF);
|
timer_clear_flag(TIM2, TIM_SR_UIF);
|
||||||
@@ -246,12 +246,12 @@ void tim3_isr(void) {
|
|||||||
if ((TIM3_SR & TIM3_CC_IF_PERIOD) != 0) {
|
if ((TIM3_SR & TIM3_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM3, TIM3_CC_IF_PERIOD);
|
timer_clear_flag(TIM3, TIM3_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_PERIOD;
|
pwm_input_period_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM3_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM3_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM3_SR & TIM3_CC_IF_DUTY) != 0) {
|
if ((TIM3_SR & TIM3_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM3, TIM3_CC_IF_DUTY);
|
timer_clear_flag(TIM3, TIM3_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_DUTY;
|
pwm_input_duty_tics[TIM3_PWM_INPUT_IDX] = TIM3_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM3_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM3_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM3_SR & TIM_SR_UIF) != 0) {
|
if ((TIM3_SR & TIM_SR_UIF) != 0) {
|
||||||
timer_clear_flag(TIM3, TIM_SR_UIF);
|
timer_clear_flag(TIM3, TIM_SR_UIF);
|
||||||
@@ -267,12 +267,12 @@ void tim5_isr(void) {
|
|||||||
if ((TIM5_SR & TIM5_CC_IF_PERIOD) != 0) {
|
if ((TIM5_SR & TIM5_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM5, TIM5_CC_IF_PERIOD);
|
timer_clear_flag(TIM5, TIM5_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM5_PWM_INPUT_IDX] = TIM5_CCR_PERIOD;
|
pwm_input_period_tics[TIM5_PWM_INPUT_IDX] = TIM5_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM5_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM5_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM5_SR & TIM5_CC_IF_DUTY) != 0) {
|
if ((TIM5_SR & TIM5_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM5, TIM5_CC_IF_DUTY);
|
timer_clear_flag(TIM5, TIM5_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM5_PWM_INPUT_IDX] = TIM5_CCR_DUTY;
|
pwm_input_duty_tics[TIM5_PWM_INPUT_IDX] = TIM5_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM5_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM5_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM5_SR & TIM_SR_UIF) != 0) {
|
if ((TIM5_SR & TIM_SR_UIF) != 0) {
|
||||||
timer_clear_flag(TIM5, TIM_SR_UIF);
|
timer_clear_flag(TIM5, TIM_SR_UIF);
|
||||||
@@ -300,12 +300,12 @@ void tim8_cc_isr(void) {
|
|||||||
if ((TIM8_SR & TIM8_CC_IF_PERIOD) != 0) {
|
if ((TIM8_SR & TIM8_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM8, TIM8_CC_IF_PERIOD);
|
timer_clear_flag(TIM8, TIM8_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM8_PWM_INPUT_IDX] = TIM8_CCR_PERIOD;
|
pwm_input_period_tics[TIM8_PWM_INPUT_IDX] = TIM8_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM8_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM8_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM8_SR & TIM8_CC_IF_DUTY) != 0) {
|
if ((TIM8_SR & TIM8_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM8, TIM8_CC_IF_DUTY);
|
timer_clear_flag(TIM8, TIM8_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM8_PWM_INPUT_IDX] = TIM8_CCR_DUTY;
|
pwm_input_duty_tics[TIM8_PWM_INPUT_IDX] = TIM8_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM8_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM8_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,12 +318,12 @@ void tim1_brk_tim9_isr(void) {
|
|||||||
if ((TIM9_SR & TIM9_CC_IF_PERIOD) != 0) {
|
if ((TIM9_SR & TIM9_CC_IF_PERIOD) != 0) {
|
||||||
timer_clear_flag(TIM9, TIM9_CC_IF_PERIOD);
|
timer_clear_flag(TIM9, TIM9_CC_IF_PERIOD);
|
||||||
pwm_input_period_tics[TIM9_PWM_INPUT_IDX] = TIM9_CCR_PERIOD;
|
pwm_input_period_tics[TIM9_PWM_INPUT_IDX] = TIM9_CCR_PERIOD;
|
||||||
pwm_input_period_valid[TIM9_PWM_INPUT_IDX] = TRUE;
|
pwm_input_period_valid[TIM9_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM9_SR & TIM9_CC_IF_DUTY) != 0) {
|
if ((TIM9_SR & TIM9_CC_IF_DUTY) != 0) {
|
||||||
timer_clear_flag(TIM9, TIM9_CC_IF_DUTY);
|
timer_clear_flag(TIM9, TIM9_CC_IF_DUTY);
|
||||||
pwm_input_duty_tics[TIM9_PWM_INPUT_IDX] = TIM9_CCR_DUTY;
|
pwm_input_duty_tics[TIM9_PWM_INPUT_IDX] = TIM9_CCR_DUTY;
|
||||||
pwm_input_duty_valid[TIM9_PWM_INPUT_IDX] = TRUE;
|
pwm_input_duty_valid[TIM9_PWM_INPUT_IDX] = true;
|
||||||
}
|
}
|
||||||
if ((TIM9_SR & TIM_SR_UIF) != 0) {
|
if ((TIM9_SR & TIM_SR_UIF) != 0) {
|
||||||
timer_clear_flag(TIM9, TIM_SR_UIF);
|
timer_clear_flag(TIM9, TIM_SR_UIF);
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
if (idx >= SPI_TRANSACTION_QUEUE_LEN) { idx = 0; }
|
if (idx >= SPI_TRANSACTION_QUEUE_LEN) { idx = 0; }
|
||||||
if ((idx == p->trans_extract_idx) || ((t->input_length == 0) && (t->output_length == 0))) {
|
if ((idx == p->trans_extract_idx) || ((t->input_length == 0) && (t->output_length == 0))) {
|
||||||
t->status = SPITransFailed;
|
t->status = SPITransFailed;
|
||||||
return FALSE; /* queue full or input_length and output_length both 0 */
|
return false; /* queue full or input_length and output_length both 0 */
|
||||||
// TODO can't tell why it failed here if it does
|
// TODO can't tell why it failed here if it does
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
|||||||
}
|
}
|
||||||
//FIXME
|
//FIXME
|
||||||
spi_arch_int_enable(p);
|
spi_arch_int_enable(p);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
||||||
@@ -296,10 +296,10 @@ bool spi_lock(struct spi_periph *p, uint8_t slave)
|
|||||||
if (slave < 254 && p->suspend == 0) {
|
if (slave < 254 && p->suspend == 0) {
|
||||||
p->suspend = slave + 1; // 0 is reserved for unlock state
|
p->suspend = slave + 1; // 0 is reserved for unlock state
|
||||||
spi_arch_int_enable(p);
|
spi_arch_int_enable(p);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
spi_arch_int_enable(p);
|
spi_arch_int_enable(p);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||||
@@ -312,10 +312,10 @@ bool spi_resume(struct spi_periph *p, uint8_t slave)
|
|||||||
spi_start_dma_transaction(p, p->trans[p->trans_extract_idx]);
|
spi_start_dma_transaction(p, p->trans[p->trans_extract_idx]);
|
||||||
}
|
}
|
||||||
spi_arch_int_enable(p);
|
spi_arch_int_enable(p);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
spi_arch_int_enable(p);
|
spi_arch_int_enable(p);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ static void spi_start_dma_transaction(struct spi_periph *periph, struct spi_tran
|
|||||||
/* use dummy rx dma for the rest */
|
/* use dummy rx dma for the rest */
|
||||||
if (trans->output_length > trans->input_length) {
|
if (trans->output_length > trans->input_length) {
|
||||||
/* Enable use of second dma transfer with dummy buffer (cleared in ISR) */
|
/* Enable use of second dma transfer with dummy buffer (cleared in ISR) */
|
||||||
dma->rx_extra_dummy_dma = TRUE;
|
dma->rx_extra_dummy_dma = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef STM32F1
|
#ifdef STM32F1
|
||||||
@@ -634,7 +634,7 @@ static void spi_start_dma_transaction(struct spi_periph *periph, struct spi_tran
|
|||||||
(uint32_t)trans->output_buf, trans->output_length, trans->dss, TRUE);
|
(uint32_t)trans->output_buf, trans->output_length, trans->dss, TRUE);
|
||||||
if (trans->input_length > trans->output_length) {
|
if (trans->input_length > trans->output_length) {
|
||||||
/* Enable use of second dma transfer with dummy buffer (cleared in ISR) */
|
/* Enable use of second dma transfer with dummy buffer (cleared in ISR) */
|
||||||
dma->tx_extra_dummy_dma = TRUE;
|
dma->tx_extra_dummy_dma = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef STM32F1
|
#ifdef STM32F1
|
||||||
@@ -696,9 +696,9 @@ void spi1_arch_init(void)
|
|||||||
spi1_dma.tx_nvic_irq = NVIC_DMA2_STREAM5_IRQ;
|
spi1_dma.tx_nvic_irq = NVIC_DMA2_STREAM5_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi1_dma.tx_dummy_buf = 0;
|
spi1_dma.tx_dummy_buf = 0;
|
||||||
spi1_dma.tx_extra_dummy_dma = FALSE;
|
spi1_dma.tx_extra_dummy_dma = false;
|
||||||
spi1_dma.rx_dummy_buf = 0;
|
spi1_dma.rx_dummy_buf = 0;
|
||||||
spi1_dma.rx_extra_dummy_dma = FALSE;
|
spi1_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi1_dma.comm);
|
set_default_comm_config(&spi1_dma.comm);
|
||||||
@@ -784,9 +784,9 @@ void spi2_arch_init(void)
|
|||||||
spi2_dma.tx_nvic_irq = NVIC_DMA1_STREAM4_IRQ;
|
spi2_dma.tx_nvic_irq = NVIC_DMA1_STREAM4_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi2_dma.tx_dummy_buf = 0;
|
spi2_dma.tx_dummy_buf = 0;
|
||||||
spi2_dma.tx_extra_dummy_dma = FALSE;
|
spi2_dma.tx_extra_dummy_dma = false;
|
||||||
spi2_dma.rx_dummy_buf = 0;
|
spi2_dma.rx_dummy_buf = 0;
|
||||||
spi2_dma.rx_extra_dummy_dma = FALSE;
|
spi2_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi2_dma.comm);
|
set_default_comm_config(&spi2_dma.comm);
|
||||||
@@ -873,9 +873,9 @@ void spi3_arch_init(void)
|
|||||||
spi3_dma.tx_nvic_irq = NVIC_DMA1_STREAM5_IRQ;
|
spi3_dma.tx_nvic_irq = NVIC_DMA1_STREAM5_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi3_dma.tx_dummy_buf = 0;
|
spi3_dma.tx_dummy_buf = 0;
|
||||||
spi3_dma.tx_extra_dummy_dma = FALSE;
|
spi3_dma.tx_extra_dummy_dma = false;
|
||||||
spi3_dma.rx_dummy_buf = 0;
|
spi3_dma.rx_dummy_buf = 0;
|
||||||
spi3_dma.rx_extra_dummy_dma = FALSE;
|
spi3_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi3_dma.comm);
|
set_default_comm_config(&spi3_dma.comm);
|
||||||
@@ -1087,7 +1087,7 @@ void process_rx_dma_interrupt(struct spi_periph * periph) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Reset the flag so this only happens once in a transaction */
|
/* Reset the flag so this only happens once in a transaction */
|
||||||
dma->rx_extra_dummy_dma = FALSE;
|
dma->rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
/* Use the difference in length between rx and tx */
|
/* Use the difference in length between rx and tx */
|
||||||
uint16_t len_remaining = trans->output_length - trans->input_length;
|
uint16_t len_remaining = trans->output_length - trans->input_length;
|
||||||
@@ -1161,7 +1161,7 @@ void process_tx_dma_interrupt(struct spi_periph * periph) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Reset the flag so this only happens once in a transaction */
|
/* Reset the flag so this only happens once in a transaction */
|
||||||
dma->tx_extra_dummy_dma = FALSE;
|
dma->tx_extra_dummy_dma = false;
|
||||||
|
|
||||||
/* Use the difference in length between tx and rx */
|
/* Use the difference in length between tx and rx */
|
||||||
uint16_t len_remaining = trans->input_length - trans->output_length;
|
uint16_t len_remaining = trans->input_length - trans->output_length;
|
||||||
@@ -1236,9 +1236,9 @@ void spi1_slave_arch_init(void) {
|
|||||||
spi1_dma.tx_nvic_irq = NVIC_DMA2_STREAM5_IRQ;
|
spi1_dma.tx_nvic_irq = NVIC_DMA2_STREAM5_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi1_dma.tx_dummy_buf = 0;
|
spi1_dma.tx_dummy_buf = 0;
|
||||||
spi1_dma.tx_extra_dummy_dma = FALSE;
|
spi1_dma.tx_extra_dummy_dma = false;
|
||||||
spi1_dma.rx_dummy_buf = 0;
|
spi1_dma.rx_dummy_buf = 0;
|
||||||
spi1_dma.rx_extra_dummy_dma = FALSE;
|
spi1_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi1_dma.comm);
|
set_default_comm_config(&spi1_dma.comm);
|
||||||
@@ -1362,9 +1362,9 @@ void spi2_slave_arch_init(void) {
|
|||||||
spi2_dma.tx_nvic_irq = NVIC_DMA1_STREAM4_IRQ;
|
spi2_dma.tx_nvic_irq = NVIC_DMA1_STREAM4_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi2_dma.tx_dummy_buf = 0;
|
spi2_dma.tx_dummy_buf = 0;
|
||||||
spi2_dma.tx_extra_dummy_dma = FALSE;
|
spi2_dma.tx_extra_dummy_dma = false;
|
||||||
spi2_dma.rx_dummy_buf = 0;
|
spi2_dma.rx_dummy_buf = 0;
|
||||||
spi2_dma.rx_extra_dummy_dma = FALSE;
|
spi2_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi2_dma.comm);
|
set_default_comm_config(&spi2_dma.comm);
|
||||||
@@ -1491,9 +1491,9 @@ void spi3_slave_arch_init(void) {
|
|||||||
spi3_dma.tx_nvic_irq = NVIC_DMA1_STREAM5_IRQ;
|
spi3_dma.tx_nvic_irq = NVIC_DMA1_STREAM5_IRQ;
|
||||||
#endif
|
#endif
|
||||||
spi3_dma.tx_dummy_buf = 0;
|
spi3_dma.tx_dummy_buf = 0;
|
||||||
spi3_dma.tx_extra_dummy_dma = FALSE;
|
spi3_dma.tx_extra_dummy_dma = false;
|
||||||
spi3_dma.rx_dummy_buf = 0;
|
spi3_dma.rx_dummy_buf = 0;
|
||||||
spi3_dma.rx_extra_dummy_dma = FALSE;
|
spi3_dma.rx_extra_dummy_dma = false;
|
||||||
|
|
||||||
// set the default configuration
|
// set the default configuration
|
||||||
set_default_comm_config(&spi3_dma.comm);
|
set_default_comm_config(&spi3_dma.comm);
|
||||||
@@ -1687,7 +1687,7 @@ bool spi_slave_register(struct spi_periph * periph, struct spi_transaction * tra
|
|||||||
/* enable dma interrupt */
|
/* enable dma interrupt */
|
||||||
spi_arch_int_enable(periph);
|
spi_arch_int_enable(periph);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_slave_rx_dma_interrupt(struct spi_periph * periph) {
|
void process_slave_rx_dma_interrupt(struct spi_periph * periph) {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void sys_tick_handler(void)
|
|||||||
if (sys_time.timer[i].in_use &&
|
if (sys_time.timer[i].in_use &&
|
||||||
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
sys_time.nb_tick >= sys_time.timer[i].end_time) {
|
||||||
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
sys_time.timer[i].end_time += sys_time.timer[i].duration;
|
||||||
sys_time.timer[i].elapsed = TRUE;
|
sys_time.timer[i].elapsed = true;
|
||||||
if (sys_time.timer[i].cb) {
|
if (sys_time.timer[i].cb) {
|
||||||
sys_time.timer[i].cb(i);
|
sys_time.timer[i].cb(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ void uart_put_byte(struct uart_periph *p, uint8_t data)
|
|||||||
p->tx_buf[p->tx_insert_idx] = data;
|
p->tx_buf[p->tx_insert_idx] = data;
|
||||||
p->tx_insert_idx = temp;
|
p->tx_insert_idx = temp;
|
||||||
} else { // no, set running flag and write to output register
|
} else { // no, set running flag and write to output register
|
||||||
p->tx_running = TRUE;
|
p->tx_running = true;
|
||||||
usart_send((uint32_t)p->reg_addr, data);
|
usart_send((uint32_t)p->reg_addr, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ static inline void usart_isr(struct uart_periph *p)
|
|||||||
p->tx_extract_idx++;
|
p->tx_extract_idx++;
|
||||||
p->tx_extract_idx %= UART_TX_BUFFER_SIZE;
|
p->tx_extract_idx %= UART_TX_BUFFER_SIZE;
|
||||||
} else {
|
} else {
|
||||||
p->tx_running = FALSE; // clear running flag
|
p->tx_running = false; // clear running flag
|
||||||
USART_CR1((uint32_t)p->reg_addr) &= ~USART_CR1_TXEIE; // Disable TX interrupt
|
USART_CR1((uint32_t)p->reg_addr) &= ~USART_CR1_TXEIE; // Disable TX interrupt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void exti15_10_isr(void)
|
|||||||
exti_reset_request(EXTI14);
|
exti_reset_request(EXTI14);
|
||||||
|
|
||||||
#ifdef ASPIRIN_USE_GYRO_INT
|
#ifdef ASPIRIN_USE_GYRO_INT
|
||||||
imu_aspirin.gyro_eoc = TRUE;
|
imu_aspirin.gyro_eoc = true;
|
||||||
imu_aspirin.status = AspirinStatusReadingGyro;
|
imu_aspirin.status = AspirinStatusReadingGyro;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void dma1_c4_irq_handler(void)
|
|||||||
ADS8344_values[channel] = (buf_in[1] << 8 | buf_in[2]) << 1 | buf_in[3] >> 7;
|
ADS8344_values[channel] = (buf_in[1] << 8 | buf_in[2]) << 1 | buf_in[3] >> 7;
|
||||||
channel++;
|
channel++;
|
||||||
if (channel > 6) {
|
if (channel > 6) {
|
||||||
ADS8344_available = TRUE;
|
ADS8344_available = true;
|
||||||
ADS8344Unselect();
|
ADS8344Unselect();
|
||||||
DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE);
|
DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE);
|
||||||
/* Disable SPI_2 Rx and TX request */
|
/* Disable SPI_2 Rx and TX request */
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ void exti9_5_isr(void)
|
|||||||
/* clear EXTI */
|
/* clear EXTI */
|
||||||
if (EXTI_PR & EXTI6) {
|
if (EXTI_PR & EXTI6) {
|
||||||
exti_reset_request(EXTI6);
|
exti_reset_request(EXTI6);
|
||||||
imu_krooz.hmc_eoc = TRUE;
|
imu_krooz.hmc_eoc = true;
|
||||||
}
|
}
|
||||||
if (EXTI_PR & EXTI5) {
|
if (EXTI_PR & EXTI5) {
|
||||||
exti_reset_request(EXTI5);
|
exti_reset_request(EXTI5);
|
||||||
imu_krooz.mpu_eoc = TRUE;
|
imu_krooz.mpu_eoc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ static bool usb_connected;
|
|||||||
// use suspend callback to detect disconnect
|
// use suspend callback to detect disconnect
|
||||||
static void suspend_cb(void)
|
static void suspend_cb(void)
|
||||||
{
|
{
|
||||||
usb_connected = FALSE;
|
usb_connected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,7 +312,7 @@ static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue)
|
|||||||
cdcacm_control_request);
|
cdcacm_control_request);
|
||||||
|
|
||||||
// use config and suspend callback to detect connect
|
// use config and suspend callback to detect connect
|
||||||
usb_connected = TRUE;
|
usb_connected = true;
|
||||||
usbd_register_suspend_callback(usbd_dev, suspend_cb);
|
usbd_register_suspend_callback(usbd_dev, suspend_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,13 +334,13 @@ bool fifo_put(fifo_t *fifo, uint8_t c)
|
|||||||
next = (fifo->head + 1) % VCOM_FIFO_SIZE;
|
next = (fifo->head + 1) % VCOM_FIFO_SIZE;
|
||||||
if (next == fifo->tail) {
|
if (next == fifo->tail) {
|
||||||
// full
|
// full
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fifo->buf[fifo->head] = c;
|
fifo->buf[fifo->head] = c;
|
||||||
fifo->head = next;
|
fifo->head = next;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ bool fifo_get(fifo_t *fifo, uint8_t *pc)
|
|||||||
|
|
||||||
// check if FIFO has data
|
// check if FIFO has data
|
||||||
if (fifo->head == fifo->tail) {
|
if (fifo->head == fifo->tail) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
next = (fifo->tail + 1) % VCOM_FIFO_SIZE;
|
next = (fifo->tail + 1) % VCOM_FIFO_SIZE;
|
||||||
@@ -358,7 +358,7 @@ bool fifo_get(fifo_t *fifo, uint8_t *pc)
|
|||||||
*pc = fifo->buf[fifo->tail];
|
*pc = fifo->buf[fifo->tail];
|
||||||
fifo->tail = next;
|
fifo->tail = next;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -552,7 +552,7 @@ void VCOM_init(void)
|
|||||||
usbd_register_set_config_callback(my_usbd_dev, cdcacm_set_config);
|
usbd_register_set_config_callback(my_usbd_dev, cdcacm_set_config);
|
||||||
|
|
||||||
// disconnected by default
|
// disconnected by default
|
||||||
usb_connected = FALSE;
|
usb_connected = false;
|
||||||
|
|
||||||
// Configure generic device
|
// Configure generic device
|
||||||
usb_serial.device.periph = (void *)(&usb_serial);
|
usb_serial.device.periph = (void *)(&usb_serial);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void baro_init(void)
|
|||||||
startup_cnt = BARO_STARTUP_COUNTER;
|
startup_cnt = BARO_STARTUP_COUNTER;
|
||||||
|
|
||||||
#if APOGEE_BARO_SDLOG
|
#if APOGEE_BARO_SDLOG
|
||||||
log_apogee_baro_started = FALSE;
|
log_apogee_baro_started = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ void baro_periodic(void)
|
|||||||
if (startup_cnt > 0 && apogee_baro.data_available) {
|
if (startup_cnt > 0 && apogee_baro.data_available) {
|
||||||
// Run some loops to get correct readings from the adc
|
// Run some loops to get correct readings from the adc
|
||||||
--startup_cnt;
|
--startup_cnt;
|
||||||
apogee_baro.data_available = FALSE;
|
apogee_baro.data_available = false;
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
LED_TOGGLE(BARO_LED);
|
LED_TOGGLE(BARO_LED);
|
||||||
if (startup_cnt == 0) {
|
if (startup_cnt == 0) {
|
||||||
@@ -118,13 +118,13 @@ void apogee_baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = apogee_baro.temperature / 16.0f;
|
float temp = apogee_baro.temperature / 16.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
apogee_baro.data_available = FALSE;
|
apogee_baro.data_available = false;
|
||||||
|
|
||||||
#if APOGEE_BARO_SDLOG
|
#if APOGEE_BARO_SDLOG
|
||||||
if (pprzLogFile != -1) {
|
if (pprzLogFile != -1) {
|
||||||
if (!log_apogee_baro_started) {
|
if (!log_apogee_baro_started) {
|
||||||
sdLogWriteLog(pprzLogFile, "APOGEE_BARO: Pres(Pa) Temp(degC) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gpseed(cm/s) course(1e7deg) climb(cm/s)\n");
|
sdLogWriteLog(pprzLogFile, "APOGEE_BARO: Pres(Pa) Temp(degC) GPS_fix TOW(ms) Week Lat(1e7deg) Lon(1e7deg) HMSL(mm) gpseed(cm/s) course(1e7deg) climb(cm/s)\n");
|
||||||
log_apogee_baro_started = TRUE;
|
log_apogee_baro_started = true;
|
||||||
}
|
}
|
||||||
sdLogWriteLog(pprzLogFile, "apogee_baro: %9.4f %9.4f %d %d %d %d %d %d %d %d %d\n",
|
sdLogWriteLog(pprzLogFile, "apogee_baro: %9.4f %9.4f %d %d %d %d %d %d %d %d %d\n",
|
||||||
pressure,temp,
|
pressure,temp,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void __early_init(void) {
|
|||||||
*/
|
*/
|
||||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||||
(void)sdcp;
|
(void)sdcp;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +90,7 @@ bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
|||||||
|
|
||||||
(void)mmcp;
|
(void)mmcp;
|
||||||
/* TODO: Fill the implementation.*/
|
/* TODO: Fill the implementation.*/
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +100,7 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
|||||||
|
|
||||||
(void)mmcp;
|
(void)mmcp;
|
||||||
/* TODO: Fill the implementation.*/
|
/* TODO: Fill the implementation.*/
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ PRINT_CONFIG_VAR(MAG_PRESCALER)
|
|||||||
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||||
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -95,7 +95,7 @@ struct ImuApogee imu_apogee;
|
|||||||
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||||
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void imu_impl_init(void)
|
void imu_impl_init(void)
|
||||||
@@ -111,7 +111,7 @@ void imu_impl_init(void)
|
|||||||
// set MPU in bypass mode for the baro
|
// set MPU in bypass mode for the baro
|
||||||
imu_apogee.mpu.config.nb_slaves = 1;
|
imu_apogee.mpu.config.nb_slaves = 1;
|
||||||
imu_apogee.mpu.config.slaves[0].configure = &configure_baro_slave;
|
imu_apogee.mpu.config.slaves[0].configure = &configure_baro_slave;
|
||||||
imu_apogee.mpu.config.i2c_bypass = TRUE;
|
imu_apogee.mpu.config.i2c_bypass = true;
|
||||||
#if APOGEE_USE_MPU9150
|
#if APOGEE_USE_MPU9150
|
||||||
// if using MPU9150, internal mag needs to be configured
|
// if using MPU9150, internal mag needs to be configured
|
||||||
ak8975_init(&imu_apogee.ak, &(IMU_APOGEE_I2C_DEV), AK8975_I2C_SLV_ADDR);
|
ak8975_init(&imu_apogee.ak, &(IMU_APOGEE_I2C_DEV), AK8975_I2C_SLV_ADDR);
|
||||||
@@ -161,7 +161,7 @@ void imu_apogee_event(void)
|
|||||||
(int32_t)(-imu_apogee.mpu.data_accel.value[IMU_APOGEE_CHAN_Z])
|
(int32_t)(-imu_apogee.mpu.data_accel.value[IMU_APOGEE_CHAN_Z])
|
||||||
};
|
};
|
||||||
VECT3_COPY(imu.accel_unscaled, accel);
|
VECT3_COPY(imu.accel_unscaled, accel);
|
||||||
imu_apogee.mpu.data_available = FALSE;
|
imu_apogee.mpu.data_available = false;
|
||||||
imu_scale_gyro(&imu);
|
imu_scale_gyro(&imu);
|
||||||
imu_scale_accel(&imu);
|
imu_scale_accel(&imu);
|
||||||
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
||||||
@@ -177,7 +177,7 @@ void imu_apogee_event(void)
|
|||||||
(int32_t)( imu_apogee.ak.data.value[IMU_APOGEE_CHAN_Z])
|
(int32_t)( imu_apogee.ak.data.value[IMU_APOGEE_CHAN_Z])
|
||||||
};
|
};
|
||||||
VECT3_COPY(imu.mag_unscaled, mag);
|
VECT3_COPY(imu.mag_unscaled, mag);
|
||||||
imu_apogee.ak.data_available = FALSE;
|
imu_apogee.ak.data_available = false;
|
||||||
imu_scale_mag(&imu);
|
imu_scale_mag(&imu);
|
||||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ int actuators_ardrone_cmd(uint8_t cmd, uint8_t *reply, int replylen)
|
|||||||
void actuators_ardrone_motor_status(void);
|
void actuators_ardrone_motor_status(void);
|
||||||
void actuators_ardrone_motor_status(void)
|
void actuators_ardrone_motor_status(void)
|
||||||
{
|
{
|
||||||
static bool last_motor_on = FALSE;
|
static bool last_motor_on = false;
|
||||||
|
|
||||||
// Reset Flipflop sequence
|
// Reset Flipflop sequence
|
||||||
static bool reset_flipflop_counter = 0;
|
static bool reset_flipflop_counter = 0;
|
||||||
|
|||||||
@@ -103,6 +103,6 @@ void ardrone_baro_event(void)
|
|||||||
float pressure = (float)press_pascal;
|
float pressure = (float)press_pascal;
|
||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
}
|
}
|
||||||
navdata.baro_available = FALSE;
|
navdata.baro_available = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ struct navdata_t navdata;
|
|||||||
/** Buffer filled in the thread (maximum one navdata packet) */
|
/** Buffer filled in the thread (maximum one navdata packet) */
|
||||||
static uint8_t navdata_buffer[NAVDATA_PACKET_SIZE];
|
static uint8_t navdata_buffer[NAVDATA_PACKET_SIZE];
|
||||||
/** flag to indicate new packet is available in buffer */
|
/** flag to indicate new packet is available in buffer */
|
||||||
static bool navdata_available = FALSE;
|
static bool navdata_available = false;
|
||||||
|
|
||||||
/* syncronization variables */
|
/* syncronization variables */
|
||||||
static pthread_mutex_t navdata_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t navdata_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
@@ -178,7 +178,7 @@ bool navdata_init()
|
|||||||
|
|
||||||
if (navdata.fd < 0) {
|
if (navdata.fd < 0) {
|
||||||
printf("[navdata] Unable to open navdata board connection(/dev/ttyO1)\n");
|
printf("[navdata] Unable to open navdata board connection(/dev/ttyO1)\n");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the settings of the UART connection */
|
/* Update the settings of the UART connection */
|
||||||
@@ -201,10 +201,10 @@ bool navdata_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset available flags
|
// Reset available flags
|
||||||
navdata_available = FALSE;
|
navdata_available = false;
|
||||||
navdata.baro_calibrated = FALSE;
|
navdata.baro_calibrated = false;
|
||||||
navdata.baro_available = FALSE;
|
navdata.baro_available = false;
|
||||||
navdata.imu_lost = FALSE;
|
navdata.imu_lost = false;
|
||||||
|
|
||||||
// Set all statistics to 0
|
// Set all statistics to 0
|
||||||
navdata.checksum_errors = 0;
|
navdata.checksum_errors = 0;
|
||||||
@@ -219,9 +219,9 @@ bool navdata_init()
|
|||||||
/* Read the baro calibration(blocking) */
|
/* Read the baro calibration(blocking) */
|
||||||
if (!navdata_baro_calib()) {
|
if (!navdata_baro_calib()) {
|
||||||
printf("[navdata] Could not acquire baro calibration!\n");
|
printf("[navdata] Could not acquire baro calibration!\n");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
navdata.baro_calibrated = TRUE;
|
navdata.baro_calibrated = true;
|
||||||
|
|
||||||
/* Start acquisition */
|
/* Start acquisition */
|
||||||
navdata_cmd_send(NAVDATA_CMD_START);
|
navdata_cmd_send(NAVDATA_CMD_START);
|
||||||
@@ -234,7 +234,7 @@ bool navdata_init()
|
|||||||
pthread_t navdata_thread;
|
pthread_t navdata_thread;
|
||||||
if (pthread_create(&navdata_thread, NULL, navdata_read, NULL) != 0) {
|
if (pthread_create(&navdata_thread, NULL, navdata_read, NULL) != 0) {
|
||||||
printf("[navdata] Could not create navdata reading thread!\n");
|
printf("[navdata] Could not create navdata reading thread!\n");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PERIODIC_TELEMETRY
|
#if PERIODIC_TELEMETRY
|
||||||
@@ -242,8 +242,8 @@ bool navdata_init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set to initialized */
|
/* Set to initialized */
|
||||||
navdata.is_initialized = TRUE;
|
navdata.is_initialized = true;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ static void *navdata_read(void *data __attribute__((unused)))
|
|||||||
|
|
||||||
/* Set flag that we have new valid navdata */
|
/* Set flag that we have new valid navdata */
|
||||||
pthread_mutex_lock(&navdata_mutex);
|
pthread_mutex_lock(&navdata_mutex);
|
||||||
navdata_available = TRUE;
|
navdata_available = true;
|
||||||
pthread_mutex_unlock(&navdata_mutex);
|
pthread_mutex_unlock(&navdata_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,7 +356,7 @@ void navdata_update()
|
|||||||
memcpy(&navdata.measure, navdata_buffer, NAVDATA_PACKET_SIZE);
|
memcpy(&navdata.measure, navdata_buffer, NAVDATA_PACKET_SIZE);
|
||||||
|
|
||||||
/* reset the flag */
|
/* reset the flag */
|
||||||
navdata_available = FALSE;
|
navdata_available = false;
|
||||||
/* signal that we copied the buffer and new packet can be read */
|
/* signal that we copied the buffer and new packet can be read */
|
||||||
pthread_cond_signal(&navdata_cond);
|
pthread_cond_signal(&navdata_cond);
|
||||||
pthread_mutex_unlock(&navdata_mutex);
|
pthread_mutex_unlock(&navdata_mutex);
|
||||||
@@ -422,7 +422,7 @@ static bool navdata_baro_calib(void)
|
|||||||
uint8_t calibBuffer[22];
|
uint8_t calibBuffer[22];
|
||||||
if (full_read(navdata.fd, calibBuffer, sizeof calibBuffer) < 0) {
|
if (full_read(navdata.fd, calibBuffer, sizeof calibBuffer) < 0) {
|
||||||
printf("[navdata] Could not read calibration data.");
|
printf("[navdata] Could not read calibration data.");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the read bytes */
|
/* Convert the read bytes */
|
||||||
@@ -438,7 +438,7 @@ static bool navdata_baro_calib(void)
|
|||||||
navdata.bmp180_calib.mc = calibBuffer[18] << 8 | calibBuffer[19];
|
navdata.bmp180_calib.mc = calibBuffer[18] << 8 | calibBuffer[19];
|
||||||
navdata.bmp180_calib.md = calibBuffer[20] << 8 | calibBuffer[21];
|
navdata.bmp180_calib.md = calibBuffer[20] << 8 | calibBuffer[21];
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -459,7 +459,7 @@ static void mag_freeze_check(void)
|
|||||||
fprintf(stderr, "mag freeze detected, resetting!\n");
|
fprintf(stderr, "mag freeze detected, resetting!\n");
|
||||||
|
|
||||||
/* set imu_lost flag */
|
/* set imu_lost flag */
|
||||||
navdata.imu_lost = TRUE;
|
navdata.imu_lost = true;
|
||||||
navdata.lost_imu_frames++;
|
navdata.lost_imu_frames++;
|
||||||
|
|
||||||
/* Stop acquisition */
|
/* Stop acquisition */
|
||||||
@@ -478,7 +478,7 @@ static void mag_freeze_check(void)
|
|||||||
MagFreezeCounter = 0; /* reset counter back to zero */
|
MagFreezeCounter = 0; /* reset counter back to zero */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
navdata.imu_lost = FALSE;
|
navdata.imu_lost = false;
|
||||||
/* Reset counter if value _does_ change */
|
/* Reset counter if value _does_ change */
|
||||||
MagFreezeCounter = 0;
|
MagFreezeCounter = 0;
|
||||||
}
|
}
|
||||||
@@ -505,34 +505,34 @@ static void baro_update_logic(void)
|
|||||||
|
|
||||||
if (temp_or_press_was_updated_last == 0) { /* Last update was press so we are now waiting for temp */
|
if (temp_or_press_was_updated_last == 0) { /* Last update was press so we are now waiting for temp */
|
||||||
/* temp was updated */
|
/* temp was updated */
|
||||||
temp_or_press_was_updated_last = TRUE;
|
temp_or_press_was_updated_last = true;
|
||||||
|
|
||||||
/* This means that press must remain constant */
|
/* This means that press must remain constant */
|
||||||
if (lastpressval != 0) {
|
if (lastpressval != 0) {
|
||||||
/* If pressure was updated: this is a sync error */
|
/* If pressure was updated: this is a sync error */
|
||||||
if (lastpressval != navdata.measure.pressure) {
|
if (lastpressval != navdata.measure.pressure) {
|
||||||
/* wait for temp again */
|
/* wait for temp again */
|
||||||
temp_or_press_was_updated_last = FALSE;
|
temp_or_press_was_updated_last = false;
|
||||||
sync_errors++;
|
sync_errors++;
|
||||||
//printf("Baro-Logic-Error (expected updated temp, got press)\n");
|
//printf("Baro-Logic-Error (expected updated temp, got press)\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* press was updated */
|
/* press was updated */
|
||||||
temp_or_press_was_updated_last = FALSE;
|
temp_or_press_was_updated_last = false;
|
||||||
|
|
||||||
/* This means that temp must remain constant */
|
/* This means that temp must remain constant */
|
||||||
if (lasttempval != 0) {
|
if (lasttempval != 0) {
|
||||||
/* If temp was updated: this is a sync error */
|
/* If temp was updated: this is a sync error */
|
||||||
if (lasttempval != navdata.measure.temperature_pressure) {
|
if (lasttempval != navdata.measure.temperature_pressure) {
|
||||||
/* wait for press again */
|
/* wait for press again */
|
||||||
temp_or_press_was_updated_last = TRUE;
|
temp_or_press_was_updated_last = true;
|
||||||
sync_errors++;
|
sync_errors++;
|
||||||
//printf("Baro-Logic-Error (expected updated press, got temp)\n");
|
//printf("Baro-Logic-Error (expected updated press, got temp)\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* We now got valid pressure and temperature */
|
/* We now got valid pressure and temperature */
|
||||||
navdata.baro_available = TRUE;
|
navdata.baro_available = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,13 +540,13 @@ static void baro_update_logic(void)
|
|||||||
/* Detected a pressure swap */
|
/* Detected a pressure swap */
|
||||||
if (lastpressval != 0 && lasttempval != 0
|
if (lastpressval != 0 && lasttempval != 0
|
||||||
&& ABS(lastpressval - navdata.measure.pressure) > ABS(lasttempval - navdata.measure.pressure)) {
|
&& ABS(lastpressval - navdata.measure.pressure) > ABS(lasttempval - navdata.measure.pressure)) {
|
||||||
navdata.baro_available = FALSE;
|
navdata.baro_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Detected a temprature swap */
|
/* Detected a temprature swap */
|
||||||
if (lastpressval != 0 && lasttempval != 0
|
if (lastpressval != 0 && lasttempval != 0
|
||||||
&& ABS(lasttempval - navdata.measure.temperature_pressure) > ABS(lastpressval - navdata.measure.temperature_pressure)) {
|
&& ABS(lasttempval - navdata.measure.temperature_pressure) > ABS(lastpressval - navdata.measure.temperature_pressure)) {
|
||||||
navdata.baro_available = FALSE;
|
navdata.baro_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lasttempval = navdata.measure.temperature_pressure;
|
lasttempval = navdata.measure.temperature_pressure;
|
||||||
@@ -600,7 +600,7 @@ static void baro_update_logic(void)
|
|||||||
|
|
||||||
if (spike_detected > 0) {
|
if (spike_detected > 0) {
|
||||||
/* disable kalman filter use */
|
/* disable kalman filter use */
|
||||||
navdata.baro_available = FALSE;
|
navdata.baro_available = false;
|
||||||
|
|
||||||
// override both to last good
|
// override both to last good
|
||||||
navdata.measure.pressure = lastpressval_nospike;
|
navdata.measure.pressure = lastpressval_nospike;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = bb_ms5611.data.temperature / 100.0f;
|
float temp = bb_ms5611.data.temperature / 100.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
bb_ms5611.data_available = FALSE;
|
bb_ms5611.data_available = false;
|
||||||
|
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = bb_ms5611.data.temperature / 100.0f;
|
float temp = bb_ms5611.data.temperature / 100.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
bb_ms5611.data_available = FALSE;
|
bb_ms5611.data_available = false;
|
||||||
|
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ static bool write_reg(int fd, char *addr_val, uint8_t cnt)
|
|||||||
|
|
||||||
if (write(fd, addr_val, cnt) != cnt) {
|
if (write(fd, addr_val, cnt) != cnt) {
|
||||||
printf("Write failed!\n");
|
printf("Write failed!\n");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (write(fd, addr_val, 2) != 2) {
|
if (write(fd, addr_val, 2) != 2) {
|
||||||
printf("Write2 failed!\n");
|
printf("Write2 failed!\n");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
while (read(fd, resp, cnt - 2) != cnt - 2) { ; }
|
while (read(fd, resp, cnt - 2) != cnt - 2) { ; }
|
||||||
for (i = 0; i < cnt - 2; i++) {
|
for (i = 0; i < cnt - 2; i++) {
|
||||||
@@ -79,7 +79,7 @@ static bool write_reg(int fd, char *addr_val, uint8_t cnt)
|
|||||||
return write_reg(fd, addr_val, cnt);
|
return write_reg(fd, addr_val, cnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _write(int fd, char *data, uint8_t cnt)
|
static bool _write(int fd, char *data, uint8_t cnt)
|
||||||
@@ -87,7 +87,7 @@ static bool _write(int fd, char *data, uint8_t cnt)
|
|||||||
if (write(fd, data, cnt) != cnt) {
|
if (write(fd, data, cnt) != cnt) {
|
||||||
printf("Failed!\n");
|
printf("Failed!\n");
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void bmp_baro_event(void)
|
|||||||
if (baro_bmp085.data_available) {
|
if (baro_bmp085.data_available) {
|
||||||
float pressure = (float)baro_bmp085.pressure;
|
float pressure = (float)baro_bmp085.pressure;
|
||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
baro_bmp085.data_available = FALSE;
|
baro_bmp085.data_available = false;
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void imu_hbmini_event(void)
|
|||||||
imu.mag_unscaled.y = imu_hbmini.hmc.data.value[IMU_MAG_Y_CHAN];
|
imu.mag_unscaled.y = imu_hbmini.hmc.data.value[IMU_MAG_Y_CHAN];
|
||||||
imu.mag_unscaled.x = imu_hbmini.hmc.data.value[IMU_MAG_Z_CHAN];
|
imu.mag_unscaled.x = imu_hbmini.hmc.data.value[IMU_MAG_Z_CHAN];
|
||||||
|
|
||||||
imu_hbmini.hmc.data_available = FALSE;
|
imu_hbmini.hmc.data_available = false;
|
||||||
imu_scale_mag(&imu);
|
imu_scale_mag(&imu);
|
||||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void imu_impl_init(void)
|
|||||||
imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
|
imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
|
||||||
imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
|
imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
|
||||||
imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
|
imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
|
||||||
imu_krooz.mpu.config.drdy_int_enable = TRUE;
|
imu_krooz.mpu.config.drdy_int_enable = true;
|
||||||
|
|
||||||
hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);
|
hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);
|
||||||
|
|
||||||
@@ -89,8 +89,8 @@ void imu_impl_init(void)
|
|||||||
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
||||||
imu_krooz.meas_nb = 0;
|
imu_krooz.meas_nb = 0;
|
||||||
|
|
||||||
imu_krooz.hmc_eoc = FALSE;
|
imu_krooz.hmc_eoc = false;
|
||||||
imu_krooz.mpu_eoc = FALSE;
|
imu_krooz.mpu_eoc = false;
|
||||||
|
|
||||||
imu_krooz_sd_arch_init();
|
imu_krooz_sd_arch_init();
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ void imu_krooz_event(void)
|
|||||||
{
|
{
|
||||||
if (imu_krooz.mpu_eoc) {
|
if (imu_krooz.mpu_eoc) {
|
||||||
mpu60x0_i2c_read(&imu_krooz.mpu);
|
mpu60x0_i2c_read(&imu_krooz.mpu);
|
||||||
imu_krooz.mpu_eoc = FALSE;
|
imu_krooz.mpu_eoc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the MPU6050 I2C transaction has succeeded: convert the data
|
// If the MPU6050 I2C transaction has succeeded: convert the data
|
||||||
@@ -156,12 +156,12 @@ void imu_krooz_event(void)
|
|||||||
RATES_ADD(imu_krooz.rates_sum, imu_krooz.mpu.data_rates.rates);
|
RATES_ADD(imu_krooz.rates_sum, imu_krooz.mpu.data_rates.rates);
|
||||||
VECT3_ADD(imu_krooz.accel_sum, imu_krooz.mpu.data_accel.vect);
|
VECT3_ADD(imu_krooz.accel_sum, imu_krooz.mpu.data_accel.vect);
|
||||||
imu_krooz.meas_nb++;
|
imu_krooz.meas_nb++;
|
||||||
imu_krooz.mpu.data_available = FALSE;
|
imu_krooz.mpu.data_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imu_krooz.hmc_eoc) {
|
if (imu_krooz.hmc_eoc) {
|
||||||
hmc58xx_read(&imu_krooz.hmc);
|
hmc58xx_read(&imu_krooz.hmc);
|
||||||
imu_krooz.hmc_eoc = FALSE;
|
imu_krooz.hmc_eoc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the HMC5883 I2C transaction has succeeded: convert the data
|
// If the HMC5883 I2C transaction has succeeded: convert the data
|
||||||
@@ -169,7 +169,7 @@ void imu_krooz_event(void)
|
|||||||
if (imu_krooz.hmc.data_available) {
|
if (imu_krooz.hmc.data_available) {
|
||||||
VECT3_ASSIGN(imu.mag_unscaled, imu_krooz.hmc.data.vect.y, -imu_krooz.hmc.data.vect.x, imu_krooz.hmc.data.vect.z);
|
VECT3_ASSIGN(imu.mag_unscaled, imu_krooz.hmc.data.vect.y, -imu_krooz.hmc.data.vect.x, imu_krooz.hmc.data.vect.z);
|
||||||
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
||||||
imu_krooz.hmc.data_available = FALSE;
|
imu_krooz.hmc.data_available = false;
|
||||||
imu_scale_mag(&imu);
|
imu_scale_mag(&imu);
|
||||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, get_sys_time_usec(), &imu.mag);
|
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, get_sys_time_usec(), &imu.mag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void imu_impl_init(void)
|
|||||||
imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
|
imu_krooz.mpu.config.dlpf_cfg = KROOZ_LOWPASS_FILTER;
|
||||||
imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
|
imu_krooz.mpu.config.gyro_range = KROOZ_GYRO_RANGE;
|
||||||
imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
|
imu_krooz.mpu.config.accel_range = KROOZ_ACCEL_RANGE;
|
||||||
imu_krooz.mpu.config.drdy_int_enable = TRUE;
|
imu_krooz.mpu.config.drdy_int_enable = true;
|
||||||
|
|
||||||
hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);
|
hmc58xx_init(&imu_krooz.hmc, &(IMU_KROOZ_I2C_DEV), HMC58XX_ADDR);
|
||||||
|
|
||||||
@@ -90,8 +90,8 @@ void imu_impl_init(void)
|
|||||||
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
VECT3_ASSIGN(imu_krooz.accel_sum, 0, 0, 0);
|
||||||
imu_krooz.meas_nb = 0;
|
imu_krooz.meas_nb = 0;
|
||||||
|
|
||||||
imu_krooz.hmc_eoc = FALSE;
|
imu_krooz.hmc_eoc = false;
|
||||||
imu_krooz.mpu_eoc = FALSE;
|
imu_krooz.mpu_eoc = false;
|
||||||
|
|
||||||
imu_krooz.ad7689_trans.slave_idx = IMU_KROOZ_SPI_SLAVE_IDX;
|
imu_krooz.ad7689_trans.slave_idx = IMU_KROOZ_SPI_SLAVE_IDX;
|
||||||
imu_krooz.ad7689_trans.select = SPISelectUnselect;
|
imu_krooz.ad7689_trans.select = SPISelectUnselect;
|
||||||
@@ -162,7 +162,7 @@ void imu_krooz_event(void)
|
|||||||
{
|
{
|
||||||
if (imu_krooz.mpu_eoc) {
|
if (imu_krooz.mpu_eoc) {
|
||||||
mpu60x0_i2c_read(&imu_krooz.mpu);
|
mpu60x0_i2c_read(&imu_krooz.mpu);
|
||||||
imu_krooz.mpu_eoc = FALSE;
|
imu_krooz.mpu_eoc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the MPU6050 I2C transaction has succeeded: convert the data
|
// If the MPU6050 I2C transaction has succeeded: convert the data
|
||||||
@@ -170,7 +170,7 @@ void imu_krooz_event(void)
|
|||||||
if (imu_krooz.mpu.data_available) {
|
if (imu_krooz.mpu.data_available) {
|
||||||
RATES_ADD(imu_krooz.rates_sum, imu_krooz.mpu.data_rates.rates);
|
RATES_ADD(imu_krooz.rates_sum, imu_krooz.mpu.data_rates.rates);
|
||||||
imu_krooz.meas_nb++;
|
imu_krooz.meas_nb++;
|
||||||
imu_krooz.mpu.data_available = FALSE;
|
imu_krooz.mpu.data_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SysTimeTimer(ad7689_event_timer) > 215) {
|
if (SysTimeTimer(ad7689_event_timer) > 215) {
|
||||||
@@ -216,7 +216,7 @@ void imu_krooz_event(void)
|
|||||||
|
|
||||||
if (imu_krooz.hmc_eoc) {
|
if (imu_krooz.hmc_eoc) {
|
||||||
hmc58xx_read(&imu_krooz.hmc);
|
hmc58xx_read(&imu_krooz.hmc);
|
||||||
imu_krooz.hmc_eoc = FALSE;
|
imu_krooz.hmc_eoc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the HMC5883 I2C transaction has succeeded: convert the data
|
// If the HMC5883 I2C transaction has succeeded: convert the data
|
||||||
@@ -224,7 +224,7 @@ void imu_krooz_event(void)
|
|||||||
if (imu_krooz.hmc.data_available) {
|
if (imu_krooz.hmc.data_available) {
|
||||||
VECT3_ASSIGN(imu.mag_unscaled, imu_krooz.hmc.data.vect.y, -imu_krooz.hmc.data.vect.x, imu_krooz.hmc.data.vect.z);
|
VECT3_ASSIGN(imu.mag_unscaled, imu_krooz.hmc.data.vect.y, -imu_krooz.hmc.data.vect.x, imu_krooz.hmc.data.vect.z);
|
||||||
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
||||||
imu_krooz.hmc.data_available = FALSE;
|
imu_krooz.hmc.data_available = false;
|
||||||
imu_scale_mag(&imu);
|
imu_scale_mag(&imu);
|
||||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, get_sys_time_usec(), &imu.mag);
|
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, get_sys_time_usec(), &imu.mag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void baro_init(void)
|
|||||||
LED_OFF(BARO_LED);
|
LED_OFF(BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
baro_board.status = LBS_UNINITIALIZED;
|
baro_board.status = LBS_UNINITIALIZED;
|
||||||
baro_board.running = FALSE;
|
baro_board.running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ void baro_periodic(void)
|
|||||||
// baro_board.status = LBS_UNINITIALIZED;
|
// baro_board.status = LBS_UNINITIALIZED;
|
||||||
break;
|
break;
|
||||||
case LBS_INITIALIZING_DIFF_1:
|
case LBS_INITIALIZING_DIFF_1:
|
||||||
baro_board.running = TRUE;
|
baro_board.running = true;
|
||||||
case LBS_READ_DIFF:
|
case LBS_READ_DIFF:
|
||||||
baro_board_read_from_current_register(BARO_ABS_ADDR);
|
baro_board_read_from_current_register(BARO_ABS_ADDR);
|
||||||
baro_board.status = LBS_READING_ABS;
|
baro_board.status = LBS_READING_ABS;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = baro_bmp085.temperature / 10.0f;
|
float temp = baro_bmp085.temperature / 10.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
baro_bmp085.data_available = FALSE;
|
baro_bmp085.data_available = false;
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = baro_bmp085.temperature / 10.0f;
|
float temp = baro_bmp085.temperature / 10.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
baro_bmp085.data_available = FALSE;
|
baro_bmp085.data_available = false;
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -88,6 +88,6 @@ void navgo_baro_event(void)
|
|||||||
float pressure = NAVGO_BARO_SENS * (mcp355x_data + NAVGO_BARO_OFFSET);
|
float pressure = NAVGO_BARO_SENS * (mcp355x_data + NAVGO_BARO_OFFSET);
|
||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
}
|
}
|
||||||
mcp355x_data_available = FALSE;
|
mcp355x_data_available = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ void imu_navgo_event(void)
|
|||||||
#if NAVGO_USE_MEDIAN_FILTER
|
#if NAVGO_USE_MEDIAN_FILTER
|
||||||
UpdateMedianFilterRatesInt(median_gyro, imu.gyro_unscaled);
|
UpdateMedianFilterRatesInt(median_gyro, imu.gyro_unscaled);
|
||||||
#endif
|
#endif
|
||||||
imu_navgo.itg.data_available = FALSE;
|
imu_navgo.itg.data_available = false;
|
||||||
imu_scale_gyro(&imu);
|
imu_scale_gyro(&imu);
|
||||||
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
AbiSendMsgIMU_GYRO_INT32(IMU_BOARD_ID, now_ts, &imu.gyro);
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ void imu_navgo_event(void)
|
|||||||
#if NAVGO_USE_MEDIAN_FILTER
|
#if NAVGO_USE_MEDIAN_FILTER
|
||||||
UpdateMedianFilterVect3Int(median_accel, imu.accel_unscaled);
|
UpdateMedianFilterVect3Int(median_accel, imu.accel_unscaled);
|
||||||
#endif
|
#endif
|
||||||
imu_navgo.adxl.data_available = FALSE;
|
imu_navgo.adxl.data_available = false;
|
||||||
imu_scale_accel(&imu);
|
imu_scale_accel(&imu);
|
||||||
AbiSendMsgIMU_ACCEL_INT32(IMU_BOARD_ID, now_ts, &imu.accel);
|
AbiSendMsgIMU_ACCEL_INT32(IMU_BOARD_ID, now_ts, &imu.accel);
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ void imu_navgo_event(void)
|
|||||||
#if NAVGO_USE_MEDIAN_FILTER
|
#if NAVGO_USE_MEDIAN_FILTER
|
||||||
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
UpdateMedianFilterVect3Int(median_mag, imu.mag_unscaled);
|
||||||
#endif
|
#endif
|
||||||
imu_navgo.hmc.data_available = FALSE;
|
imu_navgo.hmc.data_available = false;
|
||||||
imu_scale_mag(&imu);
|
imu_scale_mag(&imu);
|
||||||
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
AbiSendMsgIMU_MAG_INT32(IMU_BOARD_ID, now_ts, &imu.mag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void baro_event(void)
|
|||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
float temp = baro_bmp085.temperature / 10.0f;
|
float temp = baro_bmp085.temperature / 10.0f;
|
||||||
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
AbiSendMsgTEMPERATURE(BARO_BOARD_SENDER_ID, temp);
|
||||||
baro_bmp085.data_available = FALSE;
|
baro_bmp085.data_available = false;
|
||||||
#ifdef BARO_LED
|
#ifdef BARO_LED
|
||||||
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
RunOnceEvery(10, LED_TOGGLE(BARO_LED));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void umarim_baro_event(void)
|
|||||||
float pressure = UMARIM_BARO_SENS * Ads1114GetValue(BARO_ABS_ADS);
|
float pressure = UMARIM_BARO_SENS * Ads1114GetValue(BARO_ABS_ADS);
|
||||||
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
AbiSendMsgBARO_ABS(BARO_BOARD_SENDER_ID, pressure);
|
||||||
}
|
}
|
||||||
BARO_ABS_ADS.data_available = FALSE;
|
BARO_ABS_ADS.data_available = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user