Driver API for SERCOM (plib_sercom0_i2c_host.h) More...
Macros | |
| #define | I2C_CLIENT_ERROR_BUSERR SERCOM_I2CS_STATUS_BUSERR_Msk |
| Bus error detected on the I2C bus. | |
| #define | I2C_CLIENT_ERROR_COLL SERCOM_I2CS_STATUS_COLL_Msk |
| Collision detected on the I2C bus. | |
| #define | I2C_CLIENT_ERROR_LOWTOUT SERCOM_I2CS_STATUS_LOWTOUT_Msk |
| SCL low timeout error detected. | |
| #define | I2C_CLIENT_ERROR_SEXTTOUT SERCOM_I2CS_STATUS_SEXTTOUT_Msk |
| Slave SCL extend timeout error detected. | |
| #define | I2C_CLIENT_ERROR_ALL (I2C_CLIENT_ERROR_BUSERR | I2C_CLIENT_ERROR_COLL | I2C_CLIENT_ERROR_LOWTOUT | I2C_CLIENT_ERROR_SEXTTOUT) |
| Mask for all I2C client error conditions. | |
| #define | SERCOM_SPI_BAUD_MAX (0xFFU) |
| Maximum value for the SPI baud rate register. | |
| #define | USART_ERROR_NONE 0U |
| Error status when no error has occurred. | |
| #define | USART_ERROR_PARITY SERCOM_USART_STATUS_PERR_Msk |
| Error status when a parity error has occurred. | |
| #define | USART_ERROR_FRAMING SERCOM_USART_STATUS_FERR_Msk |
| Error status when a framing error has occurred. | |
| #define | USART_ERROR_OVERRUN SERCOM_USART_STATUS_BUFOVF_Msk |
| Error status when an overrun error has occurred. | |
| #define | USART_ERROR_COLLISION SERCOM_USART_STATUS_COLL_Msk |
| Error status when a collision detection has occurred. | |
Typedefs | |
| typedef void(* | SERCOM_INTERRUPT_HANDLER) (void) |
| Function pointer type for SERCOM interrupt handlers. | |
| typedef void(* | SERCOM_I2C_CALLBACK_HANDLER) (void) |
| Function pointer type for SERCOM I2C event callback handler. | |
| typedef void(* | SERCOM_SPI_CALLBACK) (uint8_t intr) |
| Callback function type for SPI interrupts. | |
| typedef uint16_t | USART_ERROR |
| Type for representing USART error status. | |
| typedef void(* | SERCOM_USART_CALLBACK_HANDLER) (USART_EVENT event) |
| Function pointer type for SERCOM USART event callback handler. | |
Functions | |
| void | SERCOM0_I2CS_ResetSoftware (void) |
| Resets the SERCOM0 I2C client peripheral. | |
| void | SERCOM0_I2CS_Enable (void) |
| Enables the SERCOM0 I2C client peripheral. | |
| void | SERCOM0_I2CS_Disable (void) |
| Disables the SERCOM0 I2C client peripheral. | |
| void | SERCOM0_I2CS_SetOperatingMode (void) |
| Sets up the SERCOM0 I2C client mode. | |
| void | SERCOM0_I2CS_Set7bitAddress (uint8_t addr) |
| Sets the I2C client address. | |
| void | SERCOM0_I2CS_Set7bitAddressMask (uint8_t addr_mask) |
| Sets the I2C client address mask. | |
| void | SERCOM0_I2CS_SetGeneralCall (bool value) |
| Enables or disables general call address recognition. | |
| uint8_t | SERCOM0_I2CS_ReceiveData (void) |
| Reads a byte of data from the I2C client. | |
| void | SERCOM0_I2CS_SendData (uint8_t data) |
| Writes a byte of data to the I2C client. | |
| uint32_t | SERCOM0_I2CS_GetError (void) |
| Gets and clears error status for the I2C client. | |
| I2C_CLIENT_DIR | SERCOM0_I2CS_GetTransferDirection (void) |
| Gets the current transfer direction (read/write). | |
| I2C_CLIENT_ACK_STATUS | SERCOM0_I2CS_GetLastByteAckStatus (void) |
| Gets the ACK/NACK status for the last data packet sent. | |
| void | SERCOM0_I2CS_SetCommand (I2C_CLIENT_COMMAND command) |
| Sets a command for the I2C client. | |
| I2C_CLIENT_TRANSFER_EVENT | SERCOM0_I2CS_GetBusStatus (void) |
| Get current I2C bus status for SERCOM0. | |
| void | SERCOM0_I2CS_EnableInterrupts (I2C_CLIENT_INTERRUPT interrupts) |
| Enables specific I2C client interrupts. | |
| void | SERCOM0_I2CS_DisableInterrupts (I2C_CLIENT_INTERRUPT interrupts) |
| Disables specific I2C client interrupts. | |
| void | SERCOM0_I2CS_ClearInterruptFlags (I2C_CLIENT_INTFLAG interrupt_flags) |
| Clears specific I2C client interrupt flags. | |
| void | SERCOM0_I2CM_Enable (void) |
| Enables the SERCOM0 I2C peripheral. | |
| void | SERCOM0_I2CM_Disable (void) |
| Disables the SERCOM0 I2C peripheral. | |
| void | SERCOM0_I2CM_SetTransferSpeed (I2C_HOST_TRANSFER_SPEED_MODE transfer_speed) |
| Sets the I2C transfer speed mode for SERCOM0. | |
| void | SERCOM0_I2CM_SetIdle (void) |
| Sets the SERCOM0 I2C peripheral to idle state. | |
| void | SERCOM0_I2CM_ResetSoftware (void) |
| Performs a software reset of the SERCOM0 I2C peripheral. | |
| void | SERCOM0_I2CM_EnableSmartMode (bool smart_mode) |
| Enables or disables Smart Mode for SERCOM0 I2C. | |
| void | SERCOM0_I2CM_SetOperatingMode (void) |
| Sets the operating mode for SERCOM0 I2C. | |
| void | SERCOM0_I2CM_SetSDAHoldTime (I2C_HOST_SDA_HOLD_TIME hold_time) |
| Sets the SDA hold time for SERCOM0 I2C. | |
| void | SERCOM0_I2CM_SetSCLCLockStretchMode (I2C_HOST_SCL_CLK_STRETCH_MODE clock_stretch_mode) |
| Sets the SCL clock stretch mode for SERCOM0 I2C. | |
| I2C_HOST_HWREG_STATUS | SERCOM0_I2CM_SetBaudRate (uint32_t srcClkFreq, uint32_t i2cClkSpeed) |
| Sets the SERCOM0 I2C baud rate. | |
| void | SERCOM0_I2CM_SetAckAction (I2C_HOST_ACK_ACTION ack_action) |
| Sets the ACK action for SERCOM0 I2C. | |
| void | SERCOM0_I2CM_SendAddress (uint32_t address, bool direction) |
| Sends an I2C address on the SERCOM0 bus. | |
| bool | SERCOM0_I2CM_BusIsIdle (void) |
| Checks if the SERCOM0 I2C bus is idle. | |
| void | SERCOM0_I2CM_SendStop (void) |
| Sends a STOP condition on the SERCOM0 I2C bus. | |
| void | SERCOM0_I2CM_SendData (uint8_t data) |
| Sends a data byte on the SERCOM0 I2C bus. | |
| uint8_t | SERCOM0_I2CM_ReceiveData (void) |
| Receives a data byte from the SERCOM0 I2C bus. | |
| uint8_t | SERCOM0_I2CM_GetSyncBusyStatus (void) |
| Gets the synchronization busy status for SERCOM0 I2C. | |
| void | SERCOM0_I2CM_EnableInterrupts (I2C_HOST_INTERRUPT interrupts) |
| Enables specific SERCOM0 I2C interrupts. | |
| void | SERCOM0_I2CM_DisableInterrupts (I2C_HOST_INTERRUPT interrupts) |
| Disables specific SERCOM0 I2C interrupts. | |
| void | SERCOM0_I2CM_ClearInterruptFlag (I2C_HOST_INTERRUPT interrupt_flag) |
| Clears specific SERCOM0 I2C interrupt flags. | |
| void | SERCOM0_I2CM_SetCallbackHandler (SERCOM_I2C_CALLBACK_HANDLER callback) |
| Sets the callback handler for SERCOM0 I2C events. | |
| void | SERCOM0_I2CM_SetInterruptHandler (void) |
| Assigns the interrupt handler for SERCOM0 I2C. | |
| uint32_t | SERCOM0_I2CM_GetBusStatus (void) |
| Gets SERCOM0 I2C bus status, reads the status register. | |
| void | SERCOM0_SPI_Enable (void) |
| Enables the SERCOM0 SPI peripheral. | |
| void | SERCOM0_SPI_Disable (void) |
| Disables the SERCOM0 SPI peripheral. | |
| void | SERCOM0_SPI_ResetSoftware (void) |
| Performs a software reset of the SERCOM0 SPI peripheral. | |
| void | SERCOM0_SPI_EnableReceiver (void) |
| Enables the SPI receiver. | |
| void | SERCOM0_SPI_DisableReceiver (void) |
| Disables the SPI receiver. | |
| SPI_HWREG_STATUS | SERCOM0_SPI_SetBusSpeed (uint32_t bus_speed, uint32_t clk_frequency) |
| Sets the SPI bus speed. | |
| uint32_t | SERCOM0_SPI_GetBusSpeed (uint32_t clk_frequency) |
| Returns the SPI bus speed. | |
| void | SERCOM0_SPI_SetDataOrder (bool lsb_first) |
| Sets the SPI data order. | |
| void | SERCOM0_SPI_SetClockPolarity (bool cpol_high) |
| Sets the SPI clock polarity. | |
| void | SERCOM0_SPI_SetClockPhase (bool cpha_trailing) |
| Sets the SPI clock phase. | |
| void | SERCOM0_SPI_SetOperatingMode (SPI_OPERATING_MODE mode) |
| Sets the SPI operating mode. | |
| void | SERCOM0_SPI_SetCharacterSize (SERCOM_SPI_CHSIZE chsize) |
| Sets the character size for the SERCOM0 SPI module. | |
| void | SERCOM0_SPI_SetPinOut (SPI_DATAIN_PIN dipo, SPI_DATAOUT_PIN dopo) |
| Set SERCOM0 SPI data in (DIPO) and data out (DOPO) pinout. | |
| void | SERCOM0_SPI_Send (uint16_t data) |
| Writes data to the SPI bus. | |
| uint16_t | SERCOM0_SPI_Receive (void) |
| Reads data from the SPI bus. | |
| bool | SERCOM0_SPI_RxIsReady (void) |
| Checks if the SPI receive buffer is ready. | |
| bool | SERCOM0_SPI_TxIsReady (void) |
| Checks if the SPI transmit buffer is ready. | |
| void | SERCOM0_SPI_SetImmediateBufferOverflow (bool immediate) |
| Sets immediate buffer overflow behavior. | |
| bool | SERCOM0_SPI_BufferIsOverflow (void) |
| Checks for SPI buffer overflow. | |
| void | SERCOM0_SPI_ClearBufferOverflow (void) |
| Clears the SPI buffer overflow flag. | |
| void | SERCOM0_SPI_SetAddressMode (SPI_ADDRESS_MODE mode) |
| Sets the SPI address mode. | |
| void | SERCOM0_SPI_EnableHardwareSS (bool enable) |
| Enables or disables hardware slave select (SS) management. | |
| void | SERCOM0_SPI_EnableSSLowDetect (bool enable) |
| Enables or disables slave select low detect. | |
| void | SERCOM0_SPI_SetRunInStandby (bool run_stdby) |
| Sets the SPI to run in standby mode. | |
| void | SERCOM0_SPI_EnablePreload (bool enable) |
| Enables or disables SPI preload feature. | |
| void | SERCOM0_SPI_EnableInterrupt (SPI_INTERRUPT_SOURCE src) |
| Enables a specific SPI interrupt source. | |
| void | SERCOM0_SPI_DisableInterrupt (SPI_INTERRUPT_SOURCE src) |
| Disables a specific SPI interrupt source. | |
| bool | SERCOM0_SPI_InterruptFlagIsSet (SPI_INTERRUPT_FLAG flag) |
| Checks if the specified SPI interrupt flag is set. | |
| void | SERCOM0_SPI_ClearInterruptFlag (SPI_INTERRUPT_FLAG flag) |
| Clears the specified SPI interrupt flag. | |
| void | SERCOM0_SPI_SetCallbackHandler (SERCOM_SPI_CALLBACK cb) |
| Registers a callback function for SPI interrupts. | |
| void | SERCOM0_SPI_SetInterruptHandler (void) |
| Assigns the interrupt handler for SERCOM0 SPI. | |
| void | SERCOM0_USART_Enable (void) |
| Enables the SERCOM USART peripheral. | |
| void | SERCOM0_USART_Disable (void) |
| Disables the SERCOM USART peripheral. | |
| void | SERCOM0_USART_EnableTransmitter (void) |
| Enables the USART transmitter. | |
| void | SERCOM0_USART_DisableTransmitter (void) |
| Disables the USART transmitter. | |
| void | SERCOM0_USART_EnableReceiver (void) |
| Enables the USART receiver. | |
| void | SERCOM0_USART_DisableReceiver (void) |
| Disables the USART receiver. | |
| void | SERCOM0_USART_SetOperatingMode (USART_OPMODE mode) |
| Sets the USART operating mode. | |
| void | SERCOM0_USART_SetCommunicationMode (USART_COMM_MODE comm_mode) |
| Sets the USART communication mode. | |
| void | SERCOM0_USART_SetTxDataPinout (USART_TXDATA_PINOUT tx_pinout) |
| Sets the USART TX data pinout. | |
| void | SERCOM0_USART_SetRxDataPinout (USART_RXDATA_PINOUT rx_pinout) |
| Sets the USART RX data pinout. | |
| void | SERCOM0_USART_SetDataSize (USART_CHARSIZE char_size) |
| Sets the USART data size. | |
| void | SERCOM0_USART_SetFrameFormat (USART_FRAME_FORMAT frame_format) |
| Sets the USART frame format. | |
| void | SERCOM0_USART_SetParityMode (USART_PARITY_MODE parity) |
| Sets the USART parity mode. | |
| void | SERCOM0_USART_SetStopBits (USART_STOPBITS stop_bits) |
| Sets the USART stop bits. | |
| void | SERCOM0_USART_SetDataOrder (USART_DATA_ORDER data_order) |
| Sets the USART data order. | |
| USART_HWREG_STATUS | SERCOM0_USART_SetBaudrate (uint32_t baud, uint32_t clk_frequency) |
| Sets the USART baud rate. | |
| void | SERCOM0_USART_DisableRxCompleteInterrupt (void) |
| Disables the receive complete interrupt. | |
| void | SERCOM0_USART_EnableRxCompleteInterrupt (void) |
| Enables the receive complete interrupt. | |
| void | SERCOM0_USART_DisableTxCompleteInterrupt (void) |
| Disables the transmit complete interrupt. | |
| void | SERCOM0_USART_EnableTxCompleteInterrupt (void) |
| Enables the transmit complete interrupt. | |
| void | SERCOM0_USART_DisableDataRegEmptyInterrupt (void) |
| Disables the data register empty interrupt. | |
| void | SERCOM0_USART_EnableDataRegEmptyInterrupt (void) |
| Enables the data register empty interrupt. | |
| void | SERCOM0_USART_DisableErrorInterrupt (void) |
| Disables the error interrupt. | |
| void | SERCOM0_USART_EnableErrorInterrupt (void) |
| Enables the error interrupt. | |
| void | SERCOM0_USART_EnableCollisionDetection (bool collision_detection) |
| Enables or disables collision detection. | |
| void | SERCOM0_USART_Send (uint8_t data) |
| Sends a byte of data via USART. | |
| uint8_t | SERCOM0_USART_Receive (void) |
| Receives a byte of data from USART. | |
| void | SERCOM0_USART_Send9Bit (uint16_t data) |
| Sends 9-bit data via USART. | |
| uint16_t | SERCOM0_USART_Receive9Bit (void) |
| Receives 9-bit data from USART. | |
| bool | SERCOM0_USART_TxIsReady (void) |
| Checks if the USART transmitter is ready. | |
| bool | SERCOM0_USART_RxIsReady (void) |
| Checks if the USART receiver is ready. | |
| bool | SERCOM0_USART_TxIsDone (void) |
| Checks if the USART transmission is complete. | |
| USART_ERROR | SERCOM0_USART_ErrorGet (void) |
| Gets the current USART error status and clears it. | |
| void | SERCOM0_USART_SetCallbackHandler (SERCOM_USART_CALLBACK_HANDLER callback) |
| Registers callback for the USART interrupt events. | |
| void | SERCOM0_USART_ResetSoftware (void) |
| Performs a software reset of the USART peripheral. | |
| void | SERCOM0_USART_SetInterruptHandler (void) |
| Assigns the interrupt handler for SERCOM0 USART. | |
Variables | |
| volatile SERCOM_INTERRUPT_HANDLER | SERCOM0_InterruptHandler |
| Interrupt handler for SERCOM0 peripheral. | |
Driver API for SERCOM (plib_sercom0_i2c_host.h)
Driver API for SERCOM (plib_sercom0_spi.h)
Driver API for SERCOM (plib_sercom0_interrupt.h)
| #define I2C_CLIENT_ERROR_ALL (I2C_CLIENT_ERROR_BUSERR | I2C_CLIENT_ERROR_COLL | I2C_CLIENT_ERROR_LOWTOUT | I2C_CLIENT_ERROR_SEXTTOUT) |
Mask for all I2C client error conditions.
| #define I2C_CLIENT_ERROR_BUSERR SERCOM_I2CS_STATUS_BUSERR_Msk |
Bus error detected on the I2C bus.
| #define I2C_CLIENT_ERROR_COLL SERCOM_I2CS_STATUS_COLL_Msk |
Collision detected on the I2C bus.
| #define I2C_CLIENT_ERROR_LOWTOUT SERCOM_I2CS_STATUS_LOWTOUT_Msk |
SCL low timeout error detected.
| #define I2C_CLIENT_ERROR_SEXTTOUT SERCOM_I2CS_STATUS_SEXTTOUT_Msk |
Slave SCL extend timeout error detected.
| #define SERCOM_SPI_BAUD_MAX (0xFFU) |
Maximum value for the SPI baud rate register.
| #define USART_ERROR_COLLISION SERCOM_USART_STATUS_COLL_Msk |
Error status when a collision detection has occurred.
| #define USART_ERROR_FRAMING SERCOM_USART_STATUS_FERR_Msk |
Error status when a framing error has occurred.
| #define USART_ERROR_NONE 0U |
Error status when no error has occurred.
| #define USART_ERROR_OVERRUN SERCOM_USART_STATUS_BUFOVF_Msk |
Error status when an overrun error has occurred.
| #define USART_ERROR_PARITY SERCOM_USART_STATUS_PERR_Msk |
Error status when a parity error has occurred.
| SERCOM_I2C_CALLBACK_HANDLER |
Function pointer type for SERCOM I2C event callback handler.
| SERCOM_INTERRUPT_HANDLER |
Function pointer type for SERCOM interrupt handlers.
This typedef defines a function pointer for interrupt handlers associated with SERCOM. The handler function must take no parameters and return void.
| SERCOM_SPI_CALLBACK |
Callback function type for SPI interrupts.
| intr | The interrupt source that triggered the callback. |
| SERCOM_USART_CALLBACK_HANDLER |
Function pointer type for SERCOM USART event callback handler.
This typedef defines a callback function type that is called when a USART event occurs. The callback receives a single parameter indicating the event type.
| event | The USART event that triggered the callback. |
Type for representing USART error status.
| enum I2C_CLIENT_COMMAND |
| enum I2C_CLIENT_DIR |
| enum I2C_CLIENT_INTERRUPT |
I2C Client Interrupt options.
| enum I2C_CLIENT_INTFLAG |
I2C client transfer event types.
| enum I2C_HOST_ACK_ACTION |
| enum I2C_HOST_EVENT |
Status codes for USART hardware register operations.
| enum I2C_HOST_INTERRUPT |
I2C Speed mode selection.
| enum I2C_OPMODE |
| enum SERCOM_SPI_CHSIZE |
| enum SPI_ADDRESS_MODE |
| enum SPI_DATAIN_PIN |
Enumeration of SERCOM SPI data input (DI) pin configurations.
This enum specifies the mapping of the SPI data input (DI) signal to SERCOM PADs. The DI signal corresponds to:
The value programmed into the SERCOM_SPI_CTRLA_DIPO register determines which PAD is used for DI.
| Enumerator | |
|---|---|
| SPI_DI_PAD0 | |
| SPI_DI_PAD1 | |
| SPI_DI_PAD2 | |
| SPI_DI_PAD3 | |
| enum SPI_DATAOUT_PIN |
Enumeration of possible SERCOM SPI data output pin configurations.
This enum defines the mapping of SPI data output (MOSI/MISO), clock (SCK), and slave select (SS) pins to SERCOM PADs for both Host and Client modes. The mapping depends on the value programmed into the SERCOM_SPI_CTRLA_DOPO register.
| Enumerator | |
|---|---|
| SPI_DO_PAD0_SCK_PAD1_SS_PAD2 | |
| SPI_DO_PAD2_SCK_PAD3_SS_PAD1 | |
| SPI_DO_PAD3_SCK_PAD1_SS_PAD2 | |
| SPI_DO_PAD0_SCK_PAD3_SS_PAD1 | |
| enum SPI_HWREG_STATUS |
| enum SPI_INTERRUPT_FLAG |
| enum SPI_INTERRUPT_SOURCE |
| enum SPI_OPERATING_MODE |
| enum USART_CHARSIZE |
| enum USART_COMM_MODE |
| enum USART_DATA_ORDER |
| enum USART_EVENT |
| enum USART_FRAME_FORMAT |
| enum USART_HWREG_STATUS |
Status codes for USART hardware register operations.
| enum USART_OPMODE |
| enum USART_PARITY_MODE |
| enum USART_RXDATA_PINOUT |
| enum USART_STOPBITS |
| enum USART_TXDATA_PINOUT |
| bool SERCOM0_I2CM_BusIsIdle | ( | void | ) |
Checks if the SERCOM0 I2C bus is idle.
| None. |
| void SERCOM0_I2CM_ClearInterruptFlag | ( | I2C_HOST_INTERRUPT | interrupt_flag | ) |
Clears specific SERCOM0 I2C interrupt flags.
| interrupt_flag | - Bitmask specifying which interrupt flags to clear. |
| void SERCOM0_I2CM_Disable | ( | void | ) |
Disables the SERCOM0 I2C peripheral.
| None. |
| void SERCOM0_I2CM_DisableInterrupts | ( | I2C_HOST_INTERRUPT | interrupts | ) |
Disables specific SERCOM0 I2C interrupts.
| interrupts | - Bitmask specifying which interrupts to disable. |
| void SERCOM0_I2CM_Enable | ( | void | ) |
Enables the SERCOM0 I2C peripheral.
| None. |
| void SERCOM0_I2CM_EnableInterrupts | ( | I2C_HOST_INTERRUPT | interrupts | ) |
Enables specific SERCOM0 I2C interrupts.
| interrupts | - Bitmask specifying which interrupts to enable. |
| void SERCOM0_I2CM_EnableSmartMode | ( | bool | smart_mode | ) |
Enables or disables Smart Mode for SERCOM0 I2C.
| smart_mode | - true to enable, false to disable. |
| uint32_t SERCOM0_I2CM_GetBusStatus | ( | void | ) |
Gets SERCOM0 I2C bus status, reads the status register.
| None. |
| uint8_t SERCOM0_I2CM_GetSyncBusyStatus | ( | void | ) |
Gets the synchronization busy status for SERCOM0 I2C.
| None. |
| uint8_t SERCOM0_I2CM_ReceiveData | ( | void | ) |
Receives a data byte from the SERCOM0 I2C bus.
| None. |
| void SERCOM0_I2CM_ResetSoftware | ( | void | ) |
Performs a software reset of the SERCOM0 I2C peripheral.
| None. |
| void SERCOM0_I2CM_SendAddress | ( | uint32_t | address, |
| bool | direction ) |
Sends an I2C address on the SERCOM0 bus.
| address | - I2C address to send. |
| direction | - true for read, false for write. |
| void SERCOM0_I2CM_SendData | ( | uint8_t | data | ) |
Sends a data byte on the SERCOM0 I2C bus.
| data | - Data byte to send. |
| void SERCOM0_I2CM_SendStop | ( | void | ) |
Sends a STOP condition on the SERCOM0 I2C bus.
| None. |
| void SERCOM0_I2CM_SetAckAction | ( | I2C_HOST_ACK_ACTION | ack_action | ) |
Sets the ACK action for SERCOM0 I2C.
| ack_action | - ACK action configuration. |
| I2C_HOST_HWREG_STATUS SERCOM0_I2CM_SetBaudRate | ( | uint32_t | srcClkFreq, |
| uint32_t | i2cClkSpeed ) |
Sets the SERCOM0 I2C baud rate.
| srcClkFreq | - System clock frequency in Hz. |
| i2cClkSpeed | - Desired I2C clock speed in Hz. |
| void SERCOM0_I2CM_SetCallbackHandler | ( | SERCOM_I2C_CALLBACK_HANDLER | callback | ) |
Sets the callback handler for SERCOM0 I2C events.
| callback | - Function pointer to the callback handler. |
| void SERCOM0_I2CM_SetIdle | ( | void | ) |
Sets the SERCOM0 I2C peripheral to idle state.
| None. |
| void SERCOM0_I2CM_SetInterruptHandler | ( | void | ) |
Assigns the interrupt handler for SERCOM0 I2C.
| None. |
| void SERCOM0_I2CM_SetOperatingMode | ( | void | ) |
Sets the operating mode for SERCOM0 I2C.
| mode | - Operating mode (master or slave). |
| void SERCOM0_I2CM_SetSCLCLockStretchMode | ( | I2C_HOST_SCL_CLK_STRETCH_MODE | clock_stretch_mode | ) |
Sets the SCL clock stretch mode for SERCOM0 I2C.
| clock_stretch_mode | - SCL clock stretch mode configuration. |
| void SERCOM0_I2CM_SetSDAHoldTime | ( | I2C_HOST_SDA_HOLD_TIME | hold_time | ) |
Sets the SDA hold time for SERCOM0 I2C.
| hold_time | - SDA hold time configuration. |
| void SERCOM0_I2CM_SetTransferSpeed | ( | I2C_HOST_TRANSFER_SPEED_MODE | transfer_speed | ) |
Sets the I2C transfer speed mode for SERCOM0.
| transfer_speed | - Transfer speed mode (e.g., standard, fast, fastplus). |
| void SERCOM0_I2CS_ClearInterruptFlags | ( | I2C_CLIENT_INTFLAG | interrupt_flags | ) |
Clears specific I2C client interrupt flags.
| interrupt_flags | Interrupt flag mask. |
| void SERCOM0_I2CS_Disable | ( | void | ) |
Disables the SERCOM0 I2C client peripheral.
| void SERCOM0_I2CS_DisableInterrupts | ( | I2C_CLIENT_INTERRUPT | interrupts | ) |
Disables specific I2C client interrupts.
| interrupts | Interrupt mask. |
| void SERCOM0_I2CS_Enable | ( | void | ) |
Enables the SERCOM0 I2C client peripheral.
| void SERCOM0_I2CS_EnableInterrupts | ( | I2C_CLIENT_INTERRUPT | interrupts | ) |
Enables specific I2C client interrupts.
| interrupts | Interrupt mask. |
| I2C_CLIENT_TRANSFER_EVENT SERCOM0_I2CS_GetBusStatus | ( | void | ) |
Get current I2C bus status for SERCOM0.
| uint32_t SERCOM0_I2CS_GetError | ( | void | ) |
Gets and clears error status for the I2C client.
| I2C_CLIENT_ACK_STATUS SERCOM0_I2CS_GetLastByteAckStatus | ( | void | ) |
Gets the ACK/NACK status for the last data packet sent.
| I2C_CLIENT_DIR SERCOM0_I2CS_GetTransferDirection | ( | void | ) |
Gets the current transfer direction (read/write).
| uint8_t SERCOM0_I2CS_ReceiveData | ( | void | ) |
Reads a byte of data from the I2C client.
| void SERCOM0_I2CS_ResetSoftware | ( | void | ) |
Resets the SERCOM0 I2C client peripheral.
| void SERCOM0_I2CS_SendData | ( | uint8_t | data | ) |
Writes a byte of data to the I2C client.
| data | Data byte to send. |
| void SERCOM0_I2CS_Set7bitAddress | ( | uint8_t | addr | ) |
Sets the I2C client address.
| addr | 7-bit I2C address. |
| void SERCOM0_I2CS_Set7bitAddressMask | ( | uint8_t | addr_mask | ) |
Sets the I2C client address mask.
| addr_mask | 7-bit address mask. |
| void SERCOM0_I2CS_SetCommand | ( | I2C_CLIENT_COMMAND | command | ) |
Sets a command for the I2C client.
| command | Command enum value. |
| void SERCOM0_I2CS_SetGeneralCall | ( | bool | value | ) |
Enables or disables general call address recognition.
| value | true to enable, false to disable. |
| void SERCOM0_I2CS_SetOperatingMode | ( | void | ) |
Sets up the SERCOM0 I2C client mode.
| bool SERCOM0_SPI_BufferIsOverflow | ( | void | ) |
Checks for SPI buffer overflow.
This function indicates whether a buffer overflow condition has occurred.
| void SERCOM0_SPI_ClearBufferOverflow | ( | void | ) |
Clears the SPI buffer overflow flag.
This function clears the buffer overflow condition in the SPI module.
| void SERCOM0_SPI_ClearInterruptFlag | ( | SPI_INTERRUPT_FLAG | flag | ) |
Clears the specified SPI interrupt flag.
| flag | Interrupt flag to clear. |
| void SERCOM0_SPI_Disable | ( | void | ) |
Disables the SERCOM0 SPI peripheral.
This function clears the enable bit in the SPI control register and waits for synchronization to complete.
| void SERCOM0_SPI_DisableInterrupt | ( | SPI_INTERRUPT_SOURCE | src | ) |
Disables a specific SPI interrupt source.
| src | The interrupt source to disable. |
This function disables the specified SPI interrupt.
| void SERCOM0_SPI_DisableReceiver | ( | void | ) |
Disables the SPI receiver.
This function clears the receiver enable bit and waits for synchronization to complete.
| void SERCOM0_SPI_Enable | ( | void | ) |
Enables the SERCOM0 SPI peripheral.
This function sets the enable bit in the SPI control register and waits for synchronization to complete.
| void SERCOM0_SPI_EnableHardwareSS | ( | bool | enable | ) |
Enables or disables hardware slave select (SS) management.
| enable | If true, enables hardware SS; otherwise, disables. |
| void SERCOM0_SPI_EnableInterrupt | ( | SPI_INTERRUPT_SOURCE | src | ) |
Enables a specific SPI interrupt source.
| src | The interrupt source to enable. |
This function enables the specified SPI interrupt.
| void SERCOM0_SPI_EnablePreload | ( | bool | enable | ) |
Enables or disables SPI preload feature.
| enable | If true, enables preload; otherwise, disables. |
| void SERCOM0_SPI_EnableReceiver | ( | void | ) |
Enables the SPI receiver.
This function sets the receiver enable bit and waits for synchronization to complete.
| void SERCOM0_SPI_EnableSSLowDetect | ( | bool | enable | ) |
Enables or disables slave select low detect.
| enable | If true, enables SS low detect; otherwise, disables. |
| uint32_t SERCOM0_SPI_GetBusSpeed | ( | uint32_t | clk_frequency | ) |
Returns the SPI bus speed.
| clk_frequency | The input clock frequency in Hertz (Hz) supplied to the SPI peripheral. |
This function computes and returns the actual SPI bus speed (in Hz) for the SPI peripheral.
| bool SERCOM0_SPI_InterruptFlagIsSet | ( | SPI_INTERRUPT_FLAG | flag | ) |
Checks if the specified SPI interrupt flag is set.
| flag | Interrupt flag to check. |
| uint16_t SERCOM0_SPI_Receive | ( | void | ) |
Reads data from the SPI bus.
This function reads and returns data received from the SPI bus.
| void SERCOM0_SPI_ResetSoftware | ( | void | ) |
Performs a software reset of the SERCOM0 SPI peripheral.
This function sets the software reset bit and waits for synchronization to complete.
| bool SERCOM0_SPI_RxIsReady | ( | void | ) |
Checks if the SPI receive buffer is ready.
This function indicates whether the SPI receive buffer has unread data.
| void SERCOM0_SPI_Send | ( | uint16_t | data | ) |
Writes data to the SPI bus.
| data | The 16-bit data to be transmitted. |
This function transmits the specified data over the SPI bus.
| void SERCOM0_SPI_SetAddressMode | ( | SPI_ADDRESS_MODE | mode | ) |
Sets the SPI address mode.
| mode | Address mode to be set. |
| SPI_HWREG_STATUS SERCOM0_SPI_SetBusSpeed | ( | uint32_t | bus_speed, |
| uint32_t | clk_frequency ) |
Sets the SPI bus speed.
| bus_speed | Desired SPI bus speed in Hz. |
| clk_frequency | Clock frequency in Hz. |
This function calculates and sets the baud rate for the SPI peripheral. Returns SPI_HWREG_INVALID_PARAM if bus_speed is zero, clk_frequency is zero, or if bus_speed exceeds clk_frequency.
| void SERCOM0_SPI_SetCallbackHandler | ( | SERCOM_SPI_CALLBACK | cb | ) |
Registers a callback function for SPI interrupts.
| cb | Callback function to be registered. |
| void SERCOM0_SPI_SetCharacterSize | ( | SERCOM_SPI_CHSIZE | chsize | ) |
Sets the character size for the SERCOM0 SPI module.
| chsize | The desired character size. This should be a value from the SERCOM_SPI_CHSIZE enumeration (e.g., SPI_CHSIZE_8BIT or SPI_CHSIZE_9BIT). |
| void SERCOM0_SPI_SetClockPhase | ( | bool | cpha_trailing | ) |
Sets the SPI clock phase.
| cpha_trailing | If true, sets clock phase to trailing edge; otherwise, leading edge. |
| void SERCOM0_SPI_SetClockPolarity | ( | bool | cpol_high | ) |
Sets the SPI clock polarity.
| cpol_high | If true, sets clock polarity to high when idle; otherwise, low. |
| void SERCOM0_SPI_SetDataOrder | ( | bool | lsb_first | ) |
Sets the SPI data order.
| lsb_first | If true, sets data order to LSB first; otherwise, MSB first. |
| void SERCOM0_SPI_SetImmediateBufferOverflow | ( | bool | immediate | ) |
Sets immediate buffer overflow behavior.
| immediate | If true, enables immediate buffer overflow; otherwise, disables. |
| void SERCOM0_SPI_SetInterruptHandler | ( | void | ) |
Assigns the interrupt handler for SERCOM0 SPI.
| void SERCOM0_SPI_SetOperatingMode | ( | SPI_OPERATING_MODE | mode | ) |
Sets the SPI operating mode.
| mode | SPI operating mode (master, slave, etc.). |
| void SERCOM0_SPI_SetPinOut | ( | SPI_DATAIN_PIN | dipo, |
| SPI_DATAOUT_PIN | dopo ) |
Set SERCOM0 SPI data in (DIPO) and data out (DOPO) pinout.
| dipo | Data in pin selection (SPI_DATAIN_PIN). |
| dopo | Data out pin selection (SPI_DATAOUT_PIN). |
| void SERCOM0_SPI_SetRunInStandby | ( | bool | run_stdby | ) |
Sets the SPI to run in standby mode.
| run_stdby | If true, enables run in standby; otherwise, disables. |
| bool SERCOM0_SPI_TxIsReady | ( | void | ) |
Checks if the SPI transmit buffer is ready.
This function indicates whether the SPI transmit buffer is ready for new data.
| void SERCOM0_USART_Disable | ( | void | ) |
Disables the SERCOM USART peripheral.
| None. |
| void SERCOM0_USART_DisableDataRegEmptyInterrupt | ( | void | ) |
Disables the data register empty interrupt.
| None. |
| void SERCOM0_USART_DisableErrorInterrupt | ( | void | ) |
Disables the error interrupt.
| None. |
| void SERCOM0_USART_DisableReceiver | ( | void | ) |
Disables the USART receiver.
| None. |
| void SERCOM0_USART_DisableRxCompleteInterrupt | ( | void | ) |
Disables the receive complete interrupt.
| None. |
| void SERCOM0_USART_DisableTransmitter | ( | void | ) |
Disables the USART transmitter.
| None. |
| void SERCOM0_USART_DisableTxCompleteInterrupt | ( | void | ) |
Disables the transmit complete interrupt.
| None. |
| void SERCOM0_USART_Enable | ( | void | ) |
Enables the SERCOM USART peripheral.
| None. |
| void SERCOM0_USART_EnableCollisionDetection | ( | bool | collision_detection | ) |
Enables or disables collision detection.
| collision_detection | - true to enable, false to disable. |
| void SERCOM0_USART_EnableDataRegEmptyInterrupt | ( | void | ) |
Enables the data register empty interrupt.
| None. |
| void SERCOM0_USART_EnableErrorInterrupt | ( | void | ) |
Enables the error interrupt.
| None. |
| void SERCOM0_USART_EnableReceiver | ( | void | ) |
Enables the USART receiver.
| None. |
| void SERCOM0_USART_EnableRxCompleteInterrupt | ( | void | ) |
Enables the receive complete interrupt.
| None. |
| void SERCOM0_USART_EnableTransmitter | ( | void | ) |
Enables the USART transmitter.
| None. |
| void SERCOM0_USART_EnableTxCompleteInterrupt | ( | void | ) |
Enables the transmit complete interrupt.
| None. |
| USART_ERROR SERCOM0_USART_ErrorGet | ( | void | ) |
Gets the current USART error status and clears it.
| None. |
| uint8_t SERCOM0_USART_Receive | ( | void | ) |
Receives a byte of data from USART.
| None. |
| uint16_t SERCOM0_USART_Receive9Bit | ( | void | ) |
Receives 9-bit data from USART.
| None. |
| void SERCOM0_USART_ResetSoftware | ( | void | ) |
Performs a software reset of the USART peripheral.
| None. |
| bool SERCOM0_USART_RxIsReady | ( | void | ) |
Checks if the USART receiver is ready.
| None. |
| void SERCOM0_USART_Send | ( | uint8_t | data | ) |
Sends a byte of data via USART.
| data | - Byte to send. |
| void SERCOM0_USART_Send9Bit | ( | uint16_t | data | ) |
Sends 9-bit data via USART.
| data | - 9-bit data to send. |
| USART_HWREG_STATUS SERCOM0_USART_SetBaudrate | ( | uint32_t | baud, |
| uint32_t | clk_frequency ) |
Sets the USART baud rate.
| baud | - Desired baud rate. |
| clk_frequency | - Clock frequency in Hz. |
| void SERCOM0_USART_SetCallbackHandler | ( | SERCOM_USART_CALLBACK_HANDLER | callback | ) |
Registers callback for the USART interrupt events.
| callback | - Pointer to the callback function. |
| void SERCOM0_USART_SetCommunicationMode | ( | USART_COMM_MODE | comm_mode | ) |
Sets the USART communication mode.
| comm_mode | - The desired communication mode (see USART_COMM_MODE). |
| void SERCOM0_USART_SetDataOrder | ( | USART_DATA_ORDER | data_order | ) |
Sets the USART data order.
| data_order | - The desired data order (see USART_DATA_ORDER). |
| void SERCOM0_USART_SetDataSize | ( | USART_CHARSIZE | char_size | ) |
Sets the USART data size.
| char_size | - The desired character size (see USART_CHARSIZE). |
| void SERCOM0_USART_SetFrameFormat | ( | USART_FRAME_FORMAT | frame_format | ) |
Sets the USART frame format.
| frame_format | - The desired frame format (see USART_FRAME_FORMAT). |
| void SERCOM0_USART_SetInterruptHandler | ( | void | ) |
Assigns the interrupt handler for SERCOM0 USART.
| void SERCOM0_USART_SetOperatingMode | ( | USART_OPMODE | mode | ) |
Sets the USART operating mode.
| mode | - The desired operating mode (see USART_OPMODE). |
| void SERCOM0_USART_SetParityMode | ( | USART_PARITY_MODE | parity | ) |
Sets the USART parity mode.
| parity | - The desired parity mode (see USART_PARITY_MODE). |
| void SERCOM0_USART_SetRxDataPinout | ( | USART_RXDATA_PINOUT | rx_pinout | ) |
Sets the USART RX data pinout.
| rx_pinout | - The desired RX pinout (see USART_RXDATA_PINOUT). |
| void SERCOM0_USART_SetStopBits | ( | USART_STOPBITS | stop_bits | ) |
Sets the USART stop bits.
| stop_bits | - The desired number of stop bits (see USART_STOPBITS). |
| void SERCOM0_USART_SetTxDataPinout | ( | USART_TXDATA_PINOUT | tx_pinout | ) |
Sets the USART TX data pinout.
| tx_pinout | - The desired TX pinout (see USART_TXDATA_PINOUT). |
| bool SERCOM0_USART_TxIsDone | ( | void | ) |
Checks if the USART transmission is complete.
| None. |
| bool SERCOM0_USART_TxIsReady | ( | void | ) |
Checks if the USART transmitter is ready.
| None. |
|
extern |
Interrupt handler for SERCOM0 peripheral.
This variable holds the function pointer to the current interrupt handler for the SERCOM0 module. It should be assigned to a function that matches the SERCOM_INTERRUPT_HANDLER signature. The variable is declared as volatile because it may be modified by interrupt service routines.