EFM32 Giant Gecko Software Documentation  efm32gg-doc-4.2.1
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 /***************************************************************************/
28 /***************************************************************************/
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*******************************************************************************
38  ******************************** STRUCTS **********************************
39  ******************************************************************************/
40 
46 typedef struct
47 {
50  uint8_t sclPin;
52  uint8_t sdaPin;
53 #if defined (_I2C_ROUTELOC0_MASK)
54  uint8_t portLocationScl;
55  uint8_t portLocationSda;
56 #else
57  uint8_t portLocation;
58 #endif
59  uint32_t i2cRefFreq;
60  uint32_t i2cMaxFreq;
63 
64 
67 #if !defined( I2CSPM_INIT_DEFAULT )
68 #define I2CSPM_INIT_DEFAULT \
69  { I2C0, /* Use I2C instance 0 */ \
70  gpioPortC, /* SCL port */ \
71  5, /* SCL pin */ \
72  gpioPortC, /* SDA port */ \
73  4, /* SDA pin */ \
74  0, /* Location */ \
75  0, /* Use currently configured reference clock */ \
76  I2C_FREQ_STANDARD_MAX, /* Set to standard rate */ \
77  i2cClockHLRStandard, /* Set to use 4:4 low/high duty cycle */ \
78  }
79 #endif
80 
81 
82 /*******************************************************************************
83  ***************************** PROTOTYPES **********************************
84  ******************************************************************************/
85 
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
96 #endif /* __SILICON_LABS_I2CSPM_H__ */
GPIO_Port_TypeDef
Definition: em_gpio.h:232
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:49
void I2CSPM_Init(I2CSPM_Init_TypeDef *init)
Initalize I2C peripheral.
Definition: i2cspm.c:39
GPIO_Port_TypeDef sdaPort
Definition: i2cspm.h:51
I2C_TransferReturn_TypeDef
Definition: em_i2c.h:174
uint8_t sclPin
Definition: i2cspm.h:50
I2C_ClockHLR_TypeDef i2cClhr
Definition: i2cspm.h:61
uint8_t portLocation
Definition: i2cspm.h:57
General Purpose IO (GPIO) peripheral API.
I2C_TypeDef * port
Definition: i2cspm.h:48
uint32_t i2cMaxFreq
Definition: i2cspm.h:60
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to...
Definition: em_i2c.h:247
uint8_t sdaPin
Definition: i2cspm.h:52
uint32_t i2cRefFreq
Definition: i2cspm.h:59
I2C_ClockHLR_TypeDef
Definition: em_i2c.h:165
Inter-intergrated circuit (I2C) peripheral API.