Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
1-Wire data link layer More...
Functions | |
int | w1_reset_bus (const struct device *dev) |
Reset the 1-Wire bus to prepare slaves for communication. | |
int | w1_read_bit (const struct device *dev) |
Read a single bit from the 1-Wire bus. | |
int | w1_write_bit (const struct device *dev, const bool bit) |
Write a single bit to the 1-Wire bus. | |
int | w1_read_byte (const struct device *dev) |
Read a single byte from the 1-Wire bus. | |
int | w1_write_byte (const struct device *dev, uint8_t byte) |
Write a single byte to the 1-Wire bus. | |
int | w1_read_block (const struct device *dev, uint8_t *buffer, size_t len) |
Read a block of data from the 1-Wire bus. | |
int | w1_write_block (const struct device *dev, const uint8_t *buffer, size_t len) |
Write a block of data from the 1-Wire bus. | |
size_t | w1_get_slave_count (const struct device *dev) |
Get the number of slaves on the bus. | |
int | w1_configure (const struct device *dev, enum w1_settings_type type, uint32_t value) |
Configure parameters of the 1-Wire master. | |
1-Wire data link layer
int w1_configure | ( | const struct device * | dev, |
enum w1_settings_type | type, | ||
uint32_t | value | ||
) |
#include <zephyr/drivers/w1.h>
Configure parameters of the 1-Wire master.
Allowed configuration parameters are defined in enum w1_settings_type, but master devices may not support all types.
[in] | dev | Pointer to the device structure for the driver instance. |
type | Enum specifying the setting type. | |
value | The new value for the passed settings type. |
0 | If successful. |
-ENOTSUP | The master doesn't support the configuration of the supplied type. |
-EIO | General input / output error, failed to configure master devices. |
#include <zephyr/drivers/w1.h>
Get the number of slaves on the bus.
[in] | dev | Pointer to the device structure for the driver instance. |
slave_count | Positive Number of connected 1-Wire slaves on success. |
-errno | Negative error code on error. |
int w1_read_bit | ( | const struct device * | dev | ) |
#include <zephyr/drivers/w1.h>
Read a single bit from the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
rx_bit | The read bit value on success. |
-errno | Negative error code on error. |
#include <zephyr/drivers/w1.h>
Read a block of data from the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
[out] | buffer | Pointer to receive buffer. |
len | Length of receiving buffer (in bytes). |
0 | If successful. |
-errno | Negative error code on error. |
int w1_read_byte | ( | const struct device * | dev | ) |
#include <zephyr/drivers/w1.h>
Read a single byte from the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
rx_byte | The read byte value on success. |
-errno | Negative error code on error. |
int w1_reset_bus | ( | const struct device * | dev | ) |
#include <zephyr/drivers/w1.h>
Reset the 1-Wire bus to prepare slaves for communication.
This routine resets all 1-Wire bus slaves such that they are ready to receive a command. Connected slaves answer with a presence pulse once they are ready to receive data.
In case the driver supports both standard speed and overdrive speed, the reset routine takes care of sendig either a short or a long reset pulse depending on the current state. The speed can be changed using w1_configure().
[in] | dev | Pointer to the device structure for the driver instance. |
0 | If no slaves answer with a present pulse. |
1 | If at least one slave answers with a present pulse. |
-errno | Negative error code on error. |
#include <zephyr/drivers/w1.h>
Write a single bit to the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
bit | Transmitting bit value 1 or 0. |
0 | If successful. |
-errno | Negative error code on error. |
#include <zephyr/drivers/w1.h>
Write a block of data from the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
[in] | buffer | Pointer to transmitting buffer. |
len | Length of transmitting buffer (in bytes). |
0 | If successful. |
-errno | Negative error code on error. |
#include <zephyr/drivers/w1.h>
Write a single byte to the 1-Wire bus.
[in] | dev | Pointer to the device structure for the driver instance. |
byte | Transmitting byte. |
0 | If successful. |
-errno | Negative error code on error. |