]>
git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-bootloader/global.h
170de6a0c8d14f6e42c2d29e9e02025295554ffd
1 /* vim:ts=4 sts=4 et tw=80
3 * fnordlichtmini serial bootloader
5 * for additional information please
6 * see http://lochraster.org/fnordlichtmini
8 * (c) by Alexander Neumann <alexander@bumpern.de>
9 * Lars Noschinski <lars@public.noschinski.de>
11 * This program is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as published by
13 * the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
20 * You should have received a copy of the GNU General Public License along with
21 * this program. If not, see <http://www.gnu.org/licenses/>.
29 /* configure primary pwm pins (MUST be three successive pins in a port) */
31 #define PWM_CHANNELS 3
32 #define PWM_CHANNEL_MASK (_BV(PB0) | _BV(PB1) | _BV(PB2))
35 /* configure INT pin */
36 #define REMOTE_INT_PORT D
37 #define REMOTE_INT_PIN PD2
39 /* abbreviations for port, ddr and pin */
40 #define P_PORT _OUTPORT(PWM_PORT)
41 #define P_DDR _DDRPORT(PWM_PORT)
42 #define R_PORT _OUTPORT(REMOTE_INT_PORT)
43 #define R_DDR _DDRPORT(REMOTE_INT_PORT)
44 #define R_PIN _INPORT(REMOTE_INT_PORT)
45 #define INTPIN REMOTE_INT_PIN
47 /* check if hardware is valid */
48 #if defined(HARDWARE_fnordlicht)
49 /* specific settings for old fnordlicht hardware */
50 #if !defined(PWM_INVERTED)
53 #elif defined(HARDWARE_fnordlichtmini)
54 /* specific settings for fnordlichtmini hardware */
57 #error "unknown HARDWARE platform!"
60 /* turn pwm output pins on and off */
62 #define PWM_PIN_ON(bit) P_PORT &= ~_BV(bit) << (PWM_SHIFT)
63 #define PWM_PIN_OFF(bit) P_PORT |= _BV(bit) << (PWM_SHIFT)
65 #define PWM_PIN_ON(bit) P_PORT |= _BV(bit) << (PWM_SHIFT)
66 #define PWM_PIN_OFF(bit) P_PORT &= ~_BV(bit) << (PWM_SHIFT)
69 #define PWM_PIN_TOGGLE(bit) P_PORT ^= _BV(bit) << (PWM_SHIFT)
75 /* wait 100ms before checking INT pin (for delay_loop_2(50000)) */
76 #define CONFIG_DELAY F_CPU/4/50000/10
77 #define CONFIG_DELAY_LOOP2 50000