attempt at getting the spi issues fixed

This commit is contained in:
KonradIT
2025-03-12 20:23:35 +01:00
parent adc751abf0
commit ef2f788d88
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -20,12 +20,15 @@ bool initUARTs(Config &config)
return true;
}
#ifndef HELTEC
SPIClass &hspi = *(new SPIClass(HSPI)); // not usable until initSPIs
#endif
bool initSPIs(Config &config)
{
if (config.spi1.enabled)
{
#ifndef HELTEC
delete (&hspi);
hspi = *(new SPIClass(config.spi1.bus_num));
if (config.spi1.clock_freq > 0)
@@ -35,10 +38,14 @@ bool initSPIs(Config &config)
// if all the pins are -1, then will use the default for SPI bus_num
hspi.begin(config.spi1.clk, config.spi1.miso, config.spi1.mosi);
Serial.printf("Initialized SPI%d @ %x: SC:%d MISO:%d MOSI:%d clock:%d\n",
(int)config.spi1.bus_num, (void *)&hspi, (int)config.spi1.clk,
(int)config.spi1.miso, (int)config.spi1.mosi,
(int)config.spi1.clock_freq);
#else
Serial.println("SPI not supported on Heltec");
#endif
}
return true;
+2
View File
@@ -17,7 +17,9 @@ enum I2CDevices
extern uint8_t wireDevices;
extern uint8_t wire1Devices;
#ifndef HELTEC
extern SPIClass &hspi;
#endif
// abstract away a reference to Serial vs Serial0 vs Serial1, so it compiles
#ifndef ARDUINO_USB_CDC_ON_BOOT