Library for running the VFD display in the YoRadio project and more
Hello!
I present my hot library for the SC16312 (PT6312) VFD display. Where did this come from... Like many of us, I made myself a YoRadio. First in a box on the table... I liked it, so I dusted off the old Manta DVD-001 DVD player. It had a damaged drive and I didn't feel like repairing it (I had repaired several and why would I need another one). After removing the drive, there was a lot of space. And this is how YoRadio was created in the Manta housing. But since there was an original display and original keys, it was tempting to use them. A few days of testing segments and it started. I present to you the first version of the library.
What it can display:
- rotate the "disk"
- turn on/off icons on the display (regardless of other displayed elements)
- display digit on a single module
- display number on dual module
- display subtitles (on 1 to 6 modules)
- keys reading (full support)
- display brightness control (8 steps: 0-7)
- supports the keyboard via the driver (In the Manta DVD, there are 6 keys)
And if you try hard and use moving the contents of the chain, you will also see scrolling.
Have fun and good luck in recovering your old equipment.
P.S. Be sure to remember to renovate the Manta power supply - after so many years it deserves it. The library is easy to modify and adapt to your own display from any device.
#include "VFD_SC16321/VFD_SC16312.h"
display.init();
// start
vfd_init(); // It has to be here
printVFDStr(1, "YRADIO"); // Display an example text on a 7-segment display startin from 1 position of display. You can change it to any text or delete this line
// end
player.init();
icon_DISC(true); // true = on, false = off
This is just a quick example and performance test. If the "disk" is spinning too fast, try skipping calls, e.g. modulo 256, 512, etc.
But a better method is put some code in widgets.cpp at the end od procedure ClockWidget::_printClock in file widgets.cpp
// VFD CLOCK
char _vfdtimebuffer[5] = {' ', ' ', ' ', ' ', ' '};
strftime(_vfdtimebuffer, sizeof(_vfdtimebuffer), "%H%M", &network.timeinfo);
printVFDStr(3, _vfdtimebuffer);
showClockColon(dots);
if (player.status() == PLAYING) {
icon_DISC(true ); // spin the disc
// set station number on display
int stationNr = config.lastStation();
printVFDNumber(1, stationNr);
// if the station number is large, turn on additional icons informing about it...
icon_3_0(stationNr >= 100);
icon_S (stationNr >= 200);
icon_V (stationNr >= 300);
icon_CD (stationNr >= 400);
// turn on the icons informing about the station's broadcasting format
icon_MP3(config.configFmt == BF_MP3);
icon_DVD( (config.configFmt == BF_AAC) ||
(config.configFmt == BF_FLAC) ||
(config.configFmt == BF_WAV)
);
}
else {
icon_DISC(false); // stop the disc
// clear display and turn off the icons
printVFDStr(1, " ");
icon_3_0(false);
icon_S (false);
icon_V (false);
icon_CD (false);
icon_MP3(false);
icon_DVD(false);
}
P.S. Writing characters on a 7 segment display is hardcore. Better to use it to write numbers. This is what it was created for...
In my case, the 4 digits on the right are the clock and the two digits on the left are probably the station number.
And if you need to write subtitles... Well, sometimes you can... "Load" inscription next to connecting, "error" inscription (hopefully never)