LED Driver, 6 digits @ 8 segm, 8 LEDs, 16 Keys. SPI Interface

Dependents:   mbed_STLED316S

Embed: (wiki syntax)

« Back to documentation index

STLED316S Class Reference

STLED316S Class Reference

A class for driving STM STLED316S LED controller. More...

#include <STLED316S.h>

Inherited by STLED316S_BOARD.

Public Types

enum  Mode
 

Enums for Display mode.

More...
enum  BrightMode
 

Enums for Brightness mode.

More...
typedef char DisplayData_t [STLED316S_DISPLAY_MEM]
 Datatypes for display and keymatrix data.

Public Member Functions

 STLED316S (PinName mosi, PinName miso, PinName sclk, PinName cs, Mode mode=Grid6_Seg8)
 Constructor for class for driving STLED316S LED controller.
void cls ()
 Clear the screen and locate to 0.
void writeData (int address, char data)
 Write databyte to STLED316S.
void writeData (DisplayData_t data, int length=STLED316S_DISPLAY_MEM)
 Write Display datablock to STLED316S.
void writeLedData (LedData_t leds)
 Write LED data to STLED316S.
void setLed (LedData_t leds)
 Set LED.
void clrLed (LedData_t leds)
 Clr LED.
bool getKeys (KeyData_t *keydata)
 Read keydata block from STLED316S.
void setBrightness (char brightness=STLED316S_BRT_DEF)
 Set Brightness for all Digits and LEDs (value is used in GlobalBrightness mode)
void setLedBrightness (LedData_t leds=STLED316S_LED_ALL, char led_brt=STLED316S_BRT_DEF)
 Set Individual LED Brightness (value is used in IndivBright mode)
void setDigitBrightness (LedData_t digits=STLED316S_DIG_ALL, char dig_brt=STLED316S_BRT_DEF)
 Set Individual Digit Brightness (value is used in IndivBright mode)
void setBrightMode (BrightMode brt_mode=GlobalBright)
 Set Brightness mode.
void setDisplay (bool on)
 Set the Display mode On/off.

Detailed Description

A class for driving STM STLED316S LED controller.

Supports 1..6 Grids @ 8 Segments and 8 LEDs. Also supports a scanned keyboard of upto 16 keys. SPI bus interface device.

Definition at line 213 of file STLED316S.h.


Member Typedef Documentation

typedef char DisplayData_t[STLED316S_DISPLAY_MEM]

Datatypes for display and keymatrix data.

Definition at line 233 of file STLED316S.h.


Member Enumeration Documentation

enum BrightMode

Enums for Brightness mode.

Definition at line 227 of file STLED316S.h.

enum Mode

Enums for Display mode.

Definition at line 217 of file STLED316S.h.


Constructor & Destructor Documentation

STLED316S ( PinName  mosi,
PinName  miso,
PinName  sclk,
PinName  cs,
Mode  mode = Grid6_Seg8 
)

Constructor for class for driving STLED316S LED controller.

Constructor for class for driving STLED316S LED controller with SPI bus interface device.

Supports 1..6 Grids @ 8 Segments and 8 LEDs. Also supports a scanned keyboard of upto 16 keys. SPI bus interface device.

Parameters:
PinNamemosi, miso, sclk, cs SPI bus pins
Modeselects either Grids/Segments (default 6 Grids @ 8 Segments)

Supports 1..6 digits @ 8 segments and 8 LEDs. Also supports a scanned keyboard of upto 16 keys.

Parameters:
PinNamemosi, miso, sclk, cs SPI bus pins
Modeselects 1..6 Digits of 8 Segments (default 6 Digits of 8 Segments)

Definition at line 33 of file STLED316S.cpp.


Member Function Documentation

void clrLed ( LedData_t  leds )

Clr LED.

Parameters:
LedData_tleds pattern of LED data
Returns:
none

Definition at line 314 of file STLED316S.cpp.

void cls (  )

Clear the screen and locate to 0.

Definition at line 68 of file STLED316S.cpp.

bool getKeys ( KeyData_t *  keydata )

Read keydata block from STLED316S.

Parameters:
*keydataPtr to Array of STLED316S_KEY_MEM (=2) bytes for keydata
Returns:
bool keypress True when at least one key was pressed

Note: Due to the hardware configuration the STLED316S key matrix scanner will detect multiple keys pressed at same time, but this may result in some spurious keys also being set in keypress data array. It may be best to ignore all keys in those situations. That option is implemented in this method depending on define setting.

Parameters:
*keydataPtr to Array of STLED316S_KEY_MEM (=5) bytes for keydata
Returns:
bool keypress True when at least one key was pressed

Note: Due to the hardware configuration the STLED316S key matrix scanner will detect multiple keys pressed at same time, but this may also result in some spurious keys being set in keypress data array. It may be best to ignore all keys in those situations. That option is implemented in this method depending on define setting.

Definition at line 327 of file STLED316S.cpp.

void setBrightMode ( BrightMode  brt_mode = GlobalBright )

Set Brightness mode.

Parameters:
BrightModebrt_mode (value is IndivBright or GlobalBright)
Returns:
none

Definition at line 218 of file STLED316S.cpp.

void setBrightness ( char  brightness = STLED316S_BRT_DEF )

Set Brightness for all Digits and LEDs (value is used in GlobalBrightness mode)

Set Brightness for all Digits and LEDs (value is used in GlobalBright mode)

Parameters:
charbrightness (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
Returns:
none

Definition at line 87 of file STLED316S.cpp.

void setDigitBrightness ( LedData_t  digits = STLED316S_DIG_ALL,
char  dig_brt = STLED316S_BRT_DEF 
)

Set Individual Digit Brightness (value is used in IndivBright mode)

Parameters:
LedData_tdigits pattern of Digit data
chardig_brt (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
Returns:
none

Definition at line 161 of file STLED316S.cpp.

void setDisplay ( bool  on )

Set the Display mode On/off.

Parameters:
booldisplay mode

Definition at line 203 of file STLED316S.cpp.

void setLed ( LedData_t  leds )

Set LED.

Parameters:
LedData_tleds pattern of LED data
Returns:
none

Definition at line 303 of file STLED316S.cpp.

void setLedBrightness ( LedData_t  leds = STLED316S_LED_ALL,
char  led_brt = STLED316S_BRT_DEF 
)

Set Individual LED Brightness (value is used in IndivBright mode)

Parameters:
LedData_tleds pattern of LED data
charled_brt (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
Returns:
none

Definition at line 107 of file STLED316S.cpp.

void writeData ( int  address,
char  data 
)

Write databyte to STLED316S.

Parameters:
intaddress display memory location to write byte
chardata byte written at given address
Returns:
none

Reimplemented in STLED316S_BOARD.

Definition at line 237 of file STLED316S.cpp.

void writeData ( DisplayData_t  data,
int  length = STLED316S_DISPLAY_MEM 
)

Write Display datablock to STLED316S.

Parameters:
DisplayData_tdata Array of STLED316S_DISPLAY_MEM (=6) bytes for displaydata (starting at address 0)
lengthnumber bytes to write (valid range 0..STLED316S_DISPLAY_MEM (=6), starting at address 0)
Returns:
none
Parameters:
DisplayData_tdata Array of STLED316S_DISPLAY_MEM (=6) bytes for displaydata (starting at address 0)
lengthnumber bytes to write (valide range 0..STLED316S_DISPLAY_MEM (=6), starting at address 0)
Returns:
none

Reimplemented in STLED316S_BOARD.

Definition at line 253 of file STLED316S.cpp.

void writeLedData ( LedData_t  leds )

Write LED data to STLED316S.

Parameters:
LedData_tleds LED data
Returns:
none

Definition at line 281 of file STLED316S.cpp.