aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2019-01-03 18:02:23 +0100
committerKévin Redon <kredon@sysmocom.de>2019-01-16 18:40:31 +0100
commitd25509abca2baed8dad4f39a6aea27edd914b77f (patch)
tree9bfd717e7c7856c4d81a2ede1b5e5a4e117af010
parent5c7d9805c23fe459377b5aa8584549a478a9c3c1 (diff)
add system LED initialisation
-rw-r--r--atmel_start_pins.h4
-rw-r--r--driver_init.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/atmel_start_pins.h b/atmel_start_pins.h
index dbf9891..23b8d33 100644
--- a/atmel_start_pins.h
+++ b/atmel_start_pins.h
@@ -27,6 +27,10 @@
#define GPIO_PIN_FUNCTION_M 12
#define GPIO_PIN_FUNCTION_N 13
+/** LED pin to indicate system state (pull low to switch on */
+#define LED_SYSTEM GPIO(GPIO_PORTC, 18)
+
+/** USB D+/D- pins */
#define PA24 GPIO(GPIO_PORTA, 24)
#define PA25 GPIO(GPIO_PORTA, 25)
diff --git a/driver_init.c b/driver_init.c
index b324be8..0b07cc1 100644
--- a/driver_init.c
+++ b/driver_init.c
@@ -143,6 +143,11 @@ void system_init(void)
{
init_mcu();
+ // configure system LED
+ gpio_set_pin_level(LED_SYSTEM, true); // switch off LED
+ gpio_set_pin_direction(LED_SYSTEM, GPIO_DIRECTION_OUT);
+ gpio_set_pin_function(LED_SYSTEM, GPIO_PIN_FUNCTION_OFF);
+
USB_DEVICE_INSTANCE_init();
FLASH_0_init();
}