:mod:`onewire` --- One Wire ==================================================== .. module:: onewire :synopsis: One Wire bus The one-wire bus is a peripheral serial expansion bus technology introduced by Dallas Semiconductor in the United States. It differs from SPI and I2C serial data communication methods. It uses a single signal line to transmit both the clock and the data, and data transmission is bidirectional. It has many advantages, such as saving I/O lines, simple resource structure, low cost, and easy bus expansion and maintenance. The one-wire bus is suitable for single-master systems and can control one or more slave devices. The master can be a microcontroller, and the slave can be a one-wire device. Data exchange between them passes through only one signal line. When there is only one slave device, the system can operate as a single-node system; when there are multiple slave devices, the system operates as a multi-node system. Figure 12-1 shows a one-wire multi-node system. .. figure:: /_static/external/ss0_baidu_com_cd2141b72e.jpg :width: 400 :align: center Diagram of a one-wire multi-node system OneWire Class ------------- .. class:: OneWire(pin) Construct a OneWire class. - ``pin`` - a `machine.Pin` instance object. .. method:: reset(required=False) .. method:: readinto(buf) Read bytes. .. method:: write(buf) Write bytes. .. method:: select_rom(rom) .. method:: scan() Scan the devices on the bus. .. method:: crc8(data)