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.
Revision 3:585d3996f715, committed 2019-05-16
- Comitter:
- goymame
- Date:
- Thu May 16 22:27:24 2019 +0000
- Parent:
- 2:42f8f6b183ae
- Commit message:
- Update example to lates version of the library
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-os-wiegand.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed May 08 18:13:50 2019 +0000
+++ b/main.cpp Thu May 16 22:27:24 2019 +0000
@@ -33,6 +33,7 @@
Wiegand* w2;
Wiegand* w3;
Wiegand* w4;
+ unsigned short int _bits;
void _onTag(Wiegand* wiegandReader){
long double rawInt = wiegandReader->getRawInt();
unsigned char id = wiegandReader->getId();
@@ -57,15 +58,24 @@
}
public:
wiegandUserApp(EventQueue* eventQueue,PinName p1d0, PinName p1d1,PinName p2d0, PinName p2d1, PinName p3d0, PinName p3d1, PinName p4d0, PinName p4d1){
- w1 = new Wiegand (p1d0, p1d1, eventQueue, 32,1);
- w2 = new Wiegand (p2d0, p2d1, eventQueue, 32,2);
- w3 = new Wiegand (p3d0, p3d1, eventQueue, 32,3);
- w4 = new Wiegand (p4d0, p4d1, eventQueue, 32,4);
+ w1 = new Wiegand (p1d0, p1d1, eventQueue,1);
+ w2 = new Wiegand (p2d0, p2d1, eventQueue,2);
+ w3 = new Wiegand (p3d0, p3d1, eventQueue,3);
+ w4 = new Wiegand (p4d0, p4d1, eventQueue,4);
+ };
+ void init(){
+ w1->setBits(_bits);
+ w2->setBits(_bits);
+ w3->setBits(_bits);
+ w4->setBits(_bits);
w1->attach(callback(this,&wiegandUserApp::_onTag));
w2->attach(callback(this,&wiegandUserApp::_onTag));
w3->attach(callback(this,&wiegandUserApp::_onTag));
w4->attach(callback(this,&wiegandUserApp::_onTag));
- };
+ }
+ void setBits(unsigned short int bits){
+ _bits= bits;
+ }
};
PinName P1D0 = PE_0;
@@ -81,4 +91,6 @@
serial.printf("\r\n******************* Wiegand reader example *******************\r\n\n");
wiegandThread.start(callback(queue,&EventQueue::dispatch_forever));
wiegandUserApp wiegandApp(queue,P1D0,P1D1,P2D0,P2D1,P3D0,P3D1,P4D0,P4D1);
+ wiegandApp.setBits(32);
+ wiegandApp.init();
}
\ No newline at end of file
--- a/mbed-os-wiegand.lib Wed May 08 18:13:50 2019 +0000 +++ b/mbed-os-wiegand.lib Thu May 16 22:27:24 2019 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/goymame/code/mbed-os-wiegand/#2c72a6b13593 +https://os.mbed.com/users/goymame/code/mbed-os-wiegand/#ea5e0ab156b5