SAM Serial Peripheral Interface Driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
#include <system.h>
#include <clock.h>
#include <system_interrupt.h>
#include "sercom_pinout.h"
Macros | |
#define | FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1 |
#define | SERCOM_GCLK_ID SERCOM0_GCLK_ID_SLOW |
Enumerations | |
enum | sercom_asynchronous_operation_mode { SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC = 0, SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL } |
sercom asynchronous operation mode More... | |
enum | sercom_asynchronous_sample_num { SERCOM_ASYNC_SAMPLE_NUM_3 = 3, SERCOM_ASYNC_SAMPLE_NUM_8 = 8, SERCOM_ASYNC_SAMPLE_NUM_16 = 16 } |
sercom asynchronous samples per bit More... | |
Functions | |
enum status_code | _sercom_get_async_baud_val (const uint32_t baudrate, const uint32_t peripheral_clock, uint16_t *const baudval, enum sercom_asynchronous_operation_mode mode, enum sercom_asynchronous_sample_num sample_num) |
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_get_sync_baud_val (const uint32_t baudrate, const uint32_t external_clock, uint16_t *const baudval) |
enum status_code | sercom_set_gclk_generator (const enum gclk_generator generator_source, const bool force_change) |
Set GCLK channel to generator. More... | |
#define FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1 |
#define SERCOM_GCLK_ID SERCOM0_GCLK_ID_SLOW |
Referenced by sercom_set_gclk_generator().
enum status_code _sercom_get_async_baud_val | ( | const uint32_t | baudrate, |
const uint32_t | peripheral_clock, | ||
uint16_t *const | baudval, | ||
enum sercom_asynchronous_operation_mode | mode, | ||
enum sercom_asynchronous_sample_num | sample_num | ||
) |
Referenced by _usart_set_config().
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 _i2c_slave_set_config(), and usart_init().
uint8_t _sercom_get_sercom_inst_index | ( | Sercom *const | sercom_instance | ) |
Find index of given instance.
[in] | sercom_instance | Instance pointer. |
References Assert.
Referenced by _sercom_get_interrupt_vector(), _usart_set_config(), i2c_master_init(), i2c_slave_init(), and usart_init().
enum status_code _sercom_get_sync_baud_val | ( | const uint32_t | baudrate, |
const uint32_t | external_clock, | ||
uint16_t *const | baudval | ||
) |
Referenced by _usart_set_config().
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 i2c_master_init(), i2c_slave_init(), and usart_init().