code sanitization (i2c pins renamed)
This commit is contained in:
parent
902eeb1414
commit
a0c15c1fa1
@ -4,7 +4,7 @@
|
||||
#include "globals.h"
|
||||
#include <esp_spi_flash.h> // needed for reading ESP32 chip attributes
|
||||
|
||||
HAS_DISPLAY u8x8(OLED_RST, OLED_SCL, OLED_SDA);
|
||||
HAS_DISPLAY u8x8(OLED_RST, I2C_SCL, I2C_SDA);
|
||||
|
||||
// helper string for converting LoRa spread factor values
|
||||
#if defined(CFG_eu868)
|
||||
|
@ -34,5 +34,5 @@
|
||||
|
||||
// pin definitions for I2C interface of OLED Display
|
||||
#define OLED_RST GPIO_NUM_16 // SSD1306 RST
|
||||
#define OLED_SDA GPIO_NUM_4 // SD1306 D1+D2
|
||||
#define OLED_SCL GPIO_NUM_15 // SD1306 D0
|
||||
#define I2C_SDA GPIO_NUM_4 // SD1306 D1+D2
|
||||
#define I2C_SCL GPIO_NUM_15 // SD1306 D0
|
@ -22,5 +22,5 @@
|
||||
|
||||
// Hardware pin definitions for Heltec LoRa-32 Board with OLED SSD1306 I2C Display
|
||||
#define OLED_RST GPIO_NUM_16 // ESP32 GPIO16 (Pin16) -- SD1306 RST
|
||||
#define OLED_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 D1+D2
|
||||
#define OLED_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 D0
|
||||
#define I2C_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 D1+D2
|
||||
#define I2C_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 D0
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
// Hardware pin definitions for LoRaNode32 Board with OLED I2C Display
|
||||
#define OLED_RST U8X8_PIN_NONE // Not reset pin
|
||||
#define OLED_SDA 14 // ESP32 GPIO14 (Pin14) -- OLED SDA
|
||||
#define OLED_SCL 12 // ESP32 GPIO12 (Pin12) -- OLED SCL
|
||||
#define I2C_SDA 14 // ESP32 GPIO14 (Pin14) -- OLED SDA
|
||||
#define I2C_SCL 12 // ESP32 GPIO12 (Pin12) -- OLED SCL
|
||||
|
||||
// I2C config for Microchip 24AA02E64 DEVEUI unique address
|
||||
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
// Hardware pin definitions for LoRaNode32 Board with OLED I2C Display
|
||||
#define OLED_RST U8X8_PIN_NONE // Not reset pin
|
||||
#define OLED_SDA 21 // ESP32 GPIO21 (Pin21) -- OLED SDA
|
||||
#define OLED_SCL 22 // ESP32 GPIO22 (Pin22) -- OLED SCL
|
||||
#define I2C_SDA 21 // ESP32 GPIO21 (Pin21) -- OLED SDA
|
||||
#define I2C_SCL 22 // ESP32 GPIO22 (Pin22) -- OLED SCL
|
||||
|
||||
// I2C config for Microchip 24AA02E64 DEVEUI unique address
|
||||
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64
|
||||
|
@ -24,5 +24,5 @@
|
||||
|
||||
// Hardware pin definitions for TTGOv1 Board with OLED SSD1306 I2C Display
|
||||
#define OLED_RST GPIO_NUM_16 // ESP32 GPIO16 (Pin16) -- SD1306 Reset
|
||||
#define OLED_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 Data
|
||||
#define OLED_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 Clock
|
||||
#define I2C_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 Data
|
||||
#define I2C_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 Clock
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
||||
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
||||
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
#define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
|
||||
/* source:
|
||||
https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973
|
||||
|
@ -26,5 +26,5 @@
|
||||
|
||||
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
||||
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
||||
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
#define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
@ -28,5 +28,5 @@
|
||||
|
||||
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display
|
||||
#define OLED_RST U8X8_PIN_NONE // connected to CPU RST/EN
|
||||
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
#define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
|
||||
#define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
|
||||
|
@ -43,6 +43,10 @@ void gen_lora_deveui(uint8_t *pdeveui) {
|
||||
void gen_lora_deveui(uint8_t *pdeveui) {
|
||||
uint8_t *p = pdeveui, dmac[6];
|
||||
ESP_ERROR_CHECK(esp_efuse_mac_get_default(dmac));
|
||||
// deveui is LSB, we reverse it so TTN DEVEUI display
|
||||
// will remain the same as MAC address
|
||||
// MAC is 6 bytes, devEUI 8, set middle 2 ones
|
||||
// to an arbitrary value
|
||||
*p++ = dmac[5];
|
||||
*p++ = dmac[4];
|
||||
*p++ = dmac[3];
|
||||
@ -96,7 +100,7 @@ void get_hard_deveui(uint8_t *pdeveui) {
|
||||
#ifdef MCP_24AA02E64_I2C_ADDRESS
|
||||
uint8_t i2c_ret;
|
||||
// Init this just in case, no more to 100KHz
|
||||
Wire.begin(OLED_SDA, OLED_SCL, 100000);
|
||||
Wire.begin(I2C_SDA, I2C_SCL, 100000);
|
||||
Wire.beginTransmission(MCP_24AA02E64_I2C_ADDRESS);
|
||||
Wire.write(MCP_24AA02E64_MAC_ADDRESS);
|
||||
i2c_ret = Wire.endTransmission();
|
||||
|
Loading…
Reference in New Issue
Block a user