-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added character set and string handling (thanks dmadison and hans-jorg:
dmadison/LED-Segment-ASCII#2) TODO: change it to use PGM instead of SRAM.
- Loading branch information
Showing
3 changed files
with
147 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Project Segmented LED Display - ASCII Library | ||
* @author David Madison | ||
* @link github.com/dmadison/Segmented-LED-Display-ASCII | ||
* @license MIT - Copyright (c) 2017 David Madison | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
*/ | ||
#include <stdint.h> | ||
#define _DP 0x80 | ||
#define _G 0x1 | ||
#define _F 0x2 | ||
#define _E 0x4 | ||
#define _D 0x8 | ||
#define _C 0x10 | ||
#define _B 0x20 | ||
#define _A 0x40 | ||
|
||
const uint8_t SevenSegmentASCII[96] = { | ||
0 , /* (space) */ | ||
_DP |_C |_B , /* ! */ | ||
_F |_B , /* " */ | ||
_G |_F |_E |_D |_C |_B , /* # */ | ||
_G |_F |_D |_C |_A , /* $ */ | ||
_DP|_G |_E |_B , /* % */ | ||
_G |_C |_B , /* & */ | ||
_F , /* ' */ | ||
_F |_D |_A , /* ( */ | ||
_D |_B |_A , /* ) */ | ||
_F |_A , /* * */ | ||
_G |_F |_E , /* + */ | ||
_E , /* , */ | ||
_G , /* - */ | ||
_DP , /* . */ | ||
_G |_E |_B , /* / */ | ||
_F |_E |_D |_C |_B |_A , /* 0 */ | ||
_C |_B , /* 1 */ | ||
_G |_E |_D |_B |_A , /* 2 */ | ||
_G |_D |_C |_B |_A , /* 3 */ | ||
_G |_F |_C |_B , /* 4 */ | ||
_G |_F |_D |_C |_A , /* 5 */ | ||
_G |_F |_E |_D |_C |_A , /* 6 */ | ||
_C |_B |_A , /* 7 */ | ||
_G |_F |_E |_D |_C |_B |_A , /* 8 */ | ||
_G |_F |_D |_C |_B |_A , /* 9 */ | ||
_D |_A , /* : */ | ||
_D |_C |_A , /* ; */ | ||
_G |_F |_A , /* < */ | ||
_G |_D , /* = */ | ||
_G |_B |_A , /* > */ | ||
_DP|_G |_E |_B |_A , /* ? */ | ||
_G |_E |_D |_C |_B |_A , /* @ */ | ||
_G |_F |_E |_C |_B |_A , /* A */ | ||
_G |_F |_E |_D |_C , /* B */ | ||
_F |_E |_D |_A , /* C */ | ||
_G |_E |_D |_C |_B , /* D */ | ||
_G |_F |_E |_D |_A , /* E */ | ||
_G |_F |_E |_A , /* F */ | ||
_F |_E |_D |_C |_A , /* G */ | ||
_G |_F |_E |_C |_B , /* H */ | ||
_F |_E , /* I */ | ||
_E |_D |_C |_B , /* J */ | ||
_G |_F |_E |_C |_A , /* K */ | ||
_F |_E |_D , /* L */ | ||
_E |_C |_A , /* M */ | ||
_F |_E |_C |_B |_A , /* N */ | ||
_F |_E |_D |_C |_B |_A , /* O */ | ||
_G |_F |_E |_B |_A , /* P */ | ||
_G |_F |_D |_B |_A , /* Q */ | ||
_F |_E |_B |_A , /* R */ | ||
_G |_F |_D |_C |_A , /* S */ | ||
_G |_F |_E |_D , /* T */ | ||
_F |_E |_D |_C |_B , /* U */ | ||
_F |_E |_D |_C |_B , /* V */ | ||
_F |_D |_B , /* W */ | ||
_G |_F |_E |_C |_B , /* X */ | ||
_G |_F |_D |_C |_B , /* Y */ | ||
_G |_E |_D |_B |_A , /* Z */ | ||
_F |_E |_D |_A , /* [ */ | ||
_G |_F |_C , /* \ */ | ||
_D |_C |_B |_A , /* ] */ | ||
_F |_B |_A , /* ^ */ | ||
_D , /* _ */ | ||
_B , /* ` */ | ||
_G |_E |_D |_C |_B |_A , /* a */ | ||
_G |_F |_E |_D |_C , /* b */ | ||
_G |_E |_D , /* c */ | ||
_G |_E |_D |_C |_B , /* d */ | ||
_G |_F |_E |_D |_B |_A , /* e */ | ||
_G |_F |_E |_A , /* f */ | ||
_G |_F |_D |_C |_B |_A , /* g */ | ||
_G |_F |_E |_C , /* h */ | ||
_E , /* i */ | ||
_D |_C , /* j */ | ||
_G |_F |_E |_C |_A , /* k */ | ||
_F |_E , /* l */ | ||
_E |_C , /* m */ | ||
_G |_E |_C , /* n */ | ||
_G |_E |_D |_C , /* o */ | ||
_G |_F |_E |_B |_A , /* p */ | ||
_G |_F |_C |_B |_A , /* q */ | ||
_G |_E , /* r */ | ||
_G |_F |_D |_C |_A , /* s */ | ||
_G |_F |_E |_D , /* t */ | ||
_E |_D |_C , /* u */ | ||
_E |_D |_C , /* v */ | ||
_E |_C , /* w */ | ||
_G |_F |_E |_C |_B , /* x */ | ||
_G |_F |_D |_C |_B , /* y */ | ||
_G |_E |_D |_B |_A , /* z */ | ||
_G |_C |_B , /* { */ | ||
_F |_E , /* | */ | ||
_G |_F |_E , /* } */ | ||
_A , /* ~ */ | ||
0 , /* (del) */ | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters