Coder Social home page Coder Social logo

cst816s's Introduction

CST816S

An Arduino library for the CST816S capacitive touch screen IC

arduino-library-badge

cst816s's People

Contributors

fbiego avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cst816s's Issues

Screen Size

Hi, where should I define the screen size?

CST816S - Data Reference

Hello,

Do you have the CST816S Data Reference document which lists all the addresses and technical information ?

Also is the CST816S the same as the CST816D ?

We need to increase the swipe detection response.

Thanks

Maybe the location of touch is not correct

My touch chip is CST816T.
I tried this library, it works well, except that the y position is always less than 255.

According to the datasheet, maybe x and y should be:

data.x = data_raw[2] & 0xF;
data.x = (data.x << 8) + data_raw[3];

data.y = data_raw[4] & 0xF;
data.y = (data.y << 8) + data_raw[5];

Does it also work with CST816T?

I hope it is ok to write my question under the issue field. Has someone tried this library with CST816T chips?
With best regards!

Compilation errors with ESP32-C3 and ESP8266

I think it has some issues.
Tried to compile with Arduino-IDE 2.2,1

Here is the compilation errors when I try to compile for ESP32C3.
Also there are some compilation errors with ESP8266..

/home/death/Arduino/libraries/CST816S/CST816S.cpp: In member function 'uint8_t CST816S::i2c_read(uint16_t, uint8_t, uint8_t*, uint32_t)':
/home/death/Arduino/libraries/CST816S/CST816S.cpp:173:38: error: call of overloaded 'requestFrom(uint16_t&, uint32_t&, bool)' is ambiguous
   Wire.requestFrom(addr, length, true);
                                      ^
In file included from /home/death/Arduino/libraries/CST816S/CST816S.cpp:26:
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:119:12: note: candidate: 'size_t TwoWire::requestFrom(uint16_t, size_t, bool)'
     size_t requestFrom(uint16_t address, size_t size, bool sendStop);
            ^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:120:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, bool)'
     uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop);
             ^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:121:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint16_t, uint8_t, uint8_t)'
     uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop);
             ^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:122:12: note: candidate: 'size_t TwoWire::requestFrom(uint8_t, size_t, bool)'
     size_t requestFrom(uint8_t address, size_t len, bool stopBit);
            ^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:124:13: note: candidate: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t, uint8_t)'
     uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop);
             ^~~~~~~~~~~
/home/death/.arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src/Wire.h:126:13: note: candidate: 'uint8_t TwoWire::requestFrom(int, int, int)'
     uint8_t requestFrom(int address, int size, int sendStop);
             ^~~~~~~~~~~

exit status 1

Compilation error: exit status 1

For fixing it, you should use size_t at wire definitions...

    uint8_t i2c_read(uint16_t addr, uint8_t reg_addr, uint8_t * reg_data, size_t length);
    uint8_t i2c_write(uint8_t addr, uint8_t reg_addr, const uint8_t * reg_data, size_t length);

Bugs/issues

So I've been testing this on an RP2040 and also ESP32....

The Double Tap (click) never triggers, no matter how fast or slow I try tapping the screen, it only ever registers a SINGLE tap

Touch points is always 1 - I'm not entirely sure what this is supposed to do, but it's just always 1

Event - from the library comments I'm assuming this is meant to allow you to differentiate between touching and releasing but it just doesn't really work. when touching, it's 2, when I remove my finger after a swipe for example, 95% of the time it remains 2. Rarely it will show 1 which Is what I would expected when removing my finger / exiting the screen

This is a great start at a library, but it really isn't hugely useful in it's current state because of the inconsistencies etc

How does one deduce when an action has been completed RELIABLY? Again, Double Tap/Click is never recognised either

FunctionalInterrupt

hello ,
On compiling the code in arduino , i Get this error
Arduino: 1.8.16 (Windows 7), Board: "Arduino Uno"
In file included from C:\Users\vishal\Documents\Arduino\libraries\CST816S-1.1.0\CST816S.cpp:27:0:

C:\Users\vishal\Documents\Arduino\libraries\CST816S-1.1.0/FunctionalInterrupt.h:7:10: fatal error: functional: No such file or directory

#include "functional"

      ^~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.