makes GPIO_PIN_RST optional for the sx1276
[ExpressLRS.git] / src / variants / FM30_mini / variant_FM30_MINI.cpp
blobec15416cf2c8a3d59a53aab3ed7f8a66889c8505
1 /*
2 *******************************************************************************
3 * Copyright (c) 2021, STMicroelectronics
4 * All rights reserved.
6 * This software component is licensed by ST under BSD 3-Clause license,
7 * the "License"; You may not use this file except in compliance with the
8 * License. You may obtain a copy of the License at:
9 * opensource.org/licenses/BSD-3-Clause
11 *******************************************************************************
14 #include "pins_arduino.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 // Digital PinName array
21 const PinName digitalPin[] = {
22 PA_0,
23 PA_1,
24 PA_2,
25 PA_3,
26 PA_4,
27 PA_5,
28 PA_6,
29 PA_8,
30 PA_9,
31 PA_10,
32 PA_11,
33 PA_12,
34 PA_13,
35 PA_14,
36 PA_15,
37 PB_0,
38 PB_1,
39 PB_2,
40 PB_3,
41 PB_4,
42 PB_5,
43 PB_6,
44 PB_7,
45 PB_8,
46 PB_9,
47 PB_14,
48 PB_15,
49 PC_13,
50 PC_14,
51 PC_15,
52 PD_8,
53 PE_8,
54 PE_9,
55 PF_0,
56 PF_1,
57 PF_6,
58 PF_7
61 // Analog (Ax) pin number array
62 const uint32_t analogInputPin[] = {
63 0, // A0, PA0
64 1, // A1, PA1
65 2, // A2, PA2
66 3, // A3, PA3
67 4, // A4, PA4
68 5, // A5, PA5
69 6, // A6, PA6
70 15, // A7, PB0
71 16 // A8, PB1
74 /**
75 * @brief System Clock Configuration
76 * @param None
77 * @retval None
79 WEAK void SystemClock_Config(void)
81 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
82 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
83 RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
85 /** Initializes the RCC Oscillators according to the specified parameters
86 * in the RCC_OscInitTypeDef structure.
88 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
89 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
90 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV2;
91 RCC_OscInitStruct.HSIState = RCC_HSI_ON;
92 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
93 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
94 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
95 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
97 Error_Handler();
99 /** Initializes the CPU, AHB and APB buses clocks
101 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
102 |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
103 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
104 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
105 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
106 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
108 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
110 Error_Handler();
112 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2
113 |RCC_PERIPHCLK_USART3;
114 PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
115 PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
116 PeriphClkInit.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
117 if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
119 Error_Handler();
123 #ifdef __cplusplus
124 } // extern "C"
125 #endif