SAM Serial Peripheral Interface Driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include "sercom.h"
Macros | |
#define | _SERCOM_PAD_DEFAULTS_CASE(n, pad) |
#define | BAUD_FP_MAX 8 |
#define | BAUD_INT_MAX 8192 |
#define | SHIFT 32 |
Functions | |
uint32_t | _sercom_get_default_pad (Sercom *const sercom_module, const uint8_t pad) |
uint8_t | _sercom_get_sercom_inst_index (Sercom *const sercom_instance) |
enum status_code | sercom_set_gclk_generator (const enum gclk_generator generator_source, const bool force_change) |
Set GCLK channel to generator. More... | |
#define _SERCOM_PAD_DEFAULTS_CASE | ( | n, | |
pad | |||
) |
Creates a switch statement case entry to convert a SERCOM instance and pad index to the default SERCOM pad MUX setting.
Referenced by _sercom_get_default_pad().
#define BAUD_FP_MAX 8 |
#define BAUD_INT_MAX 8192 |
#define SHIFT 32 |
uint32_t _sercom_get_default_pad | ( | Sercom *const | sercom_module, |
const uint8_t | pad | ||
) |
Gets the default PAD pinout for a given SERCOM.
Returns the pinmux settings for the given SERCOM and pad. This is used for default configuration of pins.
[in] | sercom_module | Pointer to the SERCOM module |
[in] | pad | PAD to get default pinout for |
References _SERCOM_PAD_DEFAULTS_CASE, Assert, and MREPEAT.
Referenced by usart_init().
uint8_t _sercom_get_sercom_inst_index | ( | Sercom *const | sercom_instance | ) |
Find index of given instance.
[in] | sercom_instance | Instance pointer. |
Referenced by _sercom_get_interrupt_vector(), _usart_set_config(), and usart_init().
enum status_code sercom_set_gclk_generator | ( | const enum gclk_generator | generator_source, |
const bool | force_change | ||
) |
Set GCLK channel to generator.
This will set the appropriate GCLK channel to the requested GCLK generator. This will set the generator for all SERCOM instances, and the user will thus only be able to set the same generator that has previously been set, if any.
After the generator has been set the first time, the generator can be changed using the force_change
flag.
[in] | generator_source | The generator to use for SERCOM. |
[in] | force_change | Force change the generator. |
STATUS_OK | If the generator update request was successful. |
STATUS_ERR_ALREADY_INITIALIZED | If a generator was already configured and the new configuration was not forced. |
References SERCOM_GCLK_ID, system_gclk_chan_config::source_generator, STATUS_ERR_ALREADY_INITIALIZED, STATUS_OK, system_gclk_chan_enable(), system_gclk_chan_get_config_defaults(), and system_gclk_chan_set_config().
Referenced by usart_init().