pyupm_ds2413 module

class pyupm_ds2413.DS2413(uart=0)[source]

Bases: object

API for the DS2413 1-Wire Dual Channel Addressable Switch.

ID: ds2413

Name: 1-Wire Dual Channel Addressable Switch

Category: gpio

Manufacturer: maxim

Connection: uart

Link:https://learn.adafruit.com/adafruit-1-wire-gpio-breakout- ds2413/overview The DS2413 is a dual-channel programmable I/O 1-Wire(r) chip. The PIO outputs are configured as open-drain and provide up to 20mA continuous sink capability and off-state operating voltage up to 28V. Control and sensing of the PIO pins is performed with a dedicated device-level command protocol.

This device requires the use of a UART to provide access to a Dallas 1-wire bus, via a new facility supported by MRAA (once the relevant PR is accepted), using the UartOW access class. It is important to realize that the UART is only being used to access and control a Dallas 1-wire compliant bus, it is not actually a UART device.

Multiple DS2413 devices can be connected to this bus. This module will identify all such devices connected, and allow you to access them using an index starting at 0.

C++ includes: ds2413.hpp

ACCESS_READ = 245
ACCESS_WRITE = 90
ACK_FAILURE = 255
ACK_SUCCESS = 170
DS2413_FAMILY_CODE = 58L
devicesFound()[source]

int devicesFound()

This method will return the number of DS2413 devices that were found on the bus.

number of DS2413’s that were found on the bus

getId(index)[source]

std::string getId(int index)

Return an 8 byte string representing the unique device ID for a given device index. If the index is invalid, an empty strig will be returned.

index: The device index to access (starts at 0).

8 byte string representing the 1-wire device’s unique rom code.

init()[source]

void init()

This method will search the 1-wire bus and store information on each device detected on the bus. If no devices are found, an exception is thrown. Once this function completes successfully, you can use devicesFound() to determine how many devices were detected.

readGpios(index=0)[source]

int readGpios(int index=0)

Read the GPIO latches and values for a given device. Only the lower 4 bits of the return value have any meaning. The bits are formatted as follows (from msb to lsb): <gpioB latch>=”“> <gpioB value>=”“> <gpioA latch>=”“> <gpioA value>=”“>

index: The device index to access (starts at 0). Default is the first device (index = 0)

the 4 bit status of the 2 gpios

writeGpios(index, value)[source]

void writeGpios(int index, int value)

Write the given values to the gpio latches for a given device. Only the lower 2 bits of the value have any meaning. The lsb is gor gpioA and the next lsb is for gpioB: <gpioB latch>=”“> <gpioA latch>=”“>

index: The device index to access (starts at 0).

value: the value to write to the gpio latches

class pyupm_ds2413.charArray(nelements)[source]

Bases: object

cast()[source]
static frompointer()