このライブラリはSW認識を行います。 SWは1個から20個まで認識できます。 SWの認識周期は10msです。 SWはmbedの端子とGNDの間に接続します。 This library does the recognition SW. SW, one can recognize up to 20. Recognition of the SW period is 10ms. SW is connected to GND terminal of mbed. ON the SW, OFF (level) data output. Output data from OFF to ON edge of the SW. Output data from ON to OFF edge of the SW. SWのON,OFF(レベル)データを出力します。 SWのOFFからONのエッジデータを出力します。 SWのONからOFFのエッジデータを出力します。
Dependents: kitchenTimer_Clock SwDigitalLibraryExampleProgram
SwDigital Class Reference
SWDIGITAL control class, based on a "mbed function". More...
#include <SwDigital.h>
Public Member Functions | |
SwDigital (PinName sw0=NC, PinName sw1=NC, PinName sw2=NC, PinName sw3=NC, PinName sw4=NC, PinName sw5=NC, PinName sw6=NC, PinName sw7=NC, PinName sw8=NC, PinName sw9=NC, PinName sw10=NC, PinName sw11=NC, PinName sw12=NC, PinName sw13=NC, PinName sw14=NC, PinName sw15=NC, PinName sw16=NC, PinName sw17=NC, PinName sw18=NC, PinName sw19=NC) | |
Create a sound object connected to the specified PwmOut pin & DigitalOut pin. | |
void | refreshEdgeData (void) |
refresh edge data | |
uint8_t | checkEdgeOn (uint8_t swNo) |
Check Off to On edge. | |
uint8_t | checkEdgeOff (uint8_t swNo) |
Check On to Off edge. | |
uint8_t | checkLevel (uint8_t swNo) |
Check On to Off edge. |
Detailed Description
SWDIGITAL control class, based on a "mbed function".
Example:
//============================================ // SwDigital Library example program // // <schematic> // // mbed // sw1 // ---- // p20 --------o o----------- GND // // sw2 // ---- // p21 --------o o------------GND // //============================================= #include "mbed.h" #include "SwDigital.h" SwDigital sw(p20,p21); // p20 : sw1 control LED1,LED2 // p21 : sw2 control LED3,LED4 DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); int main() { while(1) { // sw level and edge data refresh sw.refreshEdgeData(); //@001 // tact action (sw level = on : led1 = on) led1 = sw.checkLevel(0); // tact action (sw level = off : led2 = on) led2 = !sw.checkLevel(0); // toggle action (level Off to On) if(sw.checkEdgeOn(1) == 1){ led3 = !led3; } // toggle action (level On to Off) if(sw.checkEdgeOff(1) == 1){ led4 = !led4; } } }
Definition at line 94 of file SwDigital.h.
Constructor & Destructor Documentation
SwDigital | ( | PinName | sw0 = NC , |
PinName | sw1 = NC , |
||
PinName | sw2 = NC , |
||
PinName | sw3 = NC , |
||
PinName | sw4 = NC , |
||
PinName | sw5 = NC , |
||
PinName | sw6 = NC , |
||
PinName | sw7 = NC , |
||
PinName | sw8 = NC , |
||
PinName | sw9 = NC , |
||
PinName | sw10 = NC , |
||
PinName | sw11 = NC , |
||
PinName | sw12 = NC , |
||
PinName | sw13 = NC , |
||
PinName | sw14 = NC , |
||
PinName | sw15 = NC , |
||
PinName | sw16 = NC , |
||
PinName | sw17 = NC , |
||
PinName | sw18 = NC , |
||
PinName | sw19 = NC |
||
) |
Create a sound object connected to the specified PwmOut pin & DigitalOut pin.
- Parameters:
-
pin sw0 to sw19 : sw input pin
sw can be set from 1 to 20. Recognition of the SW period is 10ms
Definition at line 15 of file SwDigital.cpp.
Member Function Documentation
uint8_t checkEdgeOff | ( | uint8_t | swNo ) |
Check On to Off edge.
- Parameters:
-
uint8_t swNo : check swNo 0 to 19 return uint8_t Off edge check 0 : Nasi 1 : Ari
Definition at line 182 of file SwDigital.cpp.
uint8_t checkEdgeOn | ( | uint8_t | swNo ) |
Check Off to On edge.
- Parameters:
-
uint8_t swNo : check swNo 0 to 19 return uint8_t On edge check 0: edge Nasi 1: edge Ari
Definition at line 172 of file SwDigital.cpp.
uint8_t checkLevel | ( | uint8_t | swNo ) |
Check On to Off edge.
- Parameters:
-
uint8_t swNo : check swNo 0 to 19 return uint8_t sw level check 0 : Off 1 : On
Definition at line 192 of file SwDigital.cpp.
void refreshEdgeData | ( | void | ) |
refresh edge data
- Parameters:
-
none return none
main de edge data wo tukau maeni jiko suru
Definition at line 160 of file SwDigital.cpp.
Generated on Fri Jul 15 2022 22:51:18 by 1.7.2