Menu

LedBoard class methods

jkrah

Here is a brief description of the main methods (functions) that are provided by the LedBoard Class. Please refer to the demo files and if still in doubt let me know of any areas that may need clarification. Obviously you can also check the source code for more info.

Methods (functions) that are usually only used internally by the Library are not currently shown here.

void LedBoard::init(void)

This is called to initialise the LedBoard library and should be called before any other LedBaord operations.
In summary this method will
+ Initialise SPI
+ Enable the appropriate Arduino OutPut pins
+ Initialise (clear) the frame buffer, message buffer and translation (effects) buffer.

void LedBoard::spi_init(void)

This will (re)initialise the SPI for the LedBoard. This can be used if the SPI bus is shared and should be called once other devices are finished using SPI.

void LedBoard::cls(void)

This will clear the frame buffer. ie clears the ledboard display.

void LedBoard::clrmsgs(void)

This will clear the message buffer and translation (effects) buffer.

void LedBoard::write_char(uint8_t ch, uint8_t posx)

This will draw the ASCI character ch (acsci(32) to acsci(127)) at column posx

void LedBoard::write_char(uint8_t ch, uint8_t posx, bool state, bool inv)

This will draw the single ASCI character ch (acsci(32) to acsci(127)) at column posx.
If state is true the char is drawn (ie leds on) else if state is false the char is cleared (ie leds off). Inv is usually set to false but if set to true the character will be drawn in inverse mode.

void LedBoard::set_pix(uint8_t x, uint8_t y, bool state)

Draw a pixel at column x and row y. If state is true then draw the pixel (led on). If state is false then clear the pixel (ie led off).

int LedBoard::add_mesg(char *msg)

Add the null terminated string *msg to the message buffer.
RETURNS: message id (pointer location to start of messages) or error if <0.

int LedBoard::add_trans(int msgid, uint8_t posx, uint8_t space, LB_TRANSITION trans, int8_t speed, uint8_t end_time, bool end_clear)

Add a messages transition for message id msgid to the transition (effects) buffer.
posx is the final message position (column)
space is the inter character spacing (in columns)
trans is the transition type. see [Transition Types]
speed is a parameter controlling how fast the transtion should occur.
end_time is how long to pause at the end of the transition before proceeding to the next transition
end_clear controls if the screen (frame buffer) should cleared before starting the next transition.
RETURNS: transition id or error if <0.

int LedBoard::add_trans(char msg, char transtr)

Like the above function but the transition is given as an ascii string. This is useful when using reading transitions from ascii sources eg files (SD Card) or Serial.

void LedBoard::process_transitions(void)

This is called to update the LedBoard library. If this is not called on regular basis nothing will be displayed. (see the demo files)


Related

Wiki: Home
Wiki: Transition Types