2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: pwm_config.h,v 1.2.6.1 2006-11-26 21:06:05 zer0 Exp $
22 /* Droids-corp, Eirbot, Microb Technology 2005 - Zer0
25 /** \file pwm_config.h
26 \brief Module to operate all PWM outputs
36 /* Which PWM are enabled ? */
37 //#define PWM0_ENABLED
39 //#define PWM1B_ENABLED
40 //#define PWM1C_ENABLED
41 //#define PWM2_ENABLED
42 //#define PWM3A_ENABLED
43 //#define PWM3B_ENABLED
44 //#define PWM3C_ENABLED
47 /** max value for PWM entry, default 12 bits > 4095 */
48 #define PWM_SIGNIFICANT_BITS 12
50 // timer configs (not all possibilities can be used at this time)
51 #define TIMER0_MODE TIMER_8_MODE_PWM
52 #define TIMER0_PRESCALE TIMER_8_PRESCALE_64
54 #define TIMER1_MODE TIMER_16_MODE_PWM_10
55 #define TIMER1_PRESCALE TIMER_16_PRESCALE_8
57 #define TIMER2_MODE TIMER_8_MODE_PWM
58 #define TIMER2_PRESCALE TIMER_8_PRESCALE_64
60 #define TIMER3_MODE TIMER_16_MODE_PWM_10
61 #define TIMER3_PRESCALE TIMER_16_PRESCALE_8
66 /** config for pwm and signs
68 The pwm mode is defined as follows :
69 you can add flags like the ones who follow :
71 PWM_NORMAL : normal pwm, just to put a value if nothing else is needed
72 PWM_REVERSE : invert pwm output, not sign
74 PWM_SIGNED : activate the sign output on a port (see config)
75 PWM_SIGN_INVERTED : invert sign output
76 PWM_SPECIAL_SIGN_MODE : if defined, the pwm is always near 0 for low values,
77 else negative low values are near 100%
79 if you need for example a PWM1A with special sign mode you configure like this :
81 #define PWM1A_MODE (PWM_SIGNED | PWM_SPECIAL_SIGN_MODE)
82 #define PWM1A_SIGN_PORT PORTB
83 #define PWM1A_SIGN_BIT 2
89 // example for signed pwm1A
90 #define PWM1A_MODE (PWM_SIGNED)
91 #define PWM1A_SIGN_PORT PORTB
92 #define PWM1A_SIGN_BIT 2
96 /** this tries to make the PWMs to synchronize.
97 experimental feature, could lead to problems.
98 to synch PWMs you need to enshure that the timers have same prescales,
99 and the same PWM mode */
103 /* choose one of these */
104 //#define PWM_SYNCH_NO_PRESCALE
105 //#define PWM_SYNCH_PRESCALE_8
106 #define PWM_SYNCH_PRESCALE_MORE
108 #define TIMER_0_SYNCH
109 #define TIMER_1_SYNCH
110 #define TIMER_2_SYNCH
111 #define TIMER_3_SYNCH