]>
git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/common/common.h
1 /* vim:ts=4 sts=4 et tw=80
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 /* macros for extracting low and high byte */
30 #define LO8(x) (uint8_t)(0x00ff & (x))
31 #define HI8(x) (uint8_t)((0xff00 & (x)) >> 8)
33 /* macros for concatenating PORT, PIN and DDR */
34 #define _CONCAT(a, b) a ## b
35 #define _OUTPORT(name) _CONCAT(PORT, name)
36 #define _INPORT(name) _CONCAT(PIN, name)
37 #define _DDRPORT(name) _CONCAT(DDR, name)
38 #define _PCIE(name) _CONCAT(PCIE, name)
39 #define _PCIF(name) _CONCAT(PCIF, name)
40 #define _PCMSK(name) _CONCAT(PCMSK, name)
41 #define _PCINT(name) _CONCAT(PCINT, name)
43 /* __noinline attribute (opposite of inline attribute */
44 #define __noinline __attribute__((noinline))
46 /* structure for accessing bytes and words in an uint32_t */
47 union uint32_t_access
{