3#include "../../proto/transcoder.h"
4#include "../../sensors/solenoid.h"
5#include "../communication.h"
10 IrrigationCommand* output);
13 IrrigationCommand* output) {
34 Esp32Command cmd = Esp32Command_init_default;
38 memcpy(output, &cmd.command.irrigation_command,
sizeof(IrrigationCommand));
44 IrrigationCommand irrigation_cmd = IrrigationCommand_init_zero;
45 irrigation_cmd.type = IrrigationCommand_Type_CHECK;
47 IrrigationCommand resp = IrrigationCommand_init_zero;
51 return IrrigationCommand_State_OPEN;
70 case IrrigationCommand_State_OPEN:
73 case IrrigationCommand_State_CLOSE:
Buffer * ControllerTx(void)
Get reference to transmit buffer.
Buffer * ControllerRx(void)
Get reference to receive buffer.
ControllerStatus ControllerTransaction(void)
Send message and receive response from esp32.
IrrigationCommand_State ControllerIrrigationCheck(void)
size_t EncodeIrrigationCommand(const IrrigationCommand *irrigation_cmd, uint8_t *buffer, size_t size)
Encodes an IrrigationCommand.
Esp32Command DecodeEsp32Command(const uint8_t *data, const size_t len)
Decodes an Esp32Command message.
unsigned int g_controller_i2c_timeout
ControllerStatus IrrigationCommandTransaction(const IrrigationCommand *input, IrrigationCommand *output)
Irrigation interface implementation with the esp32.
void SolenoidOpen(void)
Returns both the raw voltage value and a calibrated measurement from a water Flow sensor.
void SolenoidClose(void)
Read water Flow sensor and serialize measurement.