- #include <stdint.h>
- #include <stdio.h>
- #include "board_init.h"
- #include "leds.h"
- /*
- * Definitions.
- */
- /*
- * Variables.
- */
- /*
- * Declerations.
- */
- void some_delay(void);
- /*
- * Functions.
- */
- int main(void)
- {
- uint8_t i;
- BOARD_Init();
- leds_init();
-
- printf("\r\ngpio_basic example.\r\n");
- while (1)
- {
- // if ( GPIO_ReadInDataBit(BOARD_KEY0_GPIO_PORT, BOARD_KEY0_GPIO_PIN) ) /* key is no pressed. */
- // {
- // GPIO_WriteBit(BOARD_LED0_GPIO_PORT, BOARD_LED0_GPIO_PIN, 1u); /* led off. */
- // GPIO_WriteBit(BOARD_LED1_GPIO_PORT, BOARD_LED1_GPIO_PIN, 0u); /* led on. */
- // }
- // else /* key is pressed. */
- // {
- // GPIO_WriteBit(BOARD_LED0_GPIO_PORT, BOARD_LED0_GPIO_PIN, 0u); /* led on. */
- // GPIO_WriteBit(BOARD_LED1_GPIO_PORT, BOARD_LED1_GPIO_PIN, 1u); /* led off. */
- // }
- leds_error_on(); some_delay();
- leds_error_off(); some_delay();
- leds_error_toggle(); some_delay();
- leds_error_blink(); some_delay();
-
- // radio LED functions
- leds_radio_on(); some_delay();
- leds_radio_off(); some_delay();
- leds_radio_toggle(); some_delay();
-
- // sync LED functions
- leds_sync_on(); some_delay();
- leds_sync_off(); some_delay();
- leds_sync_toggle(); some_delay();
-
- // debug LED functions
- leds_debug_on(); some_delay();
- leds_debug_off(); some_delay();
- leds_debug_toggle(); some_delay();
-
- // all LED functions
- leds_all_off(); some_delay();
- leds_all_on(); some_delay();
- leds_all_off(); some_delay();
- leds_all_toggle(); some_delay();
-
- // LED increment function
- leds_all_off(); some_delay();
- for (i=0;i<9;i++) {
- leds_increment(); some_delay();
- }
-
- // LED circular shift function
- leds_all_off(); some_delay();
- leds_error_on(); some_delay();
- for (i=0;i<9;i++) {
- leds_circular_shift(); some_delay();
- }
-
- }
- }
- void some_delay(void) {
- volatile uint16_t delay;
- for (delay=0xffff;delay>0;delay--);
- }
|