forked from JaCharer/OpenSprinkler-Firmware-ESP32port
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesp32.h
98 lines (73 loc) · 3.52 KB
/
esp32.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
#ifndef _ESP32_H
#define _ESP32_H
#if defined(ESP32)
/** Data file names for esp32 / in filename is needed to work correctly*/
#define IOPTS_FILENAME "/iopts.dat" // integer options data file
#define SOPTS_FILENAME "/sopts.dat" // string options data file
#define STATIONS_FILENAME "/stns.dat" // stations data file
#define NVCON_FILENAME "/nvcon.dat" // non-volatile controller data file, see OpenSprinkler.h --> struct NVConData
#define PROG_FILENAME "/prog.dat" // program data file
#define DONE_FILENAME "/done.dat" // used to indicate the completion of all files
// chose LCD type: 0.96 probably SSD1306, 1.3" is probably SH1106
#define LCD_SH1106
// #define LCD_SSD1306
#define MDNS_NAME "opensprinkler" // mDNS name for OS controler
#define OS_HW_VERSION (OS_HW_VERSION_BASE+40)
//#define RFTX // uncoment when planning to use RX controler
//#define ETHPORT // uncoment when palnning to use wired etherner
#define SDA_PIN 21 // I2C pin definition
#define SCL_PIN 22
#define LCD_I2CADDR 0x3c // 128x64 OLED display I2C address
#define IOEXP_PIN 0x99 // base for pins on main IO expander
/* ESP32 port support only AC mode as DC and Latch need dedicated HW
* Dont need this to declere and saerch for Main IO controler and
* ac, dc or latch drivers. However you may use DC nad Latch when deciated HW builded - not tested
*/
#define MAIN_I2CADDR 0x20 // main IO expander I2C address
#define ACDR_I2CADDR 0x21 // ac driver I2C address
#define DCDR_I2CADDR 0x22 // dc driver I2C address
#define LADR_I2CADDR 0x23 // latch driver I2C address
#define EXP_I2CADDR_BASE 0x24 // base of expander I2C address
#define ETHER_BUFFER_SIZE 8192
/* To accommodate different OS30 versions, we use software defines pins */
extern byte PIN_BUTTON_1;
extern byte PIN_BUTTON_2;
extern byte PIN_BUTTON_3;
extern byte PIN_RFRX;
extern byte PIN_RFTX;
extern byte PIN_BOOST;
extern byte PIN_BOOST_EN;
extern byte PIN_LATCH_COM;
extern byte PIN_SENSOR1;
extern byte PIN_SENSOR2;
extern byte PIN_IOEXP_INT;
#define E0_PIN_BUTTON_1 18 // button 1
#define E0_PIN_BUTTON_2 5 // button 2
#define E0_PIN_BUTTON_3 17 // button 3
#define E0_PIN_RFRX 255
#define E0_PIN_RFTX 255
#define E0_PIN_BOOST 255// special HW needed
#define E0_PIN_BOOST_EN 255// special HW needed
#define E0_PIN_LATCH_COM 255// not needed for ESP32
#define E0_PIN_SENSOR1 39 // sensor 1
#define E0_PIN_SENSOR2 33 // sensor 2
#define E0_PIN_IOEXP_INT 255// not needed for ESP32
#define PIN_ETHER_CS 255 // ENC28J60 CS (chip select pin) is 16 on OS 3.2.
#define USE_IOEXP_SR 1 // use Shift-register as station setting - uncomment this to use built-in gpio style
#define ON_BOARD_GPIN_LIST {255,255,255,255,255,255,255,255} // ESP32 on board gpins to be usead as sections, 255 - pin not defined
#define PIN_FREE_LIST {} // no free GPIO pin at the moment
#define PIN_CURR_SENSE 255
#define STATION_LOGIC 1 // Zone output logic for relays - 1 => HIGH in ON, 0 => LOW is ON
// Rotary Encoder instead of buttons - not used for now
#define ROTARY_ENCODER_A_PIN 35
#define ROTARY_ENCODER_B_PIN 34
#define ROTARY_ENCODER_BUTTON_PIN 36
#define ROTARY_ENCODER_VCC_PIN -1
#define SEPARATE_MASTER_VALVE 19
// 74HC595 shift reg
#define IOEXP_SR_DATA_PIN 25
#define IOEXP_SR_CLK_PIN 27
#define IOEXP_SR_LATCH_PIN 32
#define SYS_STATUS_LED_PIN 13
#endif
#endif //_ESP32_H