|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: 2025 Marian Buschsieweke |
| 3 | + * SPDX-License-Identifier: LGPL-2.1-only |
| 4 | + */ |
| 5 | + |
| 6 | +#pragma once |
| 7 | + |
| 8 | +/** |
| 9 | + * @ingroup boards_olimexino-stm32f3 |
| 10 | + * @{ |
| 11 | + * |
| 12 | + * @file |
| 13 | + * @brief Mapping from MCU pins to Arduino pins |
| 14 | + * |
| 15 | + * You can use the defines in this file for simplified interaction with the |
| 16 | + * Arduino specific pin numbers. |
| 17 | + * |
| 18 | + * @author Marian Buschsieweke <[email protected]> |
| 19 | + */ |
| 20 | + |
| 21 | +#include "periph/adc.h" |
| 22 | +#include "periph/gpio.h" |
| 23 | +#include "periph/i2c.h" |
| 24 | +#include "periph/pwm.h" |
| 25 | +#include "periph/spi.h" |
| 26 | +#include "periph/uart.h" |
| 27 | + |
| 28 | +#ifdef __cplusplus |
| 29 | +extern "C" { |
| 30 | +#endif |
| 31 | + |
| 32 | +/** |
| 33 | + * @name Arduino's UART devices |
| 34 | + * @{ |
| 35 | + */ |
| 36 | +#define ARDUINO_UART_D0D1 UART_DEV(0) |
| 37 | +/** @} */ |
| 38 | + |
| 39 | +/** |
| 40 | + * @name Arduino's SPI buses |
| 41 | + * @{ |
| 42 | + */ |
| 43 | +/** |
| 44 | + * @brief SPI_DEV(0) is connected to the ISP header |
| 45 | + */ |
| 46 | +#define ARDUINO_SPI_ISP SPI_DEV(0) |
| 47 | +/** @} */ |
| 48 | + |
| 49 | +/** |
| 50 | + * @name Arduino's I2C buses |
| 51 | + * @{ |
| 52 | + */ |
| 53 | +/** |
| 54 | + * @brief The first I2C bus is next to the AREF pin |
| 55 | + */ |
| 56 | +#define ARDUINO_I2C_UNO I2C_DEV(0) |
| 57 | +/** @} */ |
| 58 | + |
| 59 | +/** |
| 60 | + * @name Mapping of MCU pins to Arduino pins |
| 61 | + * @{ |
| 62 | + */ |
| 63 | +#define ARDUINO_PIN_0 GPIO_PIN(PORT_A, 3) |
| 64 | +#define ARDUINO_PIN_1 GPIO_PIN(PORT_A, 2) |
| 65 | +#define ARDUINO_PIN_2 GPIO_PIN(PORT_A, 0) |
| 66 | +#define ARDUINO_PIN_3 GPIO_PIN(PORT_A, 1) |
| 67 | +#define ARDUINO_PIN_4 GPIO_PIN(PORT_B, 5) |
| 68 | +#define ARDUINO_PIN_5 GPIO_PIN(PORT_B, 6) |
| 69 | +#define ARDUINO_PIN_6 GPIO_PIN(PORT_A, 8) |
| 70 | +#define ARDUINO_PIN_7 GPIO_PIN(PORT_A, 9) |
| 71 | + |
| 72 | +#define ARDUINO_PIN_8 GPIO_PIN(PORT_A, 10) |
| 73 | +#define ARDUINO_PIN_9 GPIO_PIN(PORT_B, 7) |
| 74 | +#define ARDUINO_PIN_10 GPIO_PIN(PORT_A, 4) |
| 75 | +#define ARDUINO_PIN_11 GPIO_PIN(PORT_A, 7) |
| 76 | +#define ARDUINO_PIN_12 GPIO_PIN(PORT_A, 6) |
| 77 | +#define ARDUINO_PIN_13 GPIO_PIN(PORT_A, 5) |
| 78 | +#define ARDUINO_PIN_14 GPIO_PIN(PORT_B, 8) |
| 79 | + |
| 80 | +/* analog pins as digital pin: */ |
| 81 | +#define ARDUINO_PIN_15 GPIO_PIN(PORT_C, 0) |
| 82 | +#define ARDUINO_PIN_16 GPIO_PIN(PORT_C, 1) |
| 83 | +#define ARDUINO_PIN_17 GPIO_PIN(PORT_C, 2) |
| 84 | +#define ARDUINO_PIN_18 GPIO_PIN(PORT_C, 3) |
| 85 | +#define ARDUINO_PIN_19 GPIO_PIN(PORT_C, 4) |
| 86 | +#define ARDUINO_PIN_20 GPIO_PIN(PORT_C, 5) |
| 87 | + |
| 88 | +#define ARDUINO_PIN_LAST 20 |
| 89 | +/** @} */ |
| 90 | + |
| 91 | +/** |
| 92 | + * @name Aliases for analog pins |
| 93 | + * @{ |
| 94 | + */ |
| 95 | +#define ARDUINO_PIN_A0 ARDUINO_PIN_15 |
| 96 | +#define ARDUINO_PIN_A1 ARDUINO_PIN_16 |
| 97 | +#define ARDUINO_PIN_A2 ARDUINO_PIN_17 |
| 98 | +#define ARDUINO_PIN_A3 ARDUINO_PIN_18 |
| 99 | +#define ARDUINO_PIN_A4 ARDUINO_PIN_19 |
| 100 | +#define ARDUINO_PIN_A5 ARDUINO_PIN_20 |
| 101 | +/** @} */ |
| 102 | + |
| 103 | +/** |
| 104 | + * @name Mapping of Arduino analog pins to RIOT ADC lines |
| 105 | + * @{ |
| 106 | + */ |
| 107 | +#define ARDUINO_A0 ADC_LINE(0) |
| 108 | +#define ARDUINO_A1 ADC_LINE(1) |
| 109 | +#define ARDUINO_A2 ADC_LINE(2) |
| 110 | +#define ARDUINO_A3 ADC_LINE(3) |
| 111 | +#define ARDUINO_A4 ADC_LINE(4) |
| 112 | +#define ARDUINO_A5 ADC_LINE(5) |
| 113 | + |
| 114 | +#define ARDUINO_ANALOG_PIN_LAST 5 |
| 115 | +/** @} */ |
| 116 | + |
| 117 | +/** |
| 118 | + * @name Arduino's SPI buses |
| 119 | + * @{ |
| 120 | + */ |
| 121 | +/** |
| 122 | + * @brief SPI_DEV(0) is connected to D11/D12/D13 |
| 123 | + */ |
| 124 | +#define ARDUINO_SPI_D11D12D13 SPI_DEV(0) |
| 125 | +/** @} */ |
| 126 | + |
| 127 | +/** |
| 128 | + * @name UEXT Connector |
| 129 | + * @{ |
| 130 | + */ |
| 131 | +#define UEXT0_PIN_3 GPIO_PIN(PORT_B, 10) /**< UEXT0: TXD pin */ |
| 132 | +#define UEXT0_PIN_4 GPIO_PIN(PORT_B, 11) /**< UEXT0: RXD pin */ |
| 133 | +#define UEXT0_PIN_5 GPIO_PIN(PORT_A, 9) /**< UEXT0: SCL pin */ |
| 134 | +#define UEXT0_PIN_6 GPIO_PIN(PORT_A, 10) /**< UEXT0: SDA pin */ |
| 135 | +#define UEXT0_PIN_7 GPIO_PIN(PORT_A, 6) /**< UEXT0: MISO pin */ |
| 136 | +#define UEXT0_PIN_8 GPIO_PIN(PORT_A, 7) /**< UEXT0: MOSI pin */ |
| 137 | +#define UEXT0_PIN_9 GPIO_PIN(PORT_A, 5) /**< UEXT0: SCK pin */ |
| 138 | +#define UEXT0_PIN_10 GPIO_PIN(PORT_B, 5) /**< UEXT0: /CS pin */ |
| 139 | +/** @} */ |
| 140 | + |
| 141 | +#ifdef __cplusplus |
| 142 | +} |
| 143 | +#endif |
| 144 | +/** @} */ |
0 commit comments