Added possibility to override pin assignments

This commit is contained in:
Thomas Basler 2022-07-08 18:20:36 +02:00
parent 8a9a33a364
commit 4f2d705314
3 changed files with 26 additions and 5 deletions

View File

@ -42,6 +42,19 @@ It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with th
### Symbolic view ### Symbolic view
![Symbolic](docs/Wiring_ESP32_Symbol.png) ![Symbolic](docs/Wiring_ESP32_Symbol.png)
### Change pin assignment
Its possible to change the pin assignment for the following pins:
* CE
* CS
* IRQ
This can be achieved by editing the 'platformio.ini' file and add one or more of the following lines to the 'build_flags' parameter:
```
-DHOYMILES_PIN_CE=4
-DHOYMILES_PIN_CS=5
-DHOYMILES_PIN_IRQ=16
```
## Flashing and starting up ## Flashing and starting up
* Install [Visual Studio Code](https://code.visualstudio.com/download) * Install [Visual Studio Code](https://code.visualstudio.com/download)
* In Visual Studio Code, install the [PlatformIO Extension](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide) * In Visual Studio Code, install the [PlatformIO Extension](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)

View File

@ -8,7 +8,7 @@ void HoymilesRadio::init()
{ {
_dtuSerial.u64 = 0; _dtuSerial.u64 = 0;
_radio.reset(new RF24(PIN_CE, PIN_CS)); _radio.reset(new RF24(HOYMILES_PIN_CE, HOYMILES_PIN_CS));
_radio->begin(); _radio->begin();
_radio->setDataRate(RF24_250KBPS); _radio->setDataRate(RF24_250KBPS);
_radio->enableDynamicPayloads(); _radio->enableDynamicPayloads();
@ -22,7 +22,7 @@ void HoymilesRadio::init()
Serial.println(F("Connection error!!")); Serial.println(F("Connection error!!"));
} }
attachInterrupt(digitalPinToInterrupt(PIN_IRQ), std::bind(&HoymilesRadio::handleIntr, this), FALLING); attachInterrupt(digitalPinToInterrupt(HOYMILES_PIN_IRQ), std::bind(&HoymilesRadio::handleIntr, this), FALLING);
openReadingPipe(); openReadingPipe();
_radio->startListening(); _radio->startListening();

View File

@ -14,9 +14,17 @@
#define MAX_RESEND_COUNT 3 #define MAX_RESEND_COUNT 3
#define PIN_IRQ 16 #ifndef HOYMILES_PIN_IRQ
#define PIN_CE 4 #define HOYMILES_PIN_IRQ 16
#define PIN_CS 5 #endif
#ifndef HOYMILES_PIN_CE
#define HOYMILES_PIN_CE 4
#endif
#ifndef HOYMILES_PIN_CS
#define HOYMILES_PIN_CS 5
#endif
class HoymilesRadio { class HoymilesRadio {
public: public: