Added possibility to override pin assignments
This commit is contained in:
parent
8a9a33a364
commit
4f2d705314
13
README.md
13
README.md
@ -42,6 +42,19 @@ It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with th
|
||||
### Symbolic view
|
||||

|
||||
|
||||
### 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
|
||||
* 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)
|
||||
|
||||
@ -8,7 +8,7 @@ void HoymilesRadio::init()
|
||||
{
|
||||
_dtuSerial.u64 = 0;
|
||||
|
||||
_radio.reset(new RF24(PIN_CE, PIN_CS));
|
||||
_radio.reset(new RF24(HOYMILES_PIN_CE, HOYMILES_PIN_CS));
|
||||
_radio->begin();
|
||||
_radio->setDataRate(RF24_250KBPS);
|
||||
_radio->enableDynamicPayloads();
|
||||
@ -22,7 +22,7 @@ void HoymilesRadio::init()
|
||||
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();
|
||||
_radio->startListening();
|
||||
|
||||
@ -14,9 +14,17 @@
|
||||
|
||||
#define MAX_RESEND_COUNT 3
|
||||
|
||||
#define PIN_IRQ 16
|
||||
#define PIN_CE 4
|
||||
#define PIN_CS 5
|
||||
#ifndef HOYMILES_PIN_IRQ
|
||||
#define HOYMILES_PIN_IRQ 16
|
||||
#endif
|
||||
|
||||
#ifndef HOYMILES_PIN_CE
|
||||
#define HOYMILES_PIN_CE 4
|
||||
#endif
|
||||
|
||||
#ifndef HOYMILES_PIN_CS
|
||||
#define HOYMILES_PIN_CS 5
|
||||
#endif
|
||||
|
||||
class HoymilesRadio {
|
||||
public:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user