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.
LD8035.cpp
00001 #include "LD8035.h" 00002 #include "mbed.h" 00003 00004 LD8035::LD8035(PinName G1, PinName G2, PinName G3, PinName G4, PinName G5, PinName G6, 00005 PinName a_pin, PinName b_pin, PinName c_pin, PinName d_pin, PinName e_pin, 00006 PinName f_pin, PinName g_pin, PinName dot_pin, PinName hyphen_pin) 00007 : _GPin(G1,G2,G3,G4,G5,G6), _NumPin(a_pin,b_pin,c_pin,d_pin,e_pin,f_pin,g_pin), _DotPin(dot_pin), _HyphenPin(hyphen_pin) 00008 { 00009 clear(); 00010 } 00011 00012 void LD8035::set_bars(int numbers[], bool dot_flags[], bool hyphen_flags[]) 00013 { 00014 for(int i = 0 ; i < G_SIZE ; i++) { 00015 _numbers[i] = numbers[i]; 00016 _dot_flags[i] = dot_flags[i]; 00017 _hyphen_flags[i] = hyphen_flags[i]; 00018 } 00019 } 00020 00021 void LD8035::clear() 00022 { 00023 _NumPin = 0x00; 00024 } 00025 00026 void LD8035::flush() 00027 { 00028 for(int j = 0 ; j < 10 ; j++) { 00029 for(int i = 0 ; i < G_SIZE ; i++) { 00030 clear(); 00031 _GPin = 1 << i; 00032 switch(_numbers[i]) { 00033 case 0: 00034 _NumPin = 0x3f; 00035 break; 00036 case 1: 00037 _NumPin = 0x06; 00038 break; 00039 case 2: 00040 _NumPin = 0x5b; 00041 break; 00042 case 3: 00043 _NumPin = 0x4f; 00044 break; 00045 case 4: 00046 _NumPin = 0x66; 00047 break; 00048 case 5: 00049 _NumPin = 0x6d; 00050 break; 00051 case 6: 00052 _NumPin = 0x7d; 00053 break; 00054 case 7: 00055 _NumPin = 0x27; 00056 break; 00057 case 8: 00058 _NumPin = 0x7f; 00059 break; 00060 case 9: 00061 _NumPin = 0x6f; 00062 break; 00063 default: 00064 _NumPin = 0x79; 00065 break; 00066 } 00067 if(_dot_flags[i] == true) { 00068 _DotPin = 1; 00069 } else { 00070 _DotPin = 0; 00071 } 00072 if(_hyphen_flags[i] == true) { 00073 _HyphenPin = 1; 00074 } else { 00075 _HyphenPin = 0; 00076 } 00077 wait_ms(WAIT_TIME); 00078 } 00079 } 00080 } 00081
Generated on Thu Jul 21 2022 09:16:44 by
1.7.2