monoZ docs
MZ_i2c.h
Go to the documentation of this file.
1
7#ifndef MZ_I2C_H_
8#define MZ_I2C_H_
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13//#include "MZ_common.h"
14#include "MZ_public.h"
15#include "MZ_error_handler.h"
16#include "MZ_i2c.h"
17
22typedef enum
23{
24#if(MZ_I2C1 == 1)
25 _I2C1,
26#endif
27#if(MZ_I2C2 == 1)
29#endif
30#if(MZ_I2C3 == 1)
31 _I2C3,
32#endif
33#if(MZ_I2C4 == 1)
35#endif
38
39#define I2C_MAX_COUNT_SIZE I2C_MAX_COUNT
46
50typedef struct
51{
53 I2C_HandleTypeDef _handler;
66// _i2c_api I2C_process_api; /*!< I2C Custom processing API */
68}MZ_I2CX;
69
74typedef struct
75{
76 I2C_HandleTypeDef *i2c_ptr;
77 enum
78 {
81 }event;
83
88typedef MZ_I2CX MZ_I2C_BTYPE; /* I2C Base Type */
89
94typedef MZ_I2CX * MZ_I2C_BTYPE_PTR; /* I2C Base Type pointer */
95
105MZ_I2C_BTYPE_PTR MZ_I2C_get_base_address(void); // Get the base address of the I2C internal context */
106
114
121mz_error_t MZ_I2C_init(MZ_I2C_INIT_PTR _cfg); // Register a I2C. Need to call from Upper layer */
122
131
140
149
160mz_error_t MZ_I2C_Master_Transmit(uint8_t i2c_no,uint16_t DevAddress,uint8_t *pData,uint16_t Size,uint32_t Timeout);
161
172mz_error_t MZ_I2C_Master_Receive(uint8_t i2c_no,uint16_t DevAddress,uint8_t *pData,uint16_t Size,uint32_t Timeout);
173
183mz_error_t MZ_I2C_Master_Transmit_IT(uint8_t i2c_no,uint16_t DevAddress,uint8_t *pData,uint16_t Size);
184
194mz_error_t MZ_I2C_Master_Receive_IT(uint8_t i2c_no,uint16_t DevAddress,uint8_t *pData,uint16_t Size);
195
201void MZ_HAL_I2C_EV_IRQHandler(uint8_t i2c_no);
208void MZ_HAL_I2C_ER_IRQHandler(uint8_t i2c_no);
210#ifdef __cplusplus
211}
212#endif
213#endif /* MZ_I2C_H_ */
unsigned char mzUint8
1 Byte data type
Definition: MZ_common.h:57
unsigned long int mzUint32
4 Byte data type
Definition: MZ_common.h:95
mzReg
monoZ Register and Deregister
Definition: MZ_common.h:123
void(* _mz_fp)(void *)
Definition: MZ_common.h:33
monoZ Error Handler
mz_error_t
Enumeration of monoZ Error Flags.
This file contains all the functionalities for I2C protocol.
MZ_I2CX MZ_I2C_BTYPE
[TODO]
Definition: MZ_i2c.h:88
en_i2c_no
Enumeration for monoZ I2C Enable or disable the I2C instance.
Definition: MZ_i2c.h:23
@ _I2C4
Definition: MZ_i2c.h:34
@ _I2C2
Definition: MZ_i2c.h:28
@ I2C_MAX_COUNT
Definition: MZ_i2c.h:36
_mz_fp _i2c_api
use _i2c_api as monoZ function pointer
Definition: MZ_i2c.h:45
MZ_I2CX * MZ_I2C_BTYPE_PTR
[TODO]
Definition: MZ_i2c.h:94
monoZ Public All peripheral Configurations will send to monoZ library through this file
MZ_I2C_BTYPE_PTR MZ_I2C_get_base_address(void)
This function returns the base address of all the I2CS defined in SDK.
void MZ_HAL_I2C_EV_IRQHandler(uint8_t i2c_no)
This function defines the Global Event Interrupt handler functions of I2C.
mz_error_t MZ_I2C_init(MZ_I2C_INIT_PTR _cfg)
This function initializes the specific I2C.
mz_error_t MZ_I2C_register_intr_cb_rx(uint8_t i2c_no, _i2c_api cb)
This function registers the RX complete callback function for the specific I2C.
mz_error_t MZ_I2C_register_intr_cb_tx(uint8_t i2c_no, _i2c_api cb)
This function registers the TX complete callback function for the specific I2C.
mz_error_t MZ_I2C_Master_Receive(uint8_t i2c_no, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
This function is used to receive data using I2C in interrupt mode.
mz_error_t MZ_I2C_register_callback(uint8_t I2C_no, _i2c_api cb)
This function registers the I2C callback.
void MZ_HAL_I2C_ER_IRQHandler(uint8_t i2c_no)
This function defines the Global Error Interrupt handler functions of I2C.
mz_error_t MZ_I2C_Master_Receive_IT(uint8_t i2c_no, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
This function is used to receive data using I2C in interrupt mode.
MZ_I2C_BTYPE_PTR MZ_I2C_reference(en_i2c_no i2c_no)
This function returns the address of the specific I2C.
mz_error_t MZ_I2C_Master_Transmit_IT(uint8_t i2c_no, uint16_t DevAddress, uint8_t *pData, uint16_t Size)
This function is used to transmit data using I2C in polling mode.
mz_error_t MZ_I2C_Master_Transmit(uint8_t i2c_no, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
This function is used to transmit data using I2C in interrupt mode.
Structure for I2C Initialization.
Definition: MZ_public.h:37
Structure for monoZ I2C events.
Definition: MZ_i2c.h:51
mzUint8 * _rx_buffer
Definition: MZ_i2c.h:55
_i2c_api I2C_ev_call_back
Definition: MZ_i2c.h:67
I2C_HandleTypeDef _handler
Definition: MZ_i2c.h:53
_i2c_api write
Definition: MZ_i2c.h:63
_i2c_api tx_intr_api
Definition: MZ_i2c.h:65
_i2c_api read
Definition: MZ_i2c.h:62
mzUint8 _enable
Definition: MZ_i2c.h:54
mzUint8 _dev_add
Definition: MZ_i2c.h:61
mzUint8 _tx_intr
Definition: MZ_i2c.h:60
mzUint8 * _tx_buffer
Definition: MZ_i2c.h:57
_i2c_api rx_intr_api
Definition: MZ_i2c.h:64
mzUint8 _rx_intr
Definition: MZ_i2c.h:59
mzReg _reg_status
Definition: MZ_i2c.h:52
mzUint32 _tx_buffer_size
Definition: MZ_i2c.h:58
mzUint32 _rx_buffer_size
Definition: MZ_i2c.h:56
Structure for I2C interrupts.
Definition: MZ_i2c.h:75
@ HALF_COMPLETE1
Definition: MZ_i2c.h:80
@ FULL_COMPLETE1
Definition: MZ_i2c.h:79
I2C_HandleTypeDef * i2c_ptr
Definition: MZ_i2c.h:76