Lines Matching +full:overdrive +full:- +full:speed

4  * SPDX-License-Identifier: Apache-2.0
10 * @brief 1-Wire Bus Master driver using Zephyr serial interface.
12 * This driver implements the 1-Wire interface using an uart.
15 * presence detection as suggested for normal speed operating mode in:
16 …* https://www.analog.com/en/resources/technical-articles/using-a-uart-to-implement-a-1wire-bus-mas…
17 * For overdrive speed communication baudrates of 1 MBd and 115.2 kBd
34 /* Standard speed signal parameters:
43 * Overdrive speed signal parameters:
54 /** UART device used for 1-Wire communication */
66 * Concurrently transmits and receives one 1-Wire bit
72 const struct w1_serial_config *cfg = dev->config; in serial_tx_rx()
81 while (uart_poll_in(cfg->uart_dev, &dummy) == 0) { in serial_tx_rx()
85 uart_poll_out(cfg->uart_dev, tx_data[i]); in serial_tx_rx()
89 ret = uart_poll_in(cfg->uart_dev, &rx_data[i]); in serial_tx_rx()
96 /* Concurretly tranmits and receives one 1-Wire byte */
115 return -EIO; in serial_tx_rx_byte()
121 * rx-byte different from 0xFF indicates that a slave has in serial_tx_rx_byte()
132 const struct w1_serial_config *cfg = dev->config; in w1_serial_reset_bus()
133 struct w1_serial_data *data = dev->data; in w1_serial_reset_bus()
134 uint8_t reset_byte = data->overdrive_active ? in w1_serial_reset_bus()
137 * adjust timeout accordingly, also valid for overdrive speed. in w1_serial_reset_bus()
141 data->uart_cfg.baudrate = data->overdrive_active ? in w1_serial_reset_bus()
143 if (uart_configure(cfg->uart_dev, &data->uart_cfg) != 0) { in w1_serial_reset_bus()
145 return -EIO; in w1_serial_reset_bus()
150 return -EIO; in w1_serial_reset_bus()
153 data->uart_cfg.baudrate = data->overdrive_active ? in w1_serial_reset_bus()
155 if (uart_configure(cfg->uart_dev, &data->uart_cfg) != 0) { in w1_serial_reset_bus()
157 return -EIO; in w1_serial_reset_bus()
173 return -EIO; in w1_serial_read_bit()
187 return -EIO; in w1_serial_write_bit()
198 return -EIO; in w1_serial_read_byte()
214 const struct w1_serial_config *cfg = dev->config; in w1_serial_configure()
215 struct w1_serial_data *data = dev->data; in w1_serial_configure()
222 if (temp == data->overdrive_active) { in w1_serial_configure()
226 data->overdrive_active = temp; in w1_serial_configure()
227 data->uart_cfg.baudrate = data->overdrive_active ? in w1_serial_configure()
229 if (uart_configure(cfg->uart_dev, &data->uart_cfg) != 0) { in w1_serial_configure()
231 ret = -EIO; in w1_serial_configure()
235 ret = -ENOTSUP; in w1_serial_configure()
242 const struct w1_serial_config *cfg = dev->config; in w1_serial_init()
243 struct w1_serial_data *data = dev->data; in w1_serial_init()
245 if (!device_is_ready(cfg->uart_dev)) { in w1_serial_init()
247 return -ENODEV; in w1_serial_init()
250 data->uart_cfg.baudrate = W1_SERIAL_STD_DATA_BAUD; in w1_serial_init()
251 data->uart_cfg.parity = UART_CFG_PARITY_NONE; in w1_serial_init()
252 data->uart_cfg.data_bits = UART_CFG_DATA_BITS_8; in w1_serial_init()
253 data->uart_cfg.stop_bits = UART_CFG_STOP_BITS_1; in w1_serial_init()
254 data->uart_cfg.flow_ctrl = UART_CFG_FLOW_CTRL_NONE; in w1_serial_init()
256 if (uart_configure(cfg->uart_dev, &data->uart_cfg) != 0) { in w1_serial_init()
258 return -EINVAL; in w1_serial_init()
261 data->overdrive_active = false; in w1_serial_init()
263 LOG_DBG("w1-serial initialized, with %d slave devices", in w1_serial_init()
264 cfg->master_config.slave_count); in w1_serial_init()