/* Simple bit twiddler test program */ // $Id: test_gpio.c 3424 2011-11-28 10:20:11Z svn $ static const char revision[] = "$Id: test_gpio.c 3424 2011-11-28 10:20:11Z svn $"; #include int main(void) { unsigned long int i; cpu_init(DEFAULT_CPU_FREQ); #ifdef OLIMEX_STM32_P103 gpiopin_configure(GPIOPIN0, GPIOPIN_INPUT); gpiopin_configure(GPIOPIN44, GPIOPIN_OUTPUT); for (i = 0;; i++) { // Flash faster if WAKE-UP button is pressed if (GPIOPIN0IN) { GPIOPIN44OUT = i >> 18; } // Flash LED normal rate else { GPIOPIN44OUT = i >> 19; } } #endif #ifdef OLIMEX_STM32_P107 gpiopin_configure(GPIOPIN0, GPIOPIN_INPUT); gpiopin_configure(GPIOPIN38, GPIOPIN_OUTPUT); gpiopin_configure(GPIOPIN39, GPIOPIN_OUTPUT); gpiopin_configure(GPIOPIN45, GPIOPIN_INPUT); for (i = 0;; i++) { // Flash flaster if WAKE-UP button is pressed if (GPIOPIN0IN) { GPIOPIN38OUT = i >> 18; GPIOPIN39OUT = i >> 19; } // Turn off LED's if TAMPER button is pressed else if (!GPIOPIN45IN) { GPIOPIN38OUT = 0; GPIOPIN39OUT = 0; } // Flash normal rate else { GPIOPIN38OUT = i >> 19; GPIOPIN39OUT = i >> 20; } } #endif #ifdef STM32_VALUE_LINE_DISCOVERY gpiopin_configure(GPIOPIN0, GPIOPIN_INPUT); gpiopin_configure(GPIOPIN40, GPIOPIN_OUTPUT); gpiopin_configure(GPIOPIN41, GPIOPIN_OUTPUT); for (i = 0;; i++) { // Flash faster if the user button is pressed if (GPIOPIN0IN) { GPIOPIN40OUT = i >> 17; GPIOPIN41OUT = i >> 18; } // Flash normal rate else { GPIOPIN40OUT = i >> 18; GPIOPIN41OUT = i >> 19; } } #endif #ifdef W5200E01_M3 gpiopin_configure(GPIOPIN0, GPIOPIN_OUTPUT); gpiopin_configure(GPIOPIN1, GPIOPIN_OUTPUT); for (i = 0;; i++) { GPIOPIN0OUT = i >> 19; GPIOPIN1OUT = i >> 20; } #endif }