Commit | Line | Data |
---|---|---|
4cff3ded | 1 | /* mbed Microcontroller Library - PeripheralNames |
8fcce42e | 2 | * Copyright (C) 2008-2011 ARM Limited. All rights reserved. |
4cff3ded AW |
3 | * |
4 | * Provides the mappings for peripherals | |
4cff3ded AW |
5 | */ |
6 | ||
7 | #ifndef MBED_PERIPHERALNAMES_H | |
8 | #define MBED_PERIPHERALNAMES_H | |
9 | ||
10 | #include "cmsis.h" | |
11 | ||
12 | #ifdef __cplusplus | |
13 | extern "C" { | |
14 | #endif | |
15 | ||
8fcce42e AG |
16 | #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) |
17 | ||
4cff3ded AW |
18 | enum UARTName { |
19 | UART_0 = (int)LPC_UART0_BASE | |
20 | , UART_1 = (int)LPC_UART1_BASE | |
21 | , UART_2 = (int)LPC_UART2_BASE | |
22 | , UART_3 = (int)LPC_UART3_BASE | |
23 | }; | |
24 | typedef enum UARTName UARTName; | |
25 | ||
26 | enum ADCName { | |
27 | ADC0_0 = 0 | |
28 | , ADC0_1 | |
29 | , ADC0_2 | |
30 | , ADC0_3 | |
31 | , ADC0_4 | |
32 | , ADC0_5 | |
33 | , ADC0_6 | |
34 | , ADC0_7 | |
35 | }; | |
36 | typedef enum ADCName ADCName; | |
37 | ||
38 | enum DACName { | |
39 | DAC_0 = 0 | |
40 | }; | |
41 | typedef enum DACName DACName; | |
42 | ||
43 | enum SPIName { | |
44 | SPI_0 = (int)LPC_SSP0_BASE | |
45 | , SPI_1 = (int)LPC_SSP1_BASE | |
46 | }; | |
47 | typedef enum SPIName SPIName; | |
48 | ||
49 | enum I2CName { | |
50 | I2C_0 = (int)LPC_I2C0_BASE | |
51 | , I2C_1 = (int)LPC_I2C1_BASE | |
52 | , I2C_2 = (int)LPC_I2C2_BASE | |
53 | }; | |
54 | typedef enum I2CName I2CName; | |
55 | ||
56 | enum PWMName { | |
57 | PWM_1 = 1 | |
58 | , PWM_2 | |
59 | , PWM_3 | |
60 | , PWM_4 | |
61 | , PWM_5 | |
62 | , PWM_6 | |
63 | }; | |
64 | typedef enum PWMName PWMName; | |
65 | ||
66 | enum TimerName { | |
67 | TIMER_0 = (int)LPC_TIM0_BASE | |
68 | , TIMER_1 = (int)LPC_TIM1_BASE | |
69 | , TIMER_2 = (int)LPC_TIM2_BASE | |
70 | , TIMER_3 = (int)LPC_TIM3_BASE | |
71 | }; | |
72 | typedef enum TimerName TimerName; | |
73 | ||
74 | enum CANName { | |
75 | CAN_1 = (int)LPC_CAN1_BASE, | |
76 | CAN_2 = (int)LPC_CAN2_BASE | |
77 | }; | |
78 | typedef enum CANName CANName; | |
79 | ||
8fcce42e AG |
80 | #define US_TICKER_TIMER TIMER_3 |
81 | #define US_TICKER_TIMER_IRQn TIMER3_IRQn | |
82 | ||
83 | #elif defined(TARGET_LPC11U24) | |
84 | ||
85 | enum UARTName { | |
86 | UART_0 = (int)LPC_USART_BASE | |
87 | }; | |
88 | typedef enum UARTName UARTName; | |
89 | ||
90 | enum I2CName { | |
91 | I2C_0 = (int)LPC_I2C_BASE | |
92 | }; | |
93 | typedef enum I2CName I2CName; | |
94 | ||
95 | enum TimerName { | |
96 | TIMER_0 = (int)LPC_CT32B0_BASE | |
97 | , TIMER_1 = (int)LPC_CT32B1_BASE | |
98 | }; | |
99 | typedef enum TimerName TimerName; | |
100 | ||
101 | enum ADCName { | |
102 | ADC0_0 = 0 | |
103 | , ADC0_1 | |
104 | , ADC0_2 | |
105 | , ADC0_3 | |
106 | , ADC0_4 | |
107 | , ADC0_5 | |
108 | , ADC0_6 | |
109 | , ADC0_7 | |
110 | }; | |
111 | typedef enum ADCName ADCName; | |
112 | ||
113 | enum SPIName { | |
114 | SPI_0 = (int)LPC_SSP0_BASE | |
115 | , SPI_1 = (int)LPC_SSP1_BASE | |
116 | }; | |
117 | typedef enum SPIName SPIName; | |
118 | ||
119 | #define US_TICKER_TIMER TIMER_1 | |
120 | #define US_TICKER_TIMER_IRQn TIMER_32_1_IRQn | |
121 | ||
122 | typedef enum PWMName { | |
123 | PWM_1 = 0 | |
124 | , PWM_2 | |
125 | , PWM_3 | |
126 | , PWM_4 | |
127 | , PWM_5 | |
128 | , PWM_6 | |
129 | , PWM_7 | |
130 | , PWM_8 | |
131 | , PWM_9 | |
132 | , PWM_10 | |
133 | , PWM_11 | |
134 | } PWMName; | |
135 | ||
136 | #endif | |
137 | ||
4cff3ded AW |
138 | #define STDIO_UART_TX USBTX |
139 | #define STDIO_UART_RX USBRX | |
140 | #define STDIO_UART UART_0 | |
4cff3ded AW |
141 | |
142 | #ifdef __cplusplus | |
143 | } | |
144 | #endif | |
145 | ||
146 | #endif |