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.
Dependencies: CANBuffer mbed SystemManagement mbed-rtos
DC_DC.cpp
00001 #include "mbed.h" 00002 #include "DC_DC.h" 00003 00004 DigitalOut dc_pin(p20); 00005 FanPump *fanPump; 00006 CANBuffer *tx_DC_Buffer; 00007 bool status; 00008 00009 DC::DC(FanPump *fp, CANBuffer *can){ 00010 status = false; 00011 dc_pin = !status; 00012 tx_DC_Buffer = can; 00013 fanPump = fp; 00014 } 00015 00016 bool DC::is_on(){ 00017 return status; 00018 } 00019 00020 void DC::set(bool s){ 00021 status = s; 00022 if(!status){ 00023 fanPump->shutdown_all(); 00024 } 00025 00026 dc_pin = !status; 00027 } 00028 00029 void update(const void *arg){ 00030 char data[4] = {0}; 00031 while(1){ 00032 data[0] = status; 00033 CANMessage txMessage(TX_DC_DC_ID, data, 4); 00034 CANMessage msg(1); 00035 tx_DC_Buffer->txWrite(msg); 00036 00037 Thread::wait(100); //10 Hz update 00038 } 00039 } 00040 00041 void DC::start_update(){ 00042 Thread update_thread(update); 00043 }
Generated on Sat Aug 13 2022 03:42:38 by
1.7.2