EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
i2cspm.h
Go to the documentation of this file.
1 /***************************************************************************/
16 #ifndef __SILICON_LABS_I2CSPM_H__
17 #define __SILICON_LABS_I2CSPM_H__
18 
19 #include "i2cspmconfig.h"
20 #include "em_gpio.h"
21 #include "em_i2c.h"
22 
23 /***************************************************************************/
33 /***************************************************************************/
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /*******************************************************************************
43  ******************************** STRUCTS **********************************
44  ******************************************************************************/
45 
51 typedef struct
52 {
55  uint8_t sclPin;
57  uint8_t sdaPin;
58 #if defined (_I2C_ROUTELOC0_MASK)
59  uint8_t portLocationScl;
60  uint8_t portLocationSda;
61 #else
62  uint8_t portLocation;
63 #endif
64  uint32_t i2cRefFreq;
65  uint32_t i2cMaxFreq;
68 
69 
72 #if !defined( I2CSPM_INIT_DEFAULT )
73 #define I2CSPM_INIT_DEFAULT \
74  { I2C0, /* Use I2C instance 0 */ \
75  gpioPortC, /* SCL port */ \
76  5, /* SCL pin */ \
77  gpioPortC, /* SDA port */ \
78  4, /* SDA pin */ \
79  0, /* Location */ \
80  0, /* Use currently configured reference clock */ \
81  I2C_FREQ_STANDARD_MAX, /* Set to standard rate */ \
82  i2cClockHLRStandard, /* Set to use 4:4 low/high duty cycle */ \
83  }
84 #endif
85 
86 
87 /*******************************************************************************
88  ***************************** PROTOTYPES **********************************
89  ******************************************************************************/
90 
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
101 #endif /* __SILICON_LABS_I2CSPM_H__ */
GPIO_Port_TypeDef
Definition: em_gpio.h:345
I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
Perform I2C transfer.
Definition: i2cspm.c:124
GPIO_Port_TypeDef sclPort
Definition: i2cspm.h:54
void I2CSPM_Init(I2CSPM_Init_TypeDef *init)
Initalize I2C peripheral.
Definition: i2cspm.c:39
GPIO_Port_TypeDef sdaPort
Definition: i2cspm.h:56
I2C_TransferReturn_TypeDef
Definition: em_i2c.h:179
uint8_t sclPin
Definition: i2cspm.h:55
I2C_ClockHLR_TypeDef i2cClhr
Definition: i2cspm.h:66
General Purpose IO (GPIO) peripheral API.
I2C_TypeDef * port
Definition: i2cspm.h:53
uint32_t i2cMaxFreq
Definition: i2cspm.h:65
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to...
Definition: em_i2c.h:252
uint8_t sdaPin
Definition: i2cspm.h:57
uint32_t i2cRefFreq
Definition: i2cspm.h:64
I2C_ClockHLR_TypeDef
Definition: em_i2c.h:170
uint8_t portLocationSda
Definition: i2cspm.h:60
Inter-intergrated circuit (I2C) peripheral API.
uint8_t portLocationScl
Definition: i2cspm.h:59