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

Method setAirPressureReference

libraries/MTP40C/MTP40C.cpp:108–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107
108bool MTP40::setAirPressureReference(float apr)
109{
110 if ((apr < 700) || (apr > 1100)) return false;
111
112 union
113 {
114 float value;
115 uint8_t b[4];
116 } convert;
117
118 uint8_t cmd[10] = { 0xFE, 0x67, 0x01, 0x01, 0x00, 0x40, 0x7D, 0x44, 0xC4, 0xA3 };
119 convert.value = apr;
120 for (uint8_t i = 0; i < 4; i++)
121 {
122 cmd[4 + i] = convert.b[i];
123 }
124 if (request(cmd, 10, 10) )
125 {
126 return true;
127 }
128 return false;
129}
130
131
132uint16_t MTP40::getGasConcentration()

Callers 1

unittestFunction · 0.80

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.64