Merge pull request #157 from cyberman54/master

sync master to dev
This commit is contained in:
Verkehrsrot 2018-09-20 12:55:19 +02:00 committed by GitHub
commit 6af4405e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 39 additions and 18 deletions

View File

@ -4,7 +4,7 @@
#include "globals.h" #include "globals.h"
#include <esp_spi_flash.h> // needed for reading ESP32 chip attributes #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 // helper string for converting LoRa spread factor values
#if defined(CFG_eu868) #if defined(CFG_eu868)

View File

@ -34,5 +34,5 @@
// pin definitions for I2C interface of OLED Display // pin definitions for I2C interface of OLED Display
#define OLED_RST GPIO_NUM_16 // SSD1306 RST #define OLED_RST GPIO_NUM_16 // SSD1306 RST
#define OLED_SDA GPIO_NUM_4 // SD1306 D1+D2 #define I2C_SDA GPIO_NUM_4 // SD1306 D1+D2
#define OLED_SCL GPIO_NUM_15 // SD1306 D0 #define I2C_SCL GPIO_NUM_15 // SD1306 D0

View File

@ -22,5 +22,5 @@
// Hardware pin definitions for Heltec LoRa-32 Board with OLED SSD1306 I2C Display // 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_RST GPIO_NUM_16 // ESP32 GPIO16 (Pin16) -- SD1306 RST
#define OLED_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 D1+D2 #define I2C_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 D1+D2
#define OLED_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 D0 #define I2C_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 D0

View File

@ -31,8 +31,8 @@
// Hardware pin definitions for LoRaNode32 Board with OLED I2C Display // Hardware pin definitions for LoRaNode32 Board with OLED I2C Display
#define OLED_RST U8X8_PIN_NONE // Not reset pin #define OLED_RST U8X8_PIN_NONE // Not reset pin
#define OLED_SDA 14 // ESP32 GPIO14 (Pin14) -- OLED SDA #define I2C_SDA 14 // ESP32 GPIO14 (Pin14) -- OLED SDA
#define OLED_SCL 12 // ESP32 GPIO12 (Pin12) -- OLED SCL #define I2C_SCL 12 // ESP32 GPIO12 (Pin12) -- OLED SCL
// I2C config for Microchip 24AA02E64 DEVEUI unique address // I2C config for Microchip 24AA02E64 DEVEUI unique address
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64 #define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64

View File

@ -32,8 +32,8 @@
// Hardware pin definitions for LoRaNode32 Board with OLED I2C Display // Hardware pin definitions for LoRaNode32 Board with OLED I2C Display
#define OLED_RST U8X8_PIN_NONE // Not reset pin #define OLED_RST U8X8_PIN_NONE // Not reset pin
#define OLED_SDA 21 // ESP32 GPIO21 (Pin21) -- OLED SDA #define I2C_SDA 21 // ESP32 GPIO21 (Pin21) -- OLED SDA
#define OLED_SCL 22 // ESP32 GPIO22 (Pin22) -- OLED SCL #define I2C_SCL 22 // ESP32 GPIO22 (Pin22) -- OLED SCL
// I2C config for Microchip 24AA02E64 DEVEUI unique address // I2C config for Microchip 24AA02E64 DEVEUI unique address
#define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64 #define MCP_24AA02E64_I2C_ADDRESS 0x50 // I2C address for the 24AA02E64

View File

@ -24,5 +24,5 @@
// Hardware pin definitions for TTGOv1 Board with OLED SSD1306 I2C Display // Hardware pin definitions for TTGOv1 Board with OLED SSD1306 I2C Display
#define OLED_RST GPIO_NUM_16 // ESP32 GPIO16 (Pin16) -- SD1306 Reset #define OLED_RST GPIO_NUM_16 // ESP32 GPIO16 (Pin16) -- SD1306 Reset
#define OLED_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 Data #define I2C_SDA GPIO_NUM_4 // ESP32 GPIO4 (Pin4) -- SD1306 Data
#define OLED_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 Clock #define I2C_SCL GPIO_NUM_15 // ESP32 GPIO15 (Pin15) -- SD1306 Clock

View File

@ -25,8 +25,8 @@
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display // 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_RST U8X8_PIN_NONE // connected to CPU RST/EN
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2 #define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0 #define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0
/* source: /* source:
https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973 https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973

View File

@ -26,5 +26,5 @@
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display // 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_RST U8X8_PIN_NONE // connected to CPU RST/EN
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2 #define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0 #define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0

View File

@ -28,5 +28,5 @@
// Hardware pin definitions for TTGO V2 Board with OLED SSD1306 0,96" I2C Display // 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_RST U8X8_PIN_NONE // connected to CPU RST/EN
#define OLED_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2 #define I2C_SDA GPIO_NUM_21 // ESP32 GPIO21 -- SD1306 D1+D2
#define OLED_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0 #define I2C_SCL GPIO_NUM_22 // ESP32 GPIO22 -- SD1306 D0

View File

@ -37,6 +37,27 @@ void gen_lora_deveui(uint8_t *pdeveui) {
} }
} }
/* The above function should be changed to this one, but this would be a breaking change
// DevEUI generator using devices's MAC address
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];
*p++ = 0xff;
*p++ = 0xfe;
*p++ = dmac[2];
*p++ = dmac[1];
*p++ = dmac[0];
}
*/
// Function to do a byte swap in a byte array // Function to do a byte swap in a byte array
void RevBytes(unsigned char *b, size_t c) { void RevBytes(unsigned char *b, size_t c) {
u1_t i; u1_t i;
@ -79,7 +100,7 @@ void get_hard_deveui(uint8_t *pdeveui) {
#ifdef MCP_24AA02E64_I2C_ADDRESS #ifdef MCP_24AA02E64_I2C_ADDRESS
uint8_t i2c_ret; uint8_t i2c_ret;
// Init this just in case, no more to 100KHz // 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.beginTransmission(MCP_24AA02E64_I2C_ADDRESS);
Wire.write(MCP_24AA02E64_MAC_ADDRESS); Wire.write(MCP_24AA02E64_MAC_ADDRESS);
i2c_ret = Wire.endTransmission(); i2c_ret = Wire.endTransmission();