c1wirei2c 2.1.0.0
|
API for configuring and manipulating 1-Wire I2C Click driver. More...
Topics | |
1-Wire I2C Commands List | |
List of commands of 1-Wire I2C Click driver. | |
1-Wire I2C Settings | |
Settings of 1-Wire I2C Click driver. | |
1-Wire I2C MikroBUS Map | |
MikroBUS pin mapping of 1-Wire I2C Click driver. | |
Functions | |
void | c1wirei2c_cfg_setup (c1wirei2c_cfg_t *cfg) |
1-Wire I2C configuration object setup function. | |
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_default_cfg (c1wirei2c_t *ctx) |
1-Wire I2C default configuration function. | |
err_t | c1wirei2c_check_communication (c1wirei2c_t *ctx) |
1-Wire I2C check communication function. | |
err_t | c1wirei2c_select_device (c1wirei2c_t *ctx) |
1-Wire I2C select device 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. | |
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. | |
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_only_stop (c1wirei2c_t *ctx, uint8_t *data_in, uint8_t len) |
1-Wire I2C write data only stop 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_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. | |
err_t | c1wirei2c_write_configuration (c1wirei2c_t *ctx, uint8_t config) |
1-Wire I2C write configuration function. | |
err_t | c1wirei2c_read_configuration (c1wirei2c_t *ctx, uint8_t *config) |
1-Wire I2C read configuration function. | |
err_t | c1wirei2c_enable_sleep_mode (c1wirei2c_t *ctx) |
1-Wire I2C enable sleep mode function. | |
err_t | c1wirei2c_read_device_revision (c1wirei2c_t *ctx, uint8_t *revision) |
1-Wire I2C read device revision function. | |
void | c1wirei2c_set_rst_pin (c1wirei2c_t *ctx, uint8_t state) |
1-Wire I2C set rst pin function. | |
void | c1wirei2c_reset_device (c1wirei2c_t *ctx) |
1-Wire I2C reset device function. | |
API for configuring and manipulating 1-Wire I2C Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void c1wirei2c_cfg_setup | ( | c1wirei2c_cfg_t * | cfg | ) |
1-Wire I2C configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See c1wirei2c_cfg_t object definition for detailed explanation. |
err_t c1wirei2c_check_communication | ( | c1wirei2c_t * | ctx | ) |
1-Wire I2C check communication function.
This function checks the communication by reading the ROM address as well as verifying family code and CRC 8.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t c1wirei2c_default_cfg | ( | c1wirei2c_t * | ctx | ) |
1-Wire I2C default configuration function.
This function executes a default configuration of 1-Wire I2C click board.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t c1wirei2c_enable_sleep_mode | ( | c1wirei2c_t * | ctx | ) |
1-Wire I2C enable sleep mode function.
This function puts the device into a low current mode. All 1-Wire communication is ignored until woken up.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void c1wirei2c_gpio_selection | ( | c1wirei2c_cfg_t * | cfg, |
c1wirei2c_gpio_sel_t | gpio_sel ) |
1-Wire I2C driver interface setup function.
This function sets a communication GPIO pin which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See c1wirei2c_cfg_t object definition for detailed explanation. |
[in] | gpio_sel | : GPIO pin selection. See c1wirei2c_gpio_sel_t object definition for detailed explanation. |
err_t c1wirei2c_init | ( | c1wirei2c_t * | ctx, |
c1wirei2c_cfg_t * | cfg ) |
1-Wire I2C initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See c1wirei2c_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t c1wirei2c_read_configuration | ( | c1wirei2c_t * | ctx, |
uint8_t * | config ) |
1-Wire I2C read configuration function.
This function is used to read the settings of the I2C speed bits from the Configuration register.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[out] | config | : Configuration byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
This function is used to address and read 1-255 bytes from an I2C slave in one transaction.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | slave_addr | : 7-bit slave address. |
[out] | data_out | : Output data read. |
[in] | len | : Number of data bytes to read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t c1wirei2c_read_device_revision | ( | c1wirei2c_t * | ctx, |
uint8_t * | revision ) |
1-Wire I2C read device revision function.
This function reads the device revision. The read data byte contains the major revision in the upper nibble of the bytes and the minor revision in the lower nibble of the byte.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[out] | revision | : Device revision byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void c1wirei2c_reset_device | ( | c1wirei2c_t * | ctx | ) |
1-Wire I2C reset device function.
This function resets the device by toggling the RST pin state.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
err_t c1wirei2c_select_device | ( | c1wirei2c_t * | ctx | ) |
1-Wire I2C select device function.
This function selects the device by performing a skip or match ROM commands depending on the address value set in the ctx->address.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void c1wirei2c_set_rst_pin | ( | c1wirei2c_t * | ctx, |
uint8_t | state ) |
1-Wire I2C set rst pin function.
This function sets the reset pin logic state.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t c1wirei2c_write_configuration | ( | c1wirei2c_t * | ctx, |
uint8_t | config ) |
1-Wire I2C write configuration function.
This function is used to write the settings of the I2C speed bits per the formatting of the Configuration register.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | config | : Configuration byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
This function addresses and writes 1-255 bytes to an I2C slave without completing the transaction with a stop. It allows writing large amounts of data at one time when used in conjunction with the c1wirei2c_write_data_only or c1wirei2c_write_data_only_stop functions.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | slave_addr | : 7-bit slave address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of data bytes. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t c1wirei2c_write_data_only | ( | c1wirei2c_t * | ctx, |
uint8_t * | data_in, | ||
uint8_t | len ) |
1-Wire I2C write data only function.
This function is used when a start and I2C address have previously been issued with a Write Data No Stop Device command. It writes 1-255 bytes to an I2C slave without completing the transaction with a stop and enables writing large amounts of data at one time when used with more Write Data Only or a last Write Data Only with Stop Device commands.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of data bytes. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
This function is used when a start and I2C address have previously been issued with a Write Data No Stop Device command. This command writes 1-255 bytes to an I2C slave completing the transaction with a stop.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of data bytes. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
This function is used to address and write 1-255 bytes to an I2C slave in one transaction.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | slave_addr | : 7-bit slave address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of data bytes. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. 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.
This function is used to first address and write 1-255 bytes to an I2C slave. Secondly, it addresses and reads 1-255 bytes from an I2C slave and issues a stop.
[in] | ctx | : Click context object. See c1wirei2c_t object definition for detailed explanation. |
[in] | slave_addr | : 7-bit slave address. |
[in] | data_in | : Data to be written. |
[in] | in_len | : Number of data bytes to write. |
[out] | data_out | : Output data read. |
[in] | out_len | : Number of data bytes to read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.