Skip to content

Commit

Permalink
updated docs and rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
noah1510 committed Dec 30, 2020
1 parent c933653 commit 1010120
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doc/movement.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Moving the displayed data

**For more details about the LedController and its functions click [here](d9/def/class_led_controller.html) or the [examples](https://github.com/noah1510/LedController/tree/master/examples).**
**For more details about the LedController and its functions click [here](d9/def/class_led_controller.html) or the [examples](examples.html).**

This pages describes how to move the displayed data around and what you need to know when using the functions.
2 changes: 1 addition & 1 deletion doc/multi_row.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Controlling multiple rows

**For more details about the LedController and its functions click [here](d9/def/class_led_controller.html) or the [examples](https://github.com/noah1510/LedController/tree/master/examples).**
**For more details about the LedController and its functions click [here](d9/def/class_led_controller.html) or the [examples](examples.html).**

**!This feature is still work in progress and not tested well, please proceed with caution!**

Expand Down
43 changes: 35 additions & 8 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,45 @@ SS hat to be connected to CS and each Slave has its own SS pin(which can be any
To get started you need to first create a new controller_configuration object.
This is used to configure the setup of the LedController which can get complex.
controller_configuration has no constructor and is more like an struct with methods than it is a 'real' class.
Because it is a template you need to know the dimension of your Matrix which causes the type to be `controller_configuration<sements_x,segments_y>`.
To see how you can use more than one row with the LedController go [here](dc/dc4/md_doc_multi_row.html).
The rest of the example will use `controller_configuration<4,1>` like in the [rocket example](db/d6d/_led_controller_demo_rocket_8ino-example.html).

First things first, if you want to use Hardware Spi set useHardwareSpi to true, otherwise set it to false.
If you want to use Hardware Spi set useHardwareSpi to true, otherwise set it to false.
If you use hardware SPI you only need to specify the CS pin, if not you also need to CLK and MOSI pins.
Just assign the wanted values to SPI_CS, SPI_CLK and SPI_MOSI.

Next you need to specify the total number of segments you have.
Just assign the total number of segments to SegmentCount.
To keep it simple all segments are connected in series, so there is only one row.
To see how you can use more than one row with the LedController go [here](dc/dc4/md_doc_multi_row.html).

Now you can check if the configuration is Valid by calling the isValid() method.
If it returns true, you can continue wit hthe next step, if not try setting debug_output and figure out what went wrong.
If it returns true, you can continue with the next step, if not try setting debug_output and figure out what went wrong.

Now that you have a valid configuration, you can pass it to the constructor of a new LedController object.
Now that you have a valid configuration, you can pass it to the init function of a LedController object.
You can use the setRow and setSegment to send data to the LedMatrix.

setRow sets a specific Row of a given segment to a given byte.
It needs the segment index which can be calculated from the segment coordinates by calling `lc.getConfig().getSegmentNumber(x,y)`.

setSegment sets a whole segment but the segment can be specified through coordinates or the index.

```c++

#include "LedController.hpp"
auto lc = LedController<4,1>();

void setup(){
auto conf = controller_configuration<4,1>();
conf.useHardwareSpi = true;
conf.SPI_CS = 25;

lc.init(conf);

lc.setRow(lc.getConfig().getSegmentNumber(0,1),2,0xAA);
lc.setSegment(lc.getConfig().getSegmentNumber(1,1),{0x00,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F});
lc.setSegment(2,1,{0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00});

}

void loop(){

}

```
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=LedController
version=1.7.2
version=2.0.0-rc1
author=Noa Sakurajin <[email protected]>
maintainer=Noa Sakurajin <[email protected]>
sentence=The better LedControl library for the MAX7219 and the MAX7221 Led display drivers.
Expand Down
2 changes: 1 addition & 1 deletion src/LedController_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class controller_configuration {
return columns;
}

unsigned int getSegmentNumber(unsigned int column, unsigned int row){
unsigned int getSegmentNumber(unsigned int column, unsigned int row) const{
row %= rows;
column %= columns;
return row * columns + column;
Expand Down

0 comments on commit 1010120

Please sign in to comment.