System Management code
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
FanPump.h
00001 #ifndef _FILE_FANPUMP_H 00002 #define _FILE_FANPUMP_H 00003 00004 #include "mbed.h" 00005 00006 class FanPump{ 00007 public: 00008 // Takes Pwmout pin, period (seconds), duty cycle slew rate in second^-1 (1 means duty 0 to 1 occurs over 1 second, 0 means no slew) 00009 // Use slew rate to implement soft start 00010 FanPump(PinName pin, float period, float slew); 00011 void write(float duty); 00012 float read(); // Read the last setpoint 00013 float readRaw(); // Read the raw current duty (may be mid-transition) 00014 void directOff(); // Turn off the channel immediately (no slew) 00015 #ifdef MBED_OPERATORS 00016 operator float() { 00017 return read(); 00018 } 00019 FanPump& operator= (float value) { // Overloaded equals to write function 00020 write(value); 00021 return *(this); 00022 } 00023 #endif 00024 int slew(); // Slew rate callback function 00025 private: 00026 PwmOut pwm; // mbed PWM out 00027 volatile uint32_t* MR_base; // pwm channel# match register pointer 00028 volatile uint32_t period_us; // pwm period in us, shared by all channels 00029 volatile uint32_t setPoint_us; // pwm setpoint (goal) in us 00030 volatile uint32_t maxChange_us; // Max pulsewidth change in us allowed for each PWM period to achieve the slew rate 00031 }; 00032 00033 #endif
Generated on Fri Jul 15 2022 06:07:18 by
1.7.2
