vt100: include pgmspace.h as we use PROGMEM macro
[aversive.git] / modules / devices / robot / robot_system / test / pwm_config.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
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.
8  *
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.
13  *
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
17  *
18  *  Revision : $Id: pwm_config.h,v 1.2.6.1 2006-11-26 21:06:05 zer0 Exp $
19  *
20  */
21
22 /* Droids-corp, Eirbot, Microb Technology 2005 - Zer0
23  * Config for PWM
24  */
25 /** \file pwm_config.h
26     \brief Module to operate all PWM outputs
27
28     \test not tested
29  
30 */
31
32
33 #ifndef _PWM_CONFIG_
34 #define _PWM_CONFIG_
35
36 /* Which PWM are enabled ? */
37 //#define PWM0_ENABLED
38 #define PWM1A_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
45
46
47 /** max value for PWM entry, default 12 bits > 4095 */
48 #define PWM_SIGNIFICANT_BITS 12
49
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
53
54 #define TIMER1_MODE     TIMER_16_MODE_PWM_10
55 #define TIMER1_PRESCALE TIMER_16_PRESCALE_8
56
57 #define TIMER2_MODE     TIMER_8_MODE_PWM
58 #define TIMER2_PRESCALE TIMER_8_PRESCALE_64
59
60 #define TIMER3_MODE     TIMER_16_MODE_PWM_10
61 #define TIMER3_PRESCALE TIMER_16_PRESCALE_8
62
63
64
65
66 /** config for pwm and signs
67
68 The pwm mode is defined as follows :
69 you can add flags like the ones who follow : 
70
71 PWM_NORMAL            : normal pwm, just to put a value if nothing else is needed
72 PWM_REVERSE           : invert pwm output, not sign
73
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%
78
79 if you need for example a PWM1A with special sign mode you configure like this : 
80
81 #define PWM1A_MODE       (PWM_SIGNED | PWM_SPECIAL_SIGN_MODE)
82 #define PWM1A_SIGN_PORT  PORTB
83 #define PWM1A_SIGN_BIT   2
84
85 */
86
87
88
89 // example for signed pwm1A
90 #define PWM1A_MODE       (PWM_SIGNED)
91 #define PWM1A_SIGN_PORT  PORTB
92 #define PWM1A_SIGN_BIT   2
93
94
95
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  */
100
101 //#define PWM_SYNCH
102
103 /* choose one of these */
104 //#define PWM_SYNCH_NO_PRESCALE
105 //#define PWM_SYNCH_PRESCALE_8
106 #define PWM_SYNCH_PRESCALE_MORE
107
108 #define TIMER_0_SYNCH
109 #define TIMER_1_SYNCH
110 #define TIMER_2_SYNCH
111 #define TIMER_3_SYNCH
112
113
114
115 #endif
116