110 if (result < 0) {
return result; }
126 uint16_t reading =
_sw.readPublicData(
_pin);
127 uint32_t x = ((uint32_t) reading ) *
_sw._supplyVoltagemV;
128 uint16_t returnval = x >> 16;
149 return (
_sw.readPublicData(
_pin));
163 x *=
_sw._supplyVoltagemV;
164 return ((uint16_t)(x >> 16));
181 _sw.sendPacket(tx, rx,
true, 3,1);
183 return(rx[5] + rx[6] * 256);
197 x *=
_sw._supplyVoltagemV;
198 return ((uint16_t)(x >> 16));
218 _sw.sendPacket(tx, rx,
true,3,1);
219 return(rx[3] + rx[4] * 256);
225 return _sw.readSupplyVoltage_mV();
246 _sw.sendPacket(tx, rx);
247 return(rx[5] + rx[6] * 256);
256 \param resetAfterRead If True, maximum value is set to 0 after read so that subsequent values become maximum. Also resets minimum to next sample.
258 \return A 16 bit unsigned value indicating maximum A/D Counts
268 _sw.sendPacket(tx, rx);
269 return(rx[5] + rx[6] * 256);
277 \param resetAfterRead If True, minimum value is set to 0 after read so that subsequent values become minimum. Also resets maximum to next sample.
279 \return A 16 bit unsigned value indicating measurement in mV
284 x *=
_sw._supplyVoltagemV;
285 return ((uint16_t)(x >> 16));
306 _sw.sendPacket(tx, rx);
307 return(rx[3] + rx[4] * 256);
@ PIN_MODE_ANALOGINPUT
(2)
AnalogInputPublicDataOutput
@ AnalogInputPublicDataOutput_Minimum
The Minimum A/D reading is displayed as public data (default)
@ AnalogInputPublicDataOutput_Filtered
The Filtered A/D reading is displayed as public data (default)
@ AnalogInputPublicDataOutput_Maximum
The Maximum A/D reading is displayed as public data (default)
@ AnalogInputPublicDataOutput_Averaged
The Averaged A/D reading is displayed as public data (default)
@ AnalogInputPublicDataOutput_Raw
The raw A/D reading is displayed as public data (default)
Class for a Serial Wombat chip. Each Serial Wombat chip on a project should have its own instance.
SerialWombatAbstractProcessedInput(SerialWombatChip &sw)
Constructor for the SerialWombatAbstractScaledOutput Class.
uint16_t readFiltered_mV()
Retreive a filtered A/D measurement and convert it to mV.
uint16_t readAveraged_mV()
Retreive an averaged A/D measurement and convert it to mV.
SerialWombatAnalogInput(SerialWombatChip &SerialWombatChip)
Constructor for the SerialWombatAnalogInput class.
uint16_t readMinimum_mV(bool resetAfterRead=false)
uint16_t readAveragedCounts()
Retreive an averaged A/D measurement.
uint16_t readFilteredCounts()
Retreive a filtered A/D measurement.
uint16_t readMaximum_mV(bool resetAfterRead=false)
Retreive the maximum single sample A/D value in mV.
int16_t begin(uint8_t pin, uint16_t averageSamples=64, uint16_t filterConstant=0xFF80, AnalogInputPublicDataOutput output=AnalogInputPublicDataOutput::AnalogInputPublicDataOutput_Raw)
Initialize an analog input on a given pin.
uint16_t readMaximumCounts(bool resetAfterRead=false)
uint16_t readVoltage_mV()
Retreive a raw A/D measurement and convert it to mV.
uint16_t readMinimumCounts(bool resetAfterRead=false)
Retreive the maximum single sample A/D value in counts.
uint16_t readCounts()
Retreive a raw A/D measurement.
uint16_t updateSupplyVoltage_mV()
Provides a wrapper around the readSupplyVoltage_mV() method for the SerialWombat chip hosting this pi...
uint8_t pin()
Used for inheritance.
uint8_t swPinModeNumber()
Used for ineheritance.
SerialWombatAnalogInput_18AB(SerialWombatChip &serialWombat)
SerialWombatPin(SerialWombatChip &serialWombatChip)
Instantiates a Serial Wombat Pin.
int16_t initPacketNoResponse(uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55)
uint8_t pin()
Returns the current SW pin number. Used primarily for virtual calls by derived classes.