Programing/ Nordic(BLE)
타이머 인터럽트
흰군
2015. 5. 10. 19:56
예제 blinky_rtx_pca10028을 이용해서 변경한것입니다.
rtx는 CMSIS-RTOS를 나타낸다고합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdbool.h> #include <stdint.h> #include "nrf_gpio.h" #include "bsp.h" #include "cmsis_os.h" //인터럽트 인터벌 #define LED_1_INTERVAL 100 void timer1_handler(void const * arg) { //타이머 인터럽트가 발생할때 해야할 일 nrf_gpio_pin_toggle(LED_1); } //타이머 콜백 함수 osTimerDef(led_toggle_timer1, timer1_handler); int main(void) { // gpio 설정 nrf_gpio_cfg_output(LED_1); //타이머 생성 osTimerId timer1 = osTimerCreate(osTimer(led_toggle_timer1), osTimerPeriodic, NULL); //타이머 시작 osTimerStart(timer1, LED_1_INTERVAL); while (true) { } } | cs |