lpc2387/include/periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
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 
19 #ifndef PERIPH_CPU_H
20 #define PERIPH_CPU_H
21 
22 #include "cpu.h"
23 #include "periph/dev_enums.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #include <stdint.h>
30 #include "cpu.h"
31 
36 #define __IO volatile
37 
41 typedef struct {
42  __IO uint32_t DIR;
43  uint32_t _reserved[3];
44  __IO uint32_t MASK;
45  __IO uint32_t PIN;
46  __IO uint32_t SET;
47  __IO uint32_t CLR;
48 } FIO_PORT_t;
49 
50 #define FIO_PORTS ((FIO_PORT_t*)FIO_BASE_ADDR)
51 #define PINSEL ((__IO uint32_t *)(PINSEL_BASE_ADDR))
52 #define PINMODE ((__IO uint32_t *)(PINSEL_BASE_ADDR + 0x40))
53 
54 int gpio_init_mux(unsigned pin, unsigned mux);
55 void gpio_init_states(void);
56 
57 #define GPIO_PIN(port, pin) (port*32 + pin)
58 
59 #ifndef DOXYGEN
60 #define HAVE_GPIO_FLANK_T
61 typedef enum {
62  GPIO_FALLING = 1,
63  GPIO_RISING = 2,
64  GPIO_BOTH = 3
65 } gpio_flank_t;
66 #endif /* ndef DOXYGEN */
67 
71 #define TIMER_CHAN_NUMOF (4U)
72 
77 #define PERIPH_SPI_NEEDS_INIT_CS
78 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE
79 #define PERIPH_SPI_NEEDS_TRANSFER_REG
80 #define PERIPH_SPI_NEEDS_TRANSFER_REGS
81 /* @} */
82 
87 #define HAVE_SPI_CLK_T
88 typedef enum {
91  SPI_CLK_1MHZ = 1000,
92  SPI_CLK_5MHZ = 5000,
93  SPI_CLK_10MHZ = 10000
94 } spi_clk_t;
97 /* @} */
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* PERIPH_CPU_H */
103 
emit interrupt on rising flank
__IO uint32_t DIR
he
__IO uint32_t SET
know
Fast GPIO register definition struct.
drive the SPI bus with 100KHz
#define __IO
LPC2387 MCU defines.
drive the SPI bus with 400KHz
emit interrupt on both flanks
Device enumerations for backward compatibility with existing peripheral driver implementations.
__IO uint32_t PIN
to
drive the SPI bus with 5MHz
drive the SPI bus with 10MHz
__IO uint32_t MASK
wants
emit interrupt on falling flank
drive the SPI bus with 1MHz
__IO uint32_t CLR
everything