From b0cd207694674c5509932e3fd1d286f5d4d98780 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Thu, 10 Oct 2013 23:41:05 +0000 Subject: OpenPCR-controller git-svn-id: https://svn.spreadspace.org/avr/trunk@238 aa12f405-d877-488e-9caf-2d797e2a1cc7 --- pcr-controller/pwm.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pcr-controller/pwm.c (limited to 'pcr-controller/pwm.c') diff --git a/pcr-controller/pwm.c b/pcr-controller/pwm.c new file mode 100644 index 0000000..918d37b --- /dev/null +++ b/pcr-controller/pwm.c @@ -0,0 +1,48 @@ + +#include "pwm.h" + + +#define PWM_VAL OCR1AL +//OC1A + +void pwm_init(void) +{ + DDRB |= (1< 0) + pwm_on(); + else + pwm_off(); + PWM_VAL = val; +} + +inline void pwm_inc(void) +{ + if(PWM_VAL < 255) + PWM_VAL++; +} + +inline void pwm_dec(void) +{ + if(PWM_VAL > 0) + PWM_VAL--; +} -- cgit v1.2.3