Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BarcodeLED.h@0:3b5e1025cbd6, 2010-09-13 (annotated)
- Committer:
- iZsh
- Date:
- Mon Sep 13 22:19:39 2010 +0000
- Revision:
- 0:3b5e1025cbd6
Not tested IRL yet
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| iZsh | 0:3b5e1025cbd6 | 1 | /* Copyright (c) 2010 iZsh - izsh at fail0verflow.com |
| iZsh | 0:3b5e1025cbd6 | 2 | * |
| iZsh | 0:3b5e1025cbd6 | 3 | * This program is free software: you can redistribute it and/or modify |
| iZsh | 0:3b5e1025cbd6 | 4 | * it under the terms of the GNU General Public License as published by |
| iZsh | 0:3b5e1025cbd6 | 5 | * the Free Software Foundation, either version 3 of the License, or |
| iZsh | 0:3b5e1025cbd6 | 6 | * (at your option) any later version. |
| iZsh | 0:3b5e1025cbd6 | 7 | * |
| iZsh | 0:3b5e1025cbd6 | 8 | * This program is distributed in the hope that it will be useful, |
| iZsh | 0:3b5e1025cbd6 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| iZsh | 0:3b5e1025cbd6 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| iZsh | 0:3b5e1025cbd6 | 11 | * GNU General Public License for more details. |
| iZsh | 0:3b5e1025cbd6 | 12 | * |
| iZsh | 0:3b5e1025cbd6 | 13 | * You should have received a copy of the GNU General Public License |
| iZsh | 0:3b5e1025cbd6 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| iZsh | 0:3b5e1025cbd6 | 15 | */ |
| iZsh | 0:3b5e1025cbd6 | 16 | #ifndef IZSH_MBED_BARCODELED_H |
| iZsh | 0:3b5e1025cbd6 | 17 | #define IZSH_MBED_BARCODELED_H |
| iZsh | 0:3b5e1025cbd6 | 18 | |
| iZsh | 0:3b5e1025cbd6 | 19 | #include "mbed.h" |
| iZsh | 0:3b5e1025cbd6 | 20 | |
| iZsh | 0:3b5e1025cbd6 | 21 | class BarcodeLED |
| iZsh | 0:3b5e1025cbd6 | 22 | { |
| iZsh | 0:3b5e1025cbd6 | 23 | public: |
| iZsh | 0:3b5e1025cbd6 | 24 | enum CodeType |
| iZsh | 0:3b5e1025cbd6 | 25 | { |
| iZsh | 0:3b5e1025cbd6 | 26 | Code39, |
| iZsh | 0:3b5e1025cbd6 | 27 | Code128a = 103, |
| iZsh | 0:3b5e1025cbd6 | 28 | Code128b = 104, |
| iZsh | 0:3b5e1025cbd6 | 29 | Code128c = 105, |
| iZsh | 0:3b5e1025cbd6 | 30 | }; |
| iZsh | 0:3b5e1025cbd6 | 31 | |
| iZsh | 0:3b5e1025cbd6 | 32 | BarcodeLED(const PinName Led, const CodeType Codetype = Code39, const int BaseDelay = 20); |
| iZsh | 0:3b5e1025cbd6 | 33 | |
| iZsh | 0:3b5e1025cbd6 | 34 | CodeType GetCodetype(); |
| iZsh | 0:3b5e1025cbd6 | 35 | void SetCodetype(const CodeType Codetype); |
| iZsh | 0:3b5e1025cbd6 | 36 | |
| iZsh | 0:3b5e1025cbd6 | 37 | int GetBaseDelay(); |
| iZsh | 0:3b5e1025cbd6 | 38 | void SetBaseDelay(const int BaseDelay); |
| iZsh | 0:3b5e1025cbd6 | 39 | |
| iZsh | 0:3b5e1025cbd6 | 40 | int GetVerbose(); |
| iZsh | 0:3b5e1025cbd6 | 41 | void SetVerbose(const bool Verbose); |
| iZsh | 0:3b5e1025cbd6 | 42 | |
| iZsh | 0:3b5e1025cbd6 | 43 | void Emit(const char Str[]); |
| iZsh | 0:3b5e1025cbd6 | 44 | |
| iZsh | 0:3b5e1025cbd6 | 45 | private: |
| iZsh | 0:3b5e1025cbd6 | 46 | |
| iZsh | 0:3b5e1025cbd6 | 47 | void EmitCode39(const char Str[]); |
| iZsh | 0:3b5e1025cbd6 | 48 | void EmitCode128(const char Str[]); |
| iZsh | 0:3b5e1025cbd6 | 49 | |
| iZsh | 0:3b5e1025cbd6 | 50 | int ASCII2Code39(const char C); |
| iZsh | 0:3b5e1025cbd6 | 51 | int ASCII2Code128(const char C); |
| iZsh | 0:3b5e1025cbd6 | 52 | |
| iZsh | 0:3b5e1025cbd6 | 53 | char * RevStr(char Str[]); |
| iZsh | 0:3b5e1025cbd6 | 54 | void FlashSeq(const char Seq[]); |
| iZsh | 0:3b5e1025cbd6 | 55 | |
| iZsh | 0:3b5e1025cbd6 | 56 | int Code128Checksum(const char Str[]); |
| iZsh | 0:3b5e1025cbd6 | 57 | |
| iZsh | 0:3b5e1025cbd6 | 58 | DigitalOut m_Led; |
| iZsh | 0:3b5e1025cbd6 | 59 | CodeType m_Codetype; |
| iZsh | 0:3b5e1025cbd6 | 60 | int m_BaseDelay; |
| iZsh | 0:3b5e1025cbd6 | 61 | bool m_Verbose; |
| iZsh | 0:3b5e1025cbd6 | 62 | |
| iZsh | 0:3b5e1025cbd6 | 63 | static const char * m_Barcode39[]; |
| iZsh | 0:3b5e1025cbd6 | 64 | static const char * m_Barcode128[]; |
| iZsh | 0:3b5e1025cbd6 | 65 | }; |
| iZsh | 0:3b5e1025cbd6 | 66 | |
| iZsh | 0:3b5e1025cbd6 | 67 | |
| iZsh | 0:3b5e1025cbd6 | 68 | #endif |