Skip to content

Commit

Permalink
Merge pull request #83 from tobozo/1.5.1
Browse files Browse the repository at this point in the history
1.5.1
  • Loading branch information
tobozo authored Oct 13, 2023
2 parents c826ba6 + 104f0a2 commit ca62e2f
Show file tree
Hide file tree
Showing 30 changed files with 1,050 additions and 516 deletions.
Binary file added assets/jackalope.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"name": "LovyanGFX"
}
],
"version": "1.5.0",
"version": "1.5.1",
"framework": "arduino",
"platforms": "espressif32",
"headers": "ESP32-Chimera-Core.h",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32-Chimera-Core
version=1.5.0
version=1.5.1
author=tobozo,Lovyan03
maintainer[email protected]
sentence=Alternate library M5Stack/M5Core2/Odroid-Go/D-Duino and possiblly other ESP32/TFT/SD bundles
Expand Down
60 changes: 39 additions & 21 deletions src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
#define ECC_XSTR(x) ECC_STR(x)
#define ECC_STR(x) #x

#if !defined ECC_NO_PRAGMAS
#define ECC_PRAGMA_XMESSAGE(msg) ECC_PRAGMA_MESSAGE(msg)
#define ECC_PRAGMA_MESSAGE(msg) \
_Pragma( ECC_STR( message msg ) )
#define ECC_NO_PRAGMAS // stop flag propagation
#else
#define ECC_PRAGMA_XMESSAGE(msg)
#define ECC_PRAGMA_MESSAGE(msg)
#endif


#define HAS_SDCARD
//#define USE_SCREENSHOTS
//#define USE_NVSUTILS
Expand All @@ -25,6 +14,20 @@
#include "pins_arduino.h"
#include "esp32-hal-log.h"
#include <sdkconfig.h>
#if __has_include(<esp_arduino_version.h>) // platformio has optional esp_arduino_version
#include <esp_arduino_version.h>
#endif

#if !defined ECC_NO_PRAGMAS && CORE_DEBUG_LEVEL>=ARDUHAL_LOG_LEVEL_ERROR
#define ECC_PRAGMA_XMESSAGE(msg) ECC_PRAGMA_MESSAGE(msg)
#define ECC_PRAGMA_MESSAGE(msg) \
_Pragma( ECC_STR( message msg ) )
#define ECC_NO_PRAGMAS // stop flag propagation
#else
#define ECC_PRAGMA_XMESSAGE(msg)
#define ECC_PRAGMA_MESSAGE(msg)
#endif


#if defined ESP_ARDUINO_VERSION_VAL
#if __has_include(<core_version.h>) // platformio has optional core_version.h
Expand Down Expand Up @@ -650,6 +653,9 @@

#define ECC_LGFX_EXT_CONF "ext_confs/Lilygo-S3-T-Deck.hpp"




#define HAS_TOUCH
#define TOUCH_INT 16
#define TOUCH_SDA 18
Expand All @@ -659,9 +665,20 @@

#define TFCARD_CS_PIN 39
#define SD_ENABLE 1

//#define HAS_BUTTONS
#define BUTTON_A_PIN -1
#define BUTTON_B_PIN -1
#define BUTTON_C_PIN -1

#define HAS_TRACKBALL "drivers/T-Deck/trackball.h"
#define TRACKBALL_UP_PIN GPIO_NUM_3
#define TRACKBALL_DOWN_PIN GPIO_NUM_15
#define TRACKBALL_LEFT_PIN GPIO_NUM_1
#define TRACKBALL_RIGHT_PIN GPIO_NUM_2
#define TRACKBALL_CLICK_PIN GPIO_NUM_0
#define TrackBall_Class TDeck_TrackBall_Class

#define SPEAKER_PIN -1

// LoRa mapped pins
Expand All @@ -670,18 +687,19 @@
#define LORA_RST_PIN 17
#define LORA_DIO1_PIN 45

#define HAS_KEYBOARD "drivers/T-Deck/keyboard.h"
#define Keyboard_Class TDeck_Keyboard_Class

#define KEYBOARD_SDA_PIN GPIO_NUM_18
#define KEYBOARD_SCL_PIN GPIO_NUM_8
#define KEYBOARD_INT_PIN GPIO_NUM_46
#define KEYBOARD_I2C_ADDR 0x55

// Keyboard_Class( SDA, SCL, KEYBOARD_INT_PIN, KEYBOARD_ADDR, nullptr )

// #define TDECK_PERI_POWERON 10
// #define TDECK_BAT_ADC 4
//
// #define TDECK_KEYBOARD_INT 46
// #define TDECK_KEYBOARD_ADDR 0x55
//
// #define TDECK_TRACKBALL_UP 3
// #define TDECK_TRACKBALL_DOWN 15
// #define TDECK_TRACKBALL_LEFT 1
// #define TDECK_TRACKBALL_RIGHT 2
// #define TDECK_TRACKBALL_CLICK 0
//

// #define TDECK_ES7210_MCLK 48
// #define TDECK_ES7210_LRCK 21
// #define TDECK_ES7210_SCK 47
Expand Down
29 changes: 28 additions & 1 deletion src/ESP32-Chimera-Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ namespace ChimeraCore
}
#endif

#if defined HAS_TRACKBALL
log_d("Enabling Trackball");
TrackBall = new TrackBall_Class(
TRACKBALL_UP_PIN, TRACKBALL_DOWN_PIN, TRACKBALL_LEFT_PIN, TRACKBALL_RIGHT_PIN, TRACKBALL_CLICK_PIN,
Lcd.width(), Lcd.height(),
[](int16_t x, int16_t y, bool click) { log_d("Trackball Interrupt: x=%d, y=%d, clic=%s", x, y, click?"true":"false"); }
);
#endif

#if defined HAS_KEYBOARD
log_d("Enabling Keyboard");
Keyboard = new Keyboard_Class(
&Wire1, KEYBOARD_I2C_ADDR, KEYBOARD_INT_PIN,
[](uint8_t key) { [[maybe_unused]]char c[2]={key,0}; log_d("Keyboard Interrupt: char=%s (0x%02x)", c, key); }
);
#endif


#if defined HAS_AXP2101
log_d("Enabling AXP2101");
Axp.begin(&Wire1);
Expand Down Expand Up @@ -223,16 +241,25 @@ namespace ChimeraCore
}
#endif

#if defined HAS_BUTTONS && !defined ARDUINO_M5STACK_Core2
#if defined HAS_BUTTONS
BtnA.read();
BtnB.read();
BtnC.read();
#endif

//Speaker update
#ifdef HAS_SPEAKER
Speaker.update();
#endif

#if defined HAS_TRACKBALL
TrackBall->update();
#endif

#if defined HAS_KEYBOARD
Keyboard->update();
#endif

#ifdef ARDUINO_ODROID_ESP32
BtnMenu.read();
BtnVolume.read();
Expand Down
22 changes: 21 additions & 1 deletion src/ESP32-Chimera-Core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define _CHIMERA_CORE_

#if ! defined ESP32
#error This library only supports boards with ESP32 family processors
#error "This library only supports boards with ESP32 family processors"
#endif

// #define MPU9250_INSDE // M5Core2 : enable this only if plugging a secondary MPU !
Expand Down Expand Up @@ -66,6 +66,18 @@
#undef HAS_RTC
#endif

#if defined HAS_KEYBOARD && (!defined ECC_NO_KEYBOARD)
#include HAS_KEYBOARD // "drivers/T-Deck/keyboard.h"
#else
#undef HAS_KEYBOARD
#endif

#if defined HAS_TRACKBALL && (!defined ECC_NO_TRACKBALL)
#include HAS_TRACKBALL // "drivers/T-Deck/trackball.h"
#else
#undef HAS_TRACKBALL
#endif

#if defined HAS_SPEAKER && (!defined ECC_NO_SPEAKER)
#include "drivers/common/Speaker/Speaker.h"
//#include "drivers/common/Audio/Speaker_Class.hpp"
Expand Down Expand Up @@ -244,6 +256,14 @@ namespace ChimeraCore
AXP2101 Axp;// = new AXP2101();
#endif

#if defined HAS_TRACKBALL
TrackBall_Class* TrackBall = nullptr;
#endif

#if defined HAS_KEYBOARD
Keyboard_Class* Keyboard = nullptr;
#endif

#if defined HAS_RTC
void setSystemTimeFromRtc();
void setRtcTime( uint16_t year, uint8_t month, uint8_t day , uint8_t hours, uint8_t minutes, uint8_t seconds );
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/ESP32-S3-Box/Audio/src/bsp_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "esp_err.h"
#include "driver/gpio.h"
#include "driver/spi_master.h"
#include "driver/adc.h"
//#include "driver/adc.h"
#include "audio_hal.h"

#ifdef __cplusplus
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/ESP32-S3-Box/Audio/src/bsp_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "i2c_bus.h"

static const char *TAG = "bsp_i2c";
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"

#define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/

Expand Down Expand Up @@ -134,3 +136,6 @@ i2c_bus_handle_t bsp_i2c_bus_get_handle(void)
{
return i2c_bus_handle;
}


#pragma GCC diagnostic pop
5 changes: 1 addition & 4 deletions src/drivers/ESP32-S3-Box/Audio/src/bsp_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
*/

// attempt to detect esp-idf version
#if __has_include(<esp_arduino_version.h>)
#include <esp_arduino_version.h>
#endif

// esp32-2.0.2 and previous don't have the guts to handle this
// which is fine since esp32-s3-box wasn't supported before
#if defined ESP_ARDUINO_VERSION_VAL
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 3)
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 3) && ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 0)

#include "bsp_board.h"
#include "bsp_i2s.h"
Expand Down
15 changes: 14 additions & 1 deletion src/drivers/ESP32-S3-Box/Audio/src/bsp_i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@
#pragma once

#include "esp_err.h"
#include "driver/i2s.h"

#if __has_include(<esp_arduino_version.h>)
#include <esp_arduino_version.h>
#endif

#if defined ESP_ARDUINO_VERSION_VAL
#if ESP_ARDUINO_VERSION <= ESP_ARDUINO_VERSION_VAL(2,0,14)
#include "driver/i2s.h"
#else
#include "driver/i2s_std.h"
#endif
#else
#include "driver/i2s.h"
#endif

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions src/drivers/ESP32-S3-Box/Audio/src/es8311.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef _ES8311_H
#define _ES8311_H

#include "rom/ets_sys.h"
#include "audio_hal.h"
#include "esp_types.h"
#include "esxxx_common.h"
Expand Down
1 change: 1 addition & 0 deletions src/drivers/ESP32-S3-Box/Audio/src/esp32_s3_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#pragma once

#include "rom/ets_sys.h"
#include "esp_err.h"
#include "bsp_board.h"
#include "es8311.h"
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/ESP32-S3-Box/Audio/src/i2c_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#define I2C_BUS_MUTEX_TICKS_TO_WAIT (I2C_BUS_MS_TO_WAIT/portTICK_RATE_MS)

static const char *TAG = "i2c_bus";
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat"

static i2c_bus_t s_i2c_bus[I2C_NUM_MAX];

#define I2C_BUS_CHECK(a, str, ret) if(!(a)) { \
Expand Down Expand Up @@ -466,3 +469,5 @@ inline static bool i2c_config_compare(i2c_port_t port, const i2c_config_t *conf)

return false;
}

#pragma GCC diagnostic pop
3 changes: 2 additions & 1 deletion src/drivers/Odroid-Go/Battery/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

#include "battery.h"

#if defined ARDUINO_ODROID_ESP32
#if defined ARDUINO_ODROID_ESP32 && defined HAS_ADC_CAL_SUPPORT

#include <esp_sleep.h>
#include <math.h>


Battery::Battery()
{
this->_enable_protection = false;
Expand Down
20 changes: 18 additions & 2 deletions src/drivers/Odroid-Go/Battery/battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
#pragma once
#define LIBRARIES_ODROID_GO_SRC_UTILITY_BATTERY_H_

#if __has_include(<esp_arduino_version.h>) // platformio has optional esp_arduino_version
#include <esp_arduino_version.h>
#endif

#define HAS_ADC_CAL_SUPPORT

#if defined ESP_ARDUINO_VERSION_VAL
#if ESP_ARDUINO_VERSION > ESP_ARDUINO_VERSION_VAL(2,0,14)
#undef HAS_ADC_CAL_SUPPORT
#endif
#endif


#include <driver/adc.h>
#include <esp_adc_cal.h>

Expand All @@ -29,8 +42,11 @@ class Battery
void update();

private:
esp_adc_cal_characteristics_t _adc_chars;
#if defined HAS_ADC_CAL_SUPPORT
esp_adc_cal_characteristics_t _adc_chars;
#endif
bool _enable_protection;
};


// #endif
// #endif
Loading

0 comments on commit ca62e2f

Please sign in to comment.