DN23E08_modbus/DN23E08/discrete_inputs.h

46 lines
702 B
C

#pragma once
#include <Arduino.h>
#include <ModbusSerial.h>
#define DISCRETE_INPUT_COUNT 12
#define DATA_PIN_165 2
#define CLOCK_PIN_165 3
#define LOAD_PIN_165 4
#define KEY_1_PIN 5
#define KEY_2_PIN 6
#define KEY_3_PIN 7
#define KEY_4_PIN 8
struct U11 {
bool INPUT1: 1;
bool INPUT2: 1;
bool INPUT3: 1;
bool INPUT4: 1;
bool INPUT5: 1;
bool INPUT6: 1;
bool INPUT7: 1;
bool INPUT8: 1;
};
union ShiftInRegisterUnion {
U11 shiftInRegister;
uint8_t byte;
};
struct Keys {
bool KEY_1;
bool KEY_2;
bool KEY_3;
bool KEY_4;
};
struct DiscreteInputs {
U11 digitalInputs;
Keys keys;
};
void setupDiscreteInputs(ModbusSerial& mb);
void discreteInputsTask(ModbusSerial& mb);