GithubHelp home page GithubHelp logo

codebeat-nl / xtm1638 Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 0.0 569 KB

Fastest library to control TM1638 chip (for example: "LED AND KEY") based modules

License: GNU General Public License v3.0

C 14.05% C++ 85.95%
arduino arduino-library tm1638 led key atmel-mcu benchmark 7-segment display compatibility

xtm1638's Issues

can not find xtm1638.h

hi,
i am new on GitHub. I downloaded the zip file but i can not find a xtm1638.h file in the zip file.
maybe I do something wrong?

wbr
Günter

double definition of XTM_LEFT and XTM_RIGHT

The compiler (rightfully) complains about re-definition of these macros in the header file. The second definition overrides the first one. Unfortunately the two definitions use different value, so i'm wondering if the functions setNumber() and setSignedNumber() really do what they should.

#define XTM_LEFT 0x00

#define XTM_LEFT 0x70

#define XTM_RIGHT 0x01

#define XTM_RIGHT 0x46

(improvement idea) use GCC pragma for better optimization by the compiler

Hi,
thanks for creating this cool library - it is the fastest one i found so far 👍

One idea to make it even faster would be to turn on higher compiler optimisations for the core functions, see https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html
I did some experiments, by adding the following to xtm1638.cpp

at the top of the file, just after comments and includes are done (i.e. , directly after #include "xtm1638.h")

#pragma GCC push_options
#pragma GCC optimize ("O2")
//#pragma GCC optimize ("O3")

at end of the file

#pragma GCC pop_options

Testcase:

"example04" on my MEGA2560 - default options, Port manipulation mode, cached segments enabled

  1. normal optimization without pragma:
  • program 4440 Bytes (1%), glabal data 298 Bytes (3%)
  • scores = 60003 (with LEDs), 27204 (no LEDs)
  1. more optimization (-O2):
  • program 4492 Bytes (1%), glabal data 298 bytes (3%) -> FLASH usage increase: 52 bytes
  • scores = 26143 (with LEDs), 15102 (no LEDs) -> speed gain: 2.3x / 1.8x
  1. even more optimization (-O3):
  • program 13402 Bytes (5%), glabal data 298 bytes (3%) -> FLASH usage increase: 9 Kbytes
  • scores = 24103 (with LEDs), 15280 (no LEDs) -> speed gain: 2.5x / 1.8x

Possible modification to setChars...

While using setChars I've notice that "." is displayed as three horizontal bars. For example setChars("32.1") displays 32(3 horizontal bars)1 instead of 32.1
It would be nice if the dot was displayed as a dot on the same segment digit 2 in my example.

Such a fix would make displaying decimal number very easy, or do you already have a way to do this?

P.S. this is a great library and very impressive as far as speed is concerned. And the examples are A++.

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.