Skip to content

Commit

Permalink
Revert "don't call led_init() from mcu_init anymore, instead call the…
Browse files Browse the repository at this point in the history
… indiivdual LED_INIT(x) wherever they are used"

This reverts commit 46f7182.
  • Loading branch information
gautierhattenberger committed May 18, 2012
1 parent f6cbc07 commit a7a65e7
Show file tree
Hide file tree
Showing 31 changed files with 12 additions and 154 deletions.
4 changes: 0 additions & 4 deletions sw/airborne/arch/lpc21/ADS8344.c
Expand Up @@ -103,10 +103,6 @@ void ADS8344_init( void ) {
/* configure SS pin */
SetBit( ADS8344_SS_IODIR, ADS8344_SS_PIN); /* pin is output */
ADS8344Unselect(); /* pin low */

// FIXME, no hardcoded led numbers
LED_INIT(2);
LED_OFF(2);
}

static inline void read_values( void ) {
Expand Down
5 changes: 0 additions & 5 deletions sw/airborne/arch/lpc21/mcu_periph/sys_time_arch.c
Expand Up @@ -120,11 +120,6 @@ void sys_time_arch_init( void ) {
_VIC_CNTL(TIMER0_VIC_SLOT) = VIC_ENABLE | VIC_TIMER0;
/* address of the ISR */
_VIC_ADDR(TIMER0_VIC_SLOT) = (uint32_t)TIMER0_ISR;

//FIXME, no hardcoded led number
#ifdef TRIGGER_EXT
LED_INIT(3);
#endif
}


Expand Down
8 changes: 1 addition & 7 deletions sw/airborne/arch/lpc21/uart_tunnel.c
Expand Up @@ -15,14 +15,8 @@ int main (int argc, char** argv) {
int tx=0, rx=0;
int tx_shadow=1, rx_shadow=1;
mcu_init();

// FIXME, no hardcoded led numbers
LED_INIT(1);
led_init();
LED_ON(1);
LED_INIT(2);
LED_OFF(2);
LED_INIT(3);
LED_OFF(3);

/* TXD0 and TXD1 output */
SetBit(IO0DIR, TXD0_PIN);
Expand Down
10 changes: 1 addition & 9 deletions sw/airborne/arch/lpc21/usb_tunnel.c
Expand Up @@ -46,15 +46,7 @@ int main( void ) {

mcu_init();
sys_time_init();

// FIXME, no hardcoded led numbers
LED_INIT(1);
LED_ON(1);
LED_INIT(2);
LED_OFF(2);
LED_INIT(3);
LED_OFF(3);

led_init();
VCOM_allow_linecoding(1);

#ifdef USE_USB_SERIAL
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/boards/booz/baro_board.c
Expand Up @@ -49,7 +49,6 @@ void baro_init( void ) {
baro_board.value_filtered = 0;
baro_board.data_available = FALSE;
#ifdef ROTORCRAFT_BARO_LED
LED_INIT(ROTORCRAFT_BARO_LED);
LED_OFF(ROTORCRAFT_BARO_LED);
#endif
}
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/boards/navgo/baro_board.c
Expand Up @@ -43,7 +43,6 @@ void baro_init( void ) {
baro.absolute = 0;
baro.differential = 0; /* not handled on this board */
#ifdef ROTORCRAFT_BARO_LED
LED_INIT(ROTORCRAFT_BARO_LED);
LED_OFF(ROTORCRAFT_BARO_LED);
#endif
startup_cnt = STARTUP_COUNTER;
Expand Down
9 changes: 0 additions & 9 deletions sw/airborne/firmwares/fixedwing/main_ap.c
Expand Up @@ -169,15 +169,6 @@ void init_ap( void ) {
mcu_init();
#endif /* SINGLE_MCU */

#ifdef POWER_SWITCH_LED
LED_INIT(POWER_SWITCH_LED);
LED_OFF(POWER_SWITCH_LED);
#endif
#ifdef AHRS_CPU_LED
LED_INIT(AHRS_CPU_LED);
LED_OFF(AHRS_CPU_LED);
#endif

/************* Sensors initialization ***************/
#if USE_GPS
gps_init();
Expand Down
14 changes: 1 addition & 13 deletions sw/airborne/firmwares/logger/main_logger.c
Expand Up @@ -572,19 +572,7 @@ int main(void)
static inline void main_init( void ) {
mcu_init();
sys_time_init();

LED_INIT(LED_RED);
LED_OFF(LED_RED);
LED_INIT(LED_GREEN);
LED_OFF(LED_GREEN);
LED_INIT(LED_YELLOW);
LED_OFF(LED_YELLOW);

//FIXME, no hardcoded led numbers
LED_INIT(1);
LED_OFF(1);
LED_INIT(2);
LED_OFF(2);
led_init();

#ifdef USE_MAX11040
max11040_init_ssp();
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/firmwares/rotorcraft/autopilot.c
Expand Up @@ -78,7 +78,6 @@ void autopilot_init(void) {
autopilot_rc = TRUE;
autopilot_power_switch = FALSE;
#ifdef POWER_SWITCH_LED
LED_INIT(POWER_SWITCH_LED);
LED_ON(POWER_SWITCH_LED); // POWER OFF
#endif
autopilot_arming_init();
Expand Down
5 changes: 0 additions & 5 deletions sw/airborne/lisa/lisa_overo_link.c
Expand Up @@ -10,11 +10,6 @@ void overo_link_init(void) {
overo_link.crc_error = FALSE;
overo_link.timeout = FALSE;
overo_link_arch_init();

LED_INIT(OVERO_LINK_LED_OK);
LED_INIT(OVERO_LINK_LED_KO);
LED_OFF(OVERO_LINK_LED_OK);
LED_OFF(OVERO_LINK_LED_KO);
}


Expand Down
2 changes: 0 additions & 2 deletions sw/airborne/lisa/test_spi_slave.c
Expand Up @@ -53,8 +53,6 @@ int main(void) {

static inline void main_init( void ) {
mcu_init();
LED_INIT(3);
LED_OFF(3);
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
main_spi_slave_init();
}
Expand Down
4 changes: 0 additions & 4 deletions sw/airborne/lisa/test_uart_lisam.c
Expand Up @@ -52,10 +52,6 @@ int main(void) {
static inline void main_init( void ) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
LED_INIT(1);
LED_INIT(2);
LED_OFF(1);
LED_OFF(2);
}

static inline void main_periodic( void ) {
Expand Down
3 changes: 0 additions & 3 deletions sw/airborne/lisa/tunnel_hw.c
Expand Up @@ -55,9 +55,6 @@ int main(void) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);

LED_INIT(2);
LED_OFF(2);

/* init RCC */
RCC_APB2PeriphClockCmd(A_PERIPH , ENABLE);
// RCC_APB2PeriphClockCmd(B_PERIPH , ENABLE);
Expand Down
3 changes: 3 additions & 0 deletions sw/airborne/mcu.c
Expand Up @@ -60,6 +60,9 @@ void mcu_init(void) {

#ifdef PERIPHERALS_AUTO_INIT
sys_time_init();
#ifdef USE_LED
led_init();
#endif
/* for now this means using spektrum */
#if defined RADIO_CONTROL & defined RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT & defined RADIO_CONTROL_BIND_IMPL_FUNC
RADIO_CONTROL_BIND_IMPL_FUNC();
Expand Down
6 changes: 0 additions & 6 deletions sw/airborne/mcu_periph/sys_time.c
Expand Up @@ -29,7 +29,6 @@

#include "mcu_periph/sys_time.h"
#include "mcu.h"
#include "led.h"

struct sys_time sys_time;

Expand Down Expand Up @@ -70,11 +69,6 @@ void sys_time_update_timer(tid_t id, float duration) {
void sys_time_init( void ) {
sys_time_arch_init();

#ifdef SYS_TIME_LED
LED_INIT(SYS_TIME_LED);
LED_OFF(SYS_TIME_LED);
#endif

sys_time.nb_sec = 0;
sys_time.nb_sec_rem = 0;
sys_time.nb_tick = 0;
Expand Down
8 changes: 2 additions & 6 deletions sw/airborne/modules/benchmark/i2c_abuse_test.c
Expand Up @@ -33,12 +33,8 @@ volatile uint8_t i2c_abuse_test_counter = 0;
volatile uint32_t i2c_abuse_test_bitrate = 1000;

void init_i2c_abuse_test(void) {
LED_INIT(4);
LED_OFF(4);
LED_INIT(5);
LED_OFF(5);
LED_INIT(I2C_ABUSE_LED);
LED_OFF(I2C_ABUSE_LED);
//LED_INIT(DEMO_MODULE_LED);
//LED_OFF(DEMO_MODULE_LED);

i2c_test1.status = I2CTransSuccess;
i2c_test1.slave_addr = 0x3C;
Expand Down
2 changes: 0 additions & 2 deletions sw/airborne/modules/cam_control/booz_cam.c
Expand Up @@ -73,8 +73,6 @@ int16_t booz_cam_pan;
#endif

void booz_cam_init(void) {
LED_INIT(CAM_SWITCH_LED);
LED_ON(CAM_SWITCH_LED);
booz_cam_SetCamMode(BOOZ_CAM_DEFAULT_MODE);
#ifdef BOOZ_CAM_USE_TILT
booz_cam_tilt_pwm = BOOZ_CAM_TILT_NEUTRAL;
Expand Down
4 changes: 0 additions & 4 deletions sw/airborne/modules/cam_control/cam.c
Expand Up @@ -101,10 +101,6 @@ void cam_waypoint_target(void);
void cam_ac_target(void);

void cam_init( void ) {
#ifdef VIDEO_TX_SWITCH
LED_INIT(VIDEO_TX_SWITCH);
#endif

cam_mode = CAM_MODE0;
}

Expand Down
11 changes: 0 additions & 11 deletions sw/airborne/modules/digital_cam/led_cam_ctrl.h
Expand Up @@ -54,17 +54,6 @@ extern uint8_t dc_timer;

static inline void led_cam_ctrl_init(void)
{
LED_INIT(DC_SHUTTER_LED);
#ifdef DC_ZOOM_IN_LED
LED_INIT(DC_ZOOM_IN_LED);
#endif
#ifdef DC_ZOOM_OUT_LED
LED_INIT(DC_ZOOM_OUT_LED);
#endif
#ifdef DC_POWER_LED
LED_INIT(DC_POWER_LED);
#endif

// Call common DC init
dc_init();

Expand Down
2 changes: 0 additions & 2 deletions sw/airborne/modules/gsm/gsm.c
Expand Up @@ -152,8 +152,6 @@ static uint8_t gcs_index_max;

/*****************************************************************************/
void gsm_init(void) {
LED_INIT(GSM_ONOFF_LED);

if (gsm_status == STATUS_NONE) { /* First call */
LED_ON(GSM_ONOFF_LED);
gsm_status = STATUS_POWERON;
Expand Down
3 changes: 0 additions & 3 deletions sw/airborne/modules/ins/ins_chimu_spi.c
Expand Up @@ -38,9 +38,6 @@ volatile uint8_t new_ins_attitude;

void ins_init( void )
{
// FIXME, don't use hardcode led number here
LED_INIT(3);

// uint8_t ping[7] = {CHIMU_STX, CHIMU_STX, 0x01, CHIMU_BROADCAST, MSG00_PING, 0x00, 0xE6 };
uint8_t rate[12] = {CHIMU_STX, CHIMU_STX, 0x06, CHIMU_BROADCAST, MSG10_UARTSETTINGS, 0x05, 0xff, 0x79, 0x00, 0x00, 0x01, 0x76 }; // 50Hz attitude only + SPI
uint8_t quaternions[7] = {CHIMU_STX, CHIMU_STX, 0x01, CHIMU_BROADCAST, MSG09_ESTIMATOR, 0x01, 0x39 }; // 25Hz attitude only + SPI
Expand Down
3 changes: 0 additions & 3 deletions sw/airborne/modules/ins/ins_chimu_uart.c
Expand Up @@ -37,9 +37,6 @@ volatile uint8_t new_ins_attitude;

void ins_init( void )
{
// FIXME, don't use hardcode led number here
LED_INIT(3);

uint8_t ping[7] = {CHIMU_STX, CHIMU_STX, 0x01, CHIMU_BROADCAST, MSG00_PING, 0x00, 0xE6 };
uint8_t rate[12] = {CHIMU_STX, CHIMU_STX, 0x06, CHIMU_BROADCAST, MSG10_UARTSETTINGS, 0x05, 0xff, 0x79, 0x00, 0x00, 0x01, 0x76 }; // 50Hz attitude only + SPI
uint8_t quaternions[7] = {CHIMU_STX, CHIMU_STX, 0x01, CHIMU_BROADCAST, MSG09_ESTIMATOR, 0x01, 0x39 }; // 25Hz attitude only + SPI
Expand Down
8 changes: 0 additions & 8 deletions sw/airborne/modules/ins/ins_xsens.c
Expand Up @@ -226,14 +226,6 @@ volatile int xsens_configured = 0;

void ins_init( void ) {

// FIXME, don't use hardcode led number here
LED_INIT(3);

#ifdef GPS_LED
LED_INIT(GPS_LED);
LED_OFF(GPS_LED);
#endif

xsens_status = UNINIT;
xsens_configured = 20;

Expand Down
7 changes: 1 addition & 6 deletions sw/airborne/modules/meteo/humid_sht.c
Expand Up @@ -237,13 +237,8 @@ uint8_t humid_sht_reset( void )

void humid_sht_init( void )
{
// FIXME, should not use hardcoded led number
LED_INIT(2);
LED_OFF(2);

// FIXME, should not contain arch dependent code here

/* Configure DAT/SCL pin as GPIO */

#if (DAT_PIN<16)
PINSEL0 &= ~(_BV(DAT_PIN*2)|_BV(DAT_PIN*2+1));
#else
Expand Down
5 changes: 1 addition & 4 deletions sw/airborne/sd_card/main.c
Expand Up @@ -36,10 +36,7 @@ int main( void ) {
static inline void main_init( void ) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);

LED_INIT(1);
LED_OFF(1);

led_init();
Uart0Init();

spi_init();
Expand Down
5 changes: 0 additions & 5 deletions sw/airborne/subsystems/ahrs/ahrs_aligner.c
Expand Up @@ -46,11 +46,6 @@ void ahrs_aligner_init(void) {
samples_idx = 0;
ahrs_aligner.noise = 0;
ahrs_aligner.low_noise_cnt = 0;

#ifdef AHRS_ALIGNER_LED
LED_INIT(AHRS_ALIGNER_LED);
LED_OFF(AHRS_ALIGNER_LED);
#endif
}

#ifndef LOW_NOISE_THRESHOLD
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/subsystems/gps.c
Expand Up @@ -38,7 +38,6 @@ void gps_init(void) {
gps.fix = GPS_FIX_NONE;
gps.cacc = 0;
#ifdef GPS_LED
LED_INIT(GPS_LED);
LED_OFF(GPS_LED);
#endif
#ifdef GPS_TYPE_H
Expand Down
5 changes: 0 additions & 5 deletions sw/airborne/subsystems/radio_control.h
Expand Up @@ -71,11 +71,6 @@ static inline void radio_control_init ( void ) {
radio_control.frame_rate = 0;
radio_control.frame_cpt = 0;
radio_control_impl_init();

#if defined RADIO_CONTROL_LED
LED_INIT(RADIO_CONTROL_LED);
LED_OFF(RADIO_CONTROL_LED);
#endif
}

/************* PERIODIC ******************************************************/
Expand Down
14 changes: 0 additions & 14 deletions sw/airborne/test/mcu_periph/test_sys_time.c
Expand Up @@ -11,20 +11,6 @@ static inline void main_event( void );
int main(void) {

mcu_init();

#ifdef LED_GREEN
LED_INIT(LED_GREEN);
LED_OFF(LED_GREEN);
#endif
#ifdef LED_BLUE
LED_INIT(LED_BLUE);
LED_OFF(LED_BLUE);
#endif
#ifdef LED_RED
LED_INIT(LED_RED);
LED_OFF(LED_RED);
#endif

unsigned int tmr_02 = sys_time_register_timer(0.2, NULL);
unsigned int tmr_03 = sys_time_register_timer(0.3, NULL);
sys_time_register_timer(0.5, main_periodic_05);
Expand Down
7 changes: 1 addition & 6 deletions sw/airborne/test/subsystems/test_imu.c
Expand Up @@ -61,11 +61,6 @@ static inline void main_init( void ) {

mcu_init();

#ifdef BOARD_LISA_L
LED_INIT(3);
LED_OFF(3);
#endif

sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);

imu_init();
Expand All @@ -76,7 +71,7 @@ static inline void main_init( void ) {
static inline void led_toggle ( void ) {

#ifdef BOARD_LISA_L
LED_TOGGLE(3);
LED_TOGGLE(3);
#endif
}

Expand Down
5 changes: 1 addition & 4 deletions sw/airborne/test/test_adcs.c
Expand Up @@ -21,10 +21,7 @@ static struct adc_buf buf_adc[NB_ADC];
int main (int argc, char** argv) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);

LED_INIT(1);
LED_OFF(1);

led_init();
adc_init();

adc_buf_channel(ADC_0, &buf_adc[0], ADC_NB_SAMPLES);
Expand Down

0 comments on commit a7a65e7

Please sign in to comment.