mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
replace bool_t with C99 bool from stdbool.h
This commit is contained in:
committed by
Gautier Hattenberger
parent
e56fd4eae5
commit
5c1e4260fe
@@ -42,14 +42,14 @@ void i2c_setbitrate(struct i2c_periph *p __attribute__((unused)), int bitrate _
|
||||
{
|
||||
}
|
||||
|
||||
bool_t i2c_idle(struct i2c_periph *p __attribute__((unused)))
|
||||
bool i2c_idle(struct i2c_periph *p __attribute__((unused)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
bool_t i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
||||
bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
||||
{
|
||||
int file = (int)p->reg_addr;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ void spi_init_slaves(void)
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
{
|
||||
int fd = (int)p->reg_addr;
|
||||
|
||||
@@ -102,13 +102,13 @@ bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
bool_t spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
// not implemented
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
// not implemented
|
||||
return FALSE;
|
||||
|
||||
@@ -66,7 +66,7 @@ void udp_arch_init(void)
|
||||
* Initialize the UDP peripheral.
|
||||
* Allocate UdpSocket struct and create and bind the UDP socket.
|
||||
*/
|
||||
void udp_arch_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool_t broadcast)
|
||||
void udp_arch_periph_init(struct udp_periph *p, char *host, int port_out, int port_in, bool broadcast)
|
||||
{
|
||||
struct UdpSocket *sock = malloc(sizeof(struct UdpSocket));
|
||||
udp_socket_create(sock, host, port_out, port_in, broadcast);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
* @param[in] broadcast if TRUE enable broadcasting
|
||||
* @return -1 on error, otherwise 0
|
||||
*/
|
||||
int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool_t broadcast)
|
||||
int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool broadcast)
|
||||
{
|
||||
if (sock == NULL) {
|
||||
return -1;
|
||||
|
||||
@@ -46,7 +46,7 @@ struct UdpSocket {
|
||||
* @param[in] broadcast if TRUE enable broadcasting
|
||||
* @return -1 on error, otherwise 0
|
||||
*/
|
||||
extern int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool_t broadcast);
|
||||
extern int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool broadcast);
|
||||
|
||||
/**
|
||||
* Send a packet from buffer, blocking.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define ADS8344Select() SetBit(ADS8344_SS_IOCLR,ADS8344_SS_PIN)
|
||||
#define ADS8344Unselect() SetBit(ADS8344_SS_IOSET,ADS8344_SS_PIN)
|
||||
|
||||
bool_t ADS8344_available;
|
||||
bool ADS8344_available;
|
||||
uint16_t ADS8344_values[NB_CHANNELS];
|
||||
|
||||
#define POWER_MODE (1 << 1 | 1)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define NB_CHANNELS 8
|
||||
|
||||
extern uint16_t ADS8344_values[NB_CHANNELS];
|
||||
extern bool_t ADS8344_available;
|
||||
extern bool ADS8344_available;
|
||||
|
||||
void ADS8344_init(void);
|
||||
void ADS8344_start(void);
|
||||
|
||||
@@ -85,7 +85,7 @@ __attribute__((always_inline)) static inline void I2cSendByte(void *reg, uint8_t
|
||||
((i2cRegs_t *)reg)->dat = b;
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) static inline void I2cReceive(void *reg, bool_t ack)
|
||||
__attribute__((always_inline)) static inline void I2cReceive(void *reg, bool ack)
|
||||
{
|
||||
if (ack) { ((i2cRegs_t *)reg)->conset = _BV(AA); }
|
||||
else { ((i2cRegs_t *)reg)->conclr = _BV(AAC); }
|
||||
@@ -341,12 +341,12 @@ void i2c1_hw_init(void)
|
||||
#endif /* USE_I2C1 */
|
||||
|
||||
|
||||
bool_t i2c_idle(struct i2c_periph *p)
|
||||
bool i2c_idle(struct i2c_periph *p)
|
||||
{
|
||||
return p->status == I2CIdle;
|
||||
}
|
||||
|
||||
bool_t i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
||||
bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
|
||||
{
|
||||
|
||||
uint8_t idx;
|
||||
|
||||
@@ -490,7 +490,7 @@ void spi1_arch_init(void)
|
||||
#endif
|
||||
|
||||
|
||||
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
{
|
||||
//unsigned cpsr;
|
||||
|
||||
@@ -560,7 +560,7 @@ void spi_slave_unselect(uint8_t slave)
|
||||
SpiSlaveUnselect(slave);
|
||||
}
|
||||
|
||||
bool_t spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
uint8_t *vic = (uint8_t *)(p->init_struct);
|
||||
VICIntEnClear = VIC_BIT(*vic);
|
||||
@@ -573,7 +573,7 @@ bool_t spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
uint8_t *vic = (uint8_t *)(p->init_struct);
|
||||
VICIntEnClear = VIC_BIT(*vic);
|
||||
@@ -676,7 +676,7 @@ void spi1_slave_arch_init(void)
|
||||
#endif
|
||||
|
||||
/** Register one (and only one) transaction to use spi as slave */
|
||||
bool_t spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
|
||||
bool spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
|
||||
{
|
||||
|
||||
if (p->trans_insert_idx >= 1) {
|
||||
@@ -700,7 +700,7 @@ bool_t spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t spi_slave_wait(struct spi_periph *p)
|
||||
bool spi_slave_wait(struct spi_periph *p)
|
||||
{
|
||||
if (p->trans_insert_idx == 0) {
|
||||
// no transaction registered
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
uint32_t trigger_t0;
|
||||
uint32_t delta_t0;
|
||||
volatile bool_t trig_ext_valid;
|
||||
volatile bool trig_ext_valid;
|
||||
|
||||
|
||||
void TRIG_ISR()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
extern uint32_t trigger_t0;
|
||||
extern uint32_t delta_t0;
|
||||
extern volatile bool_t trig_ext_valid;
|
||||
extern volatile bool trig_ext_valid;
|
||||
|
||||
void TRIG_ISR(void);
|
||||
void trig_ext_init(void);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "subsystems/radio_control.h"
|
||||
#include "subsystems/radio_control/spektrum_arch.h"
|
||||
|
||||
bool_t rc_spk_parser_status;
|
||||
bool rc_spk_parser_status;
|
||||
uint8_t rc_spk_parser_idx;
|
||||
uint8_t rc_spk_parser_buf[RADIO_CONTROL_NB_CHANNEL * 2];
|
||||
const int16_t rc_spk_throw[RADIO_CONTROL_NB_CHANNEL] = RC_SPK_THROWS;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define RC_SPK_STA_GOT_SYNC_1 1
|
||||
#define RC_SPK_STA_GOT_SYNC_2 2
|
||||
|
||||
extern bool_t rc_spk_parser_status;
|
||||
extern bool rc_spk_parser_status;
|
||||
extern uint8_t rc_spk_parser_idx;
|
||||
extern uint8_t rc_spk_parser_buf[RADIO_CONTROL_NB_CHANNEL * 2];
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ int VCOM_getchar(void)
|
||||
|
||||
@returns TRUE if len bytes are free
|
||||
*/
|
||||
bool_t VCOM_check_free_space(uint8_t len)
|
||||
bool VCOM_check_free_space(uint8_t len)
|
||||
{
|
||||
return (fifo_free(&txfifo) >= len ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
|
||||
#if USE_BARO_MS5534A
|
||||
|
||||
extern bool_t spi_message_received;
|
||||
extern bool_t baro_MS5534A_available;
|
||||
extern bool spi_message_received;
|
||||
extern bool baro_MS5534A_available;
|
||||
extern uint32_t baro_MS5534A_pressure;
|
||||
extern uint16_t baro_MS5534A_temp;
|
||||
extern bool_t alt_baro_enabled;
|
||||
extern bool alt_baro_enabled;
|
||||
extern uint32_t baro_MS5534A_ground_pressure;
|
||||
extern float baro_MS5534A_r;
|
||||
extern float baro_MS5534A_sigma2;
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "mcu_periph/i2c.h"
|
||||
|
||||
|
||||
bool_t i2c_idle(struct i2c_periph *p __attribute__((unused))) { return TRUE; }
|
||||
bool_t i2c_submit(struct i2c_periph *p __attribute__((unused)), struct i2c_transaction *t __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;}
|
||||
void i2c_event(void) { }
|
||||
void i2c2_setbitrate(int bitrate __attribute__((unused))) { }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "mcu_periph/spi.h"
|
||||
|
||||
|
||||
bool_t 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) {}
|
||||
|
||||
@@ -35,7 +35,7 @@ void spi_slave_select(uint8_t slave __attribute__((unused))) {}
|
||||
|
||||
void spi_slave_unselect(uint8_t slave __attribute__((unused))) {}
|
||||
|
||||
bool_t 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_t 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; }
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ struct FloatVect3 arduimu_accel;
|
||||
|
||||
float ins_roll_neutral;
|
||||
float ins_pitch_neutral;
|
||||
bool_t arduimu_calibrate_neutrals;
|
||||
bool arduimu_calibrate_neutrals;
|
||||
|
||||
// Updates from Ocaml sim
|
||||
extern float sim_phi;
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
uint8_t ir_estim_mode;
|
||||
uint8_t vertical_mode;
|
||||
uint8_t inflight_calib_mode;
|
||||
bool_t rc_event_1, rc_event_2;
|
||||
bool_t launch;
|
||||
bool rc_event_1, rc_event_2;
|
||||
bool launch;
|
||||
uint8_t gps_nb_ovrn, link_fbw_fbw_nb_err, link_fbw_nb_err;
|
||||
float alt_roll_pgain;
|
||||
float roll_rate_pgain;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <caml/mlvalues.h>
|
||||
#endif
|
||||
|
||||
static bool_t spektrum_available;
|
||||
static bool spektrum_available;
|
||||
|
||||
void radio_control_spektrum_try_bind(void) {}
|
||||
|
||||
|
||||
@@ -596,7 +596,7 @@ void adc_isr(void)
|
||||
at least 500 hz, but we inject adc value in sampling buffer only at 50hz
|
||||
*/
|
||||
const uint32_t timeStampDiff = get_sys_time_msec() - adc_watchdog.timeStamp;
|
||||
const bool_t shouldAccumulateValue = timeStampDiff > 20;
|
||||
const bool shouldAccumulateValue = timeStampDiff > 20;
|
||||
if (shouldAccumulateValue) {
|
||||
adc_watchdog.timeStamp = get_sys_time_msec();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void gpio_setup_input_pulldown(uint32_t port, uint16_t gpios)
|
||||
gpio_set_mode(port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, gpios);
|
||||
}
|
||||
|
||||
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool_t is_output)
|
||||
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool is_output)
|
||||
{
|
||||
gpio_enable_clock(port);
|
||||
/* remap alternate function if needed */
|
||||
@@ -150,7 +150,7 @@ void gpio_setup_input_pulldown(uint32_t port, uint16_t gpios)
|
||||
gpio_mode_setup(port, GPIO_MODE_INPUT, GPIO_PUPD_PULLDOWN, gpios);
|
||||
}
|
||||
|
||||
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output __attribute__((unused)))
|
||||
void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool is_output __attribute__((unused)))
|
||||
{
|
||||
gpio_enable_clock(port);
|
||||
gpio_set_af(port, af, pin);
|
||||
|
||||
@@ -66,9 +66,9 @@ extern void gpio_setup_input_pulldown(uint32_t port, uint16_t gpios);
|
||||
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
|
||||
*/
|
||||
#if defined(STM32F1)
|
||||
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool_t is_output);
|
||||
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool is_output);
|
||||
#else
|
||||
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output);
|
||||
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool is_output);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -1283,9 +1283,9 @@ static inline void i2c_scl_toggle(uint32_t i2c)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool_t i2c_sda_get(uint32_t i2c)
|
||||
static inline bool i2c_sda_get(uint32_t i2c)
|
||||
{
|
||||
bool_t res = FALSE;
|
||||
bool res = FALSE;
|
||||
#if USE_I2C1
|
||||
if (i2c == I2C1) {
|
||||
res = gpio_get(I2C1_GPIO_PORT, I2C1_GPIO_SDA);
|
||||
@@ -1415,7 +1415,7 @@ void i2c_event(void)
|
||||
/////////////////////////////////////////////////////////
|
||||
// Implement Interface Functions
|
||||
|
||||
bool_t 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) {
|
||||
return FALSE;
|
||||
@@ -1465,7 +1465,7 @@ bool_t i2c_submit(struct i2c_periph *periph, struct i2c_transaction *t)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t i2c_idle(struct i2c_periph *periph)
|
||||
bool i2c_idle(struct i2c_periph *periph)
|
||||
{
|
||||
// This is actually a difficult function:
|
||||
// -simply reading the status flags can clear bits and corrupt the transaction
|
||||
|
||||
@@ -97,9 +97,9 @@ struct spi_periph_dma {
|
||||
uint8_t rx_nvic_irq; ///< receive interrupt
|
||||
uint8_t tx_nvic_irq; ///< transmit interrupt
|
||||
uint16_t tx_dummy_buf; ///< dummy tx buffer for receive only cases
|
||||
bool_t tx_extra_dummy_dma; ///< extra tx dummy dma flag for tx_len < rx_len
|
||||
bool tx_extra_dummy_dma; ///< extra tx dummy dma flag for tx_len < rx_len
|
||||
uint16_t rx_dummy_buf; ///< dummy rx buffer for receive only cases
|
||||
bool_t rx_extra_dummy_dma; ///< extra rx dummy dma flag for tx_len > rx_len
|
||||
bool rx_extra_dummy_dma; ///< extra rx dummy dma flag for tx_len > rx_len
|
||||
struct locm3_spi_comm comm; ///< current communication parameters
|
||||
uint8_t comm_sig; ///< comm config signature used to check for changes
|
||||
};
|
||||
@@ -121,7 +121,7 @@ static struct spi_periph_dma spi3_dma;
|
||||
static void spi_start_dma_transaction(struct spi_periph *periph, struct spi_transaction *_trans);
|
||||
static void spi_next_transaction(struct spi_periph *periph);
|
||||
static void spi_configure_dma(uint32_t dma, uint32_t rcc_dma, uint8_t chan, uint32_t periph_addr, uint32_t buf_addr,
|
||||
uint16_t len, enum SPIDataSizeSelect dss, bool_t increment);
|
||||
uint16_t len, enum SPIDataSizeSelect dss, bool increment);
|
||||
static void __attribute__((unused)) process_rx_dma_interrupt(struct spi_periph *periph);
|
||||
static void __attribute__((unused)) process_tx_dma_interrupt(struct spi_periph *periph);
|
||||
static void spi_arch_int_enable(struct spi_periph *spi);
|
||||
@@ -260,7 +260,7 @@ void spi_init_slaves(void)
|
||||
* Implementation of the generic SPI functions
|
||||
*
|
||||
*****************************************************************************/
|
||||
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
{
|
||||
uint8_t idx;
|
||||
idx = p->trans_insert_idx + 1;
|
||||
@@ -290,7 +290,7 @@ bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
spi_arch_int_disable(p);
|
||||
if (slave < 254 && p->suspend == 0) {
|
||||
@@ -302,7 +302,7 @@ bool_t spi_lock(struct spi_periph *p, uint8_t slave)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
bool spi_resume(struct spi_periph *p, uint8_t slave)
|
||||
{
|
||||
spi_arch_int_disable(p);
|
||||
if (p->suspend == slave + 1) {
|
||||
@@ -456,7 +456,7 @@ static void set_comm_from_transaction(struct locm3_spi_comm *c, struct spi_trans
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void spi_configure_dma(uint32_t dma, uint32_t rcc_dma, uint8_t chan, uint32_t periph_addr, uint32_t buf_addr,
|
||||
uint16_t len, enum SPIDataSizeSelect dss, bool_t increment)
|
||||
uint16_t len, enum SPIDataSizeSelect dss, bool increment)
|
||||
{
|
||||
rcc_periph_clock_enable(rcc_dma);
|
||||
#ifdef STM32F1
|
||||
@@ -1621,7 +1621,7 @@ static void spi_slave_set_config(struct spi_periph * periph, struct spi_transact
|
||||
* Therefore, to ensure that the first byte of your data will be set, you have to set the transmit buffer before you call
|
||||
* this function
|
||||
*/
|
||||
bool_t spi_slave_register(struct spi_periph * periph, struct spi_transaction * trans) {
|
||||
bool spi_slave_register(struct spi_periph * periph, struct spi_transaction * trans) {
|
||||
struct spi_periph_dma *dma = periph->init_struct;
|
||||
|
||||
/* Store local copy to notify of the results */
|
||||
|
||||
@@ -89,7 +89,7 @@ void uart_periph_set_bits_stop_parity(struct uart_periph *p, uint8_t bits, uint8
|
||||
}
|
||||
}
|
||||
|
||||
void uart_periph_set_mode(struct uart_periph *p, bool_t tx_enabled, bool_t rx_enabled, bool_t hw_flow_control)
|
||||
void uart_periph_set_mode(struct uart_periph *p, bool tx_enabled, bool rx_enabled, bool hw_flow_control)
|
||||
{
|
||||
uint32_t mode = 0;
|
||||
if (tx_enabled) {
|
||||
|
||||
@@ -324,7 +324,7 @@ void radio_control_impl_init(void)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static inline void SpektrumParser(uint8_t _c, SpektrumStateType *spektrum_state, bool_t secondary_receiver)
|
||||
static inline void SpektrumParser(uint8_t _c, SpektrumStateType *spektrum_state, bool secondary_receiver)
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ static fifo_t txfifo;
|
||||
static fifo_t rxfifo;
|
||||
|
||||
void fifo_init(fifo_t *fifo, uint8_t *buf);
|
||||
bool_t fifo_put(fifo_t *fifo, uint8_t c);
|
||||
bool_t fifo_get(fifo_t *fifo, uint8_t *pc);
|
||||
bool fifo_put(fifo_t *fifo, uint8_t c);
|
||||
bool fifo_get(fifo_t *fifo, uint8_t *pc);
|
||||
int fifo_avail(fifo_t *fifo);
|
||||
int fifo_free(fifo_t *fifo);
|
||||
int tx_timeout; // tmp work around for usbd_ep_stall_get from, this function does not always seem to work
|
||||
@@ -286,7 +286,7 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep)
|
||||
}
|
||||
|
||||
// store USB connection status
|
||||
static bool_t usb_connected;
|
||||
static bool usb_connected;
|
||||
|
||||
// use suspend callback to detect disconnect
|
||||
static void suspend_cb(void)
|
||||
@@ -326,7 +326,7 @@ void fifo_init(fifo_t *fifo, uint8_t *buf)
|
||||
|
||||
|
||||
|
||||
bool_t fifo_put(fifo_t *fifo, uint8_t c)
|
||||
bool fifo_put(fifo_t *fifo, uint8_t c)
|
||||
{
|
||||
int next;
|
||||
|
||||
@@ -344,7 +344,7 @@ bool_t fifo_put(fifo_t *fifo, uint8_t c)
|
||||
}
|
||||
|
||||
|
||||
bool_t fifo_get(fifo_t *fifo, uint8_t *pc)
|
||||
bool fifo_get(fifo_t *fifo, uint8_t *pc)
|
||||
{
|
||||
int next;
|
||||
|
||||
@@ -423,7 +423,7 @@ int VCOM_getchar(void)
|
||||
* Checks if buffer free in VCOM buffer
|
||||
* @returns TRUE if len bytes are free
|
||||
*/
|
||||
bool_t VCOM_check_free_space(uint8_t len)
|
||||
bool VCOM_check_free_space(uint8_t len)
|
||||
{
|
||||
return (fifo_free(&txfifo) >= len ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include "sdLog.h"
|
||||
#include "subsystems/chibios-libopencm3/chibios_sdlog.h"
|
||||
#include "subsystems/gps.h"
|
||||
bool_t log_apogee_baro_started;
|
||||
bool log_apogee_baro_started;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void __early_init(void) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
return !palReadPad(GPIOB, GPIOB_SDIO_DETECT);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
/**
|
||||
* @brief MMC_SPI card detection.
|
||||
*/
|
||||
bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
@@ -96,7 +96,7 @@ bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
/**
|
||||
* @brief MMC_SPI card write protection detection.
|
||||
*/
|
||||
bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
||||
bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
||||
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
|
||||
@@ -511,7 +511,7 @@
|
||||
#define SYSTEM_TICK_EVENT_HOOK() { \
|
||||
/* System tick event code here.*/ \
|
||||
void sys_tick_handler (void); \
|
||||
extern bool_t pprzReady; \
|
||||
extern bool pprzReady; \
|
||||
if (pprzReady == TRUE) sys_tick_handler (); \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -81,8 +81,8 @@ PRINT_CONFIG_VAR(APOGEE_MAG_FREQ)
|
||||
PRINT_CONFIG_VAR(MAG_PRESCALER)
|
||||
|
||||
// mag config will be done later in bypass mode
|
||||
bool_t configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||
bool_t configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||
bool configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -92,8 +92,8 @@ bool_t configure_mag_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), voi
|
||||
struct ImuApogee imu_apogee;
|
||||
|
||||
// baro config will be done later in bypass mode
|
||||
bool_t configure_baro_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||
bool_t configure_baro_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set, void *mpu);
|
||||
bool configure_baro_slave(Mpu60x0ConfigSet mpu_set __attribute__((unused)), void *mpu __attribute__((unused)))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -169,10 +169,10 @@ int actuators_ardrone_cmd(uint8_t cmd, uint8_t *reply, int replylen)
|
||||
void actuators_ardrone_motor_status(void);
|
||||
void actuators_ardrone_motor_status(void)
|
||||
{
|
||||
static bool_t last_motor_on = FALSE;
|
||||
static bool last_motor_on = FALSE;
|
||||
|
||||
// Reset Flipflop sequence
|
||||
static bool_t reset_flipflop_counter = 0;
|
||||
static bool reset_flipflop_counter = 0;
|
||||
if (reset_flipflop_counter > 0) {
|
||||
reset_flipflop_counter--;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
/* Internal used functions */
|
||||
static void *navdata_read(void *data __attribute__((unused)));
|
||||
static void navdata_cmd_send(uint8_t cmd);
|
||||
static bool_t navdata_baro_calib(void);
|
||||
static bool navdata_baro_calib(void);
|
||||
static void mag_freeze_check(void);
|
||||
static void baro_update_logic(void);
|
||||
|
||||
@@ -61,7 +61,7 @@ struct navdata_t navdata;
|
||||
/** Buffer filled in the thread (maximum one navdata packet) */
|
||||
static uint8_t navdata_buffer[NAVDATA_PACKET_SIZE];
|
||||
/** flag to indicate new packet is available in buffer */
|
||||
static bool_t navdata_available = FALSE;
|
||||
static bool navdata_available = FALSE;
|
||||
|
||||
/* syncronization variables */
|
||||
static pthread_mutex_t navdata_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@@ -168,7 +168,7 @@ static void send_navdata(struct transport_tx *trans, struct link_device *dev)
|
||||
/**
|
||||
* Initialize the navdata board
|
||||
*/
|
||||
bool_t navdata_init()
|
||||
bool navdata_init()
|
||||
{
|
||||
assert(sizeof(struct navdata_measure_t) == NAVDATA_PACKET_SIZE);
|
||||
|
||||
@@ -413,7 +413,7 @@ static void navdata_cmd_send(uint8_t cmd)
|
||||
/**
|
||||
* Try to receive the baro calibration from the navdata board
|
||||
*/
|
||||
static bool_t navdata_baro_calib(void)
|
||||
static bool navdata_baro_calib(void)
|
||||
{
|
||||
/* Start baro calibration acquisition */
|
||||
navdata_cmd_send(NAVDATA_CMD_BARO_CALIB);
|
||||
|
||||
@@ -112,7 +112,7 @@ struct bmp180_calib_t {
|
||||
|
||||
/* Main navdata structure */
|
||||
struct navdata_t {
|
||||
bool_t is_initialized; ///< Check if the navdata board is initialized
|
||||
bool is_initialized; ///< Check if the navdata board is initialized
|
||||
int fd; ///< The navdata file pointer
|
||||
|
||||
uint32_t totalBytesRead;
|
||||
@@ -124,14 +124,14 @@ struct navdata_t {
|
||||
struct navdata_measure_t measure; ///< Main navdata packet receieved from navboard
|
||||
struct bmp180_calib_t bmp180_calib; ///< BMP180 calibration receieved from navboard
|
||||
|
||||
bool_t baro_calibrated; ///< Whenever the baro is calibrated
|
||||
bool_t baro_available; ///< Whenever the baro is available
|
||||
bool_t imu_lost; ///< Whenever the imu is lost
|
||||
bool baro_calibrated; ///< Whenever the baro is calibrated
|
||||
bool baro_available; ///< Whenever the baro is available
|
||||
bool imu_lost; ///< Whenever the imu is lost
|
||||
};
|
||||
extern struct navdata_t navdata;
|
||||
|
||||
|
||||
bool_t navdata_init(void);
|
||||
bool navdata_init(void);
|
||||
void navdata_update(void);
|
||||
int16_t navdata_height(void);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ struct video_config_t front_camera = {
|
||||
.filters = VIDEO_FILTER_DEBAYER
|
||||
};
|
||||
|
||||
static bool_t write_reg(int fd, char *addr_val, uint8_t cnt)
|
||||
static bool write_reg(int fd, char *addr_val, uint8_t cnt)
|
||||
{
|
||||
char resp[cnt - 2];
|
||||
uint8_t i;
|
||||
@@ -82,7 +82,7 @@ static bool_t write_reg(int fd, char *addr_val, uint8_t cnt)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool_t _write(int fd, char *data, uint8_t cnt)
|
||||
static bool _write(int fd, char *data, uint8_t cnt)
|
||||
{
|
||||
if (write(fd, data, cnt) != cnt) {
|
||||
printf("Failed!\n");
|
||||
|
||||
@@ -105,8 +105,8 @@
|
||||
#endif
|
||||
|
||||
struct ImuKrooz {
|
||||
volatile bool_t mpu_eoc;
|
||||
volatile bool_t hmc_eoc;
|
||||
volatile bool mpu_eoc;
|
||||
volatile bool hmc_eoc;
|
||||
struct Mpu60x0_I2c mpu;
|
||||
struct Hmc58xx hmc;
|
||||
struct Int32Rates rates_sum;
|
||||
|
||||
@@ -108,8 +108,8 @@
|
||||
#endif
|
||||
|
||||
struct ImuKrooz {
|
||||
volatile bool_t mpu_eoc;
|
||||
volatile bool_t hmc_eoc;
|
||||
volatile bool mpu_eoc;
|
||||
volatile bool hmc_eoc;
|
||||
struct Mpu60x0_I2c mpu;
|
||||
struct spi_transaction ad7689_trans;
|
||||
volatile uint8_t ad7689_spi_tx_buffer[2];
|
||||
|
||||
@@ -42,7 +42,7 @@ enum LisaBaroStatus {
|
||||
|
||||
struct BaroBoard {
|
||||
enum LisaBaroStatus status;
|
||||
bool_t running;
|
||||
bool running;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
struct Bmp085 baro_bmp085;
|
||||
|
||||
static bool_t baro_eoc(void)
|
||||
static bool baro_eoc(void)
|
||||
{
|
||||
return gpio_get(GPIOB, GPIO0);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
struct Bmp085 baro_bmp085;
|
||||
|
||||
static bool_t baro_eoc(void)
|
||||
static bool baro_eoc(void)
|
||||
{
|
||||
return gpio_get(GPIOB, GPIO0);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
#define IMU_ACCEL_Z_NEUTRAL 0
|
||||
#endif
|
||||
|
||||
extern volatile bool_t gyr_valid;
|
||||
extern volatile bool_t acc_valid;
|
||||
extern volatile bool gyr_valid;
|
||||
extern volatile bool acc_valid;
|
||||
|
||||
struct ImuUmarim {
|
||||
struct Itg3200 itg;
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
#include "pprz_version.h"
|
||||
|
||||
uint8_t pprz_mode;
|
||||
bool_t kill_throttle;
|
||||
bool kill_throttle;
|
||||
uint8_t mcu1_status;
|
||||
|
||||
bool_t launch;
|
||||
bool launch;
|
||||
|
||||
/** flight time in seconds. */
|
||||
uint16_t autopilot_flight_time;
|
||||
@@ -53,9 +53,9 @@ uint16_t vsupply;
|
||||
int32_t current;
|
||||
float energy;
|
||||
|
||||
bool_t gps_lost;
|
||||
bool gps_lost;
|
||||
|
||||
bool_t power_switch;
|
||||
bool power_switch;
|
||||
|
||||
#if PERIODIC_TELEMETRY
|
||||
#include "subsystems/datalink/telemetry.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ extern void autopilot_init(void);
|
||||
(pprz > THRESHOLD1 ? PPRZ_MODE_AUTO1 : PPRZ_MODE_MANUAL))
|
||||
|
||||
extern uint8_t pprz_mode;
|
||||
extern bool_t kill_throttle;
|
||||
extern bool kill_throttle;
|
||||
extern uint8_t mcu1_status;
|
||||
|
||||
/** flight time in seconds. */
|
||||
@@ -98,9 +98,9 @@ extern int32_t current; // milliAmpere
|
||||
*/
|
||||
extern float energy;
|
||||
|
||||
extern bool_t launch;
|
||||
extern bool launch;
|
||||
|
||||
extern bool_t gps_lost;
|
||||
extern bool gps_lost;
|
||||
|
||||
/** Assignment, returning _old_value != _value
|
||||
* Using GCC expression statements */
|
||||
@@ -115,7 +115,7 @@ extern void autopilot_send_mode(void);
|
||||
|
||||
/** Power switch control.
|
||||
*/
|
||||
extern bool_t power_switch;
|
||||
extern bool power_switch;
|
||||
|
||||
#ifdef POWER_SWITCH_GPIO
|
||||
#include "mcu_periph/gpio.h"
|
||||
|
||||
@@ -56,14 +56,14 @@ Thread *pprzThdPtr = NULL;
|
||||
|
||||
static WORKING_AREA(wa_thd_heartbeat, 2048);
|
||||
void chibios_launch_heartbeat (void);
|
||||
bool_t sdOk = FALSE;
|
||||
bool sdOk = FALSE;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Init ChibiOS HAL and Sys
|
||||
*/
|
||||
bool_t chibios_init(void) {
|
||||
bool chibios_init(void) {
|
||||
halInit();
|
||||
chSysInit();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "std.h"
|
||||
|
||||
extern Thread *pprzThdPtr;
|
||||
extern bool_t chibios_init(void);
|
||||
extern bool chibios_init(void);
|
||||
extern void launch_pprz_thd (int32_t (*thd) (void *arg));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -361,7 +361,7 @@ static inline uint8_t mcu1_status_update(void)
|
||||
{
|
||||
uint8_t new_status = fbw_state->status;
|
||||
if (mcu1_status != new_status) {
|
||||
bool_t changed = ((mcu1_status & MASK_FBW_CHANGED) != (new_status & MASK_FBW_CHANGED));
|
||||
bool changed = ((mcu1_status & MASK_FBW_CHANGED) != (new_status & MASK_FBW_CHANGED));
|
||||
mcu1_status = new_status;
|
||||
return changed;
|
||||
}
|
||||
@@ -408,10 +408,10 @@ static inline void telecommand_task(void)
|
||||
}
|
||||
}
|
||||
if (bit_is_set(fbw_state->status, AVERAGED_CHANNELS_SENT)) {
|
||||
bool_t pprz_mode_changed = pprz_mode_update();
|
||||
bool pprz_mode_changed = pprz_mode_update();
|
||||
mode_changed |= pprz_mode_changed;
|
||||
#if defined RADIO_CALIB && defined RADIO_CONTROL_SETTINGS
|
||||
bool_t calib_mode_changed = RcSettingsModeUpdate(fbw_state->channels);
|
||||
bool calib_mode_changed = RcSettingsModeUpdate(fbw_state->channels);
|
||||
rc_settings(calib_mode_changed || pprz_mode_changed);
|
||||
mode_changed |= calib_mode_changed;
|
||||
#endif
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
|
||||
static int32_t pprz_thd(void *arg);
|
||||
static bool_t sdlogOk ;
|
||||
bool_t pprzReady = FALSE;
|
||||
static bool sdlogOk ;
|
||||
bool pprzReady = FALSE;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#define FBW_MODE_OF_PPRZ(mode) ((mode) < THRESHOLD_MANUAL_PPRZ ? FBW_MODE_MANUAL : FBW_MODE_AUTO)
|
||||
|
||||
extern uint8_t fbw_mode;
|
||||
extern bool_t failsafe_mode;
|
||||
extern bool failsafe_mode;
|
||||
|
||||
void init_fbw(void);
|
||||
void handle_periodic_tasks_fbw(void);
|
||||
|
||||
@@ -65,8 +65,8 @@ static float nav_carrot_leg_progress;
|
||||
/** length of the current leg (m) */
|
||||
static float nav_leg_length;
|
||||
|
||||
bool_t nav_in_circle = FALSE;
|
||||
bool_t nav_in_segment = FALSE;
|
||||
bool nav_in_circle = FALSE;
|
||||
bool nav_in_segment = FALSE;
|
||||
float nav_circle_x, nav_circle_y, nav_circle_radius;
|
||||
float nav_segment_x_1, nav_segment_y_1, nav_segment_x_2, nav_segment_y_2;
|
||||
uint8_t horizontal_mode;
|
||||
@@ -87,7 +87,7 @@ float nav_ground_speed_setpoint, nav_ground_speed_pgain;
|
||||
/* Used in nav_survey_rectangle. Defined here for downlink and uplink */
|
||||
float nav_survey_shift;
|
||||
float nav_survey_west, nav_survey_east, nav_survey_north, nav_survey_south;
|
||||
bool_t nav_survey_active;
|
||||
bool nav_survey_active;
|
||||
|
||||
int nav_mode;
|
||||
|
||||
@@ -216,7 +216,7 @@ static void nav_ground_speed_loop(void)
|
||||
#endif
|
||||
|
||||
float baseleg_out_qdr;
|
||||
bool_t nav_compute_baseleg(uint8_t wp_af, uint8_t wp_td, uint8_t wp_baseleg, float radius)
|
||||
bool nav_compute_baseleg(uint8_t wp_af, uint8_t wp_td, uint8_t wp_baseleg, float radius)
|
||||
{
|
||||
nav_radius = radius;
|
||||
|
||||
@@ -239,7 +239,7 @@ bool_t nav_compute_baseleg(uint8_t wp_af, uint8_t wp_td, uint8_t wp_baseleg, flo
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool_t nav_compute_final_from_glide(uint8_t wp_af, uint8_t wp_td, float glide)
|
||||
bool nav_compute_final_from_glide(uint8_t wp_af, uint8_t wp_td, float glide)
|
||||
{
|
||||
|
||||
float x_0 = waypoints[wp_td].x - waypoints[wp_af].x;
|
||||
@@ -262,7 +262,7 @@ bool_t nav_compute_final_from_glide(uint8_t wp_af, uint8_t wp_td, float glide)
|
||||
/* For a landing UPWIND.
|
||||
Computes Top Of Descent waypoint from Touch Down and Approach Fix
|
||||
waypoints, using glide airspeed, glide vertical speed and wind */
|
||||
static inline bool_t compute_TOD(uint8_t _af, uint8_t _td, uint8_t _tod, float glide_airspeed, float glide_vspeed)
|
||||
static inline bool compute_TOD(uint8_t _af, uint8_t _td, uint8_t _tod, float glide_airspeed, float glide_vspeed)
|
||||
{
|
||||
struct FloatVect2 *wind = stateGetHorizontalWindspeed_f();
|
||||
float td_af_x = WaypointX(_af) - WaypointX(_td);
|
||||
@@ -321,7 +321,7 @@ float fp_climb; /* m/s */
|
||||
*
|
||||
* @return true if the position (x, y) is reached
|
||||
*/
|
||||
bool_t nav_approaching_xy(float x, float y, float from_x, float from_y, float approaching_time)
|
||||
bool nav_approaching_xy(float x, float y, float from_x, float from_y, float approaching_time)
|
||||
{
|
||||
/** distance to waypoint in x */
|
||||
float pw_x = x - stateGetPositionEnu_f()->x;
|
||||
@@ -481,7 +481,7 @@ static void send_wp_moved(struct transport_tx *trans, struct link_device *dev)
|
||||
DownlinkSendWp(trans, dev, i);
|
||||
}
|
||||
|
||||
bool_t DownlinkSendWpNr(uint8_t _wp)
|
||||
bool DownlinkSendWpNr(uint8_t _wp)
|
||||
{
|
||||
DownlinkSendWp(&(DefaultChannel).trans_tx, &(DefaultDevice).device, _wp);
|
||||
return FALSE;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user