Loading...
Searching...
No Matches
one_wire_host.h File Reference

1-Wire host (master) library More...

#include <stdint.h>
#include <stdbool.h>
#include <furi_hal_gpio.h>

Go to the source code of this file.

Typedefs

typedef struct OneWireHost OneWireHost
 

Enumerations

enum  OneWireHostSearchMode { OneWireHostSearchModeConditional = 0 , OneWireHostSearchModeNormal = 1 }
 

Functions

OneWireHostonewire_host_alloc (const GpioPin *gpio_pin)
 Allocate OneWireHost instance.
 
void onewire_host_free (OneWireHost *host)
 Destroy OneWireHost instance, free resources.
 
bool onewire_host_reset (OneWireHost *host)
 Reset the 1-Wire bus.
 
bool onewire_host_read_bit (OneWireHost *host)
 Read one bit.
 
uint8_t onewire_host_read (OneWireHost *host)
 Read one byte.
 
void onewire_host_read_bytes (OneWireHost *host, uint8_t *buffer, uint16_t count)
 Read one or more bytes.
 
void onewire_host_write_bit (OneWireHost *host, bool value)
 Write one bit.
 
void onewire_host_write (OneWireHost *host, uint8_t value)
 Write one byte.
 
void onewire_host_write_bytes (OneWireHost *host, const uint8_t *buffer, uint16_t count)
 Write one or more bytes.
 
void onewire_host_start (OneWireHost *host)
 Start working with the bus.
 
void onewire_host_stop (OneWireHost *host)
 Stop working with the bus.
 
void onewire_host_reset_search (OneWireHost *host)
 Reset previous search results.
 
void onewire_host_target_search (OneWireHost *host, uint8_t family_code)
 Set the family code to search for.
 
bool onewire_host_search (OneWireHost *host, uint8_t *new_addr, OneWireHostSearchMode mode)
 Search for devices on the 1-Wire bus.
 
void onewire_host_set_overdrive (OneWireHost *host, bool set)
 Enable overdrive mode.
 

Detailed Description

1-Wire host (master) library

Enumeration Type Documentation

◆ OneWireHostSearchMode

Enumerator
OneWireHostSearchModeConditional 

Search for alarmed device.

OneWireHostSearchModeNormal 

Search for all devices.

Function Documentation

◆ onewire_host_alloc()

OneWireHost * onewire_host_alloc ( const GpioPin * gpio_pin)

Allocate OneWireHost instance.

Parameters
[in]gpio_pinconnection pin
Returns
pointer to OneWireHost instance

◆ onewire_host_free()

void onewire_host_free ( OneWireHost * host)

Destroy OneWireHost instance, free resources.

Parameters
[in]hostpointer to OneWireHost instance

◆ onewire_host_read()

uint8_t onewire_host_read ( OneWireHost * host)

Read one byte.

Parameters
[in]hostpointer to OneWireHost instance
Returns
received byte value

◆ onewire_host_read_bit()

bool onewire_host_read_bit ( OneWireHost * host)

Read one bit.

Parameters
[in]hostpointer to OneWireHost instance
Returns
received bit value

◆ onewire_host_read_bytes()

void onewire_host_read_bytes ( OneWireHost * host,
uint8_t * buffer,
uint16_t count )

Read one or more bytes.

Parameters
[in]hostpointer to OneWireHost instance
[out]bufferreceived data buffer
[in]countnumber of bytes to read

◆ onewire_host_reset()

bool onewire_host_reset ( OneWireHost * host)

Reset the 1-Wire bus.

Parameters
[in]hostpointer to OneWireHost instance
Returns
true if presence was detected, false otherwise

◆ onewire_host_reset_search()

void onewire_host_reset_search ( OneWireHost * host)

Reset previous search results.

Parameters
[in]hostpointer to OneWireHost instance

◆ onewire_host_search()

bool onewire_host_search ( OneWireHost * host,
uint8_t * new_addr,
OneWireHostSearchMode mode )

Search for devices on the 1-Wire bus.

Parameters
[in]hostpointer to OneWireHost instance
[out]new_addrpointer to the buffer to contain the unique ROM of the found device
[in]modesearch mode
Returns
true on success, false otherwise

◆ onewire_host_set_overdrive()

void onewire_host_set_overdrive ( OneWireHost * host,
bool set )

Enable overdrive mode.

Parameters
[in]hostpointer to OneWireHost instance
[in]settrue to turn overdrive on, false to turn it off

◆ onewire_host_start()

void onewire_host_start ( OneWireHost * host)

Start working with the bus.

Parameters
[in]hostpointer to OneWireHost instance

◆ onewire_host_stop()

void onewire_host_stop ( OneWireHost * host)

Stop working with the bus.

Parameters
[in]hostpointer to OneWireHost instance

◆ onewire_host_target_search()

void onewire_host_target_search ( OneWireHost * host,
uint8_t family_code )

Set the family code to search for.

Parameters
[in]hostpointer to OneWireHost instance
[in]family_codedevice family code

◆ onewire_host_write()

void onewire_host_write ( OneWireHost * host,
uint8_t value )

Write one byte.

Parameters
[in]hostpointer to OneWireHost instance
valuebyte value to write

◆ onewire_host_write_bit()

void onewire_host_write_bit ( OneWireHost * host,
bool value )

Write one bit.

Parameters
[in]hostpointer to OneWireHost instance
valuebit value to write

◆ onewire_host_write_bytes()

void onewire_host_write_bytes ( OneWireHost * host,
const uint8_t * buffer,
uint16_t count )

Write one or more bytes.

Parameters
[in]hostpointer to OneWireHost instance
[in]bufferpointer to the data to write
[in]countsize of the data to write