Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_onewire.h
1 #ifndef _BC_ONEWIRE_H
2 #define _BC_ONEWIRE_H
3 
4 #include <bc_gpio.h>
5 
9 
10 #define BC_ONEWIRE_DEVICE_NUMBER_SKIP_ROM 0
11 
14 
16 
21 
23 
28 
30 
35 
37 
41 
42 void bc_onewire_select(bc_gpio_channel_t channel, uint64_t *device_number);
43 
46 
48 
53 
54 void bc_onewire_write(bc_gpio_channel_t channel, const void *buffer, size_t length);
55 
60 
61 void bc_onewire_read(bc_gpio_channel_t channel, void *buffer, size_t length);
62 
66 
67 void bc_onewire_write_8b(bc_gpio_channel_t channel, uint8_t data);
68 
72 
73 uint8_t bc_onewire_read_8b(bc_gpio_channel_t channel);
74 
78 
79 void bc_onewire_write_bit(bc_gpio_channel_t channel, int bit);
80 
84 
86 
92 
93 int bc_onewire_search_all(bc_gpio_channel_t channel, uint64_t *device_list, size_t device_list_size);
94 
101 
102 int bc_onewire_search_family(bc_gpio_channel_t channel, uint8_t family_code, uint64_t *device_list, size_t device_list_size);
103 
106 
107 void bc_onewire_search_start(uint8_t family_code);
108 
113 
114 bool bc_onewire_search_next(bc_gpio_channel_t channel, uint64_t *device_number);
115 
118 
120 
126 
127 uint8_t bc_onewire_crc8(const void *buffer, size_t length, uint8_t crc);
128 
134 
135 uint16_t bc_onewire_crc16(const void *buffer, size_t length, uint16_t crc);
136 
138 
139 #endif // _BC_ONEWIRE_H
bool bc_onewire_search_next(bc_gpio_channel_t channel, uint64_t *device_number)
Manual search of next device.
Definition: bc_onewire.c:408
int bc_onewire_read_bit(bc_gpio_channel_t channel)
Select device.
Definition: bc_onewire.c:174
int bc_onewire_search_all(bc_gpio_channel_t channel, uint64_t *device_list, size_t device_list_size)
Search for all devices on 1-Wire.
Definition: bc_onewire.c:182
bool bc_onewire_transaction_stop(bc_gpio_channel_t channel)
Stop transaction.
Definition: bc_onewire.c:67
void bc_onewire_auto_ds28e17_sleep_mode(bool on)
Enable call sleep mode for all ds28e17 after transaction.
Definition: bc_onewire.c:545
void bc_onewire_write_bit(bc_gpio_channel_t channel, int bit)
Select device.
Definition: bc_onewire.c:167
void bc_onewire_write_8b(bc_gpio_channel_t channel, uint8_t data)
Select device.
Definition: bc_onewire.c:152
void bc_onewire_search_start(uint8_t family_code)
Start of manual search, see also bc_onewire_search_next.
Definition: bc_onewire.c:396
bool bc_onewire_reset(bc_gpio_channel_t channel)
Reset the 1-Wire bus and return the presence of any device.
Definition: bc_onewire.c:91
void bc_onewire_init(bc_gpio_channel_t channel)
Initialize 1-Wire.
Definition: bc_onewire.c:35
void bc_onewire_select(bc_gpio_channel_t channel, uint64_t *device_number)
Select device.
Definition: bc_onewire.c:104
bool bc_onewire_transaction_start(bc_gpio_channel_t channel)
Start transaction, enable pll and run timer.
Definition: bc_onewire.c:51
uint8_t bc_onewire_crc8(const void *buffer, size_t length, uint8_t crc)
Calculate 8-bit CRC.
Definition: bc_onewire.c:197
uint16_t bc_onewire_crc16(const void *buffer, size_t length, uint16_t crc)
Calculate 16-bit CRC, polynomial 0x8005.
Definition: bc_onewire.c:224
bc_gpio_channel_t
GPIO channels.
Definition: bc_gpio.h:12
void bc_onewire_write(bc_gpio_channel_t channel, const void *buffer, size_t length)
Select device.
Definition: bc_onewire.c:132
void bc_onewire_skip_rom(bc_gpio_channel_t channel)
Skip ROM.
Definition: bc_onewire.c:125
int bc_onewire_search_family(bc_gpio_channel_t channel, uint8_t family_code, uint64_t *device_list, size_t device_list_size)
Search for all devices on 1-Wire with family code.
Definition: bc_onewire.c:189
void bc_onewire_read(bc_gpio_channel_t channel, void *buffer, size_t length)
Select device.
Definition: bc_onewire.c:142
uint8_t bc_onewire_read_8b(bc_gpio_channel_t channel)
Select device.
Definition: bc_onewire.c:159