Go to the documentation of this file.
11 #define VALVE_IN_PIN A1
12 #define VALVE_OUT_PIN 32
16 #define ALARM_RELE A12
43 ledcSetup(0, 10000, 12);
61 for (
int i = 0; i < 8; i++) {
81 #ifdef USE_SPIROMETER_SFM3019
88 #ifdef USE_SPIROMETER_SFM3000
158 Wire.beginTransmission(address);
159 for (
int i = 0;i < wlength; i++)
160 Wire.write(wbuffer[i]);
161 result = Wire.endTransmission();
196 Wire.beginTransmission(address);
197 for (
int i = 0;i < wlength; i++)
198 Wire.write(wbuffer[i]);
199 result = Wire.endTransmission();
204 count = Wire.requestFrom((uint16_t)address, (uint8_t)rlength, stop);
208 for (
int i = 0;i < rlength; i++)
210 rbuffer[i] = Wire.read();
235 count = Wire.requestFrom((uint16_t)address, (uint8_t)rlength, stop);
241 for (
int i = 0;i < rlength; i++)
243 rbuffer[i] = Wire.read();
259 if ((value < 0) || (value > 100.0))
return false;
264 uint32_t v = (uint32_t)value * 4095.0 / 100.0;
303 digitalWrite(
BUZZER, value ? HIGH : LOW);
306 digitalWrite(
ALARM_LED, value ? HIGH : LOW);
333 *value = digitalRead(
BUZZER);
353 void HW_V4::__delay_blocking_ms(uint32_t ms)
440 *batteryPowered =
pWall ?
false:
true;
454 return Serial.available();
485 uint64_t HW_V4::GetMillis()
487 return (uint64_t)millis();
496 int64_t HW_V4::Get_dT_millis(uint64_t ms)
498 return (int64_t)(millis() - ms);
512 for (address = 1; address < 127; address++) {
513 Wire.beginTransmission(address);
514 error = Wire.endTransmission();
523 else if (error == 4) {
558 Wire.beginTransmission(
TCAADDR);
560 Wire.endTransmission();
561 delayMicroseconds(500);
592 wbuffer[0] = i_address;
597 a = (rbuffer [1]<< 8) | rbuffer[0];
610 wbuffer[0] = i_address;
611 wbuffer[1] = write_data & 0xFF;
612 wbuffer[2] = (write_data >> 8) & 0xFF;
bool Init()
Initialize hardware peripheral in the system.
void PrintLineDebugConsole(String s)
Print a message on console used for Debug with a CR+LR at end.
uint16_t GetSupervisorAlarms()
API return Supervisor managed alarms.
t_i2cdev iic_devs[IIC_COUNT]
bool I2CRead(t_i2cdevices device, uint8_t *wbuffer, int wlength, uint8_t *rbuffer, int rlength, bool stop)
Write buffer to I2C bus and read data.
String ReadUART0UntilEOL()
Return a terminated string from communication interface.
void __service_i2c_detect()
Detect all I2C devices on bus.
void PrintDebugConsole(String s)
Print a message on console used for Debug.
bool I2CWrite(t_i2cdevices device, uint8_t *wbuffer, int wlength, bool stop)
Write buffer to I2C bus.
uint64_t batteryStatus_reading_LT
bool WriteUART0(String s)
API to write a string to the communication interfaces.
void Tick()
Tick function must be called periodically.
float currentBatteryCharge
t_i2cdev GetIICDevice(t_i2cdevices device)
Search in the iic_devs list a particular device and return descriptor.
void GetPowerStatus(bool *batteryPowered, float *charge)
API to read battery charge and power supply status.
float GetPIN()
API return pressure on input of MVM.
float GetBoardTemperature()
API return temperature of the board.
bool DataAvailableOnUART0()
API to read if on the communication interfaces there are bytes to be read.
bool PWMSet(hw_pwm id, float value)
Control PWM device (PV1)
bool EnableWatchdogSupervisor
void WriteSupervisor(uint8_t i_address, uint16_t write_data)
Write a supervisor register.
uint16_t ReadSupervisor(uint8_t i_address)
Read a supervisor register.
bool IOSet(hw_gpio id, bool value)
Set a GPIO Status (IE Control PV6, Alarms, etc)
@ IIC_GENERAL_CALL_SENSIRION
bool IOGet(hw_gpio id, bool *value)
Get GPIO Status.
void i2c_MuxSelect(uint8_t i)
Switch I2C multiplexer.