forked from stm32duino/Arduino_Core_STM32
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://www.bfykorea.com/aurora-one/ Supersede stm32duino#1176 Signed-off-by: JongHyeon Lee <jhlee@bfykorea.com> Co-authored-by: Frederic.Pillon <frederic.pillon@st.com>
- Loading branch information
Showing
6 changed files
with
263 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
variants/STM32G0xx/Generic_G030Kx/variant_AURORA_ONE.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
******************************************************************************* | ||
* Copyright (c) 2021, STMicroelectronics | ||
* All rights reserved. | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
******************************************************************************* | ||
*/ | ||
#if defined(ARDUINO_AURORA_ONE) | ||
#include "pins_arduino.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
// Digital PinName array | ||
const PinName digitalPin[] = { | ||
PA_10, //D0 | ||
PA_9, //D1 | ||
PA_6, //D2/A6 | ||
PA_7, //D3/A7 | ||
PA_8, //D4 | ||
PC_6, //D5 | ||
PA_11, //D6/A10 | ||
PA_12, //D7/A11 | ||
PB_2, //D8/A12 | ||
PB_1, //D9/A9 | ||
PB_0, //D10/A8 | ||
PB_5, //D11 | ||
PB_4, //D12 | ||
PB_3, //D13/LED | ||
PB_7, //D14/A13 | ||
PB_6, //D15 | ||
PB_9, //D16/MAINSL | ||
PB_8, //D17/MAINSL | ||
PA_15, //D18/MAINSL | ||
PA_14, //D19/A14/SWCLK | ||
PA_13, //D20/A15/SWDIO | ||
PA_0, //D21/A0 | ||
PA_1, //D22/A1 | ||
PA_2, //D23/A2 | ||
PA_3, //D24/A3 | ||
PA_4, //D25/A4 | ||
PA_5, //D26/A5 | ||
PA_9_R, //D27 | ||
PA_10_R //D28 | ||
}; | ||
|
||
// Analog (Ax) pin number array | ||
const uint32_t analogInputPin[] = { | ||
21, //A0 | ||
22, //A1 | ||
23, //A2 | ||
24, //A3 | ||
25, //A4 | ||
26, //A5 | ||
2, //A6 | ||
3, //A7 | ||
10, //A8 | ||
9, //A9 | ||
6, //A10 | ||
7, //A11 | ||
8, //A12 | ||
14, //A13 | ||
19, //A14 | ||
20 //A15 | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief System Clock Configuration | ||
* @param None | ||
* @retval None | ||
*/ | ||
WEAK void SystemClock_Config(void) | ||
{ | ||
RCC_OscInitTypeDef RCC_OscInitStruct = {}; | ||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; | ||
|
||
/* Configure the main internal regulator output voltage */ | ||
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); | ||
/* | ||
* Initializes the RCC Oscillators according to the specified parameters | ||
* in the RCC_OscInitTypeDef structure. | ||
*/ | ||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; | ||
RCC_OscInitStruct.HSIState = RCC_HSI_ON; | ||
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1; | ||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; | ||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | ||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; | ||
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1; | ||
RCC_OscInitStruct.PLL.PLLN = 8; | ||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; | ||
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; | ||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
/* Initializes the CPU, AHB and APB buses clocks */ | ||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | ||
| RCC_CLOCKTYPE_PCLK1; | ||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | ||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; | ||
|
||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* ARDUINO_AURORA_ONE */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
******************************************************************************* | ||
* Copyright (c) 2021, STMicroelectronics | ||
* All rights reserved. | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
******************************************************************************* | ||
*/ | ||
#if defined(ARDUINO_AURORA_ONE) | ||
#ifndef _VARIANT_ARDUINO_STM32_ | ||
#define _VARIANT_ARDUINO_STM32_ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif // __cplusplus | ||
|
||
/*---------------------------------------------------------------------------- | ||
* STM32 pins number | ||
*----------------------------------------------------------------------------*/ | ||
#define PA10 0 | ||
#define PA9 1 | ||
#define PA6 A6 | ||
#define PA7 A7 | ||
#define PA8 4 | ||
#define PC6 5 | ||
#define PA11 A10 | ||
#define PA12 A11 | ||
#define PB2 A12 | ||
#define PB1 A9 | ||
#define PB0 A8 | ||
#define PB5 11 | ||
#define PB4 12 | ||
#define PB3 13 // LED | ||
#define PB7 A13 | ||
#define PB6 15 | ||
#define PB9 16 | ||
#define PB8 17 | ||
#define PA15 18 | ||
#define PA14 A14 // SWD / BOOT0 | ||
#define PA13 A15 // SWD | ||
#define PA0 A0 | ||
#define PA1 A1 | ||
#define PA2 A2 | ||
#define PA3 A3 | ||
#define PA4 A4 | ||
#define PA5 A5 | ||
#define PA9_R 27 | ||
#define PA10_R 28 | ||
// #define PC14 29 // OSC32IN | ||
// #define PC15 30 // OSC32OUT | ||
|
||
// Alternate pins number | ||
#define PA6_ALT1 (PA6 | ALT1) | ||
#define PA7_ALT1 (PA7 | ALT1) | ||
#define PA7_ALT2 (PA7 | ALT2) | ||
#define PA7_ALT3 (PA7 | ALT3) | ||
#define PB0_ALT1 (PB0 | ALT1) | ||
#define PB1_ALT1 (PB1 | ALT1) | ||
#define PB1_ALT2 (PB1 | ALT2) | ||
#define PB6_ALT1 (PB6 | ALT1) | ||
|
||
#define NUM_DIGITAL_PINS 29 | ||
#define NUM_REMAP_PINS 2 | ||
#define NUM_ANALOG_INPUTS 16 | ||
|
||
// On-board LED pin number | ||
#define LED_BUILTIN PB3 | ||
#define LED_GREEN LED_BUILTIN | ||
|
||
// Timer Definitions | ||
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin | ||
#ifndef TIMER_TONE | ||
#define TIMER_TONE TIM14 | ||
#endif | ||
#ifndef TIMER_SERVO | ||
#define TIMER_SERVO TIM16 | ||
#endif | ||
|
||
// UART Definitions | ||
#define SERIAL_UART_INSTANCE 2 //Connected to Aurora Connect Lite | ||
|
||
// Default pin used for 'Serial' instance (ex: ST-Link) | ||
// Mandatory for Firmata | ||
#define PIN_SERIAL_RX PA10 | ||
#define PIN_SERIAL_TX PA9 | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif | ||
|
||
/*---------------------------------------------------------------------------- | ||
* Arduino objects - C++ only | ||
*----------------------------------------------------------------------------*/ | ||
|
||
#ifdef __cplusplus | ||
// These serial port names are intended to allow libraries and architecture-neutral | ||
// sketches to automatically default to the correct port name for a particular type | ||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
// the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
// | ||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
// | ||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
// | ||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
// | ||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
// | ||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
// pins are NOT connected to anything by default. | ||
#define SERIAL_PORT_MONITOR Serial | ||
#define SERIAL_PORT_HARDWARE Serial2 | ||
#endif | ||
|
||
#endif /* _VARIANT_ARDUINO_STM32_ */ | ||
#endif /* ARDUINO_AURORA_ONE */ |