monoZ docs
MZ_i2c1_instance.c
Go to the documentation of this file.
1
8#include "MZ_i2c1_instance.h"
9#include "MZ_public.h"
10#include "MZ_i2c.h"
11
12static char rx_char = 0;
15void i2c1_tx_intr(void * arg)
16{
17// (void)MZ_I2C_Master_Transmit_IT(MZ_I2C_INSTANCE,(uint16_t)SLAVE_ADD,(uint8_t *)&rx_char,1);
18}
19
20void i2c1_rx_intr(void * arg)
21{
22 (void)MZ_I2C_Master_Receive_IT(MZ_I2C_INSTANCE,(uint16_t)SLAVE_ADD,(uint8_t *)&rx_char,1);
23}
24
26{
28 .Init.Timing = MZ_I2C1_INIT_TIMING,
29 .Init.OwnAddress1 = MZ_I2C1_INIT_OWNADDRESS1,
30 .Init.AddressingMode = MZ_I2C1_INIT_ADDRESSINGMODE,
31 .Init.DualAddressMode = MZ_I2C1_INIT_DUALADDRESSMODE,
32 .Init.OwnAddress2 = MZ_I2C1_INIT_OWNADDRESS2,
33 .Init.OwnAddress2Masks = MZ_I2C1_INIT_OWNADDRESS2MASKS,
34 .Init.GeneralCallMode = MZ_I2C1_INIT_GENERALCALLMODE,
35 .Init.NoStretchMode = MZ_I2C1_INIT_NOSTRETCHMODE
36};
37
39{
40 mz_error_t _ret = MZ_FAIL;
42 {
44 {
45 _ret = MZ_OK;
46 // Initiate 1 Byte receive
47 (void)MZ_I2C_Master_Receive_IT(MZ_I2C_INSTANCE,(uint16_t)SLAVE_ADD, (uint8_t *)&rx_char, 1);
48
49 }
50 }
51
52 return _ret;
53}
54
#define SLAVE_ADD
mz_error_t
Enumeration of monoZ Error Flags.
@ MZ_OK
@ MZ_FAIL
void i2c1_tx_intr(void *arg)
mz_error_t I2C1_init(void)
MZ_I2C_INIT_ST i2c1_instance
static char rx_char
void i2c1_rx_intr(void *arg)
#define MZ_I2C1_INIT_OWNADDRESS1
#define MZ_I2C1_INIT_OWNADDRESS2MASKS
#define MZ_I2C1_INIT_GENERALCALLMODE
#define MZ_I2C1_INIT_DUALADDRESSMODE
#define MZ_I2C1_INIT_NOSTRETCHMODE
#define MZ_I2C1_INIT_ADDRESSINGMODE
#define MZ_I2C1_INIT_OWNADDRESS2
#define MZ_I2C_INSTANCE
#define MZ_I2C1_INIT_TIMING
#define MZ_I2C1_INSTANCE
This file contains all the functionalities for I2C protocol.
monoZ Public All peripheral Configurations will send to monoZ library through this file
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_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.
Structure for I2C Initialization.
Definition: MZ_public.h:37
I2C_TypeDef * Instance
Definition: MZ_public.h:38