11#include <stdint.h>
22#include "hal.h"
33
4+ #define LED1 19
5+
46int main (void ) {
5- set_gpio_mode (P0 , BUILT_IN_LED_1_PIN , GPIO_MODE_OUTPUT , 0 );
6- set_gpio_mode (P0 , BUILT_IN_LED_2_PIN , GPIO_MODE_OUTPUT , 0 );
7- set_gpio_mode (P0 , BUILT_IN_LED_3_PIN , GPIO_MODE_OUTPUT , 0 );
8- set_gpio_mode (P0 , BUILT_IN_LED_4_PIN , GPIO_MODE_OUTPUT , 0 );
7+ set_gpio_mode (P0 , LED1 , GPIO_MODE_OUTPUT , 0 );
98
9+ int level = 0 ;
1010 while (1 ) {
11- gpio_write (P0 , BUILT_IN_LED_1_PIN , HIGH );
12- gpio_write (P0 , BUILT_IN_LED_2_PIN , HIGH );
13- gpio_write (P0 , BUILT_IN_LED_3_PIN , HIGH );
14- gpio_write (P0 , BUILT_IN_LED_4_PIN , HIGH );
15- spin (9999999 );
16- gpio_write (P0 , BUILT_IN_LED_4_PIN , LOW );
17- gpio_write (P0 , BUILT_IN_LED_3_PIN , LOW );
18- gpio_write (P0 , BUILT_IN_LED_2_PIN , LOW );
19- gpio_write (P0 , BUILT_IN_LED_1_PIN , LOW );
11+ gpio_write (P0 , LED1 , level );
2012 spin (9999999 );
13+ level = !level ;
2114 }
2215}
2316
2417// Startup code
25- __attribute__((naked , noreturn )) void _reset (void ) {
18+ __attribute__((naked , noreturn )) void Reset_Handler (void ) {
2619 // memset .bss to zero, and copy .data section to RAM region
2720 extern long _sbss , _ebss , _sdata , _edata , _sidata ;
2821 for (long * dst = & _sbss ; dst < & _ebss ; dst ++ ) * dst = 0 ;
@@ -36,5 +29,4 @@ extern void _estack(void); // Defined in link.ld
3629
3730// 16 standard and 42 nRF-specific handlers
3831__attribute__((section (".vectors" ))) void (* const tab [16 + 42 ])(void ) = {
39- _estack , _reset };
40-
32+ _estack , Reset_Handler };
0 commit comments