Loading...
Searching...
No Matches
periph_cpu.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef PERIPH_CPU_H
21#define PERIPH_CPU_H
22
23#include <stdint.h>
24
25#include "cpu.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#ifndef DOXYGEN
36#define HAVE_GPIO_T
37typedef uint8_t gpio_t;
43#define GPIO_PIN(port, pin) (gpio_t)((port << 5) | pin)
44
49#define PIN_DIR_IN (0x00 << 0)
50#define PIN_DIR_OUT (0x01 << 0)
51#define PIN_MODE_PU (0x00 << 1)
52#define PIN_MODE_PD (0x02 << 1)
53#define PIN_MODE_NONE (0x03 << 1)
54#define PIN_MODE_OD (0x01 << 3)
55
56#define HAVE_GPIO_MODE_T
57typedef enum {
58 GPIO_IN = (PIN_DIR_IN | PIN_MODE_NONE),
59 GPIO_IN_PD = (PIN_DIR_IN | PIN_MODE_PD),
60 GPIO_IN_PU = (PIN_DIR_IN | PIN_MODE_PU),
61 GPIO_OUT = (PIN_DIR_OUT | PIN_MODE_NONE),
62 GPIO_OD = (PIN_DIR_OUT | PIN_MODE_OD),
63 GPIO_OD_PU = (PIN_DIR_OUT | PIN_MODE_OD | PIN_MODE_PU)
66#endif /* ndef DOXYGEN */
67
71#define PROVIDES_PM_LAYERED_OFF
72
76#define PM_NUM_MODES (3U)
77
81typedef struct {
82 LPC_UART_TypeDef *dev;
83 uint8_t irq_rx;
84 uint8_t clk_offset;
85 uint8_t pinsel;
86 uint8_t pinsel_shift;
87 uint8_t pinsel_af;
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* PERIPH_CPU_H */
@ GPIO_OUT
select GPIO MASK as output
Definition periph_cpu.h:165
@ GPIO_IN
select GPIO MASK as input
Definition periph_cpu.h:164
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:82
UART device configuration.
Definition periph_cpu.h:218
uint8_t pinsel_shift
TX/RX bitshift of the PINSEL# register.
Definition periph_cpu.h:86
uint8_t pinsel
PINSEL# of the RX and TX pin.
Definition periph_cpu.h:85
LPC_UART_TypeDef * dev
pointer to the UART device
Definition periph_cpu.h:82
uint8_t irq_rx
RX IRQ number.
Definition periph_cpu.h:83
uint8_t clk_offset
The offset of the periph in the clk sel.
Definition periph_cpu.h:84
uint8_t pinsel_af
Alternate function of the PINSEL# register.
Definition periph_cpu.h:87