Skip to content

Commit

Permalink
Remove remove safty swtich LED from FMU control
Browse files Browse the repository at this point in the history
  • Loading branch information
David Sidrane committed Mar 13, 2017
1 parent a29964d commit 76a6e34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/drivers/boards/px4fmu-v4pro/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ __BEGIN_DECLS
#define GPIO_PWM_IN GPIO_TIM4_CH2IN_2

#define GPIO_RSSI_IN (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN1)
#define GPIO_LED_SAFETY (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN3)
#define GPIO_BTN_SAFETY_FMU (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTC|GPIO_PIN4)
#define GPIO_SBUS_INV (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN13)
#define INVERT_RC_INPUT(_s) px4_arch_gpiowrite(GPIO_SBUS_INV, _s)
Expand Down
16 changes: 12 additions & 4 deletions src/drivers/boards/px4fmu-v4pro/px4fmu_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,36 @@ __END_DECLS
static uint32_t g_ledmap[] = {
GPIO_LED_BLUE, // Indexed by LED_BLUE
GPIO_LED_RED, // Indexed by LED_RED, LED_AMBER
GPIO_LED_SAFETY, // Indexed by LED_SAFETY
0, // Indexed by LED_SAFETY
GPIO_LED_GREEN, // Indexed by LED_GREEN
};

__EXPORT void led_init(void)
{
/* Configure LED GPIOs for output */
for (size_t l = 0; l < (sizeof(g_ledmap) / sizeof(g_ledmap[0])); l++) {
stm32_configgpio(g_ledmap[l]);
if (g_ledmap[l] != 0) {
stm32_configgpio(g_ledmap[l]);
}
}
}

static void phy_set_led(int led, bool state)
{
/* Pull Down to switch on */
stm32_gpiowrite(g_ledmap[led], !state);
if (g_ledmap[led] != 0) {
stm32_gpiowrite(g_ledmap[led], !state);
}
}

static bool phy_get_led(int led)
{

return !stm32_gpioread(g_ledmap[led]);
if (g_ledmap[led] != 0) {
return !stm32_gpioread(g_ledmap[led]);
}

return 0;
}

__EXPORT void led_on(int led)
Expand Down

0 comments on commit 76a6e34

Please sign in to comment.