SAMV71 Xplained Ultra Software Package 1.3

main.c File Reference

#include "board.h"
#include <HIDAUDDDriver.h>
#include <HIDDKeyboard.h>
#include <AUDDFunction.h>
#include <USBD_Config.h>
#include <USBD_LEDs.h>
#include <string.h>

Go to the source code of this file.

Defines

#define NO_PUSHBUTTON
#define NUM_KEYS   2
#define NUM_NORMAL_KEYS   1
#define NUM_MODIFIER_KEYS   (NUM_KEYS - NUM_NORMAL_KEYS)
#define LED_NUMLOCK   USBD_LEDOTHER
#define BUFFER_NUMBER   500
#define BUFFER_SIZE   (AUDDevice_BYTESPERFRAME)
#define DAC_DELAY   2
#define SLOT_BY_FRAME   (2)
#define BITS_BY_SLOT   (16)
#define I2S_SLAVE_TX_SETTING
#define I2S_SLAVE_TX_FRM_SETTING
#define I2S_SLAVE_RX_SETTING
#define I2S_SLAVE_RX_FRM_SETTING
#define TWI_CLOCK   400000
#define SAMPLE_RATE   (48000)

Functions

 COMPILER_ALIGNED (32)
void XDMAC_Handler (void)
 xDMA interrupt handler.
void USBDDriverCallbacks_ConfigurationChanged (unsigned char cfgnum)
void USBDDriverCallbacks_InterfaceSettingChanged (unsigned char interface, unsigned char setting)
void USBDCallbacks_RequestReceived (const USBGenericRequest *request)
void AUDDFunction_MuteChanged (uint8_t mic, uint8_t channel, uint8_t muted)
void AUDDFunction_StreamSettingChanged (uint8_t mic, uint8_t newSetting)
void HIDDKeyboardCallbacks_LedsChanged (uint8_t numLockStatus, uint8_t capsLockStatus, uint8_t scrollLockStatus)
int main (void)
 usb_iad_hid_aud Application entry point.

Variables

const USBDDriverDescriptors hidauddDriverDescriptors

Detailed Description

This file contains all the specific code for the usb_iad_hid_aud example.

Definition in file main.c.


Define Documentation

#define BITS_BY_SLOT   (16)

SSC: Number of bits in a slot

Definition at line 156 of file main.c.

#define BUFFER_NUMBER   500

Number of available audio buffers.

Definition at line 145 of file main.c.

#define BUFFER_SIZE   (AUDDevice_BYTESPERFRAME)

Size of one buffer in bytes.

Definition at line 147 of file main.c.

#define DAC_DELAY   2

Delay in ms for starting the DAC transmission after a frame has been received.

Definition at line 151 of file main.c.

#define I2S_SLAVE_RX_FRM_SETTING
Value:
((SSC_RFMR_DATLEN(BITS_BY_SLOT - 1)) |\
                                (SSC_RFMR_MSBF) |                    \
                                (SSC_RFMR_DATNB(SLOT_BY_FRAME - 1)) |\
                                (SSC_RFMR_FSOS_NONE))

Definition at line 176 of file main.c.

#define I2S_SLAVE_RX_SETTING
Value:
((SSC_RCMR_CKS_TK) |       \
                                (SSC_RCMR_CKO_NONE) |     \
                                (SSC_RCMR_CKI) |          \
                                (SSC_RCMR_START_RF_EDGE) |\
                                (SSC_RCMR_STTDLY(1)) |    \
                                (SSC_RCMR_PERIOD(0)))

Definition at line 169 of file main.c.

#define I2S_SLAVE_TX_FRM_SETTING
Value:
((SSC_TFMR_DATLEN(BITS_BY_SLOT - 1)) |\
                                (SSC_TFMR_MSBF) |                    \
                                (SSC_TFMR_DATNB(SLOT_BY_FRAME - 1)) |\
                                (SSC_TFMR_FSOS_NONE))

Definition at line 163 of file main.c.

#define I2S_SLAVE_TX_SETTING
Value:
((SSC_TCMR_CKS_TK) |        \
                                (SSC_TCMR_CKO_NONE) |      \
                                (SSC_TCMR_START_TF_EDGE) | \
                                (SSC_TCMR_STTDLY(1)) |     \
                                (SSC_TCMR_PERIOD(0)))

Definition at line 157 of file main.c.

#define LED_NUMLOCK   USBD_LEDOTHER

Num lock LED index.

Definition at line 141 of file main.c.

#define NUM_KEYS   2

Number of keys used in the example.

Definition at line 132 of file main.c.

#define NUM_MODIFIER_KEYS   (NUM_KEYS - NUM_NORMAL_KEYS)

Number of modifier keys.

Definition at line 138 of file main.c.

#define NUM_NORMAL_KEYS   1

Number of non-modifiers keys.

Definition at line 135 of file main.c.

#define SAMPLE_RATE   (48000)

Audio sample rate

Definition at line 184 of file main.c.

#define SLOT_BY_FRAME   (2)

SSC: Number of slots in a frame

Definition at line 154 of file main.c.

#define TWI_CLOCK   400000

TWI clock

Definition at line 182 of file main.c.


Function Documentation

COMPILER_ALIGNED ( 32   ) 

Data buffers for receiving audio frames from the USB host. List of pins to configure.

Definition at line 218 of file main.c.

void HIDDKeyboardCallbacks_LedsChanged ( uint8_t  numLockStatus,
uint8_t  capsLockStatus,
uint8_t  scrollLockStatus 
)

Invoked when the status of the keyboard LEDs changes. Turns the num. lock LED on or off.

Parameters:
numLockStatus Indicates the current status of the num. lock key.
capsLockStatus Indicates the current status of the caps lock key.
scrollLockStatus Indicates the current status of the scroll lock key

Definition at line 634 of file main.c.

Here is the call graph for this function:

int main ( void   ) 

usb_iad_hid_aud Application entry point.

Starts the driver and waits for an audio input stream to forward to the DAC.

Definition at line 678 of file main.c.

Here is the call graph for this function:

void USBDCallbacks_RequestReceived ( const USBGenericRequest request  ) 

Invoked whenever a SETUP request is received from the host. Forwards the request to the standard handler.

Definition at line 578 of file main.c.

Here is the call graph for this function:

void USBDDriverCallbacks_ConfigurationChanged ( unsigned char  cfgnum  ) 

Invoked when the configuration of the device changes. Parse used endpoints.

Parameters:
cfgnum New configuration number.

Definition at line 557 of file main.c.

Here is the call graph for this function:

void USBDDriverCallbacks_InterfaceSettingChanged ( unsigned char  interface,
unsigned char  setting 
)

Invoked whenever the active setting of an interface is changed by the host. Reset streaming interface.

Parameters:
interface Interface number.
setting Newly active setting.

Definition at line 568 of file main.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines