spislave.cpp: small fixes
This commit is contained in:
parent
577cdc9497
commit
7ae82d1881
@ -11,7 +11,7 @@
|
|||||||
#define SPI_MOSI GPIO_NUM_23
|
#define SPI_MOSI GPIO_NUM_23
|
||||||
#define SPI_MISO GPIO_NUM_19
|
#define SPI_MISO GPIO_NUM_19
|
||||||
#define SPI_SCLK GPIO_NUM_18
|
#define SPI_SCLK GPIO_NUM_18
|
||||||
#define SPI_CS GPIO_NUM_5
|
#define SPI_CS GPIO_NUM_5
|
||||||
|
|
||||||
#define CFG_sx1276_radio 1 // select LoRa chip
|
#define CFG_sx1276_radio 1 // select LoRa chip
|
||||||
//#define CFG_sx1272_radio 1 // select LoRa chip
|
//#define CFG_sx1272_radio 1 // select LoRa chip
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
#define HAS_SPI 1 // comment out if device shall not send data via SPI
|
||||||
// pin definitions for local wired SPI slave interface
|
// pin definitions for local wired SPI slave interface
|
||||||
#define SPI_MOSI (22)
|
#define SPI_MOSI GPIO_NUM_22
|
||||||
#define SPI_MISO (33)
|
#define SPI_MISO GPIO_NUM_33
|
||||||
#define SPI_SCLK (26)
|
#define SPI_SCLK GPIO_NUM_26
|
||||||
#define SPI_CS (36)
|
#define SPI_CS GPIO_NUM_36
|
||||||
|
|
||||||
#define CFG_sx1276_radio 1
|
#define CFG_sx1276_radio 1
|
||||||
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED
|
||||||
|
@ -128,11 +128,16 @@ esp_err_t spi_init() {
|
|||||||
gpio_set_pull_mode(SPI_SCLK, GPIO_PULLUP_ONLY);
|
gpio_set_pull_mode(SPI_SCLK, GPIO_PULLUP_ONLY);
|
||||||
gpio_set_pull_mode(SPI_CS, GPIO_PULLUP_ONLY);
|
gpio_set_pull_mode(SPI_CS, GPIO_PULLUP_ONLY);
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Starting SPIloop...");
|
|
||||||
xTaskCreate(spi_slave_task, "spiloop", 4096, (void *)NULL, 2, &spiTask);
|
|
||||||
|
|
||||||
esp_err_t ret =
|
esp_err_t ret =
|
||||||
spi_slave_initialize(HSPI_HOST, &spi_bus_cfg, &spi_slv_cfg, 1);
|
spi_slave_initialize(HSPI_HOST, &spi_bus_cfg, &spi_slv_cfg, 1);
|
||||||
|
|
||||||
|
if (ret == ESP_OK) {
|
||||||
|
ESP_LOGI(TAG, "Starting SPIloop...");
|
||||||
|
xTaskCreate(spi_slave_task, "spiloop", 4096, (void *)NULL, 2, &spiTask);
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "SPI interface initialization failed");
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user