> /** @file
> * @brief Example template project.
> * @defgroup nrf_templates_example Example Template
> *
> */
>
> #include <stdbool.h>
> #include <stdint.h>
>
> #include "nrf.h"
> #include "nrf_gpio.h"
> #include "nrf_drv_config.h"
> #include "nordic_common.h"
> #include "nrf_delay.h"
> #include "app_error.h"
> #include "app_timer.h"
> #include "nrf_gpiote.h"
> #include "nrf_gpio.h"
> #include "nrf_drv_gpiote.h"
> #include "nrf_drv_timer.h"
> #include "app_util_platform.h"
> #include "boards.h"
> #include "bsp.h"
>
> /** * @brief Function for application
> main entry. */
>
> const nrf_drv_timer_t TIMER_GPIO =
> NRF_DRV_TIMER_INSTANCE(0);
> nrf_drv_gpiote_pin_t LED_PIN = 22;
>
> void
> timer_gpio_event_handler(nrf_timer_event_t
> event_type, void *p_context){
> switch(event_type)
> {
> case NRF_TIMER_EVENT_COMPARE0:
> nrf_drv_gpiote_out_toggle(LED_PIN);
> break;
>
> default:
> //Do nothing.
> break;
> }
>
> }
>
>
> int main(void) {
> while (true)
> {
> uint32_t time_ms = 1000;
> uint32_t time_ticks;
> uint32_t err_code = NRF_SUCCESS;
>
> err_code = nrf_drv_gpiote_init();
> APP_ERROR_CHECK(err_code);
>
> nrf_drv_gpiote_out_config_t config =
> GPIOTE_CONFIG_OUT_SIMPLE(false);
> nrf_drv_gpiote_out_init(LED_PIN, &config);
>
> err_code = nrf_drv_timer_init(&TIMER_GPIO, NULL,
> timer_gpio_event_handler);
> APP_ERROR_CHECK(err_code);
>
> time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_GPIO,
> time_ms);
> nrf_drv_timer_extended_compare(&TIMER_GPIO,
> NRF_TIMER_CC_CHANNEL0, time_ticks,
> NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
> true);
> nrf_drv_timer_enable(&TIMER_GPIO);
>
>
>
> } } /** @} */
That's the code. Additionally, I've already modified the linker file for 16KB of Memory instead of 32KB. I have no compilation errors, but Eclipse throws this one:
"Symbol 'TIMER0_INSTANCE_INDEX' could not be resolved"
I'm using SDK 11.0, so I have modified the nrf_drv_config.h, both in the libraries folder, and the one in the project folder to have TIMER0 enabled.
I've flashed it on my nRF51822_xxAA with and without the Softdevice, but nothing seems to be working. I've tried erasing everything then flashing, that doesn't work either. Please help me someone.