ssc_i2s_example.c File Reference


Detailed Description

SSC I2S example application.

This file gives an example of using the SSC in I2S mode.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file ssc_i2s_example.c.

#include <avr32/io.h>
#include "board.h"
#include "pm.h"
#include "gpio.h"
#include "ssc_i2s.h"

Go to the source code of this file.

Functions

int main (void)
 Main function, application starts executing here after initializing the stack pointer.


Function Documentation

int main ( void   ) 

Main function, application starts executing here after initializing the stack pointer.

Definition at line 90 of file ssc_i2s_example.c.

References ssc_i2s_get_status(), ssc_i2s_init(), SSC_I2S_MODE_STEREO_OUT, and ssc_i2s_transfer().

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   // Switch main clock to external oscillator 0 (crystal).
00102   pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);
00103 
00104   // Assign GPIO to SSC.
00105   gpio_enable_module(SSC_GPIO_MAP, sizeof(SSC_GPIO_MAP) / sizeof(SSC_GPIO_MAP[0]));
00106 
00107   // SSC init in I2S mode.
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 }


Generated on Fri Feb 19 02:26:28 2010 for AVR32 UC3 - SSC Driver for I²S by  doxygen 1.5.5