/* ARM Cortex M4 assembler subroutine example "blinky" 14_02_2021 chris thanks to sAlexander for LED control https://github.com/sAlexander/nrf52-minimal-c/blob/master/main.c */ #include #define LED_1 13 // Defined in "GPIO" for the nrf52. #define CFG_MODE_ON 3 #define LED_1_PIN_CNF_PTR (*((volatile unsigned long*) (0x50000000 + 0x700 + LED_1 * 4))) #define SET_PTR (*((volatile unsigned long*) (0x50000000 + 0x508))) #define CLR_PTR (*((volatile unsigned long*) (0x50000000 + 0x50C))) extern void asmDelay(uint32_t); #define DELAY_MS 1000 int main(void) { LED_1_PIN_CNF_PTR = CFG_MODE_ON; while(1) { SET_PTR = (1 << LED_1); asmDelay(DELAY_MS); CLR_PTR = (1 << LED_1); asmDelay(DELAY_MS); } }