mirror of https://github.com/ARMmbed/mbed-os.git
parent
58ac265039
commit
6f25e46181
|
@ -0,0 +1,93 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-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
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MBED_PERIPHERALNAMES_H
|
||||||
|
#define MBED_PERIPHERALNAMES_H
|
||||||
|
|
||||||
|
#include "cmsis.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ADC_1 = (int)ADC1_BASE
|
||||||
|
} ADCName;
|
||||||
|
|
||||||
|
#if defined DAC_BASE
|
||||||
|
typedef enum {
|
||||||
|
DAC_1 = (int)DAC_BASE
|
||||||
|
} DACName;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
UART_1 = (int)USART1_BASE,
|
||||||
|
UART_2 = (int)USART2_BASE,
|
||||||
|
UART_3 = (int)USART3_BASE,
|
||||||
|
UART_4 = (int)USART4_BASE,
|
||||||
|
#if defined USART5_BASE
|
||||||
|
UART_5 = (int)USART5_BASE,
|
||||||
|
#endif
|
||||||
|
#if defined USART6_BASE
|
||||||
|
UART_6 = (int)USART6_BASE,
|
||||||
|
#endif
|
||||||
|
#if defined USART7_BASE
|
||||||
|
UART_7 = (int)USART7_BASE,
|
||||||
|
#endif
|
||||||
|
#if defined USART8_BASE
|
||||||
|
UART_8 = (int)USART8_BASE,
|
||||||
|
#endif
|
||||||
|
} UARTName;
|
||||||
|
|
||||||
|
#define DEVICE_SPI_COUNT 2
|
||||||
|
typedef enum {
|
||||||
|
SPI_1 = (int)SPI1_BASE,
|
||||||
|
SPI_2 = (int)SPI2_BASE
|
||||||
|
} SPIName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
I2C_1 = (int)I2C1_BASE,
|
||||||
|
I2C_2 = (int)I2C2_BASE
|
||||||
|
} I2CName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PWM_1 = (int)TIM1_BASE,
|
||||||
|
#if defined TIM2_BASE
|
||||||
|
PWM_2 = (int)TIM2_BASE,
|
||||||
|
#endif
|
||||||
|
PWM_3 = (int)TIM3_BASE,
|
||||||
|
PWM_14 = (int)TIM14_BASE,
|
||||||
|
PWM_15 = (int)TIM15_BASE,
|
||||||
|
PWM_16 = (int)TIM16_BASE,
|
||||||
|
PWM_17 = (int)TIM17_BASE
|
||||||
|
} PWMName;
|
||||||
|
|
||||||
|
#if defined CAN_BASE
|
||||||
|
typedef enum {
|
||||||
|
CAN_1 = (int)CAN_BASE
|
||||||
|
} CANName;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined USB_BASE
|
||||||
|
typedef enum {
|
||||||
|
USB_FS = (int)USB_BASE,
|
||||||
|
} USBName;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -101,8 +101,6 @@ extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
|
||||||
|
|
||||||
extern void SystemInit(void);
|
extern void SystemInit(void);
|
||||||
extern void SystemCoreClockUpdate(void);
|
extern void SystemCoreClockUpdate(void);
|
||||||
extern void SetSysClock(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32f0xx_hal_def.h"
|
#include "stm32f0xx_hal_def.h"
|
||||||
|
|
||||||
/* Include low level driver */
|
|
||||||
#include "stm32f0xx_ll_adc.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_HAL_Driver
|
/** @addtogroup STM32F0xx_HAL_Driver
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32f0xx.h"
|
#include "stm32f0xx.h"
|
||||||
#if defined(USE_HAL_LEGACY)
|
#if defined(USE_HAL_LEGACY)
|
||||||
#include "stm32_hal_legacy.h"
|
#include "Legacy/stm32_hal_legacy.h"
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "stm32f0xx_hal_def.h"
|
#include "stm32f0xx_hal_def.h"
|
||||||
#include "stm32f0xx_ll_rtc.h"
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_HAL_Driver
|
/** @addtogroup STM32F0xx_HAL_Driver
|
||||||
* @{
|
* @{
|
||||||
|
|
|
@ -287,8 +287,7 @@
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
/* ALL MBED targets use same stm32_assert.h */
|
#include "stm32_assert.h" // MBED patch
|
||||||
#include "stm32_assert.h"
|
|
||||||
#else
|
#else
|
||||||
#define assert_param(expr) ((void)0U)
|
#define assert_param(expr) ((void)0U)
|
||||||
#endif /* USE_FULL_ASSERT */
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @author MCD Application Team
|
* @author MCD Application Team
|
||||||
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
|
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
|
||||||
*
|
*
|
||||||
* This file provides two functions and one global variable to be called from
|
* 1. This file provides two functions and one global variable to be called from
|
||||||
* user application:
|
* user application:
|
||||||
* - SystemInit(): This function is called at startup just after reset and
|
* - SystemInit(): This function is called at startup just after reset and
|
||||||
* before branch to main program. This call is made inside
|
* before branch to main program. This call is made inside
|
||||||
|
@ -18,6 +18,25 @@
|
||||||
* be called whenever the core clock is changed
|
* be called whenever the core clock is changed
|
||||||
* during program execution.
|
* during program execution.
|
||||||
*
|
*
|
||||||
|
* 2. After each device reset the HSI (8 MHz) is used as system clock source.
|
||||||
|
* Then SystemInit() function is called, in "startup_stm32f0xx.s" file, to
|
||||||
|
* configure the system clock before to branch to main program.
|
||||||
|
*
|
||||||
|
* 3. This file configures the system clock as follows:
|
||||||
|
*=============================================================================
|
||||||
|
* Supported STM32F0xx device
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
* System Clock source | HSI
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
* SYSCLK(Hz) | 8000000
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
* HCLK(Hz) | 8000000
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
* AHB Prescaler | 1
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
* APB1 Prescaler | 1
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
*=============================================================================
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
|
@ -135,10 +154,6 @@ const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*+ MBED */
|
|
||||||
#if 0
|
|
||||||
/*- MBED */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setup the microcontroller system.
|
* @brief Setup the microcontroller system.
|
||||||
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
|
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
|
||||||
|
@ -206,10 +221,6 @@ void SystemInit(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*+ MBED */
|
|
||||||
#endif
|
|
||||||
/*- MBED */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
||||||
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2014, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PERIPHERALNAMES_H
|
|
||||||
#define MBED_PERIPHERALNAMES_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
ADC_1 = (int)ADC1_BASE
|
|
||||||
} ADCName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
UART_1 = (int)USART1_BASE,
|
|
||||||
UART_2 = (int)USART2_BASE,
|
|
||||||
UART_3 = (int)USART3_BASE,
|
|
||||||
UART_4 = (int)USART4_BASE
|
|
||||||
} UARTName;
|
|
||||||
|
|
||||||
#define DEVICE_SPI_COUNT 2
|
|
||||||
typedef enum {
|
|
||||||
SPI_1 = (int)SPI1_BASE,
|
|
||||||
SPI_2 = (int)SPI2_BASE
|
|
||||||
} SPIName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
I2C_1 = (int)I2C1_BASE,
|
|
||||||
I2C_2 = (int)I2C2_BASE
|
|
||||||
} I2CName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PWM_1 = (int)TIM1_BASE,
|
|
||||||
PWM_3 = (int)TIM3_BASE,
|
|
||||||
PWM_14 = (int)TIM14_BASE,
|
|
||||||
PWM_15 = (int)TIM15_BASE,
|
|
||||||
PWM_16 = (int)TIM16_BASE,
|
|
||||||
PWM_17 = (int)TIM17_BASE
|
|
||||||
} PWMName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
USB_FS = (int)USB_BASE,
|
|
||||||
} USBName;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,57 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* CMSIS-style functionality to support dynamic vectors
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#include "cmsis_nvic.h"
|
|
||||||
|
|
||||||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
|
||||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
|
||||||
|
|
||||||
|
|
||||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Copy and switch to dynamic vectors if first time called
|
|
||||||
if ((SYSCFG->CFGR1 & SYSCFG_CFGR1_MEM_MODE) != SYSCFG_CFGR1_MEM_MODE) {
|
|
||||||
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
|
||||||
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (i*4))) = old_vectors[i];
|
|
||||||
}
|
|
||||||
SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE; // Embedded SRAM mapped at 0x00000000
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the vector
|
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (IRQn*4) + (NVIC_USER_IRQ_OFFSET*4))) = vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
|
||||||
uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
|
||||||
// Return the vector
|
|
||||||
return vectors[IRQn + 16];
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_OBJECTS_H
|
|
||||||
#define MBED_OBJECTS_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
#include "PortNames.h"
|
|
||||||
#include "PeripheralNames.h"
|
|
||||||
#include "PinNames.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct gpio_irq_s {
|
|
||||||
IRQn_Type irq_n;
|
|
||||||
uint32_t irq_index;
|
|
||||||
uint32_t event;
|
|
||||||
PinName pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct port_s {
|
|
||||||
PortName port;
|
|
||||||
uint32_t mask;
|
|
||||||
PinDirection direction;
|
|
||||||
__IO uint32_t *reg_in;
|
|
||||||
__IO uint32_t *reg_out;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "common_objects.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -45,75 +45,6 @@ uint8_t SetSysClock_PLL_HSI(void);
|
||||||
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the microcontroller system.
|
|
||||||
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemInit(void)
|
|
||||||
{
|
|
||||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
|
||||||
/* Set HSION bit */
|
|
||||||
RCC->CR |= (uint32_t)0x00000001U;
|
|
||||||
|
|
||||||
#if defined (STM32F051x8) || defined (STM32F058x8)
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xF8FFB80CU;
|
|
||||||
#else
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0x08FFB80CU;
|
|
||||||
#endif /* STM32F051x8 or STM32F058x8 */
|
|
||||||
|
|
||||||
/* Reset HSEON, CSSON and PLLON bits */
|
|
||||||
RCC->CR &= (uint32_t)0xFEF6FFFFU;
|
|
||||||
|
|
||||||
/* Reset HSEBYP bit */
|
|
||||||
RCC->CR &= (uint32_t)0xFFFBFFFFU;
|
|
||||||
|
|
||||||
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
|
|
||||||
|
|
||||||
/* Reset PREDIV[3:0] bits */
|
|
||||||
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
|
|
||||||
|
|
||||||
#if defined (STM32F072xB) || defined (STM32F078xx)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
|
|
||||||
#elif defined (STM32F071xB)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
|
|
||||||
#elif defined (STM32F091xC) || defined (STM32F098xx)
|
|
||||||
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
|
|
||||||
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
|
|
||||||
#elif defined (STM32F051x8) || defined (STM32F058xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
|
|
||||||
#elif defined (STM32F042x6) || defined (STM32F048xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
|
|
||||||
#elif defined (STM32F070x6) || defined (STM32F070xB)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
|
|
||||||
/* Set default USB clock to PLLCLK, since there is no HSI48 */
|
|
||||||
RCC->CFGR3 |= (uint32_t)0x00000080U;
|
|
||||||
#else
|
|
||||||
#warning "No target selected"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Reset HSI14 bit */
|
|
||||||
RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
|
|
||||||
|
|
||||||
/* Disable all interrupts */
|
|
||||||
RCC->CIR = 0x00000000U;
|
|
||||||
|
|
||||||
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||||
* AHB/APBx prescalers and Flash settings
|
* AHB/APBx prescalers and Flash settings
|
||||||
|
@ -154,11 +85,13 @@ void SetSysClock(void)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* PLL (clocked by HSE) used as System clock source */
|
/* PLL (clocked by HSE) used as System clock source */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
@ -209,6 +142,8 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2018 ARM Limited
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
#ifndef __US_TICKER_DATA_H
|
|
||||||
#define __US_TICKER_DATA_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "stm32f0xx.h"
|
|
||||||
#include "stm32f0xx_ll_tim.h"
|
|
||||||
#include "cmsis_nvic.h"
|
|
||||||
|
|
||||||
#define TIM_MST TIM1
|
|
||||||
#define TIM_MST_UP_IRQ TIM1_BRK_UP_TRG_COM_IRQn
|
|
||||||
#define TIM_MST_OC_IRQ TIM1_CC_IRQn
|
|
||||||
#define TIM_MST_RCC __HAL_RCC_TIM1_CLK_ENABLE()
|
|
||||||
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM1()
|
|
||||||
|
|
||||||
#define TIM_MST_RESET_ON __HAL_RCC_TIM1_FORCE_RESET()
|
|
||||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM1_RELEASE_RESET()
|
|
||||||
|
|
||||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
|
||||||
|
|
||||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __US_TICKER_DATA_H
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2014, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PERIPHERALNAMES_H
|
|
||||||
#define MBED_PERIPHERALNAMES_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
ADC_1 = (int)ADC1_BASE
|
|
||||||
} ADCName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DAC_1 = (int)DAC_BASE
|
|
||||||
} DACName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
UART_1 = (int)USART1_BASE,
|
|
||||||
UART_2 = (int)USART2_BASE,
|
|
||||||
UART_3 = (int)USART3_BASE,
|
|
||||||
UART_4 = (int)USART4_BASE
|
|
||||||
} UARTName;
|
|
||||||
|
|
||||||
#define DEVICE_SPI_COUNT 2
|
|
||||||
typedef enum {
|
|
||||||
SPI_1 = (int)SPI1_BASE,
|
|
||||||
SPI_2 = (int)SPI2_BASE
|
|
||||||
} SPIName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
I2C_1 = (int)I2C1_BASE,
|
|
||||||
I2C_2 = (int)I2C2_BASE
|
|
||||||
} I2CName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PWM_1 = (int)TIM1_BASE,
|
|
||||||
PWM_2 = (int)TIM2_BASE,
|
|
||||||
PWM_3 = (int)TIM3_BASE,
|
|
||||||
PWM_14 = (int)TIM14_BASE,
|
|
||||||
PWM_15 = (int)TIM15_BASE,
|
|
||||||
PWM_16 = (int)TIM16_BASE,
|
|
||||||
PWM_17 = (int)TIM17_BASE
|
|
||||||
} PWMName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CAN_1 = (int)CAN_BASE
|
|
||||||
} CANName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
USB_FS = (int)USB_BASE,
|
|
||||||
} USBName;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_OBJECTS_H
|
|
||||||
#define MBED_OBJECTS_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
#include "PortNames.h"
|
|
||||||
#include "PeripheralNames.h"
|
|
||||||
#include "PinNames.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct gpio_irq_s {
|
|
||||||
IRQn_Type irq_n;
|
|
||||||
uint32_t irq_index;
|
|
||||||
uint32_t event;
|
|
||||||
PinName pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct port_s {
|
|
||||||
PortName port;
|
|
||||||
uint32_t mask;
|
|
||||||
PinDirection direction;
|
|
||||||
__IO uint32_t *reg_in;
|
|
||||||
__IO uint32_t *reg_out;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "common_objects.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -45,75 +45,6 @@ uint8_t SetSysClock_PLL_HSI(void);
|
||||||
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the microcontroller system.
|
|
||||||
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemInit(void)
|
|
||||||
{
|
|
||||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
|
||||||
/* Set HSION bit */
|
|
||||||
RCC->CR |= (uint32_t)0x00000001U;
|
|
||||||
|
|
||||||
#if defined (STM32F051x8) || defined (STM32F058x8)
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xF8FFB80CU;
|
|
||||||
#else
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0x08FFB80CU;
|
|
||||||
#endif /* STM32F051x8 or STM32F058x8 */
|
|
||||||
|
|
||||||
/* Reset HSEON, CSSON and PLLON bits */
|
|
||||||
RCC->CR &= (uint32_t)0xFEF6FFFFU;
|
|
||||||
|
|
||||||
/* Reset HSEBYP bit */
|
|
||||||
RCC->CR &= (uint32_t)0xFFFBFFFFU;
|
|
||||||
|
|
||||||
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
|
|
||||||
|
|
||||||
/* Reset PREDIV[3:0] bits */
|
|
||||||
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
|
|
||||||
|
|
||||||
#if defined (STM32F072xB) || defined (STM32F078xx)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
|
|
||||||
#elif defined (STM32F071xB)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
|
|
||||||
#elif defined (STM32F091xC) || defined (STM32F098xx)
|
|
||||||
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
|
|
||||||
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
|
|
||||||
#elif defined (STM32F051x8) || defined (STM32F058xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
|
|
||||||
#elif defined (STM32F042x6) || defined (STM32F048xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
|
|
||||||
#elif defined (STM32F070x6) || defined (STM32F070xB)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
|
|
||||||
/* Set default USB clock to PLLCLK, since there is no HSI48 */
|
|
||||||
RCC->CFGR3 |= (uint32_t)0x00000080U;
|
|
||||||
#else
|
|
||||||
#warning "No target selected"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Reset HSI14 bit */
|
|
||||||
RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
|
|
||||||
|
|
||||||
/* Disable all interrupts */
|
|
||||||
RCC->CIR = 0x00000000U;
|
|
||||||
|
|
||||||
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||||
* AHB/APBx prescalers and Flash settings
|
* AHB/APBx prescalers and Flash settings
|
||||||
|
@ -154,11 +85,13 @@ void SetSysClock(void)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* PLL (clocked by HSE) used as System clock source */
|
/* PLL (clocked by HSE) used as System clock source */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
@ -209,6 +142,8 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2018 ARM Limited
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
#ifndef __US_TICKER_DATA_H
|
|
||||||
#define __US_TICKER_DATA_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "stm32f0xx.h"
|
|
||||||
#include "stm32f0xx_ll_tim.h"
|
|
||||||
#include "cmsis_nvic.h"
|
|
||||||
|
|
||||||
#define TIM_MST TIM2
|
|
||||||
#define TIM_MST_IRQ TIM2_IRQn
|
|
||||||
#define TIM_MST_RCC __HAL_RCC_TIM2_CLK_ENABLE()
|
|
||||||
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM2()
|
|
||||||
|
|
||||||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
|
||||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
|
||||||
|
|
||||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
|
||||||
|
|
||||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __US_TICKER_DATA_H
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2014, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PERIPHERALNAMES_H
|
|
||||||
#define MBED_PERIPHERALNAMES_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
ADC_1 = (int)ADC1_BASE
|
|
||||||
} ADCName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
DAC_1 = (int)DAC_BASE
|
|
||||||
} DACName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
UART_1 = (int)USART1_BASE,
|
|
||||||
UART_2 = (int)USART2_BASE,
|
|
||||||
UART_3 = (int)USART3_BASE,
|
|
||||||
UART_4 = (int)USART4_BASE,
|
|
||||||
UART_5 = (int)USART5_BASE,
|
|
||||||
UART_6 = (int)USART6_BASE,
|
|
||||||
UART_7 = (int)USART7_BASE,
|
|
||||||
UART_8 = (int)USART8_BASE
|
|
||||||
} UARTName;
|
|
||||||
|
|
||||||
#define DEVICE_SPI_COUNT 2
|
|
||||||
typedef enum {
|
|
||||||
SPI_1 = (int)SPI1_BASE,
|
|
||||||
SPI_2 = (int)SPI2_BASE
|
|
||||||
} SPIName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
I2C_1 = (int)I2C1_BASE,
|
|
||||||
I2C_2 = (int)I2C2_BASE
|
|
||||||
} I2CName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
PWM_1 = (int)TIM1_BASE,
|
|
||||||
PWM_2 = (int)TIM2_BASE,
|
|
||||||
PWM_3 = (int)TIM3_BASE,
|
|
||||||
PWM_14 = (int)TIM14_BASE,
|
|
||||||
PWM_15 = (int)TIM15_BASE,
|
|
||||||
PWM_16 = (int)TIM16_BASE,
|
|
||||||
PWM_17 = (int)TIM17_BASE
|
|
||||||
} PWMName;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CAN_1 = (int)CAN_BASE
|
|
||||||
} CANName;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,56 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* CMSIS-style functionality to support dynamic vectors
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#include "cmsis_nvic.h"
|
|
||||||
|
|
||||||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
|
||||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
|
||||||
|
|
||||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// Copy and switch to dynamic vectors if first time called
|
|
||||||
if ((SYSCFG->CFGR1 & SYSCFG_CFGR1_MEM_MODE) != SYSCFG_CFGR1_MEM_MODE) {
|
|
||||||
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
|
||||||
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (i*4))) = old_vectors[i];
|
|
||||||
}
|
|
||||||
SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE; // Embedded SRAM mapped at 0x00000000
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the vector
|
|
||||||
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (IRQn*4) + (NVIC_USER_IRQ_OFFSET*4))) = vector;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
|
||||||
uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
|
||||||
// Return the vector
|
|
||||||
return vectors[IRQn + 16];
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
*******************************************************************************
|
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
#ifndef MBED_OBJECTS_H
|
|
||||||
#define MBED_OBJECTS_H
|
|
||||||
|
|
||||||
#include "cmsis.h"
|
|
||||||
#include "PortNames.h"
|
|
||||||
#include "PeripheralNames.h"
|
|
||||||
#include "PinNames.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct gpio_irq_s {
|
|
||||||
IRQn_Type irq_n;
|
|
||||||
uint32_t irq_index;
|
|
||||||
uint32_t event;
|
|
||||||
PinName pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct port_s {
|
|
||||||
PortName port;
|
|
||||||
uint32_t mask;
|
|
||||||
PinDirection direction;
|
|
||||||
__IO uint32_t *reg_in;
|
|
||||||
__IO uint32_t *reg_out;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "common_objects.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -45,75 +45,6 @@ uint8_t SetSysClock_PLL_HSI(void);
|
||||||
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
#endif /* ((CLOCK_SOURCE) & USE_PLL_HSI) */
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Setup the microcontroller system.
|
|
||||||
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
|
|
||||||
* @param None
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void SystemInit(void)
|
|
||||||
{
|
|
||||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
|
||||||
/* Set HSION bit */
|
|
||||||
RCC->CR |= (uint32_t)0x00000001U;
|
|
||||||
|
|
||||||
#if defined (STM32F051x8) || defined (STM32F058x8)
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE and MCOSEL[2:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xF8FFB80CU;
|
|
||||||
#else
|
|
||||||
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, MCOSEL[2:0], MCOPRE[2:0] and PLLNODIV bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0x08FFB80CU;
|
|
||||||
#endif /* STM32F051x8 or STM32F058x8 */
|
|
||||||
|
|
||||||
/* Reset HSEON, CSSON and PLLON bits */
|
|
||||||
RCC->CR &= (uint32_t)0xFEF6FFFFU;
|
|
||||||
|
|
||||||
/* Reset HSEBYP bit */
|
|
||||||
RCC->CR &= (uint32_t)0xFFFBFFFFU;
|
|
||||||
|
|
||||||
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
|
|
||||||
RCC->CFGR &= (uint32_t)0xFFC0FFFFU;
|
|
||||||
|
|
||||||
/* Reset PREDIV[3:0] bits */
|
|
||||||
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0U;
|
|
||||||
|
|
||||||
#if defined (STM32F072xB) || defined (STM32F078xx)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFCFE2CU;
|
|
||||||
#elif defined (STM32F071xB)
|
|
||||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFCEACU;
|
|
||||||
#elif defined (STM32F091xC) || defined (STM32F098xx)
|
|
||||||
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFF0FEACU;
|
|
||||||
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEECU;
|
|
||||||
#elif defined (STM32F051x8) || defined (STM32F058xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEACU;
|
|
||||||
#elif defined (STM32F042x6) || defined (STM32F048xx)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE2CU;
|
|
||||||
#elif defined (STM32F070x6) || defined (STM32F070xB)
|
|
||||||
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
|
|
||||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE6CU;
|
|
||||||
/* Set default USB clock to PLLCLK, since there is no HSI48 */
|
|
||||||
RCC->CFGR3 |= (uint32_t)0x00000080U;
|
|
||||||
#else
|
|
||||||
#warning "No target selected"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Reset HSI14 bit */
|
|
||||||
RCC->CR2 &= (uint32_t)0xFFFFFFFEU;
|
|
||||||
|
|
||||||
/* Disable all interrupts */
|
|
||||||
RCC->CIR = 0x00000000U;
|
|
||||||
|
|
||||||
/* Enable SYSCFGENR in APB2EN, needed for 1st call of NVIC_SetVector, to copy vectors from flash to ram */
|
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||||
* AHB/APBx prescalers and Flash settings
|
* AHB/APBx prescalers and Flash settings
|
||||||
|
@ -154,11 +85,13 @@ void SetSysClock(void)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* PLL (clocked by HSE) used as System clock source */
|
/* PLL (clocked by HSE) used as System clock source */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
MBED_WEAK uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||||
{
|
{
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
//Select HSI as system clock source to allow modification of the PLL configuration
|
//Select HSI as system clock source to allow modification of the PLL configuration
|
||||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
|
||||||
|
@ -209,6 +142,8 @@ uint8_t SetSysClock_PLL_HSI(void)
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
|
||||||
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||||
|
|
|
@ -1,123 +0,0 @@
|
||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @file system_stm32f0xx.h
|
|
||||||
* @author MCD Application Team
|
|
||||||
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
|
|
||||||
******************************************************************************
|
|
||||||
* @attention
|
|
||||||
*
|
|
||||||
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
* are permitted provided that the following conditions are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup CMSIS
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup stm32f0xx_system
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Define to prevent recursive inclusion
|
|
||||||
*/
|
|
||||||
#ifndef __SYSTEM_STM32F0XX_H
|
|
||||||
#define __SYSTEM_STM32F0XX_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_System_Includes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_System_Exported_types
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/* This variable is updated in three ways:
|
|
||||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
|
||||||
3) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
|
||||||
3) by calling HAL API function HAL_RCC_ClockConfig()
|
|
||||||
Note: If you use this function to configure the system clock; then there
|
|
||||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
|
||||||
variable is updated automatically.
|
|
||||||
*/
|
|
||||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
|
||||||
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
|
|
||||||
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_System_Exported_Constants
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_System_Exported_Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32F0xx_System_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void SystemInit(void);
|
|
||||||
extern void SystemCoreClockUpdate(void);
|
|
||||||
extern void SetSysClock(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*__SYSTEM_STM32F0XX_H */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2018 ARM Limited
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
#ifndef __US_TICKER_DATA_H
|
|
||||||
#define __US_TICKER_DATA_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "stm32f0xx.h"
|
|
||||||
#include "stm32f0xx_ll_tim.h"
|
|
||||||
#include "cmsis_nvic.h"
|
|
||||||
|
|
||||||
#define TIM_MST TIM2
|
|
||||||
#define TIM_MST_IRQ TIM2_IRQn
|
|
||||||
#define TIM_MST_RCC __HAL_RCC_TIM2_CLK_ENABLE()
|
|
||||||
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM2()
|
|
||||||
|
|
||||||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
|
||||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
|
||||||
|
|
||||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
|
||||||
|
|
||||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __US_TICKER_DATA_H
|
|
||||||
|
|
|
@ -1,30 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2016, STMicroelectronics
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include "analogin_api.h"
|
#include "analogin_api.h"
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include "analogout_api.h"
|
#include "analogout_api.h"
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2006-2017 ARM Limited
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* you may not use this file except in compliance with the License.
|
* All rights reserved.
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
******************************************************************************
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_CAN_DEVICE_H
|
#ifndef MBED_CAN_DEVICE_H
|
||||||
#define MBED_CAN_DEVICE_H
|
#define MBED_CAN_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2019 ARM Limited
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
******************************************************************************
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* you may not use this file except in compliance with the License.
|
* All rights reserved.
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
******************************************************************************
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_CMSIS_H
|
#ifndef MBED_CMSIS_H
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
||||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
||||||
|
|
||||||
|
|
||||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
* Copyright (c) 2017 ARM Limited
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017 STMicroelectronics
|
******************************************************************************
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* you may not use this file except in compliance with the License.
|
* All rights reserved.
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
******************************************************************************
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "gpio_irq_device.h"
|
#include "gpio_irq_device.h"
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_GPIO_IRQ_DEVICE_H
|
#ifndef MBED_GPIO_IRQ_DEVICE_H
|
||||||
#define MBED_GPIO_IRQ_DEVICE_H
|
#define MBED_GPIO_IRQ_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_I2C_DEVICE_H
|
#ifndef MBED_I2C_DEVICE_H
|
||||||
#define MBED_I2C_DEVICE_H
|
#define MBED_I2C_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,33 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2016, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
#ifndef MBED_COMMON_OBJECTS_H
|
|
||||||
#define MBED_COMMON_OBJECTS_H
|
#ifndef MBED_OBJECTS_H
|
||||||
|
#define MBED_OBJECTS_H
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "PortNames.h"
|
#include "PortNames.h"
|
||||||
#include "PeripheralNames.h"
|
#include "PeripheralNames.h"
|
||||||
#include "PinNames.h"
|
#include "PinNames.h"
|
||||||
|
#include "gpio_object.h"
|
||||||
|
|
||||||
#include "stm32f0xx_ll_usart.h"
|
#include "stm32f0xx_ll_usart.h"
|
||||||
#include "stm32f0xx_ll_tim.h"
|
#include "stm32f0xx_ll_tim.h"
|
||||||
#include "stm32f0xx_ll_pwr.h"
|
#include "stm32f0xx_ll_pwr.h"
|
||||||
#include "stm32f0xx_ll_crc.h"
|
#include "stm32f0xx_ll_crc.h"
|
||||||
|
#include "stm32f0xx_ll_adc.h"
|
||||||
|
#include "stm32f0xx_ll_rtc.h"
|
||||||
#include "stm32f0xx_ll_rcc.h"
|
#include "stm32f0xx_ll_rcc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -130,13 +120,30 @@ struct analogin_s {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct gpio_irq_s {
|
||||||
|
IRQn_Type irq_n;
|
||||||
|
uint32_t irq_index;
|
||||||
|
uint32_t event;
|
||||||
|
PinName pin;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct port_s {
|
||||||
|
PortName port;
|
||||||
|
uint32_t mask;
|
||||||
|
PinDirection direction;
|
||||||
|
__IO uint32_t *reg_in;
|
||||||
|
__IO uint32_t *reg_out;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef CRC_PROG_POLYNOMIAL_SUPPORT
|
#ifdef CRC_PROG_POLYNOMIAL_SUPPORT
|
||||||
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
|
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
|
||||||
#else
|
#else
|
||||||
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 32 && (polynomial) == 0x04C11DB7)
|
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 32 && (polynomial) == 0x04C11DB7)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gpio_object.h"
|
/* STM32F0 HAL doesn't provide this API called in rtc_api.c */
|
||||||
|
#define RTC_WKUP_IRQn RTC_IRQn
|
||||||
|
|
||||||
|
|
||||||
#if DEVICE_ANALOGOUT
|
#if DEVICE_ANALOGOUT
|
||||||
struct dac_s {
|
struct dac_s {
|
||||||
|
@ -166,7 +173,4 @@ struct flash_s {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* STM32F0 HAL doesn't provide this API called in rtc_api.c */
|
|
||||||
#define RTC_WKUP_IRQn RTC_IRQn
|
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2016, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_PIN_DEVICE_H
|
#ifndef MBED_PIN_DEVICE_H
|
||||||
#define MBED_PIN_DEVICE_H
|
#define MBED_PIN_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "pwmout_api.h"
|
#include "pwmout_api.h"
|
||||||
#include "pwmout_device.h"
|
#include "pwmout_device.h"
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_PWMOUT_DEVICE_H
|
#ifndef MBED_PWMOUT_DEVICE_H
|
||||||
#define MBED_PWMOUT_DEVICE_H
|
#define MBED_PWMOUT_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,16 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2015, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "spi_api.h"
|
#include "spi_api.h"
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
/* mbed Microcontroller Library
|
/* mbed Microcontroller Library
|
||||||
*******************************************************************************
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Copyright (c) 2017, STMicroelectronics
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* 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
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
******************************************************************************
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MBED_SPI_DEVICE_H
|
#ifndef MBED_SPI_DEVICE_H
|
||||||
#define MBED_SPI_DEVICE_H
|
#define MBED_SPI_DEVICE_H
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-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
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __US_TICKER_DATA_H
|
||||||
|
#define __US_TICKER_DATA_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "stm32f0xx.h"
|
||||||
|
#include "stm32f0xx_ll_tim.h"
|
||||||
|
#include "cmsis_nvic.h"
|
||||||
|
|
||||||
|
#if defined TIM2_BASE
|
||||||
|
|
||||||
|
#define TIM_MST TIM2
|
||||||
|
#define TIM_MST_IRQ TIM2_IRQn
|
||||||
|
#define TIM_MST_RCC __HAL_RCC_TIM2_CLK_ENABLE()
|
||||||
|
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM2()
|
||||||
|
|
||||||
|
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||||
|
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||||
|
|
||||||
|
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||||
|
|
||||||
|
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||||
|
|
||||||
|
#else // TIM2_BASE
|
||||||
|
|
||||||
|
#define TIM_MST TIM1
|
||||||
|
#define TIM_MST_UP_IRQ TIM1_BRK_UP_TRG_COM_IRQn
|
||||||
|
#define TIM_MST_OC_IRQ TIM1_CC_IRQn
|
||||||
|
#define TIM_MST_RCC __HAL_RCC_TIM1_CLK_ENABLE()
|
||||||
|
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM1()
|
||||||
|
|
||||||
|
#define TIM_MST_RESET_ON __HAL_RCC_TIM1_FORCE_RESET()
|
||||||
|
#define TIM_MST_RESET_OFF __HAL_RCC_TIM1_RELEASE_RESET()
|
||||||
|
|
||||||
|
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||||
|
|
||||||
|
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||||
|
|
||||||
|
#endif // TIM2_BASE
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __US_TICKER_DATA_H
|
||||||
|
|
Loading…
Reference in New Issue