Penn Electric Racing / Mbed 2 deprecated SystemManagement

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

CANController/FanPump/FanPump.h

Committer:
martydd3
Date:
2014-11-07
Revision:
22:fc802e7715f8
Parent:
FanPump/FanPump.h@ 18:915a235bc099

File content as of revision 22:fc802e7715f8:

#ifndef _FILE_FANPUMP_H
#define _FILE_FANPUMP_H

#include "mbed.h"

class FanPump{
public:
    // 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)
    // Use slew rate to implement soft start
    FanPump(PinName pin, float period, float slew);
    void write(float duty);
    float read();       // Read the last setpoint
    float readRaw();    // Read the raw current duty (may be mid-transition)
    void directOff();   // Turn off the channel immediately (no slew)
    int slew();         // Slew rate callback function
private:
    PwmOut pwm;         // mbed PWM out
    volatile int chan;                  // pwm channel#
    static uint32_t period_us;          // Period in microseconds (shared by all channels)
    volatile uint32_t setPoint_us;
    volatile uint32_t maxChange_us;     // Max pulsewidth change allowed to achieve the slew rate
};

#endif