openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
lpc17_pincfg.h
Go to the documentation of this file.
1/*
2 * openMMC --
3 *
4 * Copyright (C) 2015 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
27#ifndef LPC17_PINCFG_H_
28#define LPC17_PINCFG_H_
29
30#include "port.h"
31
40/* 32 bit value in the format -> [port][pin][func][dir] each field [] is one byte */
41#define PIN_DEF( port, pin, func, dir ) ( (port << 24) | (pin << 16) | (func << 8) | dir )
42
43#define PIN_PORT( pin_def ) ((pin_def & 0xFF000000) >> 24)
44#define PIN_NUMBER( pin_def ) ((pin_def & 0x00FF0000) >> 16)
45#define PIN_FUNC( pin_def ) ((pin_def & 0x0000FF00) >> 8)
46#define PIN_DIR( pin_def ) ((pin_def & 0x000000FF) >> 0)
47
48/* For other mcus like Atmel's it should be PORTA, PORTB, etc */
49#define PORT0 0
50#define PORT1 1
51#define PORT2 2
52#define PORT3 3
53#define PORT4 4
54
55#define NON_GPIO 0xFF
56
57#endif
Port layer (includes all portable functions headers)