Firmware SDK
|
Driver for 1-Wire. More...
Macros | |
#define | TWR_ONEWIRE_DEVICE_NUMBER_SKIP_ROM 0 |
Typedefs | |
typedef struct twr_onewire_t | twr_onewire_t |
1-Wire instance | |
Functions | |
void | twr_onewire_init_gpio (twr_onewire_t *self, twr_gpio_channel_t channel) |
bool | twr_onewire_init (twr_onewire_t *self, const twr_onewire_driver_t *driver, void *driver_ctx) |
Initialize 1-Wire. More... | |
bool | twr_onewire_transaction_start (twr_onewire_t *self) |
Start transaction, enable pll and run timer. More... | |
bool | twr_onewire_transaction_stop (twr_onewire_t *self) |
Stop transaction. More... | |
bool | twr_onewire_is_transaction (twr_onewire_t *self) |
Is transaction run. More... | |
bool | twr_onewire_reset (twr_onewire_t *self) |
Reset the 1-Wire bus and return the presence of any device. More... | |
void | twr_onewire_select (twr_onewire_t *self, uint64_t *device_number) |
Select device. More... | |
void | twr_onewire_skip_rom (twr_onewire_t *self) |
Skip ROM. More... | |
void | twr_onewire_write (twr_onewire_t *self, const void *buffer, size_t length) |
Select device. More... | |
void | twr_onewire_read (twr_onewire_t *self, void *buffer, size_t length) |
Select device. More... | |
void | twr_onewire_write_byte (twr_onewire_t *self, uint8_t data) |
Select device. More... | |
uint8_t | twr_onewire_read_byte (twr_onewire_t *self) |
Select device. More... | |
void | twr_onewire_write_bit (twr_onewire_t *self, int bit) |
Select device. More... | |
int | twr_onewire_read_bit (twr_onewire_t *self) |
Select device. More... | |
int | twr_onewire_search_all (twr_onewire_t *self, uint64_t *device_list, size_t device_list_size) |
Search for all devices on 1-Wire. More... | |
int | twr_onewire_search_family (twr_onewire_t *self, uint8_t family_code, uint64_t *device_list, size_t device_list_size) |
Search for all devices on 1-Wire with family code. More... | |
void | twr_onewire_search_start (twr_onewire_t *self, uint8_t family_code) |
Start of manual search, see also twr_onewire_search_next. More... | |
bool | twr_onewire_search_next (twr_onewire_t *self, uint64_t *device_number) |
Manual search of next device. More... | |
void | twr_onewire_auto_ds28e17_sleep_mode (twr_onewire_t *self, bool on) |
Enable call sleep mode for all ds28e17 after transaction. More... | |
uint8_t | twr_onewire_crc8 (const void *buffer, size_t length, uint8_t crc) |
Calculate 8-bit CRC. More... | |
uint16_t | twr_onewire_crc16 (const void *buffer, size_t length, uint16_t crc) |
Calculate 16-bit CRC, polynomial 0x8005. More... | |
void | twr_onewire_ds2484_init (twr_onewire_t *onewire, twr_ds2484_t *twr_ds2484) |
Initialize 1-Wire. More... | |
void | twr_onewire_gpio_init (twr_onewire_t *onewire, twr_gpio_channel_t channel) |
Initialize 1-Wire. More... | |
const twr_onewire_driver_t * | twr_onewire_gpio_det_driver (void) |
Driver for 1-Wire.
Driver for GPIO 1-Wire.
void twr_onewire_auto_ds28e17_sleep_mode | ( | twr_onewire_t * | self, |
bool | on | ||
) |
Enable call sleep mode for all ds28e17 after transaction.
[in] | on |
Definition at line 160 of file twr_onewire.c.
Referenced by twr_ds28e17_init(), and twr_soil_sensor_init_multiple().
uint16_t twr_onewire_crc16 | ( | const void * | buffer, |
size_t | length, | ||
uint16_t | crc | ||
) |
Calculate 16-bit CRC, polynomial 0x8005.
[in] | buffer | |
[in] | length | Number of bytes |
[in] | The | crc starting value |
Definition at line 192 of file twr_onewire.c.
uint8_t twr_onewire_crc8 | ( | const void * | buffer, |
size_t | length, | ||
uint8_t | crc | ||
) |
Calculate 8-bit CRC.
[in] | buffer | |
[in] | length | Number of bytes |
[in] | The | crc starting value |
Definition at line 165 of file twr_onewire.c.
void twr_onewire_ds2484_init | ( | twr_onewire_t * | onewire, |
twr_ds2484_t * | twr_ds2484 | ||
) |
Initialize 1-Wire.
[in] | onewire | Instance 1-Wire |
Definition at line 30 of file twr_onewire_ds2484.c.
Referenced by twr_module_x1_init().
void twr_onewire_gpio_init | ( | twr_onewire_t * | onewire, |
twr_gpio_channel_t | channel | ||
) |
Initialize 1-Wire.
[in] | onewire | Instance 1-Wire |
[in] | gpio_channel | GPIO channel |
Definition at line 30 of file twr_onewire_gpio.c.
Referenced by twr_module_sensor_get_onewire().
bool twr_onewire_init | ( | twr_onewire_t * | self, |
const twr_onewire_driver_t * | driver, | ||
void * | driver_ctx | ||
) |
Initialize 1-Wire.
[in] | self | Instance |
[in] | driver | Driver |
[in] | driver_ctx | Driver context |
Definition at line 12 of file twr_onewire.c.
Referenced by twr_onewire_ds2484_init(), and twr_onewire_gpio_init().
bool twr_onewire_is_transaction | ( | twr_onewire_t * | self | ) |
Is transaction run.
[in] | self | Instance |
Definition at line 50 of file twr_onewire.c.
void twr_onewire_read | ( | twr_onewire_t * | self, |
void * | buffer, | ||
size_t | length | ||
) |
Select device.
[in] | self | Instance |
[out] | data | Output which have been read |
[in] | length | Number of bytes to be read |
Definition at line 106 of file twr_onewire.c.
int twr_onewire_read_bit | ( | twr_onewire_t * | self | ) |
Select device.
[in] | self | Instance |
Definition at line 138 of file twr_onewire.c.
uint8_t twr_onewire_read_byte | ( | twr_onewire_t * | self | ) |
Select device.
[in] | self | Instance |
Definition at line 123 of file twr_onewire.c.
Referenced by twr_onewire_relay_set_state().
bool twr_onewire_reset | ( | twr_onewire_t * | self | ) |
Reset the 1-Wire bus and return the presence of any device.
[in] | self | Instance |
Definition at line 55 of file twr_onewire.c.
Referenced by twr_ds28e17_set_speed(), and twr_onewire_relay_set_state().
int twr_onewire_search_all | ( | twr_onewire_t * | self, |
uint64_t * | device_list, | ||
size_t | device_list_size | ||
) |
Search for all devices on 1-Wire.
[in] | channel | GPIO channel |
[out] | device_list | Pointer to destination array holding list of devices |
[in] | device_list_size | Size of array holding list of devices |
Definition at line 146 of file twr_onewire.c.
int twr_onewire_search_family | ( | twr_onewire_t * | self, |
uint8_t | family_code, | ||
uint64_t * | device_list, | ||
size_t | device_list_size | ||
) |
Search for all devices on 1-Wire with family code.
[in] | channel | GPIO channel |
[in] | family_code | |
[out] | device_list | Pointer to destination array holding list of devices |
[in] | device_list_size | Size of array holding list of devices |
Definition at line 153 of file twr_onewire.c.
bool twr_onewire_search_next | ( | twr_onewire_t * | self, |
uint64_t * | device_number | ||
) |
Manual search of next device.
[in] | device_number | GPIO channel |
[in] | device_number | 64b device number |
Definition at line 226 of file twr_onewire.c.
void twr_onewire_search_start | ( | twr_onewire_t * | self, |
uint8_t | family_code | ||
) |
Start of manual search, see also twr_onewire_search_next.
[in] | channel | GPIO channel |
[in] | family_code | Family code of 1-Wire device or NULL |
Definition at line 214 of file twr_onewire.c.
void twr_onewire_select | ( | twr_onewire_t * | self, |
uint64_t * | device_number | ||
) |
Select device.
[in] | self | Instance |
[in] | device_number | Device number (for 0 skip ROM) |
Definition at line 68 of file twr_onewire.c.
Referenced by twr_ds28e17_set_speed(), and twr_onewire_relay_set_state().
void twr_onewire_skip_rom | ( | twr_onewire_t * | self | ) |
bool twr_onewire_transaction_start | ( | twr_onewire_t * | self | ) |
Start transaction, enable pll and run timer.
[in] | self | Instance |
Definition at line 31 of file twr_onewire.c.
Referenced by twr_ds28e17_set_speed().
bool twr_onewire_transaction_stop | ( | twr_onewire_t * | self | ) |
Stop transaction.
[in] | self | Instance |
Definition at line 43 of file twr_onewire.c.
Referenced by twr_ds28e17_set_speed().
void twr_onewire_write | ( | twr_onewire_t * | self, |
const void * | buffer, | ||
size_t | length | ||
) |
Select device.
[in] | self | Instance |
[in] | data | Input data to be written |
[in] | length | Number of bytes to be written |
Definition at line 96 of file twr_onewire.c.
Referenced by twr_ds28e17_set_speed(), and twr_onewire_relay_set_state().
void twr_onewire_write_bit | ( | twr_onewire_t * | self, |
int | bit | ||
) |
Select device.
[in] | self | Instance |
[in] | bit | Input bit to be written |
Definition at line 131 of file twr_onewire.c.
void twr_onewire_write_byte | ( | twr_onewire_t * | self, |
uint8_t | data | ||
) |
Select device.
[in] | self | Instance |
[in] | data | Input data to be written |
Definition at line 116 of file twr_onewire.c.