Skip to content

Commit

Permalink
Merge pull request #84 from tobozo/1.5.2
Browse files Browse the repository at this point in the history
1.5.2
  • Loading branch information
tobozo authored Oct 30, 2023
2 parents ca62e2f + b6b2591 commit 44970c2
Show file tree
Hide file tree
Showing 19 changed files with 1,097 additions and 1,336 deletions.
Binary file added assets/bifocal-pidgin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ESP32-Chimera-Core",
"description": "Alternate library M5Stack/Odroid-Go/D-Duino and possiblly other ESP32/TFT/SD bundles",
"keywords": ["ESP32-Chimera-Core", "M5Stack", "M5Core2", "Odroid-Go", "ttgo-ts", "d-duino-32-xs", "esp32-wrover-kit"],
"description": "Alternate library for M5Stack/Odroid-Go/D-Duino and possiblly other ESP32/TFT/SD bundles",
"keywords": ["ESP32-Chimera-Core", "M5Stack", "M5Core2", "Odroid-Go", "ttgo-ts", "d-duino-32-xs", "esp32-wrover-kit", "M5CoreS3", "T-Deck"],
"authors": [
{
"name": "tobozo",
Expand All @@ -22,7 +22,7 @@
"name": "LovyanGFX"
}
],
"version": "1.5.1",
"version": "1.5.2",
"framework": "arduino",
"platforms": "espressif32",
"headers": "ESP32-Chimera-Core.h",
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name=ESP32-Chimera-Core
version=1.5.1
version=1.5.2
author=tobozo,Lovyan03
maintainer[email protected]
sentence=Alternate library M5Stack/M5Core2/Odroid-Go/D-Duino and possiblly other ESP32/TFT/SD bundles
sentence=Alternate library for M5Stack/M5Core2/Odroid-Go/D-Duino and possiblly other ESP32/TFT/SD bundles
paragraph=See more on https://github.com/tobozo/ESP32-Chimera-Core
category=Device Control
url=https://github.com/tobozo/ESP32-Chimera-Core
Expand Down
27 changes: 24 additions & 3 deletions src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,6 @@

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




#define HAS_TOUCH
#define TOUCH_INT 16
#define TOUCH_SDA 18
Expand Down Expand Up @@ -710,6 +707,30 @@
// #define TDECK_I2S_DOUT 6
//

#elif defined ARDUINO_SUNTON_4827S043

#define ECC_LGFX_EXT_CONF "ext_confs/Sunton-4827S043.hpp"
#define HAS_TOUCH

#define TFCARD_CS_PIN GPIO_NUM_10
#define TFCARD_MOSI_PIN GPIO_NUM_11
#define TFCARD_MISO_PIN GPIO_NUM_13
#define TFCARD_CLK_PIN GPIO_NUM_12

#define SD_ENABLE 1
#define TFCARD_SPI_FREQ 80000000

//#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN GPIO_NUM_17
#define RADAR_TX_PIN GPIO_NUM_18

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

#define SPEAKER_PIN -1


#else
Expand Down
2 changes: 1 addition & 1 deletion src/ESP32-Chimera-Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace ChimeraCore
#if defined HAS_KEYBOARD
log_d("Enabling Keyboard");
Keyboard = new Keyboard_Class(
&Wire1, KEYBOARD_I2C_ADDR, KEYBOARD_INT_PIN,
&Wire1, KEYBOARD_SDA_PIN, KEYBOARD_SCL_PIN, KEYBOARD_INT_PIN, KEYBOARD_I2C_ADDR,
[](uint8_t key) { [[maybe_unused]]char c[2]={key,0}; log_d("Keyboard Interrupt: char=%s (0x%02x)", c, key); }
);
#endif
Expand Down
61 changes: 45 additions & 16 deletions src/drivers/T-Deck/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ namespace ChimeraCore
: _bus(bus), _dev_addr(dev_addr), _fire_event(fire_event) { init(); }
TDeck_Keyboard_Class( TwoWire* bus, uint8_t dev_addr, gpio_num_t pin_int, fire_event_t fire_event )
: _bus(bus), _pin_int(pin_int), _dev_addr(dev_addr), _fire_event(fire_event) { _has_interrupt = true; init(); }
TDeck_Keyboard_Class( gpio_num_t pin_sda, gpio_num_t pin_scl, uint8_t dev_addr, fire_event_t fire_event )
: _pin_sda(pin_sda), _pin_scl(pin_scl), _dev_addr(dev_addr), _fire_event(fire_event) { _bus=&Wire1; _has_pins=true; init(); }
TDeck_Keyboard_Class( gpio_num_t pin_sda, gpio_num_t pin_scl, gpio_num_t pin_int, uint8_t dev_addr, fire_event_t fire_event )
: _pin_sda(pin_sda), _pin_scl(pin_scl), _pin_int(pin_int), _dev_addr(dev_addr), _fire_event(fire_event) { _bus=&Wire; _has_pins=true; _has_interrupt = true; init(); }
TDeck_Keyboard_Class( TwoWire* bus, gpio_num_t pin_sda, gpio_num_t pin_scl, uint8_t dev_addr, fire_event_t fire_event )
: _bus(bus), _pin_sda(pin_sda), _pin_scl(pin_scl), _dev_addr(dev_addr), _fire_event(fire_event), _has_pins(true) { init(); }
TDeck_Keyboard_Class( TwoWire* bus, gpio_num_t pin_sda, gpio_num_t pin_scl, gpio_num_t pin_int, uint8_t dev_addr, fire_event_t fire_event )
: _bus(bus), _pin_sda(pin_sda), _pin_scl(pin_scl), _pin_int(pin_int), _dev_addr(dev_addr), _fire_event(fire_event), _has_interrupt(true), _has_pins(true) { init(); }

~TDeck_Keyboard_Class()
{
Expand All @@ -45,17 +45,43 @@ namespace ChimeraCore
return false;
}
if( _has_pins ) {
_bus->begin(_pin_sda, _pin_scl/*, _i2c_freq*/);
_bus->end();
_bus->begin(_pin_sda, _pin_scl, _i2c_freq);
log_d("Starting I2C bus sda=%d,scl=%d", _pin_sda, _pin_scl );
}
_bus->requestFrom(_dev_addr, (uint8_t)1);
if (_bus->read() == -1) {
int response = _bus->read();
if (response == -1) {
Serial.println("LILYGO Keyboad not online!");
return false;
}

// uint8_t ret = 0;
// uint8_t reg_helo[4] = { 'h','e','l','o' };
// _bus->beginTransmission(_dev_addr); // begin
// _bus->write( reg_helo, (uint8_t)4 ); // send HELO message
// ret = _bus->endTransmission(true); // end
// log_d("endTransmission: %u", ret);
//
// // read 4 bytes
// uint8_t bytes_to_read = 4;
// ret = _bus->requestFrom(_dev_addr, bytes_to_read ); // request a total of 16 registers
//
// if( ret == bytes_to_read ) {
// uint8_t resp[bytes_to_read];
// _bus->readBytes( resp, bytes_to_read );
// log_print_buf(resp, bytes_to_read);
// // uint16_t b16 = _bus->read() << 8 | _bus->read();
// // uint8_t b81 = _bus->read();
// // uint8_t b82 = _bus->read();
// // log_d("b16: 0x%04x b81: 0x%02x b82: 0x%02x", b16, b81, b82 );
// } else {
// log_d("Error in requestFrom: %u", ret);
// }

if( _has_interrupt ) {
log_d("Attaching interrupt");
pinMode(_pin_int, INPUT_PULLUP);
pinMode(_pin_int, INPUT/*_PULLUP*/);
attachInterrupt(_pin_int, TDeck_Keyboard::ISR_key, FALLING);
}
return true;
Expand Down Expand Up @@ -97,22 +123,25 @@ namespace ChimeraCore
void update()
{
if( _has_interrupt ) {
static uint32_t next_key_scan_ms = 0;
if (TDeck_Keyboard::keyboard_interrupted || (millis() > next_key_scan_ms)) {
if (TDeck_Keyboard::keyboard_interrupted ) {
log_d("Interrupt!");
char key;
do {
//do {
key = get_key();
if( key !=0 ) {
if( _fire_event ) _fire_event( key );
next_key_scan_ms = millis() + TDeck_Keyboard::key_scan_interval_ms;
}
} while( key !=0 );
TDeck_Keyboard::keyboard_interrupted = false;
//} while( key !=0 );
}
TDeck_Keyboard::keyboard_interrupted = false;
} else {
int key = get_key();
if(key > 0) {
if( _fire_event ) _fire_event( key );
static uint32_t next_key_scan_ms = 0;
if(millis() > next_key_scan_ms) {
int key = get_key();
if(key > 0) {
if( _fire_event ) _fire_event( key );
}
next_key_scan_ms = millis() + TDeck_Keyboard::key_scan_interval_ms;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/drivers/common/Button/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Button
uint8_t pressedFor(uint32_t ms);
uint8_t releasedFor(uint32_t ms);
uint8_t wasReleasefor(uint32_t ms);
uint8_t wasReleaseFor(uint32_t ms) { return wasReleasefor(ms); } // compliance with M5Unified camel casing
uint32_t lastChange();
void setDebounce( uint32_t dbTime_millis) { _dbTime_millis = dbTime_millis; }
#ifdef ARDUINO_ODROID_ESP32
Expand Down
4 changes: 2 additions & 2 deletions src/ext_confs/Lilygo-S3-T-Deck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@
cfg.y_max = 320;
cfg.bus_shared = true;
// I2C
cfg.i2c_port = I2C_NUM_1;
cfg.i2c_port = I2C_NUM_1; // Wire1
cfg.i2c_addr = 0x5D;
cfg.pin_sda = GPIO_NUM_18;
cfg.pin_scl = GPIO_NUM_8;
cfg.pin_int = GPIO_NUM_16;
cfg.pin_rst = -1;
cfg.freq = 400000;
cfg.freq = 800000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
}
Expand Down
122 changes: 122 additions & 0 deletions src/ext_confs/Sunton-4827S043.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#pragma once

#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <driver/i2c.h>



class LGFX_Makerfabs : public lgfx::LGFX_Device
{
public:

lgfx::Bus_RGB _bus_instance;
lgfx::Panel_RGB _panel_instance;
lgfx::Light_PWM _light_instance;
lgfx::Touch_GT911 _touch_instance;

LGFX_Makerfabs(void)
{
{
auto cfg = _panel_instance.config();

cfg.memory_width = 480;
cfg.panel_width = 480;
cfg.memory_height = 272;
cfg.panel_height = 272;

cfg.offset_x = 0;
cfg.offset_y = 0;

_panel_instance.config(cfg);
}

{
auto cfg = _panel_instance.config_detail();

cfg.use_psram = 1;

_panel_instance.config_detail(cfg);
}

{
auto cfg = _bus_instance.config();
cfg.panel = &_panel_instance;

cfg.pin_d0 = GPIO_NUM_8; // B0
cfg.pin_d1 = GPIO_NUM_3; // B1
cfg.pin_d2 = GPIO_NUM_46; // B2
cfg.pin_d3 = GPIO_NUM_9; // B3
cfg.pin_d4 = GPIO_NUM_1; // B4
cfg.pin_d5 = GPIO_NUM_5; // G0
cfg.pin_d6 = GPIO_NUM_6; // G1
cfg.pin_d7 = GPIO_NUM_7; // G2
cfg.pin_d8 = GPIO_NUM_15; // G3
cfg.pin_d9 = GPIO_NUM_16; // G4
cfg.pin_d10 = GPIO_NUM_4; // G5
cfg.pin_d11 = GPIO_NUM_45; // R0
cfg.pin_d12 = GPIO_NUM_48; // R1
cfg.pin_d13 = GPIO_NUM_47; // R2
cfg.pin_d14 = GPIO_NUM_21; // R3
cfg.pin_d15 = GPIO_NUM_14; // R4

cfg.pin_henable = GPIO_NUM_40;
cfg.pin_vsync = GPIO_NUM_41;
cfg.pin_hsync = GPIO_NUM_39;
cfg.pin_pclk = GPIO_NUM_42;
cfg.freq_write = 9000000;

cfg.hsync_polarity = 0;
cfg.hsync_front_porch = 8;
cfg.hsync_pulse_width = 4;
cfg.hsync_back_porch = 43;
cfg.vsync_polarity = 0;
cfg.vsync_front_porch = 8;
cfg.vsync_pulse_width = 4;
cfg.vsync_back_porch = 12;
cfg.pclk_idle_high = 1;
cfg.pclk_active_neg = 1;
_bus_instance.config(cfg);
}
_panel_instance.setBus(&_bus_instance);

{
auto cfg = _light_instance.config();
cfg.pin_bl = GPIO_NUM_2;
cfg.invert = true;
_light_instance.config(cfg);
}
_panel_instance.light(&_light_instance);

{
auto cfg = _touch_instance.config();
cfg.x_min = 0;
cfg.y_min = 0;
cfg.bus_shared = false;
cfg.offset_rotation = 0;
// I2C接続
cfg.i2c_port = I2C_NUM_1;
cfg.pin_sda = GPIO_NUM_19;
cfg.pin_scl = GPIO_NUM_20;
cfg.pin_int = GPIO_NUM_NC;
cfg.pin_rst = GPIO_NUM_38;
// #if defined ( LGFX_MAKERFABS_MATOUCH_1024X768 )
// cfg.x_max = 1024;
// cfg.y_max = 768;
// #else
cfg.x_max = 480;
cfg.y_max = 272;
// #endif
cfg.freq = 400000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
}

setPanel(&_panel_instance);
}
};


#define LGFX LGFX_Makerfabs
using M5Display = LGFX_Makerfabs;
2 changes: 1 addition & 1 deletion src/gitTagVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#define ECC_VERSION_MAJOR 1
#define ECC_VERSION_MINOR 5
#define ECC_VERSION_PATCH 1
#define ECC_VERSION_PATCH 2
#if !defined _ECC_STR
#define _ECC_STR(x) #x
#endif
Expand Down
Loading

0 comments on commit 44970c2

Please sign in to comment.