Lab 1 Program C

Dependents:   Lab1C

Fork of mbed by -deleted-

Committer:
emilmont
Date:
Thu Dec 08 12:04:01 2011 +0000
Revision:
28:667d61c9177b
Parent:
27:7110ebee3484
Child:
29:078e4b97a13e
Add additional M0 peripherals implementations, fix GCC stdio/uart

Who changed what in which revision?

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