Skip to content

Commit

Permalink
replace bool_t with C99 bool from stdbool.h
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr authored and gautierhattenberger committed Mar 31, 2016
1 parent e56fd4e commit 5c1e426
Show file tree
Hide file tree
Showing 433 changed files with 1,025 additions and 1,035 deletions.
4 changes: 2 additions & 2 deletions sw/airborne/arch/linux/mcu_periph/i2c_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/arch/linux/mcu_periph/spi_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/linux/mcu_periph/udp_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/linux/udp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/linux/udp_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/ADS8344.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/ADS8344.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/arch/lpc21/mcu_periph/i2c_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions sw/airborne/arch/lpc21/mcu_periph/spi_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/modules/sensors/trig_ext_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/modules/sensors/trig_ext_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/lpc21/usb_ser_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/arch/sim/baro_MS5534A.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/sim/mcu_periph/i2c_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))) { }

Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/arch/sim/mcu_periph/spi_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#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) {}

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; }

2 changes: 1 addition & 1 deletion sw/airborne/arch/sim/modules/ins/ins_arduimu_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/sim/sim_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/arch/stm32/mcu_periph/adc_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/stm32/mcu_periph/gpio_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/arch/stm32/mcu_periph/gpio_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
8 changes: 4 additions & 4 deletions sw/airborne/arch/stm32/mcu_periph/i2c_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5c1e426

Please sign in to comment.