Loading...
Searching...
No Matches
flexcomm.h File Reference

Flexcomm interface functions. More...

Detailed Description

Flexcomm interface functions.

The FLEXCOMM blocks can operate in different modes such as UART, SPI and I2C, but not all modules support all modes. These functions allow to initialize and configure the FLEXCOMM, as well as route back the ISRs to the corresponding module.

Author
iosabi iosab.nosp@m.i@pr.nosp@m.otonm.nosp@m.ail..nosp@m.com

Definition in file flexcomm.h.

#include <stdint.h>
#include "periph_cpu.h"
+ Include dependency graph for flexcomm.h:

Go to the source code of this file.

enum  flexcom_pselid_t { FLEXCOMM_ID_UART = 1 , FLEXCOMM_ID_SPI = 2 , FLEXCOMM_ID_I2C = 3 }
 Flexcomm PSELID values. More...
 
int flexcomm_init (FLEXCOMM_Type *dev, flexcom_pselid_t mode)
 Initialize a flexcomm module to operate as the selected mode.
 
int flexcomm_instance_from_addr (const FLEXCOMM_Type *dev)
 Obtain the flexcomm block number (0-based) from the address.
 

Enumeration Type Documentation

◆ flexcom_pselid_t

Flexcomm PSELID values.

This value identifies the current function of a FLEXCOMM module.

Enumerator
FLEXCOMM_ID_UART 

UART mode.

FLEXCOMM_ID_SPI 

SPI mode.

FLEXCOMM_ID_I2C 

I2C mode.

Definition at line 40 of file flexcomm.h.

Function Documentation

◆ flexcomm_init()

int flexcomm_init ( FLEXCOMM_Type *  dev,
flexcom_pselid_t  mode 
)

Initialize a flexcomm module to operate as the selected mode.

Returns
-1 in case of error, otherwise returns the number of flexcomm instance initialized, such as 2 for FLEXCOMM2.

◆ flexcomm_instance_from_addr()

int flexcomm_instance_from_addr ( const FLEXCOMM_Type *  dev)

Obtain the flexcomm block number (0-based) from the address.

For example, the flexcomm block number of FLEXCOMM2, the pointer to the FLEXCOMM_Type block is 2. If an invalid address is passed returns -1.