px4fmu-v5:Runtime Safety LED support.

Safety Switch is HW version dependent on having an PX4IO
   So we init to a benign state with the _INIT definition
   and use the non _INIT verion in the driver if the run time
   decision is we do not have a PX4IO
This commit is contained in:
David Sidrane
2018-07-20 18:29:58 +02:00
committed by Lorenz Meier
parent 3136521493
commit 3ea3c1f537
+8 -4
View File
@@ -79,10 +79,10 @@ static uint32_t g_ledmap[] = {
# define xlat(p) (p)
static uint32_t g_ledmap[] = {
GPIO_nLED_BLUE, // Indexed by LED_BLUE
GPIO_nLED_RED, // Indexed by LED_RED, LED_AMBER
GPIO_nSAFETY_SWITCH_LED_OUT, // Indexed by LED_SAFETY
GPIO_nLED_GREEN, // Indexed by LED_GREEN
GPIO_nLED_BLUE, // Indexed by LED_BLUE
GPIO_nLED_RED, // Indexed by LED_RED, LED_AMBER
GPIO_nSAFETY_SWITCH_LED_OUT_INIT, // Indexed by LED_SAFETY (defaulted to an input)
GPIO_nLED_GREEN, // Indexed by LED_GREEN
};
#endif
@@ -90,6 +90,10 @@ static uint32_t g_ledmap[] = {
__EXPORT void led_init(void)
{
/* Configure LED GPIOs for output */
if (!PX4_MFT_HW_SUPPORTED(PX4_MFT_PX4IO)) {
g_ledmap[2] = GPIO_nSAFETY_SWITCH_LED_OUT;
}
for (size_t l = 0; l < (sizeof(g_ledmap) / sizeof(g_ledmap[0])); l++) {
stm32_configgpio(g_ledmap[l]);
}