Programa de torreta
Dependencies: mbed
PinNames.h@0:583269628e14, 2019-09-20 (annotated)
- Committer:
- Antulius
- Date:
- Fri Sep 20 20:46:16 2019 +0000
- Revision:
- 0:583269628e14
programa de torrete
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Antulius | 0:583269628e14 | 1 | /* mbed Microcontroller Library |
Antulius | 0:583269628e14 | 2 | ******************************************************************************* |
Antulius | 0:583269628e14 | 3 | * Copyright (c) 2014, STMicroelectronics |
Antulius | 0:583269628e14 | 4 | * All rights reserved. |
Antulius | 0:583269628e14 | 5 | * |
Antulius | 0:583269628e14 | 6 | * Redistribution and use in source and binary forms, with or without |
Antulius | 0:583269628e14 | 7 | * modification, are permitted provided that the following conditions are met: |
Antulius | 0:583269628e14 | 8 | * |
Antulius | 0:583269628e14 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
Antulius | 0:583269628e14 | 10 | * this list of conditions and the following disclaimer. |
Antulius | 0:583269628e14 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Antulius | 0:583269628e14 | 12 | * this list of conditions and the following disclaimer in the documentation |
Antulius | 0:583269628e14 | 13 | * and/or other materials provided with the distribution. |
Antulius | 0:583269628e14 | 14 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Antulius | 0:583269628e14 | 15 | * may be used to endorse or promote products derived from this software |
Antulius | 0:583269628e14 | 16 | * without specific prior written permission. |
Antulius | 0:583269628e14 | 17 | * |
Antulius | 0:583269628e14 | 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Antulius | 0:583269628e14 | 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Antulius | 0:583269628e14 | 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Antulius | 0:583269628e14 | 21 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Antulius | 0:583269628e14 | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Antulius | 0:583269628e14 | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Antulius | 0:583269628e14 | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Antulius | 0:583269628e14 | 25 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Antulius | 0:583269628e14 | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Antulius | 0:583269628e14 | 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Antulius | 0:583269628e14 | 28 | ******************************************************************************* |
Antulius | 0:583269628e14 | 29 | |
Antulius | 0:583269628e14 | 30 | */ |
Antulius | 0:583269628e14 | 31 | #ifndef MBED_PINNAMES_H |
Antulius | 0:583269628e14 | 32 | #define MBED_PINNAMES_H |
Antulius | 0:583269628e14 | 33 | |
Antulius | 0:583269628e14 | 34 | #include "cmsis.h" |
Antulius | 0:583269628e14 | 35 | #include "PinNamesTypes.h" |
Antulius | 0:583269628e14 | 36 | |
Antulius | 0:583269628e14 | 37 | #ifdef __cplusplus |
Antulius | 0:583269628e14 | 38 | extern "C" { |
Antulius | 0:583269628e14 | 39 | #endif |
Antulius | 0:583269628e14 | 40 | |
Antulius | 0:583269628e14 | 41 | //UART to AMB8826 |
Antulius | 0:583269628e14 | 42 | #define TXD1 PA_9 |
Antulius | 0:583269628e14 | 43 | #define RXD1 PA_10 |
Antulius | 0:583269628e14 | 44 | #define CTS1 PA_11 |
Antulius | 0:583269628e14 | 45 | int baudRate = 115200; |
Antulius | 0:583269628e14 | 46 | |
Antulius | 0:583269628e14 | 47 | //UART to Silicon Labs CP210x |
Antulius | 0:583269628e14 | 48 | #define TXD2 PA_2 |
Antulius | 0:583269628e14 | 49 | #define RXD2 PA_3 |
Antulius | 0:583269628e14 | 50 | |
Antulius | 0:583269628e14 | 51 | //UART to FTDI |
Antulius | 0:583269628e14 | 52 | #define TXD3 PB_10 |
Antulius | 0:583269628e14 | 53 | #define RXD3 PB_11 |
Antulius | 0:583269628e14 | 54 | |
Antulius | 0:583269628e14 | 55 | //I2C |
Antulius | 0:583269628e14 | 56 | #define I2C1_SCL PB_6 |
Antulius | 0:583269628e14 | 57 | #define I2C1_SDA PB_7 |
Antulius | 0:583269628e14 | 58 | |
Antulius | 0:583269628e14 | 59 | #define I2C2_SCL PB_10 |
Antulius | 0:583269628e14 | 60 | #define I2C2_SDA PB_11 |
Antulius | 0:583269628e14 | 61 | |
Antulius | 0:583269628e14 | 62 | //SPI |
Antulius | 0:583269628e14 | 63 | #define SPI1_MOSI PA_7 |
Antulius | 0:583269628e14 | 64 | #define SPI1_MISO PA_6 |
Antulius | 0:583269628e14 | 65 | #define SPI1_SCLK PA_5 |
Antulius | 0:583269628e14 | 66 | #define SPI1_NSS1 PA_4 |
Antulius | 0:583269628e14 | 67 | #define SDsel PA_4 |
Antulius | 0:583269628e14 | 68 | |
Antulius | 0:583269628e14 | 69 | #define SPI2_MOSI PB_15 |
Antulius | 0:583269628e14 | 70 | #define SPI2_MISO PB_14 |
Antulius | 0:583269628e14 | 71 | #define SPI2_SCLK PB_13 |
Antulius | 0:583269628e14 | 72 | #define SPI2_NSS2 PB_12 |
Antulius | 0:583269628e14 | 73 | |
Antulius | 0:583269628e14 | 74 | //CAN |
Antulius | 0:583269628e14 | 75 | #define CAN1_RX PA_11 |
Antulius | 0:583269628e14 | 76 | #define CAN1_TX PA_12 |
Antulius | 0:583269628e14 | 77 | |
Antulius | 0:583269628e14 | 78 | //USB CDC |
Antulius | 0:583269628e14 | 79 | #define USB_POS PA_12 |
Antulius | 0:583269628e14 | 80 | #define USB_NEG PA_11 |
Antulius | 0:583269628e14 | 81 | |
Antulius | 0:583269628e14 | 82 | //ADC |
Antulius | 0:583269628e14 | 83 | #define Uin PA_1 |
Antulius | 0:583269628e14 | 84 | #define Ubatt PA_0 |
Antulius | 0:583269628e14 | 85 | |
Antulius | 0:583269628e14 | 86 | typedef enum { |
Antulius | 0:583269628e14 | 87 | // Not connected |
Antulius | 0:583269628e14 | 88 | NC = (int)0xFFFFFFFF, |
Antulius | 0:583269628e14 | 89 | |
Antulius | 0:583269628e14 | 90 | // Ports |
Antulius | 0:583269628e14 | 91 | PA_0 = 0x00, |
Antulius | 0:583269628e14 | 92 | PA_1 = 0x01, |
Antulius | 0:583269628e14 | 93 | PA_2 = 0x02, |
Antulius | 0:583269628e14 | 94 | PA_3 = 0x03, |
Antulius | 0:583269628e14 | 95 | PA_4 = 0x04, |
Antulius | 0:583269628e14 | 96 | PA_5 = 0x05, |
Antulius | 0:583269628e14 | 97 | PA_6 = 0x06, |
Antulius | 0:583269628e14 | 98 | PA_7 = 0x07, |
Antulius | 0:583269628e14 | 99 | PA_8 = 0x08, |
Antulius | 0:583269628e14 | 100 | PA_9 = 0x09, |
Antulius | 0:583269628e14 | 101 | PA_10 = 0x0A, |
Antulius | 0:583269628e14 | 102 | PA_11 = 0x0B, |
Antulius | 0:583269628e14 | 103 | PA_12 = 0x0C, |
Antulius | 0:583269628e14 | 104 | PA_13 = NC, |
Antulius | 0:583269628e14 | 105 | PA_14 = NC, |
Antulius | 0:583269628e14 | 106 | PA_15 = 0x0F, |
Antulius | 0:583269628e14 | 107 | |
Antulius | 0:583269628e14 | 108 | PB_0 = 0x10, |
Antulius | 0:583269628e14 | 109 | PB_1 = 0x11, |
Antulius | 0:583269628e14 | 110 | PB_2 = NC, |
Antulius | 0:583269628e14 | 111 | PB_3 = 0x13, |
Antulius | 0:583269628e14 | 112 | PB_4 = 0x14, |
Antulius | 0:583269628e14 | 113 | PB_5 = 0x15, |
Antulius | 0:583269628e14 | 114 | PB_6 = 0x16, |
Antulius | 0:583269628e14 | 115 | PB_7 = 0x17, |
Antulius | 0:583269628e14 | 116 | PB_8 = 0x18, |
Antulius | 0:583269628e14 | 117 | PB_9 = 0x19, |
Antulius | 0:583269628e14 | 118 | PB_10 = 0x1A, |
Antulius | 0:583269628e14 | 119 | PB_11 = 0x1B, |
Antulius | 0:583269628e14 | 120 | PB_12 = 0x1C, |
Antulius | 0:583269628e14 | 121 | PB_13 = 0x1D, |
Antulius | 0:583269628e14 | 122 | PB_14 = 0x1E, |
Antulius | 0:583269628e14 | 123 | PB_15 = 0x1F, |
Antulius | 0:583269628e14 | 124 | |
Antulius | 0:583269628e14 | 125 | PC_0 = NC, |
Antulius | 0:583269628e14 | 126 | PC_1 = NC, |
Antulius | 0:583269628e14 | 127 | PC_2 = NC, |
Antulius | 0:583269628e14 | 128 | PC_3 = NC, |
Antulius | 0:583269628e14 | 129 | PC_4 = NC, |
Antulius | 0:583269628e14 | 130 | PC_5 = NC, |
Antulius | 0:583269628e14 | 131 | PC_6 = NC, |
Antulius | 0:583269628e14 | 132 | PC_7 = NC, |
Antulius | 0:583269628e14 | 133 | PC_8 = NC, |
Antulius | 0:583269628e14 | 134 | PC_9 = NC, |
Antulius | 0:583269628e14 | 135 | PC_10 = NC, |
Antulius | 0:583269628e14 | 136 | PC_11 = NC, |
Antulius | 0:583269628e14 | 137 | PC_12 = NC, |
Antulius | 0:583269628e14 | 138 | PC_13 = 0x2D, |
Antulius | 0:583269628e14 | 139 | PC_14 = 0x2E, |
Antulius | 0:583269628e14 | 140 | PC_15 = 0x2F, |
Antulius | 0:583269628e14 | 141 | |
Antulius | 0:583269628e14 | 142 | PD_2 = NC, |
Antulius | 0:583269628e14 | 143 | |
Antulius | 0:583269628e14 | 144 | // ADC internal channels |
Antulius | 0:583269628e14 | 145 | ADC_TEMP = 0xF0, |
Antulius | 0:583269628e14 | 146 | ADC_VREF = 0xF1, |
Antulius | 0:583269628e14 | 147 | |
Antulius | 0:583269628e14 | 148 | // Arduino connector namings |
Antulius | 0:583269628e14 | 149 | A0 = PA_0, |
Antulius | 0:583269628e14 | 150 | A1 = PA_1, |
Antulius | 0:583269628e14 | 151 | A2 = PA_4, |
Antulius | 0:583269628e14 | 152 | A3 = PB_0, |
Antulius | 0:583269628e14 | 153 | A4 = NC, |
Antulius | 0:583269628e14 | 154 | A5 = NC, |
Antulius | 0:583269628e14 | 155 | D0 = PA_3, |
Antulius | 0:583269628e14 | 156 | D1 = PA_2, |
Antulius | 0:583269628e14 | 157 | D2 = PA_10, |
Antulius | 0:583269628e14 | 158 | D3 = PB_3, |
Antulius | 0:583269628e14 | 159 | D4 = PB_5, |
Antulius | 0:583269628e14 | 160 | D5 = PB_4, |
Antulius | 0:583269628e14 | 161 | D6 = PB_10, |
Antulius | 0:583269628e14 | 162 | D7 = PA_8, |
Antulius | 0:583269628e14 | 163 | D8 = PA_9, |
Antulius | 0:583269628e14 | 164 | D9 = NC, |
Antulius | 0:583269628e14 | 165 | D10 = PB_6, |
Antulius | 0:583269628e14 | 166 | D11 = PA_7, |
Antulius | 0:583269628e14 | 167 | D12 = PA_6, |
Antulius | 0:583269628e14 | 168 | D13 = PA_5, |
Antulius | 0:583269628e14 | 169 | D14 = PB_9, |
Antulius | 0:583269628e14 | 170 | D15 = PB_8, |
Antulius | 0:583269628e14 | 171 | |
Antulius | 0:583269628e14 | 172 | // Generic signals namings |
Antulius | 0:583269628e14 | 173 | Red_Led = NC, |
Antulius | 0:583269628e14 | 174 | Green_Led = PC_13, |
Antulius | 0:583269628e14 | 175 | Blue_Led = NC, |
Antulius | 0:583269628e14 | 176 | LED1 = PC_13, |
Antulius | 0:583269628e14 | 177 | LED2 = NC, |
Antulius | 0:583269628e14 | 178 | LED3 = NC, |
Antulius | 0:583269628e14 | 179 | LED4 = NC, |
Antulius | 0:583269628e14 | 180 | USER_BUTTON = NC, |
Antulius | 0:583269628e14 | 181 | SERIAL_TX = PA_2, |
Antulius | 0:583269628e14 | 182 | SERIAL_RX = PA_3, |
Antulius | 0:583269628e14 | 183 | USBTX = PA_12, |
Antulius | 0:583269628e14 | 184 | USBRX = PA_11, |
Antulius | 0:583269628e14 | 185 | CANRX = PB_8, |
Antulius | 0:583269628e14 | 186 | CANTX = PB_9, |
Antulius | 0:583269628e14 | 187 | I2C_SCL = PB_6, |
Antulius | 0:583269628e14 | 188 | I2C_SDA = PB_7, |
Antulius | 0:583269628e14 | 189 | SPI_MOSI = PA_7, |
Antulius | 0:583269628e14 | 190 | SPI_MISO = PA_6, |
Antulius | 0:583269628e14 | 191 | SPI_SCK = PA_5, |
Antulius | 0:583269628e14 | 192 | SPI_CS = PA_4, |
Antulius | 0:583269628e14 | 193 | TRACE_SWO = PB_3, |
Antulius | 0:583269628e14 | 194 | SWO = PB_3 |
Antulius | 0:583269628e14 | 195 | } PinName; |
Antulius | 0:583269628e14 | 196 | |
Antulius | 0:583269628e14 | 197 | #ifdef __cplusplus |
Antulius | 0:583269628e14 | 198 | } |
Antulius | 0:583269628e14 | 199 | #endif |
Antulius | 0:583269628e14 | 200 | |
Antulius | 0:583269628e14 | 201 | #endif |