00001
00080 #include <avr32/io.h>
00081 #include "board.h"
00082 #include "pm.h"
00083 #include "gpio.h"
00084 #include "ssc_i2s.h"
00085
00086
00090 int main(void)
00091 {
00092 static const gpio_map_t SSC_GPIO_MAP =
00093 {
00094 {AVR32_SSC_TX_CLOCK_0_PIN, AVR32_SSC_TX_CLOCK_0_FUNCTION },
00095 {AVR32_SSC_TX_DATA_0_PIN, AVR32_SSC_TX_DATA_0_FUNCTION },
00096 {AVR32_SSC_TX_FRAME_SYNC_0_PIN, AVR32_SSC_TX_FRAME_SYNC_0_FUNCTION}
00097 };
00098
00099 volatile avr32_ssc_t *ssc = &AVR32_SSC;
00100
00101
00102 pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);
00103
00104
00105 gpio_enable_module(SSC_GPIO_MAP, sizeof(SSC_GPIO_MAP) / sizeof(SSC_GPIO_MAP[0]));
00106
00107
00108 ssc_i2s_init(ssc, 11025, 8, 8, SSC_I2S_MODE_STEREO_OUT, FOSC0);
00109
00110 unsigned char leds = 0x00;
00111
00112 while (1)
00113 {
00114 leds <<= 1;
00115 leds ^= (leds ^ 0x08) >> 3;
00116 LED_Display_Field(LED_MONO0_GREEN |
00117 LED_MONO1_GREEN |
00118 LED_MONO2_GREEN |
00119 LED_MONO3_GREEN,
00120 leds);
00121
00122 while (!(ssc_i2s_get_status(ssc) & AVR32_SSC_SR_TXRDY_MASK));
00123 ssc_i2s_transfer(ssc, 0xA3);
00124 }
00125 }