Quickstart guide for SAM AFEC driver

This is the quickstart guide for the SAM AFEC 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 AFEC module and single channel are configured for:

Prerequisites

  1. System Clock Management (Sysclock)

Setup steps

Example code

Add to application C-file:

Workflow

  1. Enable AFEC Module:
  2. Get the AFEC default configurations:
  3. Initialize the AFEC Module:
  4. Configure conversion trigger and free run mode:
  5. Enable Channel:

Usage steps

Example code

Add to, e.g., main loop in application C-file:

while (afec_get_interrupt_status(AFEC0) & (1 << AFEC_CHANNEL_5));
uint32_t result = afec_channel_get_value(AFEC0, AFEC_CHANNEL_5);

Workflow

  1. Start AFEC conversion on channel:
  2. Wait for the conversion over:
  3. Get the conversion result:


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00