Fix ESP8266 compiler error

This commit is contained in:
fvanroie 2020-04-11 20:10:54 +02:00
parent 51c9af9086
commit 6b0150a624
2 changed files with 194 additions and 191 deletions

View File

@ -22,39 +22,44 @@
#define NUMSAMPLES 2
TSPoint::TSPoint(void) {
TSPoint::TSPoint(void)
{
x = y = 0;
}
TSPoint::TSPoint(int16_t x0, int16_t y0, int16_t z0) {
TSPoint::TSPoint(int16_t x0, int16_t y0, int16_t z0)
{
x = x0;
y = y0;
z = z0;
}
bool TSPoint::operator==(TSPoint p1) {
bool TSPoint::operator==(TSPoint p1)
{
return ((p1.x == x) && (p1.y == y) && (p1.z == z));
}
bool TSPoint::operator!=(TSPoint p1) {
bool TSPoint::operator!=(TSPoint p1)
{
return ((p1.x != x) || (p1.y != y) || (p1.z != z));
}
#if(NUMSAMPLES > 2)
static void insert_sort(int array[], uint8_t size) {
static void insert_sort(int array[], uint8_t size)
{
uint8_t j;
int save;
for(int i = 1; i < size; i++) {
save = array[i];
for (j = i; j >= 1 && save < array[j - 1]; j--)
array[j] = array[j - 1];
for(j = i; j >= 1 && save < array[j - 1]; j--) array[j] = array[j - 1];
array[j] = save;
}
}
#endif
TSPoint TouchScreen::getPoint(void) {
TSPoint TouchScreen::getPoint(void)
{
int x, y, z;
int samples[NUMSAMPLES];
uint8_t i, valid;
@ -114,7 +119,6 @@ TSPoint TouchScreen::getPoint(void) {
digitalWrite(_yp, HIGH);
#endif
#ifdef __arm__
delayMicroseconds(20); // Fast ARM chips need to allow voltages to settle
#endif
@ -156,7 +160,6 @@ TSPoint TouchScreen::getPoint(void) {
digitalWrite(_ym, HIGH);
#endif
#if defined(ESP32_WIFI_TOUCH) && defined(ESP32)
int z1 = analogRead(aXM);
int z2 = analogRead(aYP);
@ -187,8 +190,8 @@ TSPoint TouchScreen::getPoint(void) {
return TSPoint(x, y, z);
}
TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym,
uint16_t rxplate=0) {
TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym, uint16_t rxplate = 0)
{
_yp = yp;
_xm = xm;
_ym = ym;
@ -210,7 +213,8 @@ TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym,
pressureThreshhold = 10;
}
int TouchScreen::readTouchX(void) {
int TouchScreen::readTouchX(void)
{
pinMode(_yp, INPUT);
pinMode(_ym, INPUT);
digitalWrite(_yp, LOW);
@ -228,8 +232,8 @@ int TouchScreen::readTouchX(void) {
#endif
}
int TouchScreen::readTouchY(void) {
int TouchScreen::readTouchY(void)
{
pinMode(_xp, INPUT);
pinMode(_xm, INPUT);
digitalWrite(_xp, LOW);
@ -247,8 +251,8 @@ int TouchScreen::readTouchY(void) {
#endif
}
uint16_t TouchScreen::pressure(void) {
uint16_t TouchScreen::pressure(void)
{
// Set X+ to ground
pinMode(_xp, OUTPUT);
digitalWrite(_xp, LOW);
@ -271,7 +275,6 @@ uint16_t TouchScreen::pressure(void) {
int z2 = analogRead(_yp);
#endif
if(_rxplate != 0) {
// now read the x
float rtouch;

View File

@ -24,7 +24,7 @@ typedef volatile uint8_t RwReg;
#if defined(ARDUINO_STM32_FEATHER)
typedef volatile uint32 RwReg;
#endif
#if defined(ARDUINO_FEATHER52) || defined(ESP32)
#if defined(ARDUINO_FEATHER52) || defined(ESP32) || defined(ESP8266)
typedef volatile uint32_t RwReg;
#endif