herosdevices.hardware.raspberrypi.waveshare
===========================================

.. py:module:: herosdevices.hardware.raspberrypi.waveshare

.. autoapi-nested-parse::

   Driver for Waveshare SBC/microcontroller extension boards.





Module Contents
---------------

.. py:class:: WaveshareADS1256(pos_pin: str = 'AIN0', neg_pin: str = 'AINCOM', spi_bus: int = 0, spi_device: int = 0, gain: int = 1, drate: str = '30000SPS', vref: float = 5.0, samples: int = 1)

   Bases: :py:obj:`herosdevices.interfaces.atomiq.ADCChannel`


   This class represents one channel of the Waveshare ADS1256 ADC board.

   Multiple instances of this class can run in the same interpreter to access multiple channels.
   The configuration of the ADC will performed by the first instance. This means, gain data rate and reference
   voltage are only taken from the first instance.

   :param posPin: Name of the pin receiving the positive voltage. I.e. AIN0 ... AIN7 or AINCOM
   :param negPin: Name of the pin receiving the negative voltage. I.e. AIN0 ... AIN7 or AINCOM. For non-differential
                  measurements this is usually AINCOM.
   :param spi_bus: number of the SPI bus
   :param spi_device: number of the SPI device in bus.
   :param gain: gain to set in the PGIA
   :param drate: conversion rate of the ADS1256. See .ads1256.ADS1256_DRATE for valid values
   :param vref: Reference voltage given to the ADC. Usually 3.3V or 5V
   :param samples: number of samples to average when sending out measured values as heros datasource


   .. py:attribute:: posPin


   .. py:attribute:: negPin


   .. py:attribute:: gain


   .. py:attribute:: drate


   .. py:attribute:: vref
      :value: 5.0



   .. py:attribute:: samples
      :value: 1



   .. py:method:: measure(samples: int = 1, channel: str = '') -> float

      Measure the voltage by averaging multiple ADC samples.

      :param samples: Number of samples to average.
      :type samples: int
      :param channel: Not used in this implementation.
      :type channel: str

      :returns: Measured voltage in volts.
      :rtype: float



