Removed collision with official M5Core

This commit is contained in:
tobozo 2020-09-19 23:44:33 +02:00
parent e5786c1757
commit c5c59c45a5
12 changed files with 144 additions and 16 deletions

View file

@ -7,5 +7,5 @@ paragraph=See more on https://github.com/tobozo/ESP32-Chimera-Core
category=Device Control
url=https://github.com/tobozo/ESP32-Chimera-Core
architectures=esp32
includes=M5Stack.h
includes=ESP32-Chimera-Core.h
depends=LovyanGFX

View file

@ -68,7 +68,7 @@
//#define TFCARD_CS_PIN 13
#define SPEAKER_PIN -1
//#define SPEAKER_PIN -1
#define BUTTON_A_PIN 36
#define BUTTON_B_PIN -1
#define BUTTON_C_PIN -1
@ -100,6 +100,7 @@
#define LILYGO_WATCH_HAS_AXP202
#define LILYGO_WATCH_HAS_BACKLIGHT
#define LILYGO_WATCH_HAS_BUTTON
#define HAS_TOUCH
#elif defined(LILYGO_WATCH_2019_NO_TOUCH)
#warning "Selected LILYGO_WATCH_2019_NO_TOUCH"
#define SD_ENABLE 1
@ -116,10 +117,12 @@
#define LILYGO_WATCH_HAS_AXP202
#define LILYGO_WATCH_HAS_BUTTON
#define LILYGO_WATCH_HAS_MPU6050
#define HAS_TOUCH
#else // defaulting to LILYGO_WATCH_2020
#define SD_ENABLE 0
#undef SPEAKER_PIN
#define SPEAKER_PIN -1
#define HAS_TOUCH
#if defined(BOARD_HAS_PSRAM)
#warning "Defaulting to LILYGO_WATCH_2020_V1"
//#include "board/twatch2020_v1.h"
@ -218,6 +221,7 @@
#define TFT_MISO_PIN 38
#undef TOUCH_CS // using I2C touch
#define HAS_TOUCH
#define TFCARD_CS_PIN 4
#define SD_ENABLE 0

View file

@ -4,15 +4,15 @@
/**
* \par Copyright (C), 2016-2017, M5Stack
* \class M5Stack
* \brief M5Stack library.
* @file M5Stack.h
* @author M5Stack
* @version V0.2.4
* @date 2018/10/29
* @brief Header for M5Stack.cpp module
* \brief A clone of M5Stack library with multiple devices support
* @file ESP32-Chimera-Core
* @author M5Stack, tobozo
* @version V1.1.0
* @date 2020/09/19
* @brief Header for ESP32-Chimera-Core.cpp module
*
* \par Description
* This file is a drive for M5Stack core.
* This file is a drive for M5Stack/M5Core2/Odroid-Go/TWatch (and more) core.
*
* \par Method List:
*
@ -157,6 +157,14 @@
#if defined( LILYGO_WATCH_HAS_PCF8563 )
#include "drivers/TWatch/rtc/pcf8563.h"
#endif
#if defined HAS_TOUCH
// TODO: implement TWatch Touch
#endif
#endif
#ifndef HAS_TOUCH
// dummy Touch object for detection
#include "drivers/common/DummyTouch/DummyTouch.h"
#endif
class M5Stack
@ -237,6 +245,11 @@
#endif
#endif
#ifndef HAS_TOUCH
touch Touch; // create dummy touch object
#endif
// UART
// HardwareSerial Serial0 = HardwareSerial(0);
// HardwareSerial Serial2 = HardwareSerial(2);

View file

@ -1,2 +0,0 @@
// now just an alias
#include "ESP32-Chimera-Core.h"

View file

@ -3,7 +3,7 @@
#ifndef M5Faces_h
#define M5Faces_h
#include "../../M5Stack.h"
#include "../../ESP32-Chimera-Core.h"
class M5Faces {
public:

View file

@ -1,4 +1,3 @@
#include "../../../M5Stack.h"
#include "MPU9250.h"
//==============================================================================

View file

@ -10,6 +10,7 @@
#include <SPI.h>
#include <Wire.h>
#include "../../../ESP32-Chimera-Core.h"
// See also MPU-9250 Register Map and Descriptions, Revision 4.0,
// RM-MPU-9250A-00, Rev. 1.4, 9/9/2013 for registers not listed in above

View file

@ -0,0 +1,33 @@
// TODO: fire real touch events (e.g. M5Core2 emulation) when button is pressed
#include "DummyTouch.h"
touch::touch(/* args */)
{
}
touch::~touch(void)
{
}
void touch::begin(void)
{
}
bool touch::ispressed(void)
{
return false;
}
const TouchPoint_t& touch::getPressPoint(void)
{
_TouchPoint.x = _TouchPoint.y = -1;
return _TouchPoint;
}
int touch::readTouchtoBuff(void)
{
return -1;
}

View file

@ -0,0 +1,79 @@
#ifndef _DUMMY_TOUCH_H
#define _DUMMY_TOUCH_H
#include <Arduino.h>
//#include <Wire.h>
typedef struct point
{
int x;
int y;
}TouchPoint_t;
typedef struct HotZone
{
HotZone(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, void (*fun)() = nullptr){
_x0 = x0;
_y0 = y0;
_x1 = x1;
_y1 = y1;
_fun = fun;
}
inline void setZone(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, void (*fun)() = nullptr )
{
_x0 = x0;
_y0 = y0;
_x1 = x1;
_y1 = y1;
_fun = fun;
}
inline bool inHotZone(TouchPoint_t point)
{
if(( point.x >= _x0 )&&( point.x <= _x1 )&&
( point.y >= _y0 )&&( point.y <= _y1 ))
{
return true;
}
return false;
}
inline bool inHotZoneDoFun(TouchPoint_t point)
{
if(( point.x >= _x0 )&&( point.x <= _x1 )&&
( point.y >= _y0 )&&( point.y <= _y1 ))
{
if( _fun != nullptr )
{
_fun();
}
return true;
}
return false;
}
uint16_t _x0;
uint16_t _y0;
uint16_t _x1;
uint16_t _y1;
void (*_fun)();
}HotZone_t;
class touch
{
private:
/* data */
TouchPoint_t _TouchPoint;
public:
touch(/* args */);
~touch(void);
void begin(void);
bool ispressed(void);
const TouchPoint_t& getPressPoint(void);
HotZone_t* creatHotZone(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h);
private:
int readTouchtoBuff(void);
};
#endif // _DUMMY_TOUCH_H

View file

@ -6,7 +6,7 @@
* https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html *
*----------------------------------------------------------------------*/
#include "CommUtil.h"
#include "../../../M5Stack.h"
#include "../../../ESP32-Chimera-Core.h"
extern M5Stack M5;

View file

@ -6,7 +6,7 @@
* https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html *
*----------------------------------------------------------------------*/
#include "Power.h"
#include "../../../M5Stack.h"
#include "../../../ESP32-Chimera-Core.h"
#include <rom/rtc.h>
#include <esp_sleep.h>
#include <esp_bt_main.h>

View file

@ -10,7 +10,8 @@
#ifndef _TOUCH_BUTTON_H
#define _TOUCH_BUTTON_H
#include "../M5Display.h"
//#include "../M5Display.h"
#include "../ESP32-Chimera-Core.h"
class TouchButton {