J.W. BRUCE / TTU_CSC1300

Dependents:   CSC1300_EduBaseV2_Lab0 mbed_blinky EduBaseV2_Lab0 mbed_blinky ... more

Embed: (wiki syntax)

« Back to documentation index

SSLED Class Reference

SSLED Class Reference

A 7-segment LED interface for driving 4 seven-segment LEDs connected via two cascaded 74HC595s using the STM32F031K6 SPI peripheral. More...

#include <TTU_CSC1300.h>

Public Member Functions

 SSLED (int display, int pattern)
 Constructor to create the 4-digit seven-segment display interface.
void setDisplay (int display, int pattern)
 Write a pattern to a chosen display.

Detailed Description

A 7-segment LED interface for driving 4 seven-segment LEDs connected via two cascaded 74HC595s using the STM32F031K6 SPI peripheral.

Specifically, the Nucleo32 F031K6 boards plugged into the Edubase-V2 via the adapter used at Tennessee Tech.

Supports only the four seven-segment displays (DISP1-DISP4) on the EduBase-V2 board

 #include "mbed.h"
 #include "TTU_CSC1300.h"
 
 SSLED     seg7(4, ~0x00);    // blank DISP4 on Edubase-V2 board
 
 int main() {
     while(1) {
         seg7.setDisplay( 1, ~0x3F);      // display "0"
         wait(1.0);
         seg7.setDisplay( 2, ~0x06);      // display "1"
         wait(1.0);
         seg7.setDisplay( 3, ~0x5B);      // display "2"
         wait(1.0);
         seg7.setDisplay( 4, ~0x4F);      // display "3"
         wait(1.0);
     } // end while()
 } // end main()

Definition at line 380 of file TTU_CSC1300.h.


Constructor & Destructor Documentation

SSLED ( int  display,
int  pattern 
)

Constructor to create the 4-digit seven-segment display interface.

Parameters:
displayinteger (1-4) selected desired 7-segment display DISP1-DISP4
patternbyte containing bitmask of to display (zeroed bits illuminate)
See also:
setDisplay()

Definition at line 142 of file TTU_CSC1300.cpp.


Member Function Documentation

void setDisplay ( int  display,
int  pattern 
)

Write a pattern to a chosen display.

Parameters:
displayinteger (1-4) selected desired 7-segment display DISP1-DISP4
patternbyte containing bitmask of to display (zeroed bits illuminate)
Note:
MSb in pattern is decimal point segment, then gfedcba (with segment a as LSb). Zeroes in the pattern bitmask are illuminated. For example, pattern ~0x66 will illuminate the number "4".
See also:
https://en.wikipedia.org/wiki/Seven-segment_display

Definition at line 153 of file TTU_CSC1300.cpp.