This is the quickstart guide for the SAM4L Inter-IC Sound Controller driver, with step-by-step instructions on how to configure and use the driver in a selection of use cases.
The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.
Basic use case
This use case will demonstrate how to initialize the IIS module to master in loopback mode.
Prerequisites
- System Clock Management (Sysclock)
Clock setup steps
Example code
Enable the following macro in the conf_clock.h:
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_DFLL
#define CONFIG_DFLL0_SOURCE GENCLK_SRC_OSC32K
Add the following code in the application C-file:
Workflow
- Set system clock source as DFLL:
#define CONFIG_SYSCLK_SOURCE SYSCLK_SRC_DFLL
- Set DFLL source as OSC32K:
#define CONFIG_DFLL0_SOURCE GENCLK_SRC_OSC32K
- Initialize the system clock.
Usage steps
Example code
Add to, e.g., main loop in application C-file:
config.loopback = true;
config.master = true;
Workflow
- Initialize the module with given configuration
config.loopback = true;
config.master = true;
- Enable the module
- Enable transmission, reception and clocks
- Use write/read function to access the data