31 #include "derivative.h"
37 port_enable(PORTB_EN_MASK | PORTD_EN_MASK);
39 port_conf_pin(LED_RED_PORT, LED_RED_PIN, (PORT_PCR_MUX_GPIO | PORT_PCR_ISF_MASK));
42 port_conf_pin(LED_GREEN_PORT, LED_GREEN_PIN, (PORT_PCR_MUX_GPIO | PORT_PCR_ISF_MASK));
45 port_conf_pin(LED_BLUE_PORT, LED_BLUE_PIN, (PORT_PCR_MUX_GPIO | PORT_PCR_ISF_MASK));
54 leds =
gpio_read_pin(LED_RED_GPIO, LED_RED_PIN) == 0? LEDS_RED : 0;
55 leds |=
gpio_read_pin(LED_GREEN_GPIO, LED_GREEN_PIN) == 0? LEDS_GREEN : 0;
56 leds |=
gpio_read_pin(LED_BLUE_GPIO, LED_BLUE_PIN) == 0? LEDS_BLUE : 0;
62 leds_arch_set(
unsigned char leds)
64 if(leds & LEDS_GREEN) {
70 if(leds & LEDS_BLUE) {
void gpio_set_output(GPIO_Type *Port, uint32_t Pin_Mask)
Set pins with Pin_Mask of port with GPIOn_BASE_PTR to output.
uint32_t gpio_read_pin(GPIO_Type *Port, uint32_t Pin_Mask)
Read pins with Pin_Mask of port with GPIOn_BASE_PTR.
void leds_arch_init(void)
Leds implementation.
void gpio_clr_pin(GPIO_Type *Port, uint32_t Pin_Mask)
Clear pins with Pin_Mask of port with GPIOn_BASE_PTR low.
void port_conf_pin(PORT_Type *Port, uint8_t Pin, uint32_t PCR)
Configure the specified Pin of the port with PORTx_BASE_PTR with PCR.
void gpio_set_pin(GPIO_Type *Port, uint32_t Pin_Mask)
Set pins with Pin_Mask of port with GPIOn_BASE_PTR high.
uint32_t port_pin_to_mask(uint8_t pin)
Convert a pin number (0 to 31) to a pin mask.