The A2DPort class reads from the one of the seven A2D bus On Chip Peripheral (OCP) devices integrated into the Beaglebone Black CPU via the IIO device driver access method. At this time there is no BBBCSIO class of similar functionality which uses the Memory Mapped access method.
public class A2DPortFS : PortFS
public A2DPortFS(A2DPortEnum a2dPortIn) : base(GpioEnum.GPIO_NONE)
public override void ClosePort()
public void Dispose()
public override PortDirectionEnum PortDirection()
public uint Read()
Tests indicate that the maximum possible speed here is about 1000 reads/second
Be aware that the max and min value you get here can be scaled by the Device Tree setting in use. The min and max is always representative of 0V and 1.8V respectively. If you used the BB-ADC overlay then 0V-1.8V is represented by the values 0-4095. If you used the cape-bone-iio overlay then 0V-1.8V is represented by the values 0-1799. In other words, the scaling of the output is not necessarily fixed and it is up to you to know what voltage the output numbers represent.
As an additional note, in the first Device Tree Overlay (BB-ADC) the returned values 0-1799 represent simple millivolts. So if you see a value of 1234 you know there is 1.234V on the input. However the A2D inside the BBB is 12 bits so if you wish to achieve maximum resolution you can use the range 0-4095 (thus you have over double the resolution of the 0-1799) range. A value 4095 still means 1.8V though - you just are measuring the voltage with a finer granularity.
public A2DPortEnum A2DPort { get; }