spislave.cpp: small fixes

This commit is contained in:
Klaus K Wilting 2018-11-04 13:58:35 +01:00
parent 577cdc9497
commit 7ae82d1881
3 changed files with 13 additions and 8 deletions

View File

@ -11,7 +11,7 @@
#define SPI_MOSI GPIO_NUM_23
#define SPI_MISO GPIO_NUM_19
#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_sx1272_radio 1 // select LoRa chip

View File

@ -9,10 +9,10 @@
#define HAS_SPI 1 // comment out if device shall not send data via SPI
// pin definitions for local wired SPI slave interface
#define SPI_MOSI (22)
#define SPI_MISO (33)
#define SPI_SCLK (26)
#define SPI_CS (36)
#define SPI_MOSI GPIO_NUM_22
#define SPI_MISO GPIO_NUM_33
#define SPI_SCLK GPIO_NUM_26
#define SPI_CS GPIO_NUM_36
#define CFG_sx1276_radio 1
//#define HAS_LED NOT_A_PIN // LoPy4 has no on board mono LED, we use on board RGB LED

View File

@ -128,11 +128,16 @@ esp_err_t spi_init() {
gpio_set_pull_mode(SPI_SCLK, 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 =
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;
#endif