MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / Ohm2Position

Method Ohm2Position

libraries/X9C10X/X9C10X.cpp:216–222  ·  view source on GitHub ↗

rounding needed!

Source from the content-addressed store, hash-verified

214
215// rounding needed!
216uint8_t X9C10X::Ohm2Position(uint32_t value, bool invert)
217{
218 if (value > _maxOhm) return 99;
219 uint8_t val = (99 * value + _maxOhm/2) / _maxOhm;
220 if (invert) return 99 - val;
221 return val;
222}
223
224
225uint16_t X9C10X::getType()

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64