-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpios.h
117 lines (102 loc) · 3.12 KB
/
gpios.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* gpios.h
*
* Created on: Jan 28, 2024
* Author: viorel_serbu
*/
#ifndef ESP32_COMMON_GPIOS_H_
#define ESP32_COMMON_GPIOS_H_
#if ACTIVE_CONTROLLER == WP_CONTROLLER //based on esp32 dev kit
//ADC channels provided by AD7811 channels
#ifdef WP_HW_V1
#define SENSOR_CHN 2 //VIN3 - pressure sensor
#define CURRENT_CHN 0 //VIN1 - pump current ACS712
#define MOTSENSE_CHN 1 //VIN2 - DV current sense
#endif
#ifdef WP_HW_V2
#define SENSOR_CHN 2 //VIN3 - pressure sensor
#define CURRENT_CHN 1 //VIN2 - pump current ACS712
#define MOTSENSE_CHN 3 //VIN4 - DV current sense
#endif
#ifdef WP_HW_V1
#define PIN_NUM_CONVST 14 //
#define PIN_NUM_QMETER 34 //
//SPI communication AD7811
#define PIN_NUM_MISO 27
#define PIN_NUM_MOSI 26
#define PIN_NUM_CLK 25
//rotary encoder
#define ROT_ENC_S1 35
#define ROT_ENC_S2 32
#define ROT_ENC_KEY 33
#endif
#ifdef WP_HW_V2
#define PIN_NUM_CONVST 26 //
#define PIN_NUM_QMETER 36 //
//SPI communication AD7811
#define PIN_NUM_MISO 25
#define PIN_NUM_MOSI 33
#define PIN_NUM_CLK 32
//rotary encoder
#define ROT_ENC_S1 39
#define ROT_ENC_S2 34
#define ROT_ENC_KEY 35
#endif
//ctrl GPIOs
/** DV control pin */
/* A1 ON / B1 OFF --> open
* A1 OFF / B1 ON --> close
* A1 OFF / B1 OFF --> inactive
*/
#ifdef WP_HW_V1
#define PINEN_DV0 (16) //output - dv open/close cmd goes to dv0
#define PINEN_DV1 (4) //output - dv open/close cmd goes to dv1
#define PINMOT_A1 (2) //output - H bridge cmd
#define PINMOT_B1 (15) //output - H bridge cmd
#endif
#ifdef WP_HW_V2
#define PINEN_DV0 (16) //output - dv open/close cmd goes to dv0
#define PINEN_DV1 (15) //output - dv open/close cmd goes to dv1
#define PINEN_DV2 (14) //output - dv open/close cmd goes to dv2
#define PINEN_DV3 (13) //output - dv open/close cmd goes to dv3
#define PINMOT_A1 (4) //output - H bridge cmd
#define PINMOT_B1 (2) //output - H bridge cmd
#endif
//pump on/off pin
#define PUMP_ONOFF_PIN (23) //output - pump on/off relay cmd
//LEDs
#ifdef LEDS
#define PUMP_ONOFF_LED (16) //j4/3
#define PUMP_ONLINE_LED (21) //j4/1
#define PUMP_FAULT_LED (4) //j4/2
#define DV0_ON_LED (2)
#define DV1_ON_LED (15)
#define PROG_ON_LED (8)
#define PUMP_ONLINE_CMD (22) //input - pump online/ofline push button
#endif
#endif
#if ACTIVE_CONTROLLER == PUMP_CONTROLLER
/** Pressure sensor */
#define SENSOR_PIN (5) //j5/5
/** ACS712 current sensor */
#define CURRENT_PIN (4) //j5/6 --> hardwired
/** Pump ON/OF control pin */
#define PUMP_ONOFF_PIN (6) //j5/8 --> hardwired
#define PUMP_ONOFF_LED (1) //j4/3
#define PUMP_ONLINE_LED (8)//j4/1
#define PUMP_FAULT_LED (3)//j4/2
#define PUMP_ONLINE_CMD (7) //j5/7 --> hardwired / not used if single relay populated
#endif
#if ACTIVE_CONTROLLER == WATER_CONTROLLER
#define PINEN_DV0 (6)
#define PINEN_DV1 (7)
/* A1 ON / B1 OFF --> open
* A1 OFF / B1 ON --> close
* A1 OFF / B1 OFF --> inactive
*/
#define PINMOT_A1 (8)
#define PINMOT_B1 (3)
/** current sense pin for actuators */
#define PINSENSE_MOT (4)
#endif
#endif /* ESP32_COMMON_GPIOS_H_ */