Skip to content

Commit ecdceda

Browse files
committed
Use HSPI when not official board definition
1 parent c6f7b7e commit ecdceda

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/heltec_unofficial.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,16 @@ const uint8_t scaled_voltage[100] = {
8686
};
8787

8888
#ifndef HELTEC_NO_RADIO_INSTANCE
89-
SX1262 radio = new Module(SS, DIO1, RST_LoRa, BUSY_LoRa);
89+
#ifndef ARDUINO_heltec_wifi_32_lora_V3
90+
// Assume MISO and MOSI being wrong when noty using Heltec's board definition
91+
// and use hspi to make it work anyway. See heltec_setup() for the actual SPI setup.
92+
#include <SPI.h>
93+
SPIClass* hspi = new SPIClass(HSPI);
94+
SX1262 radio = new Module(SS, DIO1, RST_LoRa, BUSY_LoRa, *hspi);
95+
#else
96+
// Default SPI on pins from pins_arduino.h
97+
SX1262 radio = new Module(SS, DIO1, RST_LoRa, BUSY_LoRa);
98+
#endif
9099
#endif
91100

92101
#ifndef HELTEC_NO_DISPLAY_INSTANCE
@@ -361,6 +370,9 @@ void heltec_display_power(bool on) {
361370
*/
362371
void heltec_setup() {
363372
Serial.begin(115200);
373+
#ifndef ARDUINO_heltec_wifi_32_lora_V3
374+
hspi->begin(SCK, MISO, MOSI, SS);
375+
#endif
364376
#ifndef HELTEC_NO_DISPLAY_INSTANCE
365377
heltec_display_power(true);
366378
display.init();

0 commit comments

Comments
 (0)