Driver to read switches, one at a time or an entire dip-sw

Dependents:   input dip_switch dipsw_change input ... more

Files at this revision

API Documentation at this revision

Comitter:
Hotboards
Date:
Tue Mar 01 03:40:45 2016 +0000
Parent:
0:8e569e04a0fb
Commit message:
read pin method corrected

Changed in this revision

Hotboards_switches.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 8e569e04a0fb -r dfb1302f847d Hotboards_switches.cpp
--- a/Hotboards_switches.cpp	Sun Feb 28 01:32:55 2016 +0000
+++ b/Hotboards_switches.cpp	Tue Mar 01 03:40:45 2016 +0000
@@ -135,12 +135,12 @@
 
 void Hotboards_switches::begin( uint8_t sw, PinName pin )
 {
-    _sw[ sw ] = new DigitalIn( pin );;
+    _sw[ sw ] = new DigitalIn( pin );
 }
 
 bool Hotboards_switches::readSw( uint8_t sw )
 {
-    bool val = _sw[ sw ];
+    bool val = _sw[ sw ]->read();
     if( _close == 0 ) val = !val;
     return val;
 }