This is the quickstart guide for the SAM PDCA 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
In this basic use case, the PDCA module and channel are configured for:
- Select USART2 as peripheral
- Interrupt-based handling
Prerequisites
- System Clock Management (Sysclock)
Setup steps
Example code
Add to application C-file:
void pdca_callback(void)
{
}
}
void pdca_setup(void)
{
pdca_channel_write_config(PDCA_RX_CHANNEL, &PDCA_RX_CONFIGS);
}
Workflow
- Define the interrupt callback function in the application:
void pdca_callback(void)
{
}
}
- Enable PDCA module:
- Note
- Including enable module clock and lock sleep mode.
- Configure PDCA channel with specified mode:
pdca_channel_write_config(PDCA_RX_CHANNEL, &PDCA_RX_CONFIGS);
- Set the PDCA callback function and enable PDCA interrupt.
- Enable PDCA channel: