Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_onewire

Driver for 1-Wire. More...

Macros

#define BC_ONEWIRE_DEVICE_NUMBER_SKIP_ROM   0
 

Functions

void bc_onewire_init (bc_gpio_channel_t channel)
 Initialize 1-Wire. More...
 
bool bc_onewire_transaction_start (bc_gpio_channel_t channel)
 Start transaction, enable pll and run timer. More...
 
bool bc_onewire_transaction_stop (bc_gpio_channel_t channel)
 Stop transaction. More...
 
bool bc_onewire_reset (bc_gpio_channel_t channel)
 Reset the 1-Wire bus and return the presence of any device. More...
 
void bc_onewire_select (bc_gpio_channel_t channel, uint64_t *device_number)
 Select device. More...
 
void bc_onewire_skip_rom (bc_gpio_channel_t channel)
 Skip ROM. More...
 
void bc_onewire_write (bc_gpio_channel_t channel, const void *buffer, size_t length)
 Select device. More...
 
void bc_onewire_read (bc_gpio_channel_t channel, void *buffer, size_t length)
 Select device. More...
 
void bc_onewire_write_8b (bc_gpio_channel_t channel, uint8_t data)
 Select device. More...
 
uint8_t bc_onewire_read_8b (bc_gpio_channel_t channel)
 Select device. More...
 
void bc_onewire_write_bit (bc_gpio_channel_t channel, int bit)
 Select device. More...
 
int bc_onewire_read_bit (bc_gpio_channel_t channel)
 Select device. More...
 
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. More...
 
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. More...
 
void bc_onewire_search_start (uint8_t family_code)
 Start of manual search, see also bc_onewire_search_next. More...
 
bool bc_onewire_search_next (bc_gpio_channel_t channel, uint64_t *device_number)
 Manual search of next device. More...
 
void bc_onewire_auto_ds28e17_sleep_mode (bool on)
 Enable call sleep mode for all ds28e17 after transaction. More...
 
uint8_t bc_onewire_crc8 (const void *buffer, size_t length, uint8_t crc)
 Calculate 8-bit CRC. More...
 
uint16_t bc_onewire_crc16 (const void *buffer, size_t length, uint16_t crc)
 Calculate 16-bit CRC, polynomial 0x8005. More...
 

Detailed Description

Driver for 1-Wire.

Function Documentation

void bc_onewire_auto_ds28e17_sleep_mode ( bool  on)

Enable call sleep mode for all ds28e17 after transaction.

Parameters
[in]on

Definition at line 545 of file bc_onewire.c.

Referenced by bc_ds28e17_init(), and bc_soil_sensor_init_multiple().

Here is the caller graph for this function:

uint16_t bc_onewire_crc16 ( const void *  buffer,
size_t  length,
uint16_t  crc 
)

Calculate 16-bit CRC, polynomial 0x8005.

Parameters
[in]buffer
[in]lengthNumber of bytes
[in]Thecrc starting value
Returns
Calculated CRC

Definition at line 224 of file bc_onewire.c.

uint8_t bc_onewire_crc8 ( const void *  buffer,
size_t  length,
uint8_t  crc 
)

Calculate 8-bit CRC.

Parameters
[in]buffer
[in]lengthNumber of bytes
[in]Thecrc starting value
Returns
Calculated CRC

Definition at line 197 of file bc_onewire.c.

Referenced by bc_onewire_search_next().

Here is the caller graph for this function:

void bc_onewire_init ( bc_gpio_channel_t  channel)

Initialize 1-Wire.

Parameters
channelGPIO channel

Definition at line 35 of file bc_onewire.c.

Referenced by bc_ds28e17_init(), bc_module_sensor_onewire_init(), bc_onewire_relay_init(), and bc_soil_sensor_init_multiple().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_onewire_read ( bc_gpio_channel_t  channel,
void *  buffer,
size_t  length 
)

Select device.

Parameters
channelGPIO channel
[out]dataOutput which have been read
[in]lengthNumber of bytes to be read

Definition at line 142 of file bc_onewire.c.

uint8_t bc_onewire_read_8b ( bc_gpio_channel_t  channel)

Select device.

Parameters
channelGPIO channel
Returns
data which have been read

Definition at line 159 of file bc_onewire.c.

Referenced by bc_onewire_relay_set_state().

Here is the caller graph for this function:

int bc_onewire_read_bit ( bc_gpio_channel_t  channel)

Select device.

Parameters
channelGPIO channel
Returns
bit which have been read

Definition at line 174 of file bc_onewire.c.

bool bc_onewire_reset ( bc_gpio_channel_t  channel)

Reset the 1-Wire bus and return the presence of any device.

Parameters
channelGPIO channel
Returns
true Device present
false No device present

Definition at line 91 of file bc_onewire.c.

Referenced by bc_ds28e17_set_speed(), and bc_onewire_relay_set_state().

Here is the caller graph for this function:

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.

Parameters
[in]channelGPIO channel
[out]device_listPointer to destination array holding list of devices
[in]device_list_sizeSize of array holding list of devices
Returns
Number of found devices

Definition at line 182 of file bc_onewire.c.

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.

Parameters
[in]channelGPIO channel
[in]family_code
[out]device_listPointer to destination array holding list of devices
[in]device_list_sizeSize of array holding list of devices
Returns
Number of found devices

Definition at line 189 of file bc_onewire.c.

bool bc_onewire_search_next ( bc_gpio_channel_t  channel,
uint64_t *  device_number 
)

Manual search of next device.

Parameters
[in]device_numberGPIO channel
[in]device_number64b device number
Returns
true if new device was found, false if ther are no more devices on the bus

Definition at line 408 of file bc_onewire.c.

Here is the call graph for this function:

void bc_onewire_search_start ( uint8_t  family_code)

Start of manual search, see also bc_onewire_search_next.

Parameters
[in]family_codeFamily code of 1-Wire device or NULL

Definition at line 396 of file bc_onewire.c.

void bc_onewire_select ( bc_gpio_channel_t  channel,
uint64_t *  device_number 
)

Select device.

Parameters
channelGPIO channel
[in]device_numberDevice number (for 0 skip ROM)

Definition at line 104 of file bc_onewire.c.

Referenced by bc_ds28e17_set_speed(), and bc_onewire_relay_set_state().

Here is the caller graph for this function:

void bc_onewire_skip_rom ( bc_gpio_channel_t  channel)

Skip ROM.

Parameters
channelGPIO channel

Definition at line 125 of file bc_onewire.c.

bool bc_onewire_transaction_start ( bc_gpio_channel_t  channel)

Start transaction, enable pll and run timer.

Parameters
channelGPIO channel
Returns
true On success
false On failure

Definition at line 51 of file bc_onewire.c.

Referenced by bc_ds28e17_set_speed().

Here is the caller graph for this function:

bool bc_onewire_transaction_stop ( bc_gpio_channel_t  channel)

Stop transaction.

Parameters
channelGPIO channel
Returns
true On success
false On failure

Definition at line 67 of file bc_onewire.c.

Referenced by bc_ds28e17_set_speed().

Here is the caller graph for this function:

void bc_onewire_write ( bc_gpio_channel_t  channel,
const void *  buffer,
size_t  length 
)

Select device.

Parameters
channelGPIO channel
[in]dataInput data to be written
[in]lengthNumber of bytes to be written

Definition at line 132 of file bc_onewire.c.

Referenced by bc_ds28e17_set_speed(), and bc_onewire_relay_set_state().

Here is the caller graph for this function:

void bc_onewire_write_8b ( bc_gpio_channel_t  channel,
uint8_t  data 
)

Select device.

Parameters
channelGPIO channel
[in]dataInput data to be written

Definition at line 152 of file bc_onewire.c.

void bc_onewire_write_bit ( bc_gpio_channel_t  channel,
int  bit 
)

Select device.

Parameters
channelGPIO channel
[in]bitInput bit to be written

Definition at line 167 of file bc_onewire.c.