suu pen さんのライブラリをフォークしました。 このライブラリは1桁から8桁までのSeven segment Numeric LEDを制御します。 LEDはanode commonとcathode common を使用することができます。 LEDの表示は1秒で表示をスムースに切り替えるモードと、直ぐに切り替えるモードの2つのモードを選択することができます。 This library to control the Seven segment Numeric LED 8 digit of 1. You can use the LED cathode common and anode common. Switch mode LED display and a second displayed a smooth, you can choose two modes to switch modes quickly.
Dependents: HumidifierController_LPC824
Fork of SevenSegLed by
Diff: SevenSegLed.cpp
- Revision:
- 4:33e035f6a337
- Parent:
- 1:3429249e30f9
- Child:
- 5:a7ba72bf10ba
--- a/SevenSegLed.cpp Fri Dec 02 14:03:00 2011 +0000 +++ b/SevenSegLed.cpp Mon Nov 25 05:48:43 2013 +0000 @@ -15,13 +15,19 @@ /** Create a seven segment led object connected to the specified DigtalOutput pin */ +#ifdef USECOM4 +SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, + PinName com_1, PinName com_2, PinName com_3, PinName com_4): + _seg_a(seg_a), _seg_b(seg_b), _seg_c(seg_c), _seg_d(seg_d), _seg_e(seg_e), _seg_f(seg_f), _seg_g(seg_g), _seg_p(seg_p), + _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4){ +#else // ~USECOM4 SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, PinName com_1, PinName com_2, PinName com_3, PinName com_4, PinName com_5, PinName com_6, PinName com_7, PinName com_8): _seg_a(seg_a), _seg_b(seg_b), _seg_c(seg_c), _seg_d(seg_d), _seg_e(seg_e), _seg_f(seg_f), _seg_g(seg_g), _seg_p(seg_p), _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4), _com_5(com_5), _com_6(com_6), _com_7(com_7), _com_8(com_8){ - +#endif // USECOM4 - timer.attach_us(this, &SevenSegLed::segmentGrayDataKosin, 10000); // led smooth control 10ms timer inttruupt +// timer.attach_us(this, &SevenSegLed::segmentGrayDataKosin, 10000); // led smooth control 10ms timer inttruupt // data table set of Brightness // DT_pwmGray[] = i ^ 2 @@ -31,10 +37,12 @@ // check connect com_x D_comNull = Z_ketaSuu; +#ifndef USECOM4 if(com_8 == NC){D_comNull--;} if(com_7 == NC){D_comNull--;} if(com_6 == NC){D_comNull--;} if(com_5 == NC){D_comNull--;} +#endif //USECOM4 if(com_4 == NC){D_comNull--;} if(com_3 == NC){D_comNull--;} if(com_2 == NC){D_comNull--;} @@ -158,6 +166,7 @@ // dynamic shuturyoku shori + segmentGrayDataKosin(); output(); } @@ -170,6 +179,7 @@ void SevenSegLed::comAllClear(void){ switch (D_comNull){ +#ifndef USECOM4 case 8: // com_1 - com_8is all connect _com_8 = D_commonOff; //break; @@ -182,6 +192,7 @@ case 5: // com_6 Null _com_5 = D_commonOff; //break; +#endif // USECOM4 case 4: // com_5 Null _com_4 = D_commonOff; //break; @@ -249,12 +260,10 @@ if(M_seg >= D_comNull){M_seg = 0;} - // com, seg syokika + //com, seg syokika comAllClear(); segAllClear(); - - - + // common output if(D_comNull != 0){ // If the terminal output processing @@ -271,6 +280,7 @@ case 3: _com_4 = D_commonOn; break; +#ifndef USECOM4 case 4: _com_5 = D_commonOn; break; @@ -283,6 +293,7 @@ case 7: _com_8 = D_commonOn; break; +#endif // USECOM4 default: break; } @@ -294,8 +305,9 @@ } - // com, seg syokika - comAllClear(); - segAllClear(); +// com, seg syokika +// comAllClear(); +// segAllClear(); M_seg++; + }