Bus Terminal Signs 1.0.0
Hull Bus Station Dot Matrix Displays
Loading...
Searching...
No Matches
Panel Class Reference

#include <CH_AS1100.h>

Public Member Functions

 Panel (int LoadPin, int NumChips)
 initialise pins used and allocate array for pixel data More...
 
 ~Panel ()
 frees memory used for the pixel array More...
 
bool begin ()
 initialises the panel. Clears the display and makes the display visible More...
 
void display (void)
 sends the pixel buffer to the display. More...
 
void fillDisplay (int state)
 Sets the entire pixel buffer to off or on if state is 0 the leds are all off is state is non-zero the leds are all on. More...
 
void clearDisplay (void)
 equivalent to fillDisplay(0) More...
 
void invertDisplay ()
 switches LED states from off to on and vice versa More...
 
void drawPixel (int16_t x, int16_t y, uint16_t color) override
 use setPixel instead More...
 
void setClockMode (int m)
 
void displayTest (bool state)
 LED test. Regardless of programming, this turns on/off all LEDs. More...
 
void setBinaryMode ()
 
void setScan (int totaldigits)
 
void setIntensity (int level, int chip)
 Sets the intensity of one AS1100 chip (character) or ALL chips if chip=-1. Note: you cannot set the intensity of individual LEDs. More...
 
void setIndividualIntensity (int chips[])
 Sets all the chips' intensities with one function. More...
 
void displayOn (int b)
 Turns the panel on/off. This needs to be called to see anything. Can be called to flash the display since LED state is not affected. More...
 
void sendPixels ()
 sends the pixel array to the panel chips More...
 
void setPixel (int x, int y, uint8_t on)
 Toggle individual pixel. You must call display() after. More...
 
uint8_t getPixel (int x, int y)
 returns a pixel state as 1 (on) or 0 (off) More...
 
void scrollRow (int dir, int row, bool wrap)
 Scroll an entire row. More...
 
void scrollRows (int dir, bool wrap)
 scroll ALL rows by calling scrollRow for each row More...
 
void scrollColumn (int dir, int col, bool wrap)
 Scrolls a single column with optional wrap around. More...
 
void scrollColumns (int dir, bool wrap)
 Scrolls all columns up or down one pixel on each call. More...
 
void dumpPixels ()
 displays the contents of the pixel array for debugging More...
 

Detailed Description

Bus sign class for interfacing with Hull Bus Station signs modified from Paul Richards work May 2020

Constructor & Destructor Documentation

◆ Panel()

Panel::Panel ( int  loadPin,
int  numChips 
)

initialise pins used and allocate array for pixel data

The panels consist of a number of AS1100 chips, one per LED sub-panel (normally one character). The full panel has 192 LEDs controlled by 32 AS1100 chips.

◆ ~Panel()

Panel::~Panel ( )

frees memory used for the pixel array

Member Function Documentation

◆ begin()

boolean Panel::begin ( )

initialises the panel. Clears the display and makes the display visible

initializes LOAD signal states. Sets up the panel ready to use.

◆ clearDisplay()

void Panel::clearDisplay ( void  )

equivalent to fillDisplay(0)

◆ display()

void Panel::display ( void  )

sends the pixel buffer to the display.

This must be called every time after editing the pixels.

It a wrapper for sendPixels().

◆ displayOn()

void Panel::displayOn ( int  state)

Turns the panel on/off. This needs to be called to see anything. Can be called to flash the display since LED state is not affected.

state 0 means off, non-zero means on

The panel can still be programmed whilst the display is off it just won't appear till you turn the display on again.

◆ displayTest()

void Panel::displayTest ( bool  state)

LED test. Regardless of programming, this turns on/off all LEDs.

on if state=true and off if state=false.

It's useful to check that you don't have any burned out LEDs.

◆ drawPixel()

void Panel::drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)
override

use setPixel instead

called by the Adafruit GFX library to set pixels in the pixel array note this only sets pixels it doesn't clear pixels to a background colour - effectively that allows for transparent backgrounds but since we only have two colours that would just make a mess of the display

this method delegates to setPixel() after changing the colour to 1 (on) or 0 (off) Any non-zero colour value is considered to mean 'on'

◆ dumpPixels()

void Panel::dumpPixels ( )

displays the contents of the pixel array for debugging

A debugging method - outputs the contents of the pixel array to the serial monitor port as a series of 1's and spaces. Spaces represent LEDs in the off state. It looks like this :-

row 0 1 1 1 1
row 1 1 1 1 1
row 2 1 1 1 1
row 3 1 1 1 1

◆ fillDisplay()

void Panel::fillDisplay ( int  state)

Sets the entire pixel buffer to off or on if state is 0 the leds are all off is state is non-zero the leds are all on.

◆ getPixel()

uint8_t Panel::getPixel ( int  col,
int  row 
)

returns a pixel state as 1 (on) or 0 (off)

col & row are bounds checked. If the col/row is outside the led array zero is returned

◆ invertDisplay()

void Panel::invertDisplay ( )

switches LED states from off to on and vice versa

◆ scrollColumn()

void Panel::scrollColumn ( int  dir,
int  col,
bool  wrap = false 
)

Scrolls a single column with optional wrap around.

Scrolls a column of pixels up or down (The Matrix effect - only smaller)

dir 1 means left to right, -1 means right to left
row 0-7, the row to be scrolled
wrap if true wrap the scrolling

◆ scrollColumns()

void Panel::scrollColumns ( int  dir,
bool  wrap = false 
)

Scrolls all columns up or down one pixel on each call.

◆ scrollRow()

void Panel::scrollRow ( int  dir,
int  row,
bool  wrap = false 
)

Scroll an entire row.

if dir>0 scroll left to right if dir<0 scroll right to left

wrap causes the scrolled row to wrap around.

Uses getPixel() and setPixel(). This needs to be reinvented to shift bit patterns in the pixel array to speed it up. You need to call display() to show changes.

Pixels are shifted by one position on each call.

◆ scrollRows()

void Panel::scrollRows ( int  dir,
bool  wrap = false 
)

scroll ALL rows by calling scrollRow for each row

◆ sendPixels()

void Panel::sendPixels ( )

sends the pixel array to the panel chips

called from display()

◆ setBinaryMode()

void Panel::setBinaryMode ( )

This puts the chips in binary mode which allows us to control which leds are on/off using the digit and segment lines

This allows us to address each pixel separately.

The AS1100 is basically intended for 7 segment displays, but with this we can control a dot-matrix of pixels too.

See datasheet section 9.3

◆ setClockMode()

void Panel::setClockMode ( int  m)

The AS1100 chips can be driven by an external clock (See AS1100 data sheet). This is called by begin().

This funcion is also used to reset the display. See datasheet, section 8.10.

◆ setIndividualIntensity()

void Panel::setIndividualIntensity ( int  chips[])

Sets all the chips' intensities with one function.

Chips is an array of intensity levels in chip order i.e chips[0] is the first chip.

This allows you to set the intensity of each character in one go. You provide an array of intensity values.

Note that the code does not check if the length of chips is correct

◆ setIntensity()

void Panel::setIntensity ( int  level,
int  chipNum = -1 
)

Sets the intensity of one AS1100 chip (character) or ALL chips if chip=-1. Note: you cannot set the intensity of individual LEDs.

if chipNum is -1 (default) sets ALL chips to same intensity level level can be 0..16 levels outside this range are ignored.

The range of level is 0-32. begin() sets the initial intensity to 5.

◆ setPixel()

void Panel::setPixel ( int  col,
int  row,
uint8_t  value 
)

Toggle individual pixel. You must call display() after.

Toggle one pixel with col + row. 0 is off. 1 (or anything else) is on.

col and row are bounds checked no action is taken if out of bounds

This does all the necessary jiggery pokery to set segment bits in the pixel array for the AS1100 chip corresponding to the X position.

◆ setScan()

void Panel::setScan ( int  totaldigits)

Set the scan mode of the chips - ie,. telling them how many digits lines to use

Used to configure the AS1100 number of digit lines (8). This is used by begin() so you don't need to call it.


The documentation for this class was generated from the following files: