42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define I2C1WIRE_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
76#define I2C1WIRE_ERROR -1
83#define I2C1WIRE_RESULT_ERROR 0x00
84#define I2C1WIRE_RESULT_OK 0x01
85#define I2C1WIRE_WIRE_RESULT_OK 0xFF
87#define I2C1WIRE_I2C_ADDRESS_0 0x18
88#define I2C1WIRE_I2C_ADDRESS_1 0x19
89#define I2C1WIRE_I2C_ADDRESS_2 0x1A
90#define I2C1WIRE_I2C_ADDRESS_3 0x1B
91#define I2C1WIRE_I2C_ADDRESS_4 0x1C
92#define I2C1WIRE_I2C_ADDRESS_5 0x1D
93#define I2C1WIRE_I2C_ADDRESS_6 0x1E
94#define I2C1WIRE_I2C_ADDRESS_7 0x1F
96#define I2C1WIRE_COMMAND_RESET 0xF0
97#define I2C1WIRE_COMMAND_SRP 0xE1
98#define I2C1WIRE_POINTER_STATUS 0xF0
99#define I2C1WIRE_STATUS_BUSY 0x01
100#define I2C1WIRE_STATUS_PPD 0x02
101#define I2C1WIRE_STATUS_SD 0x04
102#define I2C1WIRE_STATUS_LL 0x08
103#define I2C1WIRE_STATUS_RST 0x10
104#define I2C1WIRE_STATUS_SBR 0x20
105#define I2C1WIRE_STATUS_TSB 0x40
106#define I2C1WIRE_STATUS_DIR 0x80
107#define I2C1WIRE_POINTER_DATA 0xE1
108#define I2C1WIRE_POINTER_CONFIG 0xC3
109#define I2C1WIRE_CONFIG_APU_HIGH 0x30
110#define I2C1WIRE_CONFIG_APU_LOW 0x01
111#define I2C1WIRE_CONFIG_SPU_HIGH 0x60
112#define I2C1WIRE_CONFIG_SPU_LOW 0x04
113#define I2C1WIRE_CONFIG_1WS_HIGH 0xA0
114#define I2C1WIRE_CONFIG_1WS_LOW 0x08
115#define I2C1WIRE_COMMAND_WRITECONFIG 0xD2
116#define I2C1WIRE_COMMAND_RESETWIRE 0xB4
117#define I2C1WIRE_COMMAND_WRITEBYTE 0xA5
118#define I2C1WIRE_COMMAND_READBYTE 0x96
119#define I2C1WIRE_COMMAND_SINGLEBIT 0x87
120#define I2C1WIRE_COMMAND_TRIPLET 0x78
121#define I2C1WIRE_WIRE_COMMAND_SKIP 0xCC
122#define I2C1WIRE_WIRE_COMMAND_SELECT 0x55
123#define I2C1WIRE_WIRE_COMMAND_READ_ROM 0x33
124#define I2C1WIRE_WIRE_COMMAND_SEARCH 0xF0
125#define I2C1WIRE_ERROR_TIMEOUT 0x01
126#define I2C1WIRE_ERROR_SHORT 0x02
127#define I2C1WIRE_ERROR_CONFIG 0x04
128#define I2C1WIRE_CMD_CHSL 0xC3
129#define I2C1WIRE_CH_IO0 0xF0
130#define I2C1WIRE_CH_IO1 0xE1
131#define I2C1WIRE_CH_IO2 0xD2
132#define I2C1WIRE_CH_IO3 0xC3
133#define I2C1WIRE_CH_IO4 0xB4
134#define I2C1WIRE_CH_IO5 0xA5
135#define I2C1WIRE_CH_IO6 0x96
136#define I2C1WIRE_CH_IO7 0x87
137#define I2C1WIRE_RCH_IO0 0xB8
138#define I2C1WIRE_RCH_IO1 0xB1
139#define I2C1WIRE_RCH_IO2 0xAA
140#define I2C1WIRE_RCH_IO3 0xA3
141#define I2C1WIRE_RCH_IO4 0x9C
142#define I2C1WIRE_RCH_IO5 0x95
143#define I2C1WIRE_RCH_IO6 0x8E
144#define I2C1WIRE_RCH_IO7 0x87
uint8_t i2c1wire_read_byte_one_wire(i2c1wire_t *ctx)
Read byte function.
uint8_t i2c1wire_set_config(i2c1wire_t *ctx, uint8_t cfg)
Set configuration function.
void i2c1wire_write_byte_one_wire(i2c1wire_t *ctx, uint8_t input)
Write byte function.
err_t i2c1wire_init(i2c1wire_t *ctx, i2c1wire_cfg_t *cfg)
Initialization function.
void i2c1wire_soft_reset(i2c1wire_t *ctx)
Software reset function.
err_t i2c1wire_generic_read(i2c1wire_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Generic read function.
err_t i2c1wire_generic_write(i2c1wire_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Generic write function.
void i2c1wire_set_read_pointer(i2c1wire_t *ctx, uint8_t ptr)
Set read pointer function.
uint8_t i2c1wire_set_channel(i2c1wire_t *ctx, uint8_t chan)
Set channel function.
void i2c1wire_cfg_setup(i2c1wire_cfg_t *cfg)
Config Object Initialization function.
void i2c1wire_one_wire_reset(i2c1wire_t *ctx)
Reset function.
Click configuration structure definition.
Definition i2c1wire.h:171
uint32_t i2c_speed
Definition i2c1wire.h:177
pin_name_t scl
Definition i2c1wire.h:173
pin_name_t sda
Definition i2c1wire.h:174
uint8_t i2c_address
Definition i2c1wire.h:178
Click ctx object definition.
Definition i2c1wire.h:158
i2c_master_t i2c
Definition i2c1wire.h:160
uint8_t slave_address
Definition i2c1wire.h:163