A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31L12x_hal_i2cn.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _I2Cn_H_
36 #define _I2Cn_H_
37 
38 #include "A31L12x.h"
39 #include "A31L12x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
50 #define I2Cn_SLA_BITMASK (0xff)
51 
52 // I2C state handle return values
53 #define RECEIVE_MODE 1
54 #define TRANS_MODE 2
55 #define RECEIVE_DATA 3
56 #define TRANS_DATA 4
57 #define LOST_BUS 5
58 #define STOP_DECT 6
59 
60 //******************************************************************************
61 // Type
62 //******************************************************************************
63 
64 //==============================================================================
65 // Enumeration
66 //==============================================================================
67 
69 typedef enum
70 {
74 
75 //==============================================================================
76 // Structure
77 //==============================================================================
78 
80 typedef struct
81 {
82  uint32_t sl_addr7bit;
83  uint8_t* tx_data;
84  uint32_t tx_length;
85  uint32_t tx_count;
86  uint8_t* rx_data;
87  uint32_t rx_length;
88  uint32_t rx_count;
90 
92 typedef struct
93 {
94  uint8_t* tx_data;
95  uint32_t tx_length;
96  uint32_t tx_count;
97  uint8_t* rx_data;
98  uint32_t rx_length;
99  uint32_t rx_count;
101 
102 //******************************************************************************
103 // Function
104 //******************************************************************************
105 
106 HAL_Status_Type HAL_I2C_Init( I2Cn_Type* I2Cx, uint32_t clockrate );
107 HAL_Status_Type HAL_I2C_DeInit( I2Cn_Type* I2Cx );
108 
109 HAL_Status_Type HAL_I2C_ConfigInterrupt( I2Cn_Type* I2Cx, Bool NewState );
110 HAL_Status_Type HAL_I2C_Slave_SetAddress1( I2Cn_Type* I2Cx, uint8_t SlaveAddr_7bit, uint8_t GeneralCallState );
111 HAL_Status_Type HAL_I2C_Slave_SetAddress2( I2Cn_Type* I2Cx, uint8_t SlaveAddr_7bit, uint8_t GeneralCallState );
112 uint32_t HAL_I2C_Master_GetState( I2Cn_Type* I2Cx );
113 uint32_t HAL_I2C_Slave_GetState( I2Cn_Type* I2Cx );
114 
117 
118 Status HAL_I2C_MasterTransferData( I2Cn_Type* I2Cx, I2Cn_M_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt );
119 Status HAL_I2C_SlaveTransferData( I2Cn_Type* I2Cx, I2Cn_S_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt );
120 
121 Status HAL_I2C_Master_Transmit( I2Cn_Type* I2Cx, I2Cn_M_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt );
122 Status HAL_I2C_Master_Receive( I2Cn_Type* I2Cx, I2Cn_M_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt );
123 Status HAL_I2C_Slave_Receive( I2Cn_Type* I2Cx, I2Cn_S_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt );
124 
125 Status HAL_I2C_MasterTransferData_DMA( I2Cn_Type* I2Cx, I2Cn_M_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type* TxDMACx, DMACn_Type* RxDMACx );
126 Status HAL_I2C_SlaveTransferData_DMA( I2Cn_Type* I2Cx, I2Cn_S_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type* TxDMACx, DMACn_Type* RxDMACx );
127 
128 Status HAL_I2C_MasterTransmit_DMA( I2Cn_Type* I2Cx, I2Cn_M_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type* TxDMACx, DMACn_Type* RxDMACx );
129 Status HAL_I2C_SlaveReceive_DMA( I2Cn_Type* I2Cx, I2Cn_S_SETUP_Type* TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type* TxDMACx, DMACn_Type* RxDMACx );
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* _I2Cn_H_ */
136 
Status HAL_I2C_Master_Transmit(I2Cn_Type *I2Cx, I2Cn_M_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt)
Transmit an array of bytes in Master mode.
HAL_Status_Type HAL_I2C_DeInit(I2Cn_Type *I2Cx)
Deinitialize the I2Cn peripheral registers to their default reset values.
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
HAL_Status_Type
Status HAL_I2C_MasterTransmit_DMA(I2Cn_Type *I2Cx, I2Cn_M_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type *TxDMACx, DMACn_Type *RxDMACx)
Transmit an array of bytes in Master mode by DMA.
Status HAL_I2C_Master_Receive(I2Cn_Type *I2Cx, I2Cn_M_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt)
Receive an array of bytes in Master mode.
HAL_Status_Type HAL_I2C_Slave_SetAddress2(I2Cn_Type *I2Cx, uint8_t SlaveAddr_7bit, uint8_t GeneralCallState)
Set Own slave address in I2C peripheral corresponding to parameter specified in OwnSlaveAddrConfigStr...
Status HAL_I2C_MasterTransferData(I2Cn_Type *I2Cx, I2Cn_M_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt)
Transmit and Receive data in master mode.
uint32_t HAL_I2C_Master_GetState(I2Cn_Type *I2Cx)
Get Status of Master Transfer.
HAL_Status_Type HAL_I2C_ConfigInterrupt(I2Cn_Type *I2Cx, Bool NewState)
Enable/Disable interrupt for I2C peripheral.
I2Cn_TRANSFER_OPT_Type
Status HAL_I2C_MasterTransferData_DMA(I2Cn_Type *I2Cx, I2Cn_M_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type *TxDMACx, DMACn_Type *RxDMACx)
Transmit and Receive data in master mode by DMA.
Status HAL_I2C_SlaveTransferData_DMA(I2Cn_Type *I2Cx, I2Cn_S_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type *TxDMACx, DMACn_Type *RxDMACx)
Receive and Transmit data in slave mode by DMA.
uint32_t HAL_I2C_Slave_GetState(I2Cn_Type *I2Cx)
Get Status of Slave Transfer.
HAL_Status_Type HAL_I2C_Slave_IRQHandler_IT(I2Cn_Type *I2Cx)
General Slave Interrupt handler for I2C peripheral.
HAL_Status_Type HAL_I2C_Slave_SetAddress1(I2Cn_Type *I2Cx, uint8_t SlaveAddr_7bit, uint8_t GeneralCallState)
Set Own slave address in I2C peripheral corresponding to parameter specified in OwnSlaveAddrConfigStr...
Status HAL_I2C_SlaveTransferData(I2Cn_Type *I2Cx, I2Cn_S_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt)
Receive and Transmit data in slave mode.
Status HAL_I2C_Slave_Receive(I2Cn_Type *I2Cx, I2Cn_S_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt)
Receive an array of bytes in Slave mode.
HAL_Status_Type HAL_I2C_Master_IRQHandler_IT(I2Cn_Type *I2Cx)
General Master Interrupt handler for I2C peripheral.
HAL_Status_Type HAL_I2C_Init(I2Cn_Type *I2Cx, uint32_t clockrate)
Initialize the I2Cn peripheral with the specified parameters.
Status HAL_I2C_SlaveReceive_DMA(I2Cn_Type *I2Cx, I2Cn_S_SETUP_Type *TransferCfg, I2Cn_TRANSFER_OPT_Type Opt, DMACn_Type *TxDMACx, DMACn_Type *RxDMACx)
Receive an array of bytes in Slave mode by DMA.