void board_userled(int led, bool ledon) { if (led == BOARD_LED) { lpc43_gpio_write(GPIO_LED, !ledon); } }
void board_led_on(int led) { switch (led) { default: case 0: lpc43_gpio_write(GPIO_LED1, true); /* LED1 OFF */ lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ break; case 1: lpc43_gpio_write(GPIO_LED1, false); /* LED1 ON */ lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ break; case 2: lpc43_gpio_write(GPIO_LED2, false); /* LED2 ON */ break; } }
void board_led_off(int led) { switch (led) { default: case 0: case 1: break; case 2: lpc43_gpio_write(GPIO_LED2, true); /* LED2 OFF */ break; } }
void board_autoled_off(int led) { switch (led) { default: case 0: case 1: case 3: break; /* LED OFF */ case 2: return; /* LED no change */ } /* LED OFF, Low illuminates */ lpc43_gpio_write(GPIO_LED, true); }
void board_autoled_on(int led) { bool ledon = true; /* OFF. Low illuminates */ switch (led) { default: case 0: break; /* LED OFF until state 1 */ case 2: return; /* LED no change */ case 1: case 3: ledon = false; /* LED ON. Low illuminates */ break; } /* Turn LED on or off, depending on state */ lpc43_gpio_write(GPIO_LED, ledon); }
static inline void lpc43_configoutput(uint16_t gpiocfg, unsigned int port, unsigned int pin) { uintptr_t regaddr; uint32_t regval; /* Then configure the pin as an output by setting the corresponding * bit in the GPIO DIR register for the port. */ regaddr = LPC43_GPIO_DIR(port); regval = getreg32(regaddr); regval |= GPIO_DIR(pin); putreg32(regval, regaddr); /* Set the initial value of the output */ lpc43_gpio_write(gpiocfg, GPIO_IS_ONE(gpiocfg)); /* To be able to read the signal on the GPIO input, the input * buffer must be enabled in the syscon block for the corresponding pin. * This should have been done when the pin was configured as a GPIO. */ }
void lpc43_setleds(uint8_t ledset) { lpc43_gpio_write(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0); lpc43_gpio_write(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0); }
void lpc43_setled(int led, bool ledon) { uint16_t gpiocfg = (led == BOARD_LED1 ? GPIO_LED1 : GPIO_LED2); lpc43_gpio_write(gpiocfg, !ledon); }
void board_userled_all(uint8_t ledset) { lpc43_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) == 0); }