-
Notifications
You must be signed in to change notification settings - Fork 1k
Add custom devboard - Databoard #2806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
44d20ce
Update boards.txt - declare custom devboard named databoard
its-kronos fa2f938
Create variant_DATABOARD.h - add variant.h
its-kronos fee1c66
Create variant_DATABOARD.cpp - add variant.cpp
its-kronos b8e9eb2
Update README.md - add new reference
its-kronos 4d53eed
Update variant_DATABOARD.h - add pin aliases
its-kronos c091ba1
Update variant_DATABOARD.h -- add HSE conf
its-kronos fabee99
Update variant_DATABOARD.cpp - replace generic name with board name
its-kronos 0c77dec
Update variant_DATABOARD.cpp - replace if statement to board name rat…
its-kronos 43cac0d
Update variant_DATABOARD.cpp - add clock config w/ HSE prediv
its-kronos d54052f
Update README.md - add first stm32duino version that "databoard" will…
its-kronos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
139 changes: 139 additions & 0 deletions
139
variants/STM32F1xx/F103C8T_F103CB(T-U)/variant_DATABOARD.cpp
This file contains hidden or 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,139 @@ | ||
/* | ||
******************************************************************************* | ||
* Copyright (c) 2020, 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_DATABOARD) | ||
#include "pins_arduino.h" | ||
|
||
// Digital PinName array | ||
const PinName digitalPin[] = { | ||
PA_0, // D0/A0 | ||
PA_1, // D1/A1 | ||
PA_2, // D2/A2 | ||
PA_3, // D3/A3 | ||
PA_4, // D4/A4 | ||
PA_5, // D5/A5 | ||
PA_6, // D6/A6 | ||
PA_7, // D7/A7 | ||
PA_8, // D8 | ||
PA_9, // D9 | ||
PA_10, // D10 | ||
PA_11, // D11 | ||
PA_12, // D12 | ||
PA_13, // D13 | ||
PA_14, // D14 | ||
PA_15, // D15 | ||
PB_0, // D16/A8 | ||
PB_1, // D17/A9 | ||
PB_2, // D18 | ||
PB_3, // D19 | ||
PB_4, // D20 | ||
PB_5, // D21 | ||
PB_6, // D22 | ||
PB_7, // D23 | ||
PB_8, // D24 | ||
PB_9, // D25 | ||
PB_10, // D26 | ||
PB_11, // D27 | ||
PB_12, // D28 | ||
PB_13, // D29 | ||
PB_14, // D30 | ||
PB_15, // D31 | ||
PC_13, // D32 | ||
PC_14, // D33 | ||
PC_15, // D34 | ||
PD_0, // D35 | ||
PD_1 // D36 | ||
}; | ||
|
||
// Analog (Ax) pin number array | ||
const uint32_t analogInputPin[] = { | ||
0, // A0, PA0 | ||
1, // A1, PA1 | ||
2, // A2, PA2 | ||
3, // A3, PA3 | ||
4, // A4, PA4 | ||
5, // A5, PA5 | ||
6, // A6, PA6 | ||
7, // A7, PA7 | ||
16, // A8, PB0 | ||
17 // A9, PB1 | ||
}; | ||
|
||
|
||
// ---------------------------------------------------------------------------- | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief System Clock Configuration | ||
* The system Clock is configured as follow : | ||
* System Clock source = PLL (HSE) | ||
* SYSCLK(Hz) = 72000000 | ||
* HCLK(Hz) = 72000000 | ||
* AHB Prescaler = 1 | ||
* APB1 Prescaler = 2 | ||
* APB2 Prescaler = 1 | ||
* PLL_Source = HSE | ||
* PLL_Mul = 9 | ||
* Flash Latency(WS) = 2 | ||
* ADC Prescaler = 6 | ||
* USB Prescaler = 1.5 | ||
* @param None | ||
* @retval None | ||
*/ | ||
WEAK void SystemClock_Config(void) | ||
{ | ||
RCC_OscInitTypeDef RCC_OscInitStruct = {}; | ||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; | ||
RCC_PeriphCLKInitTypeDef PeriphClkInit = {}; | ||
|
||
/* Initializes the CPU, AHB and APB busses clocks */ | ||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; | ||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; | ||
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV2; | ||
RCC_OscInitStruct.HSIState = RCC_HSI_ON; | ||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; | ||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; | ||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; | ||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
|
||
/* Initializes the CPU, AHB and APB busses clocks */ | ||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | ||
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; | ||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; | ||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; | ||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; | ||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; | ||
|
||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
|
||
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_USB; | ||
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; | ||
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5; | ||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { | ||
Error_Handler(); | ||
} | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
||
|
||
#endif /* ARDUINO_DATABOARD */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.