#include <avr32/io.h>
#include "pio_defines.h"
Include dependency graph for pio_example1_rainbow_lights.c:
Go to the source code of this file.
Defines | |
| #define | black 0x00 |
| #define | blue 0x10 |
| #define | CPU_HZ 27000000 |
| #define | green 0x04 |
| #define | left 0 |
| #define | light_blue 0x14 |
| #define | NoCOLORS 8 |
| #define | purple 0x11 |
| #define | red 0x01 |
| #define | right 1 |
| #define | white 0x15 |
| #define | yellow 0x05 |
Functions | |
| void | delay (void) |
| int | main (void) |
| int | rgb_leds (struct avr32_pio_t *pio, int pos, int color) |
Variables | |
| int | color_array [NoCOLORS] = {black,purple,blue,light_blue,green,yellow,red,white} |
| #define black 0x00 |
Definition at line 12 of file pio_example1_rainbow_lights.c.
| #define blue 0x10 |
Definition at line 16 of file pio_example1_rainbow_lights.c.
| #define CPU_HZ 27000000 |
Definition at line 4 of file pio_example1_rainbow_lights.c.
| #define green 0x04 |
Definition at line 14 of file pio_example1_rainbow_lights.c.
| #define left 0 |
| #define light_blue 0x14 |
Definition at line 18 of file pio_example1_rainbow_lights.c.
| #define NoCOLORS 8 |
| #define purple 0x11 |
Definition at line 17 of file pio_example1_rainbow_lights.c.
| #define red 0x01 |
Definition at line 13 of file pio_example1_rainbow_lights.c.
| #define right 1 |
| #define white 0x15 |
Definition at line 19 of file pio_example1_rainbow_lights.c.
| #define yellow 0x05 |
Definition at line 15 of file pio_example1_rainbow_lights.c.
| void delay | ( | ) |
This function is a delay function that lasts for 1/4 second.
| none |
Definition at line 54 of file pdc_example.c.
00055 { 00056 unsigned int timeout = TIMEOUT; 00057 00058 do { 00059 --timeout; 00060 } while ( timeout > 0 ); 00061 }
| int main | ( | void | ) |
This function will run a set of colors on the rgb-leds on the STK1000. To get it to work, connect a 10 pin cable from J1 to J20 on the STK1000.
| none |
Definition at line 34 of file pio_example1_rainbow_lights.c.
References delay(), left, NoCOLORS, piob, rgb_leds(), and right.
00035 { 00036 int i,j; 00037 avr32_pio_t *piob = (void *) AVR32_PIOC_ADDRESS; 00038 00039 piob->per = 0x000000ff; 00040 piob->oer = 0x000000ff; 00041 piob->idr = 0x000000ff; 00042 00043 00044 00045 while(1){ 00046 for(i=0; i<NoCOLORS; i++){ 00047 rgb_leds(piob, left, i); 00048 for(j=0; j<NoCOLORS; j++){ 00049 rgb_leds(piob, right,j); 00050 delay(); 00051 } 00052 delay(); 00053 } 00054 } 00055 }
Here is the call graph for this function:
| int rgb_leds | ( | struct avr32_pio_t * | pio, | |
| int | pos, | |||
| int | col_pos | |||
| ) |
This function puts out a color on one of the rgb leds.
| pio | The pio struct for the port that you wish to drive | |
| pos | Which of the rgb led to drive: left(0) or right(0) |
Definition at line 72 of file pio_example1_rainbow_lights.c.
References color_array, NoCOLORS, and PIO_INVALID_ARGUMENT.
Referenced by main().
00073 { 00074 if( (pos>1) | (pos<0) | (col_pos>NoCOLORS) | (col_pos<0) ) 00075 return PIO_INVALID_ARGUMENT; 00076 00077 pio->codr = 0x00000015<<pos; 00078 pio->sodr = color_array[col_pos]<<pos; 00079 00080 return 0; 00081 }
| int color_array[NoCOLORS] = {black,purple,blue,light_blue,green,yellow,red,white} |
Definition at line 21 of file pio_example1_rainbow_lights.c.
1.5.1