simple project to control mirrorless camera
Dependencies: mbed BLE_API nRF51822
PowerSwitch.cpp
00001 #include "PowerSwitch.h" 00002 #include "mbed.h" 00003 00004 PowerSwitch::PowerSwitch(PinName pin) : _pin(pin) { 00005 powerState = false; 00006 } 00007 00008 void PowerSwitch::doSwitch(bool state, float duration){ 00009 if (state) { 00010 _pin = 1.0; 00011 } else{ 00012 _pin = 0.0; 00013 } 00014 00015 powerState = state; 00016 switchPeriod.attach(this, &PowerSwitch::doSwitchEnd, duration); 00017 00018 } 00019 00020 bool PowerSwitch::powerStateOn(void){ 00021 return powerState; 00022 } 00023 00024 void PowerSwitch::doSwitchEnd(void){ 00025 switchPeriod.detach(); 00026 _pin = 0.0; 00027 }
Generated on Wed Jul 13 2022 03:55:21 by
1.7.2