Penn Electric Racing / Mbed 2 deprecated SystemManagement

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Committer:
martydd3
Date:
Fri Nov 07 21:09:50 2014 +0000
Revision:
22:fc802e7715f8
Parent:
FanPump/FanPump.h@18:915a235bc099
CANController to link DC_DC and FanPump, as well as listen to CAN Messages (since only these 2 functions act based on incoming messages)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
martydd3 6:6a04210a3f4f 1 #ifndef _FILE_FANPUMP_H
martydd3 6:6a04210a3f4f 2 #define _FILE_FANPUMP_H
martydd3 6:6a04210a3f4f 3
martydd3 6:6a04210a3f4f 4 #include "mbed.h"
martydd3 6:6a04210a3f4f 5
martydd3 6:6a04210a3f4f 6 class FanPump{
martydd3 6:6a04210a3f4f 7 public:
pspatel321 13:fbd9b3f5a07c 8 // 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)
pspatel321 13:fbd9b3f5a07c 9 // Use slew rate to implement soft start
pspatel321 13:fbd9b3f5a07c 10 FanPump(PinName pin, float period, float slew);
pspatel321 13:fbd9b3f5a07c 11 void write(float duty);
pspatel321 13:fbd9b3f5a07c 12 float read(); // Read the last setpoint
pspatel321 13:fbd9b3f5a07c 13 float readRaw(); // Read the raw current duty (may be mid-transition)
pspatel321 17:c9ce210f6654 14 void directOff(); // Turn off the channel immediately (no slew)
pspatel321 17:c9ce210f6654 15 int slew(); // Slew rate callback function
martydd3 6:6a04210a3f4f 16 private:
pspatel321 13:fbd9b3f5a07c 17 PwmOut pwm; // mbed PWM out
pspatel321 17:c9ce210f6654 18 volatile int chan; // pwm channel#
pspatel321 17:c9ce210f6654 19 static uint32_t period_us; // Period in microseconds (shared by all channels)
pspatel321 17:c9ce210f6654 20 volatile uint32_t setPoint_us;
pspatel321 17:c9ce210f6654 21 volatile uint32_t maxChange_us; // Max pulsewidth change allowed to achieve the slew rate
martydd3 6:6a04210a3f4f 22 };
martydd3 18:915a235bc099 23
martydd3 6:6a04210a3f4f 24 #endif