Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Interfaces for 1-Wire devices. More...

Topics

 1-Wire Sensor API
 1-Wire Sensor API
 1-Wire network layer
 1-Wire network layer

Files

file  w1.h
 Main header file for 1-Wire driver API.

Data Structures

struct  w1_master_config
 @def_driverbackendgroup{1-Wire,w1_interface} More...
struct  w1_master_data
 Data common to all 1-Wire master implementations. More...
struct  w1_driver_api
 @driver_ops{1-Wire} More...

Enumerations

enum  w1_settings_type { W1_SETTING_SPEED , W1_SETTING_STRONG_PULLUP , W1_SETINGS_TYPE_COUNT }
 Defines the 1-Wire master settings types, which are runtime configurable. More...

Functions

static int w1_lock_bus (const struct device *dev)
 Lock the 1-wire bus to prevent simultaneous access.
static int w1_unlock_bus (const struct device *dev)
 Unlock the 1-wire bus.
typedef int(* w1_reset_bus_t) (const struct device *dev)
 Reset the 1-Wire bus to prepare slaves for communication.
typedef int(* w1_read_bit_t) (const struct device *dev)
 Read a single bit from the 1-Wire bus.
typedef int(* w1_write_bit_t) (const struct device *dev, bool bit)
 Write a single bit to the 1-Wire bus.
typedef int(* w1_read_byte_t) (const struct device *dev)
 Read a single byte from the 1-Wire bus.
typedef int(* w1_write_byte_t) (const struct device *dev, const uint8_t byte)
 Write a single byte to the 1-Wire bus.
typedef int(* w1_read_block_t) (const struct device *dev, uint8_t *buffer, size_t len)
 Read a block of data from the 1-Wire bus.
typedef int(* w1_write_block_t) (const struct device *dev, const uint8_t *buffer, size_t len)
 Write a block of data to the 1-Wire bus.
typedef size_t(* w1_get_slave_count_t) (const struct device *dev)
 Get the number of slaves on the bus.
typedef int(* w1_configure_t) (const struct device *dev, enum w1_settings_type type, uint32_t value)
 Configure parameters of the 1-Wire master.
typedef int(* w1_change_bus_lock_t) (const struct device *dev, bool lock)
 Lock or unlock the 1-Wire bus.

Detailed Description

Interfaces for 1-Wire devices.

Since
3.2
Version
0.8.0

Typedef Documentation

◆ w1_change_bus_lock_t

typedef int(* w1_change_bus_lock_t) (const struct device *dev, bool lock)

#include <w1.h>

Lock or unlock the 1-Wire bus.

See w1_lock_bus() and w1_unlock_bus() for details.

◆ w1_configure_t

typedef int(* w1_configure_t) (const struct device *dev, enum w1_settings_type type, uint32_t value)

#include <w1.h>

Configure parameters of the 1-Wire master.

See w1_configure() for argument description.

◆ w1_get_slave_count_t

typedef size_t(* w1_get_slave_count_t) (const struct device *dev)

#include <w1.h>

Get the number of slaves on the bus.

See w1_get_slave_count() for argument description.

◆ w1_read_bit_t

typedef int(* w1_read_bit_t) (const struct device *dev)

#include <w1.h>

Read a single bit from the 1-Wire bus.

See w1_read_bit() for argument description.

◆ w1_read_block_t

typedef int(* w1_read_block_t) (const struct device *dev, uint8_t *buffer, size_t len)

#include <w1.h>

Read a block of data from the 1-Wire bus.

See w1_read_block() for argument description.

◆ w1_read_byte_t

typedef int(* w1_read_byte_t) (const struct device *dev)

#include <w1.h>

Read a single byte from the 1-Wire bus.

See w1_read_byte() for argument description.

◆ w1_reset_bus_t

typedef int(* w1_reset_bus_t) (const struct device *dev)

#include <w1.h>

Reset the 1-Wire bus to prepare slaves for communication.

See w1_reset_bus() for argument description.

◆ w1_write_bit_t

typedef int(* w1_write_bit_t) (const struct device *dev, bool bit)

#include <w1.h>

Write a single bit to the 1-Wire bus.

See w1_write_bit() for argument description.

◆ w1_write_block_t

typedef int(* w1_write_block_t) (const struct device *dev, const uint8_t *buffer, size_t len)

#include <w1.h>

Write a block of data to the 1-Wire bus.

See w1_write_block() for argument description.

◆ w1_write_byte_t

typedef int(* w1_write_byte_t) (const struct device *dev, const uint8_t byte)

#include <w1.h>

Write a single byte to the 1-Wire bus.

See w1_write_byte() for argument description.

Enumeration Type Documentation

◆ w1_settings_type

#include <w1.h>

Defines the 1-Wire master settings types, which are runtime configurable.

Enumerator
W1_SETTING_SPEED 

Overdrive speed is enabled in case a value of 1 is passed and disabled passing 0.

W1_SETTING_STRONG_PULLUP 

The strong pullup resistor is activated immediately after the next written data block by passing a value of 1, and deactivated passing 0.

W1_SETINGS_TYPE_COUNT 

Number of different settings types.

Function Documentation

◆ w1_lock_bus()

int w1_lock_bus ( const struct device * dev)
inlinestatic

#include <w1.h>

Lock the 1-wire bus to prevent simultaneous access.

This routine locks the bus to prevent simultaneous access from different threads. The calling thread waits until the bus becomes available. A thread is permitted to lock a mutex it has already locked.

Parameters
[in]devPointer to the device structure for the driver instance.
Returns
0 on success, negative errno value on failure.

◆ w1_unlock_bus()

int w1_unlock_bus ( const struct device * dev)
inlinestatic

#include <w1.h>

Unlock the 1-wire bus.

This routine unlocks the bus to permit access to bus line.

Parameters
[in]devPointer to the device structure for the driver instance.
Returns
0 on success, negative errno value on failure.