#pragma once #include #include #define COIL_COUNT 40 #define DATA_PIN_595 9 #define OE_PIN_595 10 #define LATCH_PIN_595 11 #define CLOCK_PIN_595 12 struct U6 { bool A: 1; bool B: 1; bool C: 1; bool D: 1; bool E: 1; bool F: 1; bool G: 1; bool H: 1; }; struct U8 { bool G1: 1; bool G2: 1; bool G3: 1; bool G4: 1; unsigned NC: 4; }; struct U5 { bool J1: 1; bool J2: 1; bool J3: 1; bool J4: 1; bool J5: 1; bool J6: 1; bool J7: 1; bool J8: 1; }; struct ShiftOutRegisters { U6 u6; U8 u8; U5 u5; }; union ShiftOutRegistersUnion { ShiftOutRegisters shiftOutRegisters; uint8_t bytes[3]; }; struct Coils { U5 relays; U6 digit0; U6 digit1; U6 digit2; U6 digit3; }; void setupCoils(ModbusSerial& mb); void coilsTask(ModbusSerial& mb);