Hi folks,
I try change blinky code for nRF52810 SoC. I must create own timer. I dont know app_timer example help for me?! I want to do when power on leds on 2 seconds. I dont want to use nrf_delay_ms(). My codes are under the topic.
thanks...
.... standart blinky code block .... void lfclk_request() { uint32_t err_code = nrf_drv_clock_init(); APP_ERROR_CHECK(err_code); nrf_drv_clock_lfclk_request(NULL); } void timer_a_handler(void * p_context) { nrf_drv_gpiote_out_set(Kontrol_1); } void create_timers() { uint32_t err_code; // Create timers err_code = app_timer_create(&m_led_a_timer_id, APP_TIMER_MODE_REPEATED, timer_a_handler); APP_ERROR_CHECK(err_code); } void start_timer() { uint32_t err_code; // Start timer err_code = app_timer_start(m_led_a_timer_id, APP_TIMER_TICKS(1000), NULL); APP_ERROR_CHECK(err_code); } /**@brief Function for application main entry. */ int main(void) { // Initialize. log_init(); leds_init(); timers_init(); buttons_init(); power_management_init(); lfclk_request(); ---> APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false); create_timers(); ---> start_timer(); ---> ble_stack_init(); gap_params_init(); gatt_init(); services_init(); advertising_init(); conn_params_init(); sistem_baslangici(); // Start execution. NRF_LOG_INFO("Blinky example started."); advertising_start(); // Enter main loop. for (;;) { sutun(); // idle_state_handle(); } }
sistem_baslangici()
.... some #define and header files .... void sistem_baslangici(void) { nrf_gpio_pin_clear(Kontrol_1); nrf_gpio_pin_set(Kontrol_2); nrf_gpio_pin_clear(Motor_GERI); nrf_delay_ms(2000); nrf_gpio_pin_set(Kontrol_1); nrf_gpio_pin_clear(Kontrol_2); nrf_gpio_pin_clear(Motor_GERI); nrf_delay_ms(2000); }