39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_one_wire.h"
73#define C1WIREI2C_CMD_WRITE_DATA_WITH_STOP 0x4B
74#define C1WIREI2C_CMD_WRITE_DATA_NO_STOP 0x5A
75#define C1WIREI2C_CMD_WRITE_DATA_ONLY 0x69
76#define C1WIREI2C_CMD_WRITE_DATA_ONLY_WITH_STOP 0x78
77#define C1WIREI2C_CMD_READ_DATA_WITH_STOP 0x87
78#define C1WIREI2C_CMD_WRITE_READ_DATA_WITH_STOP 0x2D
79#define C1WIREI2C_CMD_WRITE_CONFIGURATION 0xD2
80#define C1WIREI2C_CMD_READ_CONFIGURATION 0xE1
81#define C1WIREI2C_CMD_ENABLE_SLEEP_MODE 0x1E
82#define C1WIREI2C_CMD_READ_DEVICE_REVISION 0xC3
100#define C1WIREI2C_CONFIGURATION_SPD_100KHZ 0x00
101#define C1WIREI2C_CONFIGURATION_SPD_400KHZ 0x01
102#define C1WIREI2C_CONFIGURATION_SPD_900KHZ 0x02
103#define C1WIREI2C_CONFIGURATION_SPD_MASK 0x03
109#define C1WIREI2C_FAMILY_CODE 0x19
115#define C1WIREI2C_ADDRESS_0 0x00
116#define C1WIREI2C_ADDRESS_ALL 0xFF
134#define C1WIREI2C_MAP_MIKROBUS( cfg, mikrobus ) \
135 cfg.ow2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
136 cfg.ow1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
137 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
381 uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len );
c1wirei2c_gpio_sel_t
1-Wire I2C Click gpio selector.
Definition c1wirei2c.h:147
@ C1WIREI2C_GPIO_OW2
Definition c1wirei2c.h:149
@ C1WIREI2C_GPIO_OW1
Definition c1wirei2c.h:148
c1wirei2c_return_value_t
1-Wire I2C Click return value data.
Definition c1wirei2c.h:192
@ C1WIREI2C_OK
Definition c1wirei2c.h:193
@ C1WIREI2C_ERROR
Definition c1wirei2c.h:194
void c1wirei2c_gpio_selection(c1wirei2c_cfg_t *cfg, c1wirei2c_gpio_sel_t gpio_sel)
1-Wire I2C driver interface setup function.
err_t c1wirei2c_init(c1wirei2c_t *ctx, c1wirei2c_cfg_t *cfg)
1-Wire I2C initialization function.
err_t c1wirei2c_read_data_stop(c1wirei2c_t *ctx, uint8_t slave_addr, uint8_t *data_out, uint8_t len)
1-Wire I2C read data stop function.
err_t c1wirei2c_read_configuration(c1wirei2c_t *ctx, uint8_t *config)
1-Wire I2C read configuration function.
err_t c1wirei2c_write_data_only(c1wirei2c_t *ctx, uint8_t *data_in, uint8_t len)
1-Wire I2C write data only function.
err_t c1wirei2c_write_data_stop(c1wirei2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t len)
1-Wire I2C write data stop function.
void c1wirei2c_set_rst_pin(c1wirei2c_t *ctx, uint8_t state)
1-Wire I2C set rst pin function.
err_t c1wirei2c_select_device(c1wirei2c_t *ctx)
1-Wire I2C select device function.
err_t c1wirei2c_write_read_data_stop(c1wirei2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t in_len, uint8_t *data_out, uint8_t out_len)
1-Wire I2C write read data stop function.
void c1wirei2c_cfg_setup(c1wirei2c_cfg_t *cfg)
1-Wire I2C configuration object setup function.
err_t c1wirei2c_write_data_only_stop(c1wirei2c_t *ctx, uint8_t *data_in, uint8_t len)
1-Wire I2C write data only stop function.
void c1wirei2c_reset_device(c1wirei2c_t *ctx)
1-Wire I2C reset device function.
err_t c1wirei2c_read_device_revision(c1wirei2c_t *ctx, uint8_t *revision)
1-Wire I2C read device revision function.
err_t c1wirei2c_check_communication(c1wirei2c_t *ctx)
1-Wire I2C check communication function.
err_t c1wirei2c_enable_sleep_mode(c1wirei2c_t *ctx)
1-Wire I2C enable sleep mode function.
err_t c1wirei2c_default_cfg(c1wirei2c_t *ctx)
1-Wire I2C default configuration function.
err_t c1wirei2c_write_configuration(c1wirei2c_t *ctx, uint8_t config)
1-Wire I2C write configuration function.
err_t c1wirei2c_write_data(c1wirei2c_t *ctx, uint8_t slave_addr, uint8_t *data_in, uint8_t len)
1-Wire I2C write data function.
1-Wire I2C Click configuration object.
Definition c1wirei2c.h:175
pin_name_t ow2
Definition c1wirei2c.h:178
c1wirei2c_gpio_sel_t gpio_sel
Definition c1wirei2c.h:183
pin_name_t rst
Definition c1wirei2c.h:181
pin_name_t ow1
Definition c1wirei2c.h:177
1-Wire I2C Click context object.
Definition c1wirei2c.h:158
one_wire_rom_address_t rom_addr
Definition c1wirei2c.h:165
digital_out_t rst
Definition c1wirei2c.h:160
uint8_t address
Definition c1wirei2c.h:166
one_wire_t ow
Definition c1wirei2c.h:163