GY-63_MS5611/libraries/TM1637_RT/TM1637.cpp

620 lines
12 KiB
C++
Raw Normal View History

2021-04-25 13:56:44 -04:00
//
// FILE: TM1637.cpp
// AUTHOR: Rob Tillaart
// DATE: 2019-10-28
2024-01-06 10:59:46 -05:00
// VERSION: 0.4.0
2021-04-25 13:56:44 -04:00
// PURPOSE: TM1637 library for Arduino
// URL: https://github.com/RobTillaart/TM1637_RT
2022-04-21 10:40:24 -04:00
// NOTE:
2023-11-23 07:39:41 -05:00
// on the inexpensive TM1637 boards @wfdudley has used, keyScan
2022-04-21 10:40:24 -04:00
// works if you add a 1000 ohm pull-up resistor from DIO to 3.3v
// This reduces the rise time of the DIO signal when reading the key info.
// If one only uses the pull-up inside the microcontroller,
// the rise time is too long for the data to be read reliably.
2021-10-28 04:02:41 -04:00
2021-04-25 13:56:44 -04:00
#include "TM1637.h"
#define TM1637_ADDR_AUTO 0x40
2021-10-28 04:02:41 -04:00
#define TM1637_READ_KEYSCAN 0x42
2021-04-25 13:56:44 -04:00
#define TM1637_ADDR_FIXED 0x44
#define TM1637_CMD_SET_DATA 0x40
#define TM1637_CMD_SET_ADDR 0xC0
#define TM1637_CMD_DISPLAY 0x88
2023-04-17 07:13:30 -04:00
// Special chars
#define TM1637_SPACE 16
#define TM1637_MINUS 17
#define TM1637_DEGREE 18
2021-04-25 13:56:44 -04:00
/***************
---
| |
---
| |
2022-04-21 10:40:24 -04:00
--- .
2021-04-25 13:56:44 -04:00
-01-
20 | | 02
-40-
10 | | 04
2022-04-21 10:40:24 -04:00
-08- .80
2021-04-25 13:56:44 -04:00
*/
2021-12-29 06:48:28 -05:00
2021-04-25 13:56:44 -04:00
// PROGMEM ?
2021-12-29 06:48:28 -05:00
2021-04-25 13:56:44 -04:00
static uint8_t seg[] =
{
0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, // 0 - 9
2023-11-23 07:39:41 -05:00
0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x00, 0x40, 0x63 // A - F, ' ', '-', '°'
2021-04-25 13:56:44 -04:00
};
2021-12-29 06:48:28 -05:00
2021-10-28 04:02:41 -04:00
static uint8_t alpha_seg[] =
{
0x00, 0x74, 0x10, 0x00, // g, h, i, j,
0x00, 0x38, 0x00, 0x54, // k, l, m, n,
0x5c, 0x00, 0x00, 0x50, // o, p, q, r,
0x00, 0x31, 0x1c, 0x1c, // s, t, u, v,
0x00, 0x00, 0x00, 0x00 // w, x, y, z
};
2021-04-25 13:56:44 -04:00
2021-12-29 06:48:28 -05:00
2021-04-25 13:56:44 -04:00
TM1637::TM1637()
{
2023-04-17 07:13:30 -04:00
_digits = 6;
_brightness = 3;
2021-04-25 13:56:44 -04:00
_bitDelay = 10;
}
2022-09-25 03:59:53 -04:00
void TM1637::begin(uint8_t clockPin, uint8_t dataPin, uint8_t digits)
2021-04-25 13:56:44 -04:00
{
2023-07-18 09:38:19 -04:00
_clockPin = clockPin;
_dataPin = dataPin;
_digits = digits;
2021-04-25 13:56:44 -04:00
2023-07-18 09:38:19 -04:00
pinMode(_clockPin, OUTPUT);
digitalWrite(_clockPin, HIGH);
pinMode(_dataPin, OUTPUT);
digitalWrite(_dataPin, HIGH);
2022-04-21 10:40:24 -04:00
// TODO: replace _digits by a display enumeration?
2023-02-18 07:28:46 -05:00
if (_digits == 4)
2022-04-21 10:40:24 -04:00
{
2023-02-18 07:28:46 -05:00
setDigitOrder(3, 2, 1, 0);
2022-04-21 10:40:24 -04:00
}
2023-11-23 07:39:41 -05:00
else // (_digits == 6 ) // default
2022-04-21 10:40:24 -04:00
{
2023-02-18 07:28:46 -05:00
setDigitOrder(3, 4, 5, 0, 1, 2);
2022-04-21 10:40:24 -04:00
}
2021-04-25 13:56:44 -04:00
}
void TM1637::displayInt(long value)
{
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2021-04-25 13:56:44 -04:00
long v = value;
int last = _digits;
bool neg = (v < 0);
if (neg)
{
v = -v;
last--;
2023-07-18 09:38:19 -04:00
_data[last] = TM1637_MINUS;
2021-04-25 13:56:44 -04:00
}
for (int i = 0; i < last; i++)
{
long t = v / 10;
2023-07-18 09:38:19 -04:00
_data[i] = v - 10 * t; // faster than %
2021-04-25 13:56:44 -04:00
v = t;
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, -1);
2021-04-25 13:56:44 -04:00
}
void TM1637::displayFloat(float value)
{
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2021-04-25 13:56:44 -04:00
2023-02-18 07:28:46 -05:00
float v = value;
int dpos = _digits - 1;
2021-04-25 13:56:44 -04:00
int last = _digits;
bool neg = (v < 0);
if (neg)
{
v = -v;
dpos--;
last--;
2023-07-18 09:38:19 -04:00
_data[last] = TM1637_MINUS;
2021-04-25 13:56:44 -04:00
}
while (v >= 10)
{
v /= 10;
dpos--;
}
for (int i = last-1; i > -1; i--)
{
int d = v;
2023-07-18 09:38:19 -04:00
_data[i] = d;
2021-04-25 13:56:44 -04:00
v -= d;
v *= 10;
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, dpos);
2021-04-25 13:56:44 -04:00
}
2023-02-18 07:28:46 -05:00
void TM1637::displayFloat(float value, uint8_t fixedPoint)
{
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2023-02-18 07:28:46 -05:00
float v = value;
int dpos = _digits - 1;
int last = _digits;
bool neg = (v < 0);
int point = fixedPoint + 1;
if (neg)
{
v = -v;
dpos--;
last--;
}
// v += 0.0001; // Bug fix for 12.999 <> 13.000
2023-11-23 07:39:41 -05:00
v += 0.001; // Bug fix for 12.99 <> 13.00
2023-02-18 07:28:46 -05:00
while (v >= 10)
{
v /= 10;
dpos--;
point++;
}
if (neg)
{
2023-07-18 09:38:19 -04:00
_data[point] = TM1637_MINUS;
2023-02-18 07:28:46 -05:00
}
for (int i = point - 1; i > -1; i--)
{
int d = v;
2023-07-18 09:38:19 -04:00
_data[i] = d;
2023-02-18 07:28:46 -05:00
v -= d;
v *= 10;
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, fixedPoint);
2023-02-18 07:28:46 -05:00
}
2021-04-25 13:56:44 -04:00
void TM1637::displayHex(uint32_t value)
{
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2021-04-25 13:56:44 -04:00
uint32_t v = value;
for (int i = 0; i < _digits; i++)
{
uint32_t t = v / 16;
2023-07-18 09:38:19 -04:00
_data[i] = v & 0x0F; // faster than %
2021-04-25 13:56:44 -04:00
v = t;
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, -1);
2021-04-25 13:56:44 -04:00
}
2023-07-18 09:38:19 -04:00
void TM1637::displayTime(uint8_t hour, uint8_t minute, bool colon)
2023-02-27 14:45:02 -05:00
{
if (_digits != 4) return;
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2023-04-17 07:13:30 -04:00
// optional
2023-07-18 09:38:19 -04:00
// if (hour > 99) hour = 99;
// if (minute > 99) minute = 99;
_data[3] = hour / 10;
_data[2] = hour % 10;
_data[1] = minute / 10;
_data[0] = minute % 10;
displayRaw(_data, colon ? 2 : -1);
2023-02-27 14:45:02 -05:00
}
2023-07-18 09:38:19 -04:00
void TM1637::displayTwoInt(int left, int right, bool colon)
2023-04-17 07:13:30 -04:00
{
if (_digits != 4) return;
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
2023-04-17 07:13:30 -04:00
// optional
2023-07-18 09:38:19 -04:00
// if (left < -9) left = -9;
// if (left > 99) left = 99;
// if (right < -9) right = -9;
// if (right > 99) right = 99;
if (left < 0)
2023-04-17 07:13:30 -04:00
{
2023-07-18 09:38:19 -04:00
_data[3] = TM1637_MINUS;
_data[2] = -left;
2023-04-17 07:13:30 -04:00
}
else
{
2023-07-18 09:38:19 -04:00
_data[3] = left / 10;
_data[2] = left % 10;
2023-04-17 07:13:30 -04:00
}
2023-07-18 09:38:19 -04:00
if (right < 0)
2023-04-17 07:13:30 -04:00
{
2023-07-18 09:38:19 -04:00
_data[1] = TM1637_MINUS;
_data[0] = -right;
2023-04-17 07:13:30 -04:00
}
else
{
2023-07-18 09:38:19 -04:00
_data[1] = right / 10;
_data[0] = right % 10;
2023-04-17 07:13:30 -04:00
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, colon ? 2 : -1);
2023-04-17 07:13:30 -04:00
}
void TM1637::displayCelsius(int temp, bool colon)
{
if (_digits != 4) return;
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
_data[0] = 12; // C
2023-11-23 07:39:41 -05:00
_data[1] = TM1637_DEGREE; // ° degree sign
2023-07-18 09:38:19 -04:00
if (temp < -9) temp = -9;
if (temp > 99) temp = 99;
if (temp < 0)
{
_data[3] = TM1637_MINUS;
_data[2] = -temp;
}
else
{
_data[3] = temp / 10;
_data[2] = temp % 10;
}
displayRaw(_data, colon ? 2 : -1);
}
void TM1637::displayFahrenheit(int temp, bool colon)
{
if (_digits != 4) return;
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
_data[0] = 15; // F
2023-11-23 07:39:41 -05:00
_data[1] = TM1637_DEGREE; // ° degree sign
2023-07-18 09:38:19 -04:00
2023-04-17 07:13:30 -04:00
if (temp < -9) temp = -9;
if (temp > 99) temp = 99;
if (temp < 0)
{
2023-07-18 09:38:19 -04:00
_data[3] = TM1637_MINUS;
_data[2] = -temp;
2023-04-17 07:13:30 -04:00
}
else
{
2023-07-18 09:38:19 -04:00
_data[3] = temp / 10;
_data[2] = temp % 10;
2023-04-17 07:13:30 -04:00
}
2023-07-18 09:38:19 -04:00
displayRaw(_data, colon ? 2 : -1);
2023-04-17 07:13:30 -04:00
}
2021-04-25 13:56:44 -04:00
void TM1637::displayClear()
{
2023-07-18 09:38:19 -04:00
for (int i = 0; i < 8; i++) _data[i] = TM1637_SPACE; // 16
displayRaw(_data, -1);
}
void TM1637::displayRefresh()
{
// display internal buffer again.
displayRaw(_data, _lastPointPos);
}
void TM1637::hideSegment(uint8_t idx)
{
if (idx > 7) return;
uint8_t tmp[8];
for (int i = 0; i < 8; i++) tmp[i] = _data[i];
tmp[idx] = TM1637_SPACE;
displayRaw(tmp, _lastPointPos);
}
void TM1637::hideMultiSegment(uint8_t mask)
{
uint8_t tmp[8];
for (int i = 0; i < 8; i++)
{
if ((mask & 0x01) == 0x01) tmp[i] = TM1637_SPACE;
else tmp[i] = _data[i];
mask >>= 1;
}
displayRaw(tmp, _lastPointPos);
2021-04-25 13:56:44 -04:00
}
2023-02-18 07:28:46 -05:00
void TM1637::setBrightness(uint8_t brightness)
2021-04-25 13:56:44 -04:00
{
2023-02-18 07:28:46 -05:00
_brightness = brightness;
2021-04-25 13:56:44 -04:00
if (_brightness > 0x07) _brightness = 0x07;
}
2023-02-18 07:28:46 -05:00
uint8_t TM1637::getBrightness()
{
return _brightness;
}
2023-04-17 07:13:30 -04:00
void TM1637::setBitDelay(uint8_t bitDelay)
{
_bitDelay = bitDelay;
}
uint8_t TM1637::getBitDelay()
{
return _bitDelay;
}
2022-04-21 10:40:24 -04:00
void TM1637::setDigitOrder(uint8_t a, uint8_t b,
uint8_t c, uint8_t d, uint8_t e,
uint8_t f, uint8_t g, uint8_t h)
{
_digitOrder[0] = a;
_digitOrder[1] = b;
_digitOrder[2] = c;
_digitOrder[3] = d;
_digitOrder[4] = e;
_digitOrder[5] = f;
_digitOrder[6] = g;
_digitOrder[7] = h;
}
2023-02-18 07:28:46 -05:00
// Set sign bit on any char to display decimal point
2022-10-07 05:32:52 -04:00
void TM1637::displayPChar( char * data )
2021-04-25 13:56:44 -04:00
{
start();
writeByte(TM1637_ADDR_AUTO);
stop();
start();
writeByte(TM1637_CMD_SET_ADDR);
2022-04-21 10:40:24 -04:00
2023-07-18 09:38:19 -04:00
for (int d = _digits-1; d >= 0 ; d--)
2021-04-25 13:56:44 -04:00
{
2022-04-21 10:40:24 -04:00
uint8_t i = _digitOrder[d];
2022-10-07 05:32:52 -04:00
writeByte( asciiTo7Segment(data[i]) );
2021-04-25 13:56:44 -04:00
}
2022-04-21 10:40:24 -04:00
stop();
start();
writeByte(TM1637_CMD_DISPLAY | _brightness);
stop();
}
2023-07-18 09:38:19 -04:00
void TM1637::displayRaw(uint8_t * raw, uint8_t pointPos)
2022-04-21 10:40:24 -04:00
{
2023-02-18 07:28:46 -05:00
// DEBUG
// for (uint8_t d = 0; d < _digits; d++)
// {
2023-07-18 09:38:19 -04:00
// uint8_t x = raw[_digits - d - 1];
2023-02-18 07:28:46 -05:00
// if (x < 0x10) Serial.print('0');
// Serial.print(x, HEX);
2023-07-18 09:38:19 -04:00
// Serial.print('-');
2023-02-18 07:28:46 -05:00
// }
// Serial.println();
2022-10-07 05:32:52 -04:00
uint8_t b = 0;
2023-07-18 09:38:19 -04:00
_lastPointPos = pointPos;
2022-04-21 10:40:24 -04:00
start();
writeByte(TM1637_ADDR_AUTO);
stop();
start();
writeByte(TM1637_CMD_SET_ADDR);
2022-10-07 05:32:52 -04:00
for (uint8_t d = 0; d < _digits; d++)
2021-04-25 13:56:44 -04:00
{
2022-10-07 05:32:52 -04:00
uint8_t i = _digitOrder[d];
2023-07-18 09:38:19 -04:00
bool hasPoint = raw[i] & 0x80;
raw[i] &= 0x7f;
if (raw[i] <= 18) // HEX DIGIT
2022-04-21 10:40:24 -04:00
{
2023-07-18 09:38:19 -04:00
b = seg[raw[i]];
2021-10-28 04:02:41 -04:00
}
2023-07-18 09:38:19 -04:00
else if (raw[i] <= 37) // ASCII
2022-04-21 10:40:24 -04:00
{
2023-07-18 09:38:19 -04:00
b = alpha_seg[raw[i] - 18];
2022-04-21 10:40:24 -04:00
}
2022-10-07 05:32:52 -04:00
// do we need a decimal point
2023-07-18 09:38:19 -04:00
if ((i == pointPos) || hasPoint)
2022-04-21 10:40:24 -04:00
{
2022-10-07 05:32:52 -04:00
b |= 0x80;
2021-10-28 04:02:41 -04:00
}
2022-10-07 05:32:52 -04:00
writeByte(b);
2021-04-25 13:56:44 -04:00
}
stop();
start();
writeByte(TM1637_CMD_DISPLAY | _brightness);
stop();
}
2023-07-18 09:38:19 -04:00
void TM1637::dumpCache()
{
for (int i = 0; i < 8; i++)
{
Serial.print(_data[i]);
Serial.print(" ");
}
Serial.println();
}
2022-04-21 10:40:24 -04:00
//////////////////////////////////////////////////////
//
// PRIVATE
//
2021-04-25 13:56:44 -04:00
uint8_t TM1637::writeByte(uint8_t data)
{
2023-02-18 07:28:46 -05:00
// shift out data 8 bits LSB first
2021-04-25 13:56:44 -04:00
for (uint8_t i = 8; i > 0; i--)
{
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, LOW);
writeSync(_dataPin, data & 0x01);
writeSync(_clockPin, HIGH);
2021-04-25 13:56:44 -04:00
data >>= 1;
}
2021-09-26 15:09:33 -04:00
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, LOW);
writeSync(_dataPin, HIGH);
writeSync(_clockPin, HIGH);
2021-04-25 13:56:44 -04:00
2023-02-18 07:28:46 -05:00
// get ACKNOWLEDGE
2023-07-18 09:38:19 -04:00
pinMode(_dataPin, INPUT);
2021-04-25 13:56:44 -04:00
delayMicroseconds(_bitDelay);
2023-07-18 09:38:19 -04:00
uint8_t rv = digitalRead(_dataPin);
2021-04-25 13:56:44 -04:00
2023-02-18 07:28:46 -05:00
// FORCE OUTPUT LOW
2023-07-18 09:38:19 -04:00
pinMode(_dataPin, OUTPUT);
digitalWrite(_dataPin, LOW);
2021-04-25 13:56:44 -04:00
delayMicroseconds(_bitDelay);
return rv;
}
void TM1637::start()
{
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, HIGH);
writeSync(_dataPin, HIGH);
writeSync(_dataPin, LOW);
writeSync(_clockPin, LOW);
2021-04-25 13:56:44 -04:00
}
void TM1637::stop()
{
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, LOW);
writeSync(_dataPin, LOW);
writeSync(_clockPin, HIGH);
writeSync(_dataPin, HIGH);
2021-04-25 13:56:44 -04:00
}
2021-12-29 06:48:28 -05:00
void TM1637::writeSync(uint8_t pin, uint8_t val)
2021-09-26 15:09:33 -04:00
{
digitalWrite(pin, val);
#if defined(ESP32)
2023-02-18 07:28:46 -05:00
nanoDelay(21); // delay(2) is not enough in practice.
2021-09-26 15:09:33 -04:00
#endif
2023-02-18 07:28:46 -05:00
// other processors may need other "nanoDelay(n)"
2021-09-26 15:09:33 -04:00
}
2023-11-23 07:39:41 -05:00
// keyScan results are reversed left for right from the data sheet.
// here are the values returned by keyScan():
2023-02-18 07:28:46 -05:00
//
// pin 2 3 4 5 6 7 8 9
// sg1 sg2 sg3 sg4 sg5 sg6 sg7 sg8
// 19 k1 0xf7 0xf6 0xf5 0xf4 0xf3 0xf2 0xf1 0xf0
// 20 k2 0xef 0xee 0xed 0xec 0xeb 0xea 0xe9 0xe8
2021-10-28 04:02:41 -04:00
2023-11-23 07:39:41 -05:00
uint8_t TM1637::keyScan(void)
2021-10-28 04:02:41 -04:00
{
uint8_t halfDelay = _bitDelay >> 1;
uint8_t key;
start();
key = 0;
2023-02-18 07:28:46 -05:00
writeByte(TM1637_READ_KEYSCAN); // includes the ACK, leaves DATA low
2023-07-18 09:38:19 -04:00
pinMode(_dataPin, INPUT_PULLUP);
2021-10-28 04:02:41 -04:00
for (uint8_t i = 0; i <= 7; i++) {
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, LOW);
2021-10-28 04:02:41 -04:00
delayMicroseconds(halfDelay);
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, HIGH);
2021-10-28 04:02:41 -04:00
delayMicroseconds(halfDelay);
key >>= 1;
2023-07-18 09:38:19 -04:00
key |= (digitalRead(_dataPin)) ? 0x80 : 0x00 ;
2021-10-28 04:02:41 -04:00
}
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, LOW);
2021-10-28 04:02:41 -04:00
delayMicroseconds(halfDelay);
2023-07-18 09:38:19 -04:00
writeSync(_clockPin, HIGH);
2021-10-28 04:02:41 -04:00
2023-02-18 07:28:46 -05:00
// wait for ACK
2021-10-28 04:02:41 -04:00
delayMicroseconds(halfDelay);
2023-02-18 07:28:46 -05:00
// FORCE OUTPUT LOW
2023-07-18 09:38:19 -04:00
pinMode(_dataPin, OUTPUT);
digitalWrite(_dataPin, LOW);
2021-10-28 04:02:41 -04:00
delayMicroseconds(halfDelay);
stop();
return key;
}
2023-02-18 07:28:46 -05:00
// nanoDelay() makes it possible to go into the sub micron delays.
2023-04-17 07:13:30 -04:00
// It is used to lengthen pulses to be minimal 400 ns but not much longer.
// See datasheet.
2021-09-26 15:09:33 -04:00
void TM1637::nanoDelay(uint16_t n)
{
volatile uint16_t i = n;
while (i--);
}
2021-12-29 06:48:28 -05:00
2022-10-07 05:32:52 -04:00
uint8_t TM1637::asciiTo7Segment ( char c )
{
/*
-01-
20 | | 02
-40-
10 | | 04
2023-02-18 07:28:46 -05:00
-08- .80
2022-10-07 05:32:52 -04:00
*/
// 7+1 Segment patterns for ASCII 0x30-0x5F
2023-02-18 07:28:46 -05:00
const uint8_t asciiToSegments[] = {
0x3f,0x06,0x5b,0x4f, 0x66,0x6d,0x7d,0x07, // 0123 4567
2022-10-07 05:32:52 -04:00
0x7f,0x6f,0x09,0x89, 0x58,0x48,0x4c,0xD3, // 89:; <=>?
2023-02-18 07:28:46 -05:00
0x5f,0x77,0x7c,0x39, 0x5E,0x79,0x71,0x3d, // @ABC DEFG
2022-10-07 05:32:52 -04:00
0x76,0x06,0x0E,0x75, 0x38,0x37,0x54,0x5c, // HIJK LMNO
0x73,0x67,0x50,0x6D, 0x78,0x3E,0x1C,0x9c, // PQRS TUVW
0x76,0x6E,0x5B,0x39, 0x52,0x0F,0x23,0x08 // XYZ[ /]^_
};
uint8_t segments = c & 0x80;
c &= 0x7f;
if ( c >= 0x60 ) c -= 0x20 ; // a-z -> A-Z
if ( c == '.' ) segments = 0x80; // decimal point only
if ( c == '-' ) segments |= 0x40; // minus sign
if ( ( c >= 0x30 ) && ( c <= 0x5F ) ) {
segments |= asciiToSegments[ c - 0x30 ];
}
return segments;
}
2023-02-18 07:28:46 -05:00
// -- END OF FILE --
2021-12-29 06:48:28 -05:00