nRF51 SDK
|
Modules | |
main.c | |
GPIOTE Example Application main file. | |
The GPIOTE Example shows the usage of GPIOTE peripheral by toggling a LED. We use TIMER0 to generate 'EVENT_COMPARE0' event every 200 milliseconds. This will also clear the TIMER0 internal clock. This event is passed through PPI peripheral to generate a task. This task is used by GPIOTE (task mode) to toggle the pin. This means that every time we have EVENT_COMPARE event, the GPIO pin toggles automatically, which can only be achieved using the GPIOTE peripheral. It uses the hardware delivered in the nRF51822 Development Kit.
[TIMER0]->EVENT_COMPARE->[PPI]->GPIOTE_TASK_OUT->[GPIOTE]->toggle_pin
* ---------------- -------------------------- * -Start-| Timer0 | | EEP | PPI | TEP |------- * ------>| CC[0] = 200ms |-----Timer0_Event--->| | Channel 0 | | | * | ---------------- -------------------------- | * | | * | ----------------------------------------------------------------------------- * | | * | | ----------------- --------------- * | ---------TASK-->| GPIO_TE |-->Toggled_Output-->| LED toggling |-- * | ----------------- | every 200ms | | * | --------------- | * ------------------------------------------------------------------------------ * *
The application starts with configuring the GPIOTE output pin to toggle on a GPIOTE task. Timer0 is configured to generate events every 200ms, and the PPI channel is configured to connect the timer event to the GPIOTE task.
Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).
LED assignments:
The GPIOTE Example Application can be tested as follows: