Add missing wifi targets for some DIY modules (#1210)
[ExpressLRS.git] / src / variants / GHOST_TX / variant.cpp
blobe95ccb8d062fbabb70baf51df63dc7ffb2300785
1 /*
2 *******************************************************************************
3 * Copyright (c) 2018, STMicroelectronics
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
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.
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 *******************************************************************************
30 #include "pins_arduino.h"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 // Pin number
37 const PinName digitalPin[] = {
38 PB_9, //D0 - CAN_TX
39 PB_8, //D1 - CAN_RX
40 PB_7, //D2 - UART1_RX or I2C1_SDC
41 PB_6, //D3 - UART1_TX or I2C1_SCL
42 PB_5, //D4 - LED_RED
43 PB_4, //D5 - LED_BLUE
44 PB_3, //D6
45 PA_15, //D7
46 PA_12, //D8 - USB_DP
47 PA_11, //D9 - USB_DM
48 PA_10, //D10 - SDA MPU-9150
49 PA_9, //D11 - SCL MPU-9150
50 PA_8, //D12
51 PB_15, //D13
52 PB_14, //D14
53 PB_13, //D15
54 PB_12, //D16
55 PC_13, //D17 - LED on Bluepill Board
56 PC_14, //D18
57 PC_15, //D19
58 PA_0, //D20/A0
59 PA_1, //D21/A1
60 PA_2, //D22/A2
61 PA_3, //D23/A3 - RCX
62 PA_4, //D24/A4
63 PA_5, //D25/A5
64 PA_6, //D26/A6
65 PA_7, //D27/A7
66 PB_0, //D28/A8
67 PB_1, //D29/A9
68 PB_10, //D30 - UART3_TX
69 PB_11, //D31 - UART3_RX
70 PB_2, //D32 - BOOT1
71 PA_13, //D33 - SWDI0
72 PA_14, //D34 - SWCLK
75 #ifdef __cplusplus
77 #endif
79 // ----------------------------------------------------------------------------
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
85 WEAK void SystemClock_Config(void)
88 RCC_OscInitTypeDef RCC_OscInitStruct;
89 RCC_ClkInitTypeDef RCC_ClkInitStruct;
90 RCC_PeriphCLKInitTypeDef PeriphClkInit;
92 /**Initializes the CPU, AHB and APB busses clocks
94 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
95 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
96 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV4;
97 RCC_OscInitStruct.HSIState = RCC_HSI_ON;
98 RCC_OscInitStruct.HSICalibrationValue = 16;
99 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
100 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
101 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
102 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
103 _Error_Handler(__FILE__, __LINE__);
106 /**Initializes the CPU, AHB and APB busses clocks
108 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
109 | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
110 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
111 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
112 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
113 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
115 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
116 _Error_Handler(__FILE__, __LINE__);
119 // PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART3
120 // | RCC_PERIPHCLK_I2C1;
121 // PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
122 // PeriphClkInit.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
123 // PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_HSI;
124 // if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
125 // _Error_Handler(__FILE__, __LINE__);
126 // }
129 #ifdef __cplusplus
131 #endif