init git repo

This commit is contained in:
2024-07-28 18:19:16 -05:00
commit 2cbccd5599
16 changed files with 3935 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
/*
TM1640.cpp - Library implementation for TM1640.
Copyright (C) 2011 Ricardo Batista (rjbatista <at> gmail <dot> com)
Adjusted for TM1640 by Maxint R&D, based on orignal code. See https://github.com/maxint-rd/
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TM1640.h"
#include <stdint.h>
#include <driver/gpio.h>
TM1640::TM1640(gpio_num_t dataPin, gpio_num_t clockPin, uint8_t numDigits, bool activateDisplay, uint8_t intensity)
: TM16xx(dataPin, clockPin, dataPin, TM1640_MAX_POS, numDigits, activateDisplay, intensity)
{ // NOTE: Like the TM1637, the TM1640 only has DIO and CLK. Therefor the DIO-pin is initialized as strobe in the constructor
clearDisplay();
setupDisplay(activateDisplay, intensity);
}
/*
void TM1640::bitDelay()
{
//delayMicroseconds(5);
}
*/
void TM1640::start()
{ // if needed derived classes can use different patterns to start a command (eg. for TM1637)
// Datasheet: The starting condition of data input is: when CLK is high, the DIN becomes low from high;
gpio_set_level(dataPin, 0);
gpio_set_level(clockPin, 0);
bitDelay();
}
void TM1640::stop()
{ // if needed derived classes can use different patterns to stop a command (eg. for TM1637)
// datasheet: the ending condition is: when CLK is high, the DIN becomes high from low.
gpio_set_level(clockPin, 1);
gpio_set_level(dataPin, 1);
bitDelay();
}
void TM1640::send(uint8_t data)
{
// MOLE 180514: TM1640 wants data and clock to be low after sending the data
TM16xx::send(data);
gpio_set_level(clockPin, 0); // first clock low
gpio_set_level(dataPin, 0); // then data low
bitDelay();
}
+41
View File
@@ -0,0 +1,41 @@
/*
TM1640.h - Library for TM1640.
Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>
Adjusted for TM1640 by Maxint R&D, based on orignal code. See https://github.com/maxint-rd/
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TM1640_h
#define TM1640_h
#include "TM16xx.h"
#include <stdint.h>
#define TM1640_MAX_POS 16
class TM1640 : public TM16xx
{
public:
// Instantiate a TM1640 module specifying data and clock pins, number of digits, the display state, the starting intensity (0-7).
TM1640(gpio_num_t dataPin, gpio_num_t clockPin, uint8_t numDigits=16, bool activateDisplay = true, uint8_t intensity = 7);
protected:
//virtual void bitDelay();
virtual void start();
virtual void stop();
virtual void send(uint8_t data);
};
#endif
+262
View File
@@ -0,0 +1,262 @@
/*
TM16xx.h - Library for TM1637, TM1638 and similar chips.
Modified by Maxint R&D. See https://github.com/maxint-rd/
Copyright (C) 2011 Ricardo Batista (rjbatista <at> gmail <dot> com)
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TM16xx.h"
#include <driver/gpio.h>
TM16xx::TM16xx(gpio_num_t dataPin, gpio_num_t clockPin, gpio_num_t strobePin, uint8_t maxDisplays, uint8_t nDigitsUsed, bool activateDisplay, uint8_t intensity)
{
this->dataPin = dataPin;
this->clockPin = clockPin;
this->strobePin = strobePin;
this->_maxDisplays = maxDisplays;
this->digits = nDigitsUsed;
gpio_set_direction(dataPin, GPIO_MODE_OUTPUT);
gpio_set_direction(clockPin, GPIO_MODE_OUTPUT);
gpio_set_direction(strobePin, GPIO_MODE_OUTPUT);
gpio_set_level(strobePin, 1);
gpio_set_level(clockPin, 1);
//sendCommand(TM16XX_CMD_DISPLAY | (activateDisplay ? 8 : 0) | min(7, intensity)); // display command: on or intensity
/*
sendCommand(TM16XX_CMD_DATA_AUTO); // data command: set data mode to auto-increment write mode
start();
send(TM16XX_CMD_ADDRESS); // address command + address C0H
for (int i = 0; i < 16; i++) { // TM1638 and TM1640 have 16 data addresses, TM1637 and TM1668 have less, but will wrap.
send(0x00);
}
stop();
*/
// Note: calling these methods should be done in constructor of derived class in order to use properly initialized members!
/*
clearDisplay();
setupDisplay(activateDisplay, intensity);
*/
}
void TM16xx::setupDisplay(bool active, uint8_t intensity)
{
sendCommand(TM16XX_CMD_DISPLAY | (active ? 8 : 0) | min(7, intensity));
}
void TM16xx::clearDisplay()
{ // Clear all data registers. The number of registers depends on the chip.
// TM1638 (10x8): 10 segments per grid, stored in two bytes. The first byte contains the first 8 display segments, second byte has seg9+seg10 => 16 bytes
// TM1640 (8x16): one byte per grid => 16 bytes
// TM1637 (8x6): one byte per grid => 6 bytes
// TM1668 (10x7 - 14x3): two bytes per grid => 14 bytes
sendCommand(TM16XX_CMD_DATA_AUTO); // set auto increment addressing mode
// send the address followed by bulk-sending of the data to clear the display memory
start();
send(TM16XX_CMD_ADDRESS);
for (int i = 0; i < _maxDisplays; i++) {
send(0x00);
if(_maxSegments>8)
send(0x00); // send second byte (applicable to TM1638 and TM1668)
}
stop();
}
void TM16xx::setSegments(uint8_t segments, uint8_t position)
{ // set 8 leds on common grd as specified
// TODO: support 10-14 segments on chips like TM1638/TM1668
if(position<_maxDisplays)
sendData(position, segments);
//sendData(TM16XX_CMD_ADDRESS | position, segments);
}
void TM16xx::setSegments16(uint16_t segments, uint8_t position)
{ // Some modules support more than 8 segments (e.g. 10 max for TM1638)
// The position of the additional segments in the second data byte can be different per module,
// For that reason this module has no implementation in the base class.
// E.g. for TM1638/TM1668 segments 8-9 are in bits 0-1, for TM1630 segment 14 is in bit 5
// This method assumes segments 0-7 to be in the lower byte and the extra segments in the upper byte
// Depending on the module this method should shift the segments to the proper data position.
}
void TM16xx::sendChar(uint8_t pos, uint8_t data, bool dot)
{
/*
if(pos<_maxDisplays)
sendData(pos, data | (dot ? 0b10000000 : 0));
*/
setSegments(data | (dot ? 0b10000000 : 0), pos);
}
void TM16xx::sendAsciiChar(uint8_t pos, char c, bool fDot)
{ // Method to send an Ascii character to the display
// This method is also called by TM16xxDisplay.print to display characters
// The base class uses the default 7-segment font to find the LED pattern.
// Derived classes for multi-segment displays or alternate layout displays can override this method
sendChar(pos, TM16XX_FONT_DEFAULT[c-32], fDot);
}
void TM16xx::setDisplayDigit(uint8_t digit, uint8_t pos, bool dot, const uint8_t numberFont[])
{
sendChar(pos, numberFont[digit & 0xF], dot);
}
void TM16xx::setDisplayToDecNumber(int nNumber, uint8_t bDots) // byte bDots=0
{ // Function to display a decimal number on a n-digit clock display.
// Kept simple to fit in ATtiny44A
// For extended display features use the TM16xxDisplay class
// TODO: support large displays such as 8segx16 on TM1640
for(uint8_t nPos=1; nPos<=digits; nPos++)
{
setDisplayDigit(nNumber % 10, digits - nPos, bDots&_BV(nPos));
nNumber/=10;
}
}
void TM16xx::clearDisplayDigit(uint8_t pos, bool dot)
{
sendChar(pos, 0, dot);
}
void TM16xx::setDisplay(const uint8_t values[], uint8_t size)
{ // send an array of values to the display
for (uint8_t i = 0; i < size; i++) {
sendChar(i, values[i], 0);
}
}
void TM16xx::setDisplayToString(const char* string, const uint32_t dots, const uint8_t pos, const uint8_t font[])
{
for (int i = 0; i < digits - pos; i++) {
if (string[i] != '\0') {
//sendChar(i + pos, pgm_read_byte_near(font+(string[i] - 32)), (dots & (1 << (digits - i - 1))) != 0);
sendAsciiChar(i + pos, string[i], (dots & (1 << (digits - i - 1))) != 0);
} else {
break;
}
}
}
uint8_t TM16xx::getNumDigits()
{ // get the number of digits used (needed by TM16xxDisplay to combine modules)
return(digits);
}
// key-scanning method, implemented in chip specific derived class
uint32_t TM16xx::getButtons()
{ // return state of up to 32 keys.
return(0);
}
//
// Protected methods
//
void TM16xx::bitDelay()
{ // if needed derived classes can add a delay (eg. for TM1637)
//delayMicroseconds(50);
// On fast MCUs like ESP32 a delay is required, especially when reading buttons
// The TM1638 datasheet specifies a max clock speed of 1MHz.
// Testing shows that without delay the CLK line exceeds 1.6 MHz on the ESP32. While displaying data still worked, reading buttons failed.
// Adding a 1us delay gives clockpulses of about 1.75us-2.0us (~ 250kHz) on an ESP32 @240MHz and a similar delay on an ESP8266 @160Mhz.
// An ESP32 running without delay at 240MHz gave a CLK of ~0.3us (~ 1.6MHz)
// An ESP8266 running without delay at 160MHz gave a CLK of ~0.9us (~ 470kHz)
// An ESP8266 running without delay at 80MHz gave a CLK of ~1.8us (~ 240kHz)
#if F_CPU>100000000
delayMicroseconds(1);
#endif
}
void TM16xx::start()
{ // if needed derived classes can use different patterns to start a command (eg. for TM1637)
gpio_set_level(strobePin, 0);
bitDelay();
}
void TM16xx::stop()
{ // if needed derived classes can use different patterns to stop a command (eg. for TM1637)
gpio_set_level(strobePin, 1);
bitDelay();
}
void TM16xx::send(uint8_t data)
{
// MMOLE 180203: shiftout does something, but is not okay (tested on TM1668)
//shiftOut(dataPin, clockPin, LSBFIRST, data);
for (int i = 0; i < 8; i++) {
gpio_set_level(clockPin, 0);
bitDelay();
gpio_set_level(dataPin, data & 1);
bitDelay();
data >>= 1;
gpio_set_level(clockPin, 1);
bitDelay();
}
bitDelay(); // NOTE: TM1638 specifies a Twait between bytes of minimal 1us.
}
void TM16xx::sendCommand(uint8_t cmd)
{
start();
send(cmd);
stop();
}
void TM16xx::sendData(uint8_t address, uint8_t data)
{
sendCommand(TM16XX_CMD_DATA_FIXED); // use fixed addressing for data
start();
send(TM16XX_CMD_ADDRESS | address); // address command + address
send(data);
stop();
}
uint8_t TM16xx::receive()
{
uint8_t temp = 0;
// Pull-up on
gpio_set_direction(dataPin, GPIO_MODE_INPUT);
gpio_set_level(dataPin, 1);
for (int i = 0; i < 8; i++) {
temp >>= 1;
gpio_set_level(clockPin, 0);
bitDelay(); // NOTE: on TM1637 reading keys should be slower than 250Khz (see datasheet p3)
if (gpio_get_level(dataPin)) {
temp |= 0x80;
}
gpio_set_level(clockPin, 1);
bitDelay();
}
// Pull-up off
gpio_set_direction(dataPin, GPIO_MODE_OUTPUT);
gpio_set_level(dataPin, 0);
return temp;
}
+138
View File
@@ -0,0 +1,138 @@
/*
TM16xx.h - Library for TM1637, TM1638 and similar chips.
Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>
Modified by Maxint R&D. See https://github.com/maxint-rd/
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TM16XX_h
#define TM16XX_h
#if !defined(__max)
// MMOLE 180325: min, max are no macro in ESP core 2.3.9 libraries, see https://github.com/esp8266/Arduino/issues/398
// MMOLE 211229: Redefining min/max has issues in newer ESP cores with certain wifi libraries.
// See definition as function template below.
#define __min(a,b) ((a)<(b)?(a):(b))
#define __max(a,b) ((a)>(b)?(a):(b))
#endif
#if !defined(_BV)
// MMOLE 220909: _BV is not defined in Raspberry Pi Pico RP2040 core v2.4.0 or v2.5.2 by Earle F. Philhower
// TM16xx uses it in some classes to determine button presses (TM1628/30/37/38/38Anode
// Note that _BV works on int values (16-bit in Arduino). For that reason using bit() would be better.
// This is how _BV is defined in the AVR libraries used within Arduino:
#define _BV( x )( 1<<(x))
#endif
#define TM16XX_CMD_DATA_AUTO 0x40
#define TM16XX_CMD_DATA_READ 0x42 // command to read data used on two wire interfaces of TM1637
#define TM16XX_CMD_DATA_FIXED 0x44
#define TM16XX_CMD_DISPLAY 0x80
#define TM16XX_CMD_ADDRESS 0xC0
// Common display modes for selecting different GRID x SEGMENT configuration
// Used by e.g. TM1618, TM1620, TM1628, TM1630, TM1668
// (note: TM1652 combined display control and uses a single bit to designate 5x8 or 6x8)
#define TM16XX_CMD_MODE_4GRID 0x00
#define TM16XX_CMD_MODE_5GRID 0x01 // TM1630: 4x8 - 5x7
#define TM16XX_CMD_MODE_6GRID 0x02 // TM1620: 4x10 - 6x8
#define TM16XX_CMD_MODE_7GRID 0x03 // TM1628, TM1668: 4x13 - 7x10, TM1624: 4x14 - 7x11, TM1618: 4x8 - 7x5
#include "TM16xxFonts.h"
#include <driver/gpio.h>
class TM16xx
{
public:
/**
* Instantiate a TM16xx module specifying data, clock and strobe pins (no strobe on some modules),
* the maximum number of displays supported by the chip (as provided by derived chip specific class),
* the number of digits used to display numbers or text,
* display state and the starting intensity (0-7).
*/
TM16xx(gpio_num_t dataPin, gpio_num_t clockPin, gpio_num_t strobePin, uint8_t maxDisplays, uint8_t nDigitsUsed, bool activateDisplay=true, uint8_t intensity=7);
/** Set the display (segments and LEDs) active or off and intensity (range from 0-7). */
virtual void setupDisplay(bool active, uint8_t intensity);
/** Clear the display */
virtual void clearDisplay();
/** Set segments of the display */
virtual void setSegments(uint8_t segments, uint8_t position);
virtual void setSegments16(uint16_t segments, uint8_t position); // some modules support more than 8 segments
// Basic display functions. For additional display features use the TM16xxDisplay class
/** Set a single display at pos (starting at 0) to a digit (left to right) */
virtual void setDisplayDigit(uint8_t digit, uint8_t pos=0, bool dot=false, const uint8_t numberFont[] = TM16XX_NUMBER_FONT);
/** Set the display to a decimal number */
virtual void setDisplayToDecNumber(int nNumber, uint8_t bDots=0);
/** Clear a single display at pos (starting at 0, left to right) */
virtual void clearDisplayDigit(uint8_t pos, bool dot=false);
/** Set the display to the values (left to right) */
virtual void setDisplay(const uint8_t values[], uint8_t size=8);
/** Set the display to the string (defaults to built in font) */
virtual void setDisplayToString(const char* string, const uint32_t dots=0, const uint8_t pos=0, const uint8_t font[] = TM16XX_FONT_DEFAULT);
virtual void sendChar(uint8_t pos, uint8_t data, bool dot); // made public to allow calling from TM16xxDisplay
virtual uint8_t getNumDigits(); // added as public menthod to allow calling from TM16xxDisplay
virtual void sendAsciiChar(uint8_t pos, char c, bool dot); // made public to allow calling from TM16xxDisplay
// Key-scanning functions
// Note: not all TM16xx chips support key-scanning and sizes are different per chip
// Up to 32 key states are supported, but specific chips may support less keys or less combinations
// The chip specific derived class method will return a 32-bit value representing the state of each key, containing 0 if no key is pressed
virtual uint32_t getButtons(); // return state of up to 32 keys.
protected:
// virtual void sendChar(byte pos, byte data, bool dot);
virtual void bitDelay();
virtual void start();
virtual void stop();
virtual void send(uint8_t data);
virtual void sendCommand(uint8_t led);
virtual void sendData(uint8_t add, uint8_t data);
virtual uint8_t receive();
#if !defined(max)
// MMOLE 211229: use c++ function templates to implement our own min/max, as redefining them wont work in newer ESP cores when using certain wifi libraries
// NOTE: min, max are no macro in ESP core 2.3.9 libraries, see https://github.com/esp8266/Arduino/issues/398
// See also
// https://www.cplusplus.com/doc/oldtutorial/templates/
// https://www.alltestanswers.com/c-templates-for-the-two-functions-minimum-and-maximum/
// https://www.learncpp.com/cpp-tutorial/function-templates-with-multiple-template-types/
// MMOLE 220814: Arduino IDE 1.8.12 for LGT328P required "#if !defined(max)" to prevent compilation errors
template <typename T, typename U>
auto max(T x, U y) -> decltype(x>y ? x : y)
{
return x>y ? x : y;
}
template <typename T, typename U>
auto min(T x, U y) -> decltype(x>y ? x : y)
{
return x<y ? x : y;
}
#endif // !defined(max)
uint8_t _maxDisplays=2; // maximum number of digits (grids), chip-dependent
uint8_t _maxSegments=8; // maximum number of segments per display, chip-dependent
uint8_t digits; // number of digits in the display, module dependent
gpio_num_t dataPin;
gpio_num_t clockPin;
gpio_num_t strobePin;
};
#endif
+313
View File
@@ -0,0 +1,313 @@
/*
TM16xxFonts.h - Font definition for TM16xx.
Copyright (C) 2011 Ricardo Batista (rjbatista <at> gmail <dot> com)
Modified by Maxint R&D. See https://github.com/maxint-rd/
- Improvements for 7-segment alpha-numeric font
- Additional 15-segment font
This program is free software: you can redistribute it and/or modify
it under the terms of the version 3 GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Segment labels
-- A --
| |
F B
-- G --
E C
| |
-- D -- .DP
The bits are displayed by the mapping below:
-- 0 --
| |
5 1
-- 6 --
4 2
| |
-- 3 -- .7
Common pinout 7-segments x 4 digits:
12 11 10 9 8 7
| | | | | |
+------------------------+ 12, 9, 8, 6: GRD1-GRD4
| -- -- -- -- |
| | | | | | | | | | 1: SEG_E 5: SEG_G
| -- -- -- -- | 2: SEG_D 7: SEG_B
| | | | | | | | | | 3: SEG_DP 10: SEG_F
| -- . -- . -- . -- . | 4: SEG_C 11: SEG_A
+------------------------+
| | | | | |
1 2 3 4 5 6
*/
#ifndef TM16XXFonts_h
#define TM16XXFonts_h
#include <stdint.h>
// definition for standard hexadecimal numbers
const uint8_t TM16XX_NUMBER_FONT[] = {
0b00111111, // 0
0b00000110, // 1
0b01011011, // 2
0b01001111, // 3
0b01100110, // 4
0b01101101, // 5
0b01111101, // 6
0b00000111, // 7
0b01111111, // 8
0b01101111, // 9
0b01110111, // A
0b01111100, // B
0b00111001, // C
0b01011110, // D
0b01111001, // E
0b01110001 // F
};
const uint8_t MINUS = 0b01000000;
// definition for error text
const uint8_t TM16XX_ERROR_DATA[] = {
0b01111001, // E
0b01010000, // r
0b01010000, // r
0b01011100, // o
0b01010000, // r
0,
0,
0
};
// Definition for the displayable ASCII chars
// (note that non-alpha-numeric characters may display as a space or a simple dash)
const uint8_t TM16XX_FONT_DEFAULT[] = {
0b00000000, // (32) <space>
0b10000110, // (33) !
0b00100010, // (34) "
0b01111110, // (35) #
0b01101101, // (36) $
0b00000000, // (37) %
0b00000000, // (38) &
0b00000010, // (39) '
0b00110000, // (40) (
0b00000110, // (41) )
0b01100011, // (42) *
0b00000000, // (43) +
0b00000100, // (44) ,
0b01000000, // (45) -
0b10000000, // (46) .
0b01010010, // (47) /
0b00111111, // (48) 0
0b00000110, // (49) 1
0b01011011, // (50) 2
0b01001111, // (51) 3
0b01100110, // (52) 4
0b01101101, // (53) 5
0b01111101, // (54) 6
0b00100111, // (55) 7
0b01111111, // (56) 8
0b01101111, // (57) 9
0b00000000, // (58) :
0b00000000, // (59) ;
0b00000000, // (60) <
0b01001000, // (61) =
0b00000000, // (62) >
0b01010011, // (63) ?
0b01011111, // (64) @
0b01110111, // (65) A
0b01111111, // (66) B
0b00111001, // (67) C
0b00111111, // (68) D
0b01111001, // (69) E
0b01110001, // (70) F
0b00111101, // (71) G
0b01110110, // (72) H
0b00000110, // (73) I
0b00011110, // (74) J
0b01101001, // (75) K
0b00111000, // (76) L
0b00010101, // (77) M
0b00110111, // (78) N
0b00111111, // (79) O
0b01110011, // (80) P
0b01100111, // (81) Q
0b00110001, // (82) R
0b01101101, // (83) S
0b01111000, // (84) T
0b00111110, // (85) U
0b00101010, // (86) V
0b00011101, // (87) W
0b01110110, // (88) X
0b01101110, // (89) Y
0b01011011, // (90) Z
0b00111001, // (91) [
0b01100100, // (92) \ (this can't be the last char on a line, even in comment or it'll concat)
0b00001111, // (93) ]
0b00000000, // (94) ^
0b00001000, // (95) _
0b00100000, // (96) `
0b01011111, // (97) a
0b01111100, // (98) b
0b01011000, // (99) c
0b01011110, // (100) d
0b01111011, // (101) e
0b00110001, // (102) f
0b01101111, // (103) g
0b01110100, // (104) h
0b00000100, // (105) i
0b00001110, // (106) j
0b01110101, // (107) k
0b00110000, // (108) l
0b01010101, // (109) m
0b01010100, // (110) n
0b01011100, // (111) o
0b01110011, // (112) p
0b01100111, // (113) q
0b01010000, // (114) r
0b01101101, // (115) s
0b01111000, // (116) t
0b00011100, // (117) u
0b00101010, // (118) v
0b00011101, // (119) w
0b01110110, // (120) x
0b01101110, // (121) y
0b01000111, // (122) z
0b01000110, // (123) {
0b00000110, // (124) |
0b01110000, // (125) }
0b00000001, // (126) ~
};
/*
Definition for the displayable ASCII chars on a 15-segment display.
Segment labels and bit-assignment:
|---A---| Bit Segment Bit Segment
|\ | /| [0] A [ 8] G2
F H J K B [1] B [ 9] H
| \|/ | [2] C [10] J
|-G1-G2-| [3] D [11] K
| /|\ | [4] E [12] L
E N M L C [5] F [13] M
|/ | \| [6] G1 [14] N
|---D---| DP [7] DP
14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
N M L K J H G2 DP G1 F E D C B A
Note: For compatibility bits 0-7 are in the same order as A-G on a 7-segment display.
Most characters in the font below are based on their 7-seg counterparts to keep styling alike.
*/
const uint16_t TM16XX_FONT_15SEG[] = {
0b00000000, // (32) <space>
0b10010010000000, // (33) !
0b00100010, // (34) "
0b10010101110001, // (35) #
0b10010101101101, // (36) $
0b100100000100100, // (37) %
0b1101001011001, // (38) &
0b00000010, // (39) '
0b00110000, // (40) (
0b00000110, // (41) )
0b111111101000000, // (42) *
0b010010101000000, // (43) +
0b100000000000000, // (44) ,
0b01000000, // (45) -
0b10000000, // (46) .
0b0100100000000000, // (47) /
0b00111111, // (48) 0
0b00000110, // (49) 1
0b101011011, // (50) 2
0b101001111, // (51) 3
0b101100110, // (52) 4
0b101101101, // (53) 5
0b101111101, // (54) 6
0b00100111, // (55) 7
0b101111111, // (56) 8
0b101101111, // (57) 9
0b10000000, // (58) :
0b100000000000010, // (59) ;
0b1100000000000, // (60) <
0b101001000, // (61) =
0b100001000000000, // (62) >
0b10000110000011, // (63) ?
0b100111011, // (64) @
0b101110111, // (65) A
0b10010100001111, // (66) B
0b00111001, // (67) C
0b10010000001111, // (68) D
0b101111001, // (69) E
0b101110001, // (70) F
0b100111101, // (71) G
0b101110110, // (72) H
0b10010000001001, // (73) I
0b00011110, // (74) J
0b01100001110000, // (75) K
0b00111000, // (76) L
0b101000110110, // (77) M
0b1001000110110, // (78) N
0b00111111, // (79) O
0b101110011, // (80) P
0b1000000111111, // (81) Q
0b1000101110011, // (82) R
0b101101101, // (83) S
0b010010000000001, // (84) T
0b00111110, // (85) U
0b1001000000110, // (86) V
0b101000000110110, // (87) W
0b101101000000000, // (88) X
0b00010101000000000, // (89) Y
0b100100000001001, // (90) Z
0b00111001, // (91) [
0b1001000000000, // (92) \ (this can't be the last char on a line, even in comment or it'll concat)
0b00001111, // (93) ]
0b101000000000000, // (94) ^
0b00001000, // (95) _
0b1000000000, // (96) `
0b101011111, // (97) a
0b101111100, // (98) b
0b101011000, // (99) c
0b101011110, // (100) d
0b101111011, // (101) e
0b01110001, // (102) f
0b101101111, // (103) g
0b101110100, // (104) h
0b00000100, // (105) i
0b00001110, // (106) j
0b100001110100, // (107) k
0b00110000, // (108) l
0b101000110110, // (109) m
0b10000100000100, // (110) n
0b101011100, // (111) o
0b101110011, // (112) p
0b101100111, // (113) q
0b101010000, // (114) r
0b101101101, // (115) s
0b01111000, // (116) t
0b00011100, // (117) u
0b100000000010000, // (118) v
0b101000000010100, // (119) w
0b101101000000000, // (120) x
0b100101000000000, // (121) y
0b100100000001001, // (122) z
0b100001001001001, // (123) {
0b010010000000000, // (124) |
0b1100100001001, // (125) }
0b00000001, // (126) ~
};
#endif