Definition in file gpio_peripheral_bus_example.c.
#include "compiler.h"
#include "gpio.h"
#include "board.h"
Go to the source code of this file.
Defines | |
Pin Configuration | |
#define | GPIO_PIN_EXAMPLE_1 LED0_GPIO |
#define | GPIO_PIN_EXAMPLE_2 LED1_GPIO |
#define | GPIO_PIN_EXAMPLE_3 GPIO_WAKE_BUTTON |
Functions | |
int | main (void) |
This is an example of how to access the gpio.c driver to set, clear, toggle... the pin GPIO_PIN_EXAMPLE. |
#define GPIO_PIN_EXAMPLE_1 LED0_GPIO |
#define GPIO_PIN_EXAMPLE_2 LED1_GPIO |
#define GPIO_PIN_EXAMPLE_3 GPIO_WAKE_BUTTON |
int main | ( | void | ) |
This is an example of how to access the gpio.c driver to set, clear, toggle... the pin GPIO_PIN_EXAMPLE.
Definition at line 124 of file gpio_peripheral_bus_example.c.
References gpio_clr_gpio_pin(), gpio_get_pin_value(), GPIO_PIN_EXAMPLE_1, GPIO_PIN_EXAMPLE_2, GPIO_PIN_EXAMPLE_3, gpio_set_gpio_pin(), and gpio_tgl_gpio_pin().
00125 { 00126 U32 state = 0; 00127 U32 i; 00128 00129 while (1) 00130 { 00131 switch (state) 00132 { 00133 case 0: 00134 // Access with GPIO driver gpio.c with clear and set access. 00135 gpio_clr_gpio_pin(GPIO_PIN_EXAMPLE_1); 00136 state++; 00137 break; 00138 00139 case 1: 00140 gpio_set_gpio_pin(GPIO_PIN_EXAMPLE_1); 00141 state++; 00142 break; 00143 00144 case 2: 00145 // Note that it is also possible to use the GPIO toggle feature. 00146 gpio_tgl_gpio_pin(GPIO_PIN_EXAMPLE_1); 00147 state++; 00148 break; 00149 00150 case 3: 00151 default: 00152 gpio_tgl_gpio_pin(GPIO_PIN_EXAMPLE_1); 00153 state = 0; 00154 break; 00155 } 00156 00157 // Poll push button value. 00158 for (i = 0; i < 1000; i += 4) 00159 { 00160 if (gpio_get_pin_value(GPIO_PIN_EXAMPLE_3) == 0) 00161 gpio_clr_gpio_pin(GPIO_PIN_EXAMPLE_2); 00162 else 00163 gpio_set_gpio_pin(GPIO_PIN_EXAMPLE_2); 00164 } 00165 00166 } 00167 }