Skip to content

Commit c8bd08f

Browse files
authored
Merge pull request #6043 from ithinuel/add-rak811
add support for the RAK811
2 parents 2429d5e + 85af9f9 commit c8bd08f

26 files changed

+11014
-5
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2015, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PERIPHERALNAMES_H
31+
#define MBED_PERIPHERALNAMES_H
32+
33+
#include "cmsis.h"
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
typedef enum {
40+
ADC_1 = (int)ADC1_BASE
41+
} ADCName;
42+
43+
typedef enum {
44+
DAC_1 = (int)DAC_BASE
45+
} DACName;
46+
47+
typedef enum {
48+
UART_1 = (int)USART1_BASE,
49+
UART_2 = (int)USART2_BASE,
50+
UART_3 = (int)USART3_BASE
51+
} UARTName;
52+
53+
typedef enum {
54+
SPI_1 = (int)SPI1_BASE,
55+
SPI_2 = (int)SPI2_BASE
56+
} SPIName;
57+
58+
typedef enum {
59+
I2C_1 = (int)I2C1_BASE,
60+
I2C_2 = (int)I2C2_BASE
61+
} I2CName;
62+
63+
typedef enum {
64+
PWM_2 = (int)TIM2_BASE,
65+
PWM_3 = (int)TIM3_BASE,
66+
PWM_4 = (int)TIM4_BASE, // used as us_ticker
67+
PWM_9 = (int)TIM9_BASE,
68+
PWM_10 = (int)TIM10_BASE,
69+
PWM_11 = (int)TIM11_BASE
70+
} PWMName;
71+
72+
#ifdef __cplusplus
73+
}
74+
#endif
75+
76+
#endif
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#include "PeripheralPins.h"
32+
33+
// =====
34+
// Note: Commented lines are alternative possibilities which are not used per default.
35+
// If you change them, you will have also to modify the corresponding xxx_api.c file
36+
// for pwmout, analogin, analogout, ...
37+
// =====
38+
39+
//*** ADC ***
40+
41+
const PinMap PinMap_ADC[] = {
42+
{PB_12, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC_IN18
43+
{PB_14, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 20, 0)}, // ADC_IN20
44+
{PB_15, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 21, 0)}, // ADC_IN21
45+
{NC, NC, 0}
46+
};
47+
48+
const PinMap PinMap_ADC_Internal[] = {
49+
{ADC_TEMP, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)},
50+
{ADC_VREF, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)},
51+
{NC, NC, 0}
52+
};
53+
54+
//*** DAC ***
55+
56+
const PinMap PinMap_DAC[] = {
57+
{NC, NC, 0}
58+
};
59+
60+
//*** I2C ***
61+
62+
const PinMap PinMap_I2C_SDA[] = {
63+
{PB_9, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
64+
{PB_11, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
65+
{NC, NC, 0}
66+
};
67+
68+
const PinMap PinMap_I2C_SCL[] = {
69+
{PB_8, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
70+
{PB_10, I2C_2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
71+
{NC, NC, 0}
72+
};
73+
74+
//*** PWM ***
75+
76+
// TIM5 cannot be used because already used by the us_ticker.
77+
const PinMap PinMap_PWM[] = {
78+
{PB_10, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
79+
{PB_11, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
80+
{NC, NC, 0}
81+
};
82+
83+
//*** SERIAL ***
84+
85+
const PinMap PinMap_UART_TX[] = {
86+
{PA_2, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
87+
{PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
88+
{PB_10, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
89+
{NC, NC, 0}
90+
};
91+
92+
const PinMap PinMap_UART_RX[] = {
93+
{PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
94+
{PB_11, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
95+
{NC, NC, 0}
96+
};
97+
98+
//*** SPI ***
99+
100+
const PinMap PinMap_SPI_MOSI[] = {
101+
{PA_7, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
102+
{PA_12, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
103+
{PB_5, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
104+
{PB_15, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
105+
{NC, NC, 0}
106+
};
107+
108+
const PinMap PinMap_SPI_MISO[] = {
109+
{PA_6, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
110+
{PB_4, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
111+
{PB_14, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
112+
{NC, NC, 0}
113+
};
114+
115+
const PinMap PinMap_SPI_SCLK[] = {
116+
{PA_5, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
117+
{PB_3, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
118+
{NC, NC, 0}
119+
};
120+
121+
const PinMap PinMap_SPI_SSEL[] = {
122+
{PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
123+
{PB_12, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
124+
{NC, NC, 0}
125+
};
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2016, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PINNAMES_H
31+
#define MBED_PINNAMES_H
32+
33+
#include "cmsis.h"
34+
#include "PinNamesTypes.h"
35+
36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
40+
typedef enum {
41+
PA_0 = 0x00,
42+
PA_1 = 0x01,
43+
PA_2 = 0x02,
44+
PA_3 = 0x03,
45+
PA_4 = 0x04,
46+
PA_5 = 0x05,
47+
PA_6 = 0x06,
48+
PA_7 = 0x07,
49+
PA_8 = 0x08,
50+
PA_9 = 0x09,
51+
PA_10 = 0x0A,
52+
PA_11 = 0x0B,
53+
PA_12 = 0x0C,
54+
PA_13 = 0x0D,
55+
PA_14 = 0x0E,
56+
PA_15 = 0x0F,
57+
58+
PB_0 = 0x10,
59+
PB_1 = 0x11,
60+
PB_2 = 0x12, // not used
61+
PB_3 = 0x13,
62+
PB_4 = 0x14,
63+
PB_5 = 0x15,
64+
PB_6 = 0x16,
65+
PB_7 = 0x17,
66+
PB_8 = 0x18,
67+
PB_9 = 0x19,
68+
PB_10 = 0x1A,
69+
PB_11 = 0x1B,
70+
PB_12 = 0x1C,
71+
PB_13 = 0x1D,
72+
PB_14 = 0x1E,
73+
PB_15 = 0x1F,
74+
75+
PC_13 = 0x2D,
76+
PC_14 = 0x2E, // not used ?
77+
PC_15 = 0x2F, // not used ?
78+
79+
PH_0 = 0x70,
80+
PH_1 = 0x71, // not used ?
81+
82+
// ADC internal channels
83+
ADC_TEMP = 0xF0,
84+
ADC_VREF = 0xF1,
85+
86+
ADC1_0 = PB_14,
87+
ADC1_1 = PB_15,
88+
ADC1_2 = PB_12,
89+
90+
UARTn_RX = PA_10,
91+
UARTn_TX = PA_9,
92+
93+
SPI_RF_MOSI = PA_7,
94+
SPI_RF_MISO = PA_6,
95+
SPI_RF_SCK = PA_5,
96+
SPI_RF_CS = PB_0,
97+
SPI_RF_RESET= PB_13,
98+
99+
DIO0 = PA_11,
100+
DIO1 = PB_1,
101+
DIO2 = PA_3,
102+
DIO3 = PH_0,
103+
DIO4 = PC_13,
104+
//DIO5 = ,
105+
106+
ANT_CTX_PA = PA_4,
107+
ANT_CRX_RX = PB_6,
108+
ANT_CBT_HF = PB_7,
109+
RF_TCXO_EN = PH_1,
110+
111+
SPI_MISO = PB_4,
112+
SPI_MOSI = PB_5,
113+
SPI_SCK = PB_3,
114+
FLASH_CS = PA_15,
115+
116+
I2C_SCL = PB_8,
117+
I2C_SDA = PB_0,
118+
119+
LCD_A0 = PA_8,
120+
LCD_nCS = PA_1,
121+
LCD_nRESET = PA_2,
122+
123+
// Generic signals namings
124+
LED1 = PA_12, // red
125+
LED2 = PB_10, // blue
126+
LED3 = PB_11, // green
127+
USER_BUTTON = PA_0,
128+
129+
STDIO_UART_RX = PA_10,
130+
STDIO_UART_TX = PA_9,
131+
132+
// aliases
133+
POT = ADC1_2,
134+
BUTTON1 = USER_BUTTON,
135+
SERIAL_TX = STDIO_UART_TX,
136+
SERIAL_RX = STDIO_UART_RX,
137+
USBTX = STDIO_UART_TX,
138+
USBRX = STDIO_UART_RX,
139+
140+
// Not connected
141+
NC = (int)0xFFFFFFFF
142+
} PinName;
143+
144+
#ifdef __cplusplus
145+
}
146+
#endif
147+
148+
#endif

0 commit comments

Comments
 (0)