lib_PwmOutAllPin permet de créer des PwmOut sur toutes les DigitalOut du Mbed. YSI
lib_PwmOutAllPin.h
- Committer:
- YSI
- Date:
- 2015-10-23
- Revision:
- 3:1d1669e8c9b1
- Parent:
- 2:4673fac2ae7f
- Child:
- 4:22942b7e1635
File content as of revision 3:1d1669e8c9b1:
/** Lib PwmOutAllPin * * Copyright (c) 2014, cstyles (http://mbed.org) * * Exemple: * @code * #include "mbed.h" * #include "lib_PwmOutAllPin.h" * * PwmOutAllPin pin1(p20); * PwmOutAllPin pin2(p12); * * int main() * { * pin2.period(0.0002); * pin2 = 0.25; * pin1 = 0.5; * pin1.period_us(20); * * while(1) * { * wait(0.25); * } * } * @endcode * @file lib_PwmOutAllPin.h * @purpose library for PwmOut on all pins * @date 2015 * @author Yannic Simon */ #ifndef DEF_lib_PwmOutAllPin_H #define DEF_lib_PwmOutAllPin_H #include "mbed.h" class PwmOutAllPin : public Timeout { public: PwmOutAllPin(PinName pin); void write(float value); float read(void); void period(float seconds); void period_ms(int ms); void period_us(int us); void pulsewidth(float seconds); void pulsewidth_ms(int ms); void pulsewidth_us(int us); PwmOutAllPin& operator= (float value); PwmOutAllPin& operator= (PwmOutAllPin& rhs); operator float(); protected: DigitalOut PwmOutPin; Timeout SwitchPin; Ticker TickerPeriod; float Pwm_Duty_Cycle; int Pwm_period_us; int TimeDown; void DigitalUp(void); void DigitalDown(void); void UsePwm(void); }; #endif