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.
Diff: Module/ChargingControl.h
- Revision:
- 3:a4677501ae87
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Module/ChargingControl.h Tue Nov 30 08:13:05 2021 +0000 @@ -0,0 +1,39 @@ +#ifndef ZETA_STM_KINETIC_CHARGINGCONTROL_H_ +#define ZETA_STM_KINETIC_CHARGINGCONTROL_H_ +#include "mbed.h" +#define SSR_OFF 1 +#define SSR_ON 0 + +#include <ros.h> +extern ros::NodeHandle nh; + +class ChargingControl { + public: + ChargingControl(PinName pinP, PinName pinN) : _pinP(pinP,SSR_OFF), _pinN(pinN,SSR_OFF) {} + void on() + { + if(_pinN == SSR_OFF) + { + //nh.loginfo("ssr on"); + _pinN = SSR_ON; + //ThisThread::sleep_for(100); + _pinP = SSR_ON; + } + } + void off() + { + if(_pinP == SSR_ON) + { + //nh.loginfo("ssr off"); + _pinP = SSR_OFF; + //ThisThread::sleep_for(100); + _pinN = SSR_OFF; + } + } + private: + void init(); + DigitalOut _pinP; + DigitalOut _pinN; +}; + +#endif /* ZETA_STM_KINETIC_CHARGINGCONTROL_H_ */ \ No newline at end of file