Coder Social home page Coder Social logo

noah1510 / ledcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wayoda/ledcontrol

14.0 14.0 5.0 38.61 MB

An Arduino library for MAX7219 and MAX7221 Led display drivers

License: GNU Lesser General Public License v3.0

C++ 96.68% Shell 3.07% HTML 0.25%

ledcontroller's People

Contributors

388298347 avatar aentinger avatar callmeelle avatar imgbotapp avatar lennarthennigs avatar matthijskooijman avatar milesdai avatar noah1510 avatar restyled-commits avatar stephenhouser avatar wayoda avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ledcontroller's Issues

Error when compiling for ESP32

Hey,
I get the following errors when I try to compile a program for the ESP32 Dev C module:

.../src/LedController.cpp: In member function 'std::array<unsigned char, 20u> LedController::moveDown(std::array<unsigned char, 20u>)':
.../src/LedController.cpp:481:32: error: could not convert 'makeCppByteBlock(((byte*)(& shiftedOutRow)))' from 'std::array<unsigned char, 8u>' to 'std::array<unsigned char, 20u>'
return makeCppByteBlock(shiftedOutRow);
^
.../src/LedController.cpp: In member function 'std::array<unsigned char, 20u> LedController::moveUp(std::array<unsigned char, 20u>)':
.../LedController/src/LedController.cpp:489:32: error: could not convert 'makeCppByteBlock(((byte*)(& shiftedOutRow)))' from 'std::array<unsigned char, 8u>' to 'std::array<unsigned char, 20u>'
return makeCppByteBlock(shiftedOutRow);
^
.../src/LedController.cpp: In member function 'std::array<unsigned char, 8u> LedController::reverse(std::array<unsigned char, 8u>)':
.../src/LedController.cpp:496:38: error: no matching function for call to 'LedController::reverse(std::array<unsigned char, 8u>::pointer, byte ()[20])'
reverse(input.data(), &output);
^
.../src/LedController.cpp:308:6: note: candidate: byte LedController::reverse(byte)
byte LedController::reverse(byte var){
^
.../src/LedController.cpp:308:6: note: candidate expects 1 argument, 2 provided
.../src/LedController.cpp:436:6: note: candidate: void LedController::reverse(byte
, byte ()[8])
void LedController::reverse(C_ByteBlock input, C_ByteBlock
reversedInput){
^
.../src/LedController.cpp:436:6: note: no known conversion for argument 2 from 'byte ()[20] {aka unsigned char ()[20]}' to 'byte ()[8] {aka unsigned char ()[8]}'
.../src/LedController.cpp:493:15: note: candidate: std::array<unsigned char, 8u> LedController::reverse(std::array<unsigned char, 8u>)
ByteBlock LedController::reverse(ByteBlock input){
^
.../src/LedController.cpp:493:15: note: candidate expects 1 argument, 2 provided
.../src/LedController.cpp: In member function 'std::array<unsigned char, 8u> LedController::rotate180(std::array<unsigned char, 8u>)':
.../src/LedController.cpp:504:40: error: no matching function for call to 'LedController::rotate180(std::array<unsigned char, 8u>::pointer, byte ()[20])'
rotate180(input.data(), &output);
^
.../src/LedController.cpp:446:6: note: candidate: void LedController::rotate180(byte
, byte ()[8])
void LedController::rotate180(C_ByteBlock input, C_ByteBlock
rotatedInput){
^
.../src/LedController.cpp:446:6: note: no known conversion for argument 2 from 'byte ()[20] {aka unsigned char ()[20]}' to 'byte ()[8] {aka unsigned char ()[8]}'
.../src/LedController.cpp:501:15: note: candidate: std::array<unsigned char, 8u> LedController::rotate180(std::array<unsigned char, 8u>)
ByteBlock LedController::rotate180(ByteBlock input){
^
.../src/LedController.cpp:501:15: note: candidate expects 1 argument, 2 provided
exit status 1
Fehler beim Kompilieren für das Board ESP32 Dev Module.

Do you have any suggestion on how to fix this?

Cheers
Lennart

Support for more display drivers

At the moment only MAX7219 and MAX7221 are expected to work correctly.
I the future all of the code in LedController_low_level.hpp should get refactored.

  • add a generic display_driver class which has information about the specific command, byte order, etc.
  • allow the controller_configuration to have an Instance of that class as option
  • use that config option to send commands in LedController_low_level.hpp

I don't know when this will be done but it might be a good issue if you want to get started contributing to open source projects.

debug / fix setColumn

At the moment setColumn is broken and ruins everything displayed on the matrix causing random LEDs to be set.

Examples don't load from the manual page

I tried loading the examples from the manual page: https://noah1510.github.io/LedController/english/examples.html

All of them give me 404. I wouldn't mention it, but I need to read them; I don't understand the new library, how to set it up, the V2 example programs compile but don't do anything, and of course I can't upgrade existing sketches.

Or if you could make the V1 documentation available, I could fix the old programs and then upgrade.

You'll be pleased to hear that (WITH V1.7) I WAS using NodeMCU (ESP8266) processor with no issues, using D0, D1 and D2 for CLK, CS and DIN. There may be better pins, but NodeMCU has weird names for the pins and I am also using an SPI display on D3,4,5,7,8, with TFT_eSPI library, so I don't have any other spare pins.

remove deprecated functions

this issue is just a reminder to remove functions that are marked to be removed for the release just before the release.

Add movement functions for 7-Segment Displays

At the moment the movement functions only work if you use an LED Matrix.
It would be nice to have the option to also move data when you have 7-Segment Displays connected.
The following points are what needs to be done in order for this to work.

  • add a 7-Segment-Mode config option (boolen, default false)
  • move the current movement function into LedController_movement_matrix.hpp
  • create LedController_movement_7_Segment.hpp and implement those movement functions (eg. moveLeft_7_Segment)
  • rename functions in LedController_movement_matrix.hpp (eg. moveLeft to moveLeft_matrix)
  • implement old function name in LedController_movement.hpp (eg. moveleft calls moveLeft_Matrix or moveLeft_7_Segment depending on the config)
  • make LedController_movement_matrix.hpp and LedController_movement_7_Segment.hpp private
  • update movement documentation
  • write 7-Segment Documentation page
  • update controller_configuration page and usage page
  • write unit test
  • write example

If you think that anything is missing feel free to mention it, I will add it to the list.
The list might change in the future depending on how the implementation will work out.

implement multi row support

The goal is to allow for a single LedController to control more than one row.
Each row may be connected to a different CS Pin.

The initial bits are in place, now a lot of functions need to be overwritten to support writing to/reading from segment in a position like (3,4).
There also needs to be a change to the move functions since they will behave different when there are multiple rows.

All those changes should have backwards compatibility in mind, so that code that uses the movement functions does not break.

  • update all functions to use the correct CS Pin
  • update the move functions to be aware of multiple rows
  • add new set and get functions
  • implement virtual multirow, where you have multiple rows but all segments are connected in series
  • add more tests and properly test with real hardware

remove deprecated function

this issue is just a reminder to remove functions that are marked to be removed for the release just before the release.

add option to set rotation in the configuraion

This feature should make things a lot easier.
It is an option for the controller_configuration to allow different rotation values.
This allows for a custom rotation in 90 degree steps to adjust to functions according to the actual layout of the segments.
moveRight will move the data right even if the matrix is rotated and the set functions will set the correct values.

This will require a lot of changes to the codebase and is not recommended for beginners unfamiliar with templates and the internal structure of the code.

  • add configuration option for the rotation (maybe even as an enum) and document what values have what meaning.
  • update the move functions to respect the rotation
  • update the set functions to respect the rotation
  • write example code for the use of this feature
  • add unit tests for this feature

error with setting MAX_SEGMENTS > 8

Hey,
unfortunately, setting the segments to something greater than 8 creates an error on the Nano:

LedController.hpp:55:28: note: type 'byte[8][8]' should match type 'byte[20][8]'
     using Matrix = C_Matrix;

Best
l.

More ducumentation pages

There are some topics that do not have documentation pages at the moment.
They will be added for version 2.1.0 and this issue contains a list of those pages.

  • ByteBlock / Segment page
  • ByteRow page
  • using with 7-Segment Display
  • (changes movement page) movement for 7-Segment Display

If you think some other page is also missing please leave a comment.

updating the documentation

The documentation needs some more work.

  • usage.md should be updated to use the controller_configuration.
  • usage.md should be extended to include a simple example of the library.
  • features like the movement functions need documentation.
  • there needs to be documentation on advanced topics like having multiple rows.
  • the examples have to be updated for the use with a controller_configuration.
  • document byteRow
  • document byteBlock
  • finish the documentation page on the controller_configuration
  • add German translation for all classes
  • add German translation for examples
  • add German translation for pages

All of this should be done before version 2.0.0 is released.
For more suggestions on missing documentation please leave a comment

Add function to get LED state?

Hey
is there a way to read the state of an LED?
I'd really like to have a function like this:

boolean getLed(unsigned int segmentNumber, unsigned int row, unsigned int column)

(This would reduce the need for me store the state in an array. And since I am using 20 8x8 matrixes I am running low on variable storage memory :-) )

Cheers
l.

implement byteRow as a class

Add a new classes similar to the byteBlock but for a row for the same reasons.

  • create byteRow class that simply replaces the current array
  • replace or add new functions with byteRow as return type
  • implement it to have index 0 as top row of a segment dropped in favor of compatibility

the old functions will be removed in version 2.2.0 and will be marked as deprecated as of version 2.0.0

Split the library into modules

As part of version 2.2.0 the library should be split into several modules.
If every module should be used LedController.hpp should be included but it should also be possible to only include some of the modules.
For this to work the class declaration has to be split into the following parts:

  • core (The core parts of the controller)
  • movement (All of the movement related functions)
  • transformation (The functions that transform a single ByteBlock)

This way compiled programs can be smaller for cases where there is limited program storage and some functions are not needed. So for example LedController_core.hpp can be included to have access to all of the core functions without using any of the additional features.

Feel free to propose more modules that could be implemented/split to add them to the list.

Print a value to a sertain position

Hello,
I try your library with the idea to built a 5 axis machine display. using esp32dev as processor. The axis are selected with the cs pin but the value can be positive, negative and the decimal place on a certain position.

Is that possible ?

Arduino abstraction layer

One of the features that could increase compatibility to almost 100% would be to write a custom SPI Arduino layer.
Except for Arduino.h and SPI.h are the only dependencies, but they do not exist for a lot of board (eq. raspberry PI).
A custom Arduino layer would always use 'software' SPI if there is no hardware support or try to use another SPI implementation.
Like the rest of the LedController v2+, it should be implemented as header only code, maybe even as singleton.
This Layer should be the only place that is depended on Hardware specific code.
In the future this layer may be used to allow more frameworks/boards to work with this library.

The header of this layer should define a generic interface, while the source files handle the platform specific implementation of that generic interface.
The library will not be portable from one platform to the next without recompiling but this makes a lot of code simpler

The features it needs to implement are the following:

  • have a generic Arduino header which provides all of the functions of Arduino.h
  • provide a generic interface to output SPI data with the following functions
    • initilize SPI
    • start transmission
    • send data
    • receive data
    • end transmission
    • uninitilize SPI
    • check for non 0 MOSI and MISO, to have read-only or write only functionality
  • enable hardware SPI if possible
  • provide software SPI as fallback
  • use software SPI for custom pins
  • support raspberry pi
  • write documentation
  • write unit tests
  • move this layer into a separate library and use it as dependency

Help with this appreciated.

implement byteBlock as class

byteBlock should be a class to allow it being a return type, reducing the need of C-style arguments (pointer to return location as argument).

  • create byteBlock class that simply replaces the current array
  • replace or add new functions with byteBlock as return type
  • implement it to have index 0 as top row of a segment I think it is best to not change this, since it would break compatiblility with older version.

error compail at arduino uno

version 1.7.2
In file included from LCDemo7Segment.ino:3:0: C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:9:7: error: expected nested-name-specifier before 'ByteBlock' using ByteBlock = byte[8]; ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:9:7: error: 'ByteBlock' has not been declared C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:9:17: error: expected ';' before '=' token using ByteBlock = byte[8]; ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:9:17: error: expected unqualified-id before '=' token In file included from C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:29:0, from LCDemo7Segment.ino:3: C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController_config.hpp:74:30: error: 'nullptr' was not declared in this scope unsigned int *row_SPI_CS = nullptr; ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController_config.hpp: In static member function 'static bool controller_configuration::isValidConfig(const controller_configuration&)': C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController_config.hpp:93:48: error: 'nullptr' was not declared in this scope if (conf.SPI_CS == 0 && conf.row_SPI_CS == nullptr) { ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController_config.hpp:98:28: error: 'nullptr' was not declared in this scope if (conf.row_SPI_CS != nullptr && ^ In file included from LCDemo7Segment.ino:3:0: C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp: At global scope: C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:44:3: error: 'ByteBlock' does not name a type ByteBlock *LedStates = nullptr; ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:198:52: error: 'ByteBlock' has not been declared void displayOnSegment(unsigned int segmentindex, ByteBlock data); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:206:50: error: 'ByteBlock' has not been declared void getSegmentData(unsigned int segmentindex, ByteBlock *resultLocation); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:444:20: error: 'ByteBlock' has not been declared void makeColumns(ByteBlock rowArray, ByteBlock *columnArray); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:444:40: error: 'ByteBlock' has not been declared void makeColumns(ByteBlock rowArray, ByteBlock *columnArray); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:452:16: error: 'ByteBlock' has not been declared void reverse(ByteBlock input, ByteBlock *reversedInput); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:452:33: error: 'ByteBlock' has not been declared void reverse(ByteBlock input, ByteBlock *reversedInput); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:460:18: error: 'ByteBlock' has not been declared void rotate180(ByteBlock input, ByteBlock *rotatedInput); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:460:35: error: 'ByteBlock' has not been declared void rotate180(ByteBlock input, ByteBlock *rotatedInput); ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:62:19: error: 'nullptr' was not declared in this scope byte *spidata = nullptr; ^ C:\Users\gunaon3\Documents\Arduino\libraries\LedController\src/LedController.hpp:82:20: error: 'nullptr' was not declared in this scope byte *emptyRow = nullptr; ^ Multiple libraries were found for "SPI.h" Used: C:\Users\gunaon3\Documents\Arduino\libraries\SPI_master Not used: F:\APLIKASI\ELEKTRONIKA\ARDUINO\arduino-1.6.5-r5\hardware\arduino\avr\libraries\SPI Error compiling.

Ability to limit SPI speed

This looks like the best fork of this very popular but unmaintained library. It has everything I need except for the ability to set the maximum SPI transfer speed when configuring hardware SPI. (if your devices are on the end of a few metres of wire, or in a noisy environment, then interference becomes an issue). It's a trivial change - just add an optional spiSpeedMax parameter to init(), and if it's present, pass it to SPI.begin().
Another option is to allow the user to do the SPI.begin() themselves and pass it into a new function lc.init(&mySPI).
Thanks for the great work!

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.