X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fcpu%2Favr%2Fdrv%2Fpwm_avr.c;h=16e420bd31e35a08db3c45e2b00ff8fbae620f6e;hb=4ceddcf7d53f4ddf8c4bfa78a6183ed256a1d0a5;hp=d10988adee010a388c2fccf7e6bbe6b28abb957b;hpb=6863656e1f7c8032b1405e38a4fbdb7827fec408;p=bertos.git diff --git a/bertos/cpu/avr/drv/pwm_avr.c b/bertos/cpu/avr/drv/pwm_avr.c index d10988ad..16e420bd 100644 --- a/bertos/cpu/avr/drv/pwm_avr.c +++ b/bertos/cpu/avr/drv/pwm_avr.c @@ -38,11 +38,123 @@ * */ -#include - -#if CPU_AVR - #warning TODO:No AVR implementation of PWM. -/*#elif Add other AVR families here */ -#else - #error Unknown CPU -#endif + +#include "pwm_avr.h" +#include "hw/hw_cpu.h" + +#warning TODO:This is an exmple of implementation of PWM low level channel for AVR, implemnt it! + +/** + * Set PWM polarity to select pwm channel + */ +void pwm_hw_setPolarity(PwmDev dev, bool pol) +{ + + /* + * Put here a code to PWM polarity of select + * PWM channel + */ + + //Only for test remove when implement this function + (void)dev; + (void)pol; +} + +/** + * Get preiod from select channel + * + * \a dev channel + */ +pwm_period_t pwm_hw_getPeriod(PwmDev dev) +{ + /* + * Put here a code to get period value of select + * PWM channel + */ + + //Only for test remove when implement this function + (void)dev; + + return 0; +} + +/** + * Set pwm waveform frequecy. + * + * \a freq in Hz + */ +void pwm_hw_setFrequency(PwmDev dev, uint32_t freq) +{ + /* + * Put here a code to set frequency of select + * PWM channel + */ + + //Only for test remove when implement this function + (void)dev; + (void)freq; + +} + +/** + * Set pwm duty cycle. + * + * \a duty value 0 - 2^16 + */ +void pwm_hw_setDutyUnlock(PwmDev dev, uint16_t duty) +{ + /* + * Put here a code to set duty of select + * PWM channel + */ + + //Only for test remove when implement this function + (void)dev; + (void)duty; + +} + + +/** + * Enable select pwm channel + */ +void pwm_hw_enable(PwmDev dev) +{ + /* + * Put here a code to enable + * a select PWM channel + */ + + //Only for test remove when implement this function + (void)dev; +} + +/** + * Disable select pwm channel + */ +void pwm_hw_disable(PwmDev dev) +{ + /* + * Put here a code to disable + * a select PWM channel + */ + + //Only for test remove when implement this function + (void)dev; +} + + +/** + * Init pwm. + */ +void pwm_hw_init(void) +{ + /* + * Put here a code to init + * a PWM hawdware + */ +} + + + +