i2cspm.h

Go to the documentation of this file.
00001 /***************************************************************************/
00016 #ifndef __SILICON_LABS_I2CSPM_H__
00017 #define __SILICON_LABS_I2CSPM_H__
00018 
00019 #include "i2cspmconfig.h"
00020 #include "em_gpio.h"
00021 #include "em_i2c.h"
00022 
00023 /***************************************************************************/
00028 /***************************************************************************/
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 /*******************************************************************************
00038  ********************************   STRUCTS   **********************************
00039  ******************************************************************************/
00040 
00046 typedef struct
00047 {
00048   I2C_TypeDef           *port;          
00049   GPIO_Port_TypeDef     sclPort;        
00050   uint8_t               sclPin;         
00051   GPIO_Port_TypeDef     sdaPort;        
00052   uint8_t               sdaPin;         
00053 #if defined (_I2C_ROUTELOC0_MASK)
00054   uint8_t               portLocationScl; 
00055   uint8_t               portLocationSda; 
00056 #else
00057   uint8_t               portLocation;   
00058 #endif
00059   uint32_t              i2cRefFreq;     
00060   uint32_t              i2cMaxFreq;     
00061   I2C_ClockHLR_TypeDef  i2cClhr;        
00062 } I2CSPM_Init_TypeDef;
00063 
00064 
00067 #if !defined( I2CSPM_INIT_DEFAULT )
00068 #define I2CSPM_INIT_DEFAULT     \
00069   { I2C0,                       /* Use I2C instance 0 */                        \
00070     gpioPortC,                  /* SCL port */                                  \
00071     5,                          /* SCL pin */                                   \
00072     gpioPortC,                  /* SDA port */                                  \
00073     4,                          /* SDA pin */                                   \
00074     0,                          /* Location */                                  \
00075     0,                          /* Use currently configured reference clock */  \
00076     I2C_FREQ_STANDARD_MAX,      /* Set to standard rate  */                     \
00077     i2cClockHLRStandard,        /* Set to use 4:4 low/high duty cycle */        \
00078   }
00079 #endif
00080 
00081 
00082 /*******************************************************************************
00083  *****************************   PROTOTYPES   **********************************
00084  ******************************************************************************/
00085 
00086 void I2CSPM_Init(I2CSPM_Init_TypeDef *init);
00087 I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq);
00088 
00089 #ifdef __cplusplus
00090 }
00091 #endif
00092 
00096 #endif /* __SILICON_LABS_I2CSPM_H__ */