The friendly Operating System for the Internet of Things
lpc11u34/include/periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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 #include "cpu.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 #define PERIPH_SPI_NEEDS_INIT_CS
35 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE
36 #define PERIPH_SPI_NEEDS_TRANSFER_REG
37 #define PERIPH_SPI_NEEDS_TRANSFER_REGS
38 
43 #define CPUID_LEN (16U)
44 
50 #define ADC_NUMOF (10U)
51 
56 #define HAVE_GPIO_T
57 typedef uint16_t gpio_t;
63 #define GPIO_PIN(port, pin) (gpio_t)((port << 8) | pin)
64 
68 #define PWM_CHAN_NUMOF (3U)
69 
74 #define IN (0x0000)
75 #define OUT (0x0001)
76 #define PD (0x1 << 3)
77 #define PU (0x2 << 3)
78 #define OD (0x1 << 10)
79 
80 #define HAVE_GPIO_MODE_T
81 typedef enum {
82  GPIO_IN = (IN),
83  GPIO_IN_PD = (IN | PD),
84  GPIO_IN_PU = (IN | PU),
85  GPIO_OUT = (OUT),
86  GPIO_OD = (OUT | OD),
87  GPIO_OD_PU = (OUT | OD | PU)
88 } gpio_mode_t;
91 #ifndef DOXYGEN
92 
96 #define HAVE_ADC_RES_T
97 typedef enum {
98  ADC_RES_6BIT = 0,
99  ADC_RES_8BIT,
100  ADC_RES_10BIT,
101  ADC_RES_12BIT,
102  ADC_RES_14BIT,
103  ADC_RES_16BIT,
104 } adc_res_t;
106 #endif /* ndef DOXYGEN */
107 
111 typedef struct {
112  LPC_CTxxBx_Type *dev;
113  __IO uint32_t *pins[PWM_CHAN_NUMOF];
114  uint16_t clk_bit;
115  uint8_t af;
116 } pwm_conf_t;
117 
126 #define HAVE_SPI_CLK_T
127 typedef enum {
133 } spi_clk_t;
139 typedef struct {
140  LPC_SSPx_Type *dev;
141  uint32_t preset_bit;
142  uint32_t ahb_bit;
143 } spi_conf_t;
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* PERIPH_CPU_H */
150 
push-pull output
ADC resolution: 12 bit.
LPC_SSPx_Type * dev
SPI device to configure.
uint16_t clk_bit
clock enable bit
drive the SPI bus with 100KHz
#define __IO
LPC2387 MCU defines.
drive the SPI bus with 400KHz
PWM configuration structure.
uint32_t preset_bit
mask of the corresponding preset bit
#define PWM_CHAN_NUMOF
Number of PWM channels per PWM peripheral.
ADC resolution: 14 bit (not supported)
#define IN
Override the default GPIO mode values.
ADC resolution: 10 bit.
unsigned int gpio_t
GPIO type identifier.
Definition: gpio.h:69
ADC resolution: 16 bit (not supported)
LPC_CTxxBx_Type * dev
PWM device.
drive the SPI bus with 5MHz
ADC resolution: 8 bit.
ADC resolution: 6 bit.
drive the SPI bus with 1MHz
in with pull-up
in without pull resistor
open-drain output
SPI configuration data structure.
in with pull-down
open-drain output with pull-up
uint32_t ahb_bit
mask of the corresponding AHB bit