mirror of https://github.com/ARMmbed/mbed-os.git
commit
79ec104b3c
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,239 @@
|
|||
;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f070xb.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 05-December-2014
|
||||
;* Description : STM32F070x8/STM32F070xB devices vector table for MDK-ARM toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM0 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
;
|
||||
;* 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.
|
||||
;
|
||||
;*******************************************************************************
|
||||
|
||||
; Amount of memory (in bytes) allocated for Stack
|
||||
; Tailor this value to your application needs
|
||||
; <h> Stack Configuration
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x00000400
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
EXPORT __initial_sp
|
||||
|
||||
Stack_Mem SPACE Stack_Size
|
||||
__initial_sp EQU 0x20004000 ; Top of RAM (16KB)
|
||||
|
||||
|
||||
; <h> Heap Configuration
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x00000400
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
EXPORT __heap_base
|
||||
EXPORT __heap_limit
|
||||
|
||||
__heap_base
|
||||
Heap_Mem SPACE Heap_Size
|
||||
__heap_limit EQU (__initial_sp - Stack_Size)
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD 0 ; Reserved
|
||||
DCD RTC_IRQHandler ; RTC through EXTI Line
|
||||
DCD FLASH_IRQHandler ; FLASH
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
|
||||
DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
|
||||
DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
|
||||
DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5
|
||||
DCD ADC1_IRQHandler ; ADC1
|
||||
DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD TIM14_IRQHandler ; TIM14
|
||||
DCD TIM15_IRQHandler ; TIM15
|
||||
DCD TIM16_IRQHandler ; TIM16
|
||||
DCD TIM17_IRQHandler ; TIM17
|
||||
DCD I2C1_IRQHandler ; I2C1
|
||||
DCD I2C2_IRQHandler ; I2C2
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_4_IRQHandler ; USART3 & USART4
|
||||
DCD 0 ; Reserved
|
||||
DCD USB_IRQHandler ; USB
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler routine
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_15_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_5_IRQHandler [WEAK]
|
||||
EXPORT ADC1_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT TIM14_IRQHandler [WEAK]
|
||||
EXPORT TIM15_IRQHandler [WEAK]
|
||||
EXPORT TIM16_IRQHandler [WEAK]
|
||||
EXPORT TIM17_IRQHandler [WEAK]
|
||||
EXPORT I2C1_IRQHandler [WEAK]
|
||||
EXPORT I2C2_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_4_IRQHandler [WEAK]
|
||||
EXPORT USB_IRQHandler [WEAK]
|
||||
|
||||
|
||||
WWDG_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_1_IRQHandler
|
||||
EXTI2_3_IRQHandler
|
||||
EXTI4_15_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_3_IRQHandler
|
||||
DMA1_Channel4_5_IRQHandler
|
||||
ADC1_IRQHandler
|
||||
TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
TIM14_IRQHandler
|
||||
TIM15_IRQHandler
|
||||
TIM16_IRQHandler
|
||||
TIM17_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
I2C2_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_4_IRQHandler
|
||||
USB_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
END
|
|
@ -0,0 +1,45 @@
|
|||
; Scatter-Loading Description File
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; 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.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; STM32F070RB: 128KB FLASH (0x20000) + 16KB RAM (0x4000)
|
||||
|
||||
LR_IROM1 0x08000000 0x20000 { ; load region size_region
|
||||
ER_IROM1 0x08000000 0x20000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
; 48 vectors = 192 bytes (0xC0) to be reserved in RAM
|
||||
RW_IRAM1 (0x20000000+0xC0) (0x4000-0xC0) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/* mbed Microcontroller Library - stackheap
|
||||
* Setup a fixed single stack/heap memory model,
|
||||
* between the top of the RW/ZI region and the stackpointer
|
||||
*******************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rt_misc.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char Image$$RW_IRAM1$$ZI$$Limit[];
|
||||
|
||||
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
|
||||
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
|
||||
uint32_t sp_limit = __current_sp();
|
||||
|
||||
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
|
||||
|
||||
struct __initial_stackheap r;
|
||||
r.heap_base = zi_limit;
|
||||
r.heap_limit = sp_limit;
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,212 @@
|
|||
;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f070xb.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 05-December-2014
|
||||
;* Description : STM32F070x8/STM32F070xB devices vector table for MDK-ARM toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == Reset_Handler
|
||||
;* - Set the vector table entries with the exceptions ISR address
|
||||
;* - Branches to __main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the CortexM0 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;* <<< Use Configuration Wizard in Context Menu >>>
|
||||
;*******************************************************************************
|
||||
;
|
||||
;* 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.
|
||||
;
|
||||
;*******************************************************************************
|
||||
|
||||
__initial_sp EQU 0x20004000 ; Top of RAM (16KB)
|
||||
|
||||
PRESERVE8
|
||||
THUMB
|
||||
|
||||
|
||||
; Vector Table Mapped to Address 0 at Reset
|
||||
AREA RESET, DATA, READONLY
|
||||
EXPORT __Vectors
|
||||
EXPORT __Vectors_End
|
||||
EXPORT __Vectors_Size
|
||||
|
||||
__Vectors DCD __initial_sp ; Top of Stack
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD 0 ; Reserved
|
||||
DCD RTC_IRQHandler ; RTC through EXTI Line
|
||||
DCD FLASH_IRQHandler ; FLASH
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
|
||||
DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
|
||||
DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
|
||||
DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5
|
||||
DCD ADC1_IRQHandler ; ADC1
|
||||
DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD TIM14_IRQHandler ; TIM14
|
||||
DCD TIM15_IRQHandler ; TIM15
|
||||
DCD TIM16_IRQHandler ; TIM16
|
||||
DCD TIM17_IRQHandler ; TIM17
|
||||
DCD I2C1_IRQHandler ; I2C1
|
||||
DCD I2C2_IRQHandler ; I2C2
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_4_IRQHandler ; USART3 & USART4
|
||||
DCD 0 ; Reserved
|
||||
DCD USB_IRQHandler ; USB
|
||||
|
||||
__Vectors_End
|
||||
|
||||
__Vectors_Size EQU __Vectors_End - __Vectors
|
||||
|
||||
AREA |.text|, CODE, READONLY
|
||||
|
||||
; Reset handler routine
|
||||
Reset_Handler PROC
|
||||
EXPORT Reset_Handler [WEAK]
|
||||
IMPORT __main
|
||||
IMPORT SystemInit
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__main
|
||||
BX R0
|
||||
ENDP
|
||||
|
||||
; Dummy Exception Handlers (infinite loops which can be modified)
|
||||
|
||||
NMI_Handler PROC
|
||||
EXPORT NMI_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
HardFault_Handler\
|
||||
PROC
|
||||
EXPORT HardFault_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SVC_Handler PROC
|
||||
EXPORT SVC_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
PendSV_Handler PROC
|
||||
EXPORT PendSV_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
SysTick_Handler PROC
|
||||
EXPORT SysTick_Handler [WEAK]
|
||||
B .
|
||||
ENDP
|
||||
|
||||
Default_Handler PROC
|
||||
|
||||
EXPORT WWDG_IRQHandler [WEAK]
|
||||
EXPORT RTC_IRQHandler [WEAK]
|
||||
EXPORT FLASH_IRQHandler [WEAK]
|
||||
EXPORT RCC_IRQHandler [WEAK]
|
||||
EXPORT EXTI0_1_IRQHandler [WEAK]
|
||||
EXPORT EXTI2_3_IRQHandler [WEAK]
|
||||
EXPORT EXTI4_15_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel1_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel2_3_IRQHandler [WEAK]
|
||||
EXPORT DMA1_Channel4_5_IRQHandler [WEAK]
|
||||
EXPORT ADC1_IRQHandler [WEAK]
|
||||
EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK]
|
||||
EXPORT TIM1_CC_IRQHandler [WEAK]
|
||||
EXPORT TIM3_IRQHandler [WEAK]
|
||||
EXPORT TIM6_IRQHandler [WEAK]
|
||||
EXPORT TIM7_IRQHandler [WEAK]
|
||||
EXPORT TIM14_IRQHandler [WEAK]
|
||||
EXPORT TIM15_IRQHandler [WEAK]
|
||||
EXPORT TIM16_IRQHandler [WEAK]
|
||||
EXPORT TIM17_IRQHandler [WEAK]
|
||||
EXPORT I2C1_IRQHandler [WEAK]
|
||||
EXPORT I2C2_IRQHandler [WEAK]
|
||||
EXPORT SPI1_IRQHandler [WEAK]
|
||||
EXPORT SPI2_IRQHandler [WEAK]
|
||||
EXPORT USART1_IRQHandler [WEAK]
|
||||
EXPORT USART2_IRQHandler [WEAK]
|
||||
EXPORT USART3_4_IRQHandler [WEAK]
|
||||
EXPORT USB_IRQHandler [WEAK]
|
||||
|
||||
|
||||
WWDG_IRQHandler
|
||||
RTC_IRQHandler
|
||||
FLASH_IRQHandler
|
||||
RCC_IRQHandler
|
||||
EXTI0_1_IRQHandler
|
||||
EXTI2_3_IRQHandler
|
||||
EXTI4_15_IRQHandler
|
||||
DMA1_Channel1_IRQHandler
|
||||
DMA1_Channel2_3_IRQHandler
|
||||
DMA1_Channel4_5_IRQHandler
|
||||
ADC1_IRQHandler
|
||||
TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
TIM1_CC_IRQHandler
|
||||
TIM3_IRQHandler
|
||||
TIM6_IRQHandler
|
||||
TIM7_IRQHandler
|
||||
TIM14_IRQHandler
|
||||
TIM15_IRQHandler
|
||||
TIM16_IRQHandler
|
||||
TIM17_IRQHandler
|
||||
I2C1_IRQHandler
|
||||
I2C2_IRQHandler
|
||||
SPI1_IRQHandler
|
||||
SPI2_IRQHandler
|
||||
USART1_IRQHandler
|
||||
USART2_IRQHandler
|
||||
USART3_4_IRQHandler
|
||||
USB_IRQHandler
|
||||
|
||||
B .
|
||||
|
||||
ENDP
|
||||
|
||||
ALIGN
|
||||
END
|
|
@ -0,0 +1,45 @@
|
|||
; Scatter-Loading Description File
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; 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.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; STM32F070RB: 128KB FLASH (0x20000) + 16KB RAM (0x4000)
|
||||
|
||||
LR_IROM1 0x08000000 0x20000 { ; load region size_region
|
||||
ER_IROM1 0x08000000 0x20000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
}
|
||||
|
||||
; 48 vectors = 192 bytes (0xC0) to be reserved in RAM
|
||||
RW_IRAM1 (0x20000000+0xC0) (0x4000-0xC0) { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
/* mbed Microcontroller Library - stackheap
|
||||
* Setup a fixed single stack/heap memory model,
|
||||
* between the top of the RW/ZI region and the stackpointer
|
||||
*******************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rt_misc.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char Image$$RW_IRAM1$$ZI$$Limit[];
|
||||
|
||||
extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
|
||||
uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
|
||||
uint32_t sp_limit = __current_sp();
|
||||
|
||||
zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
|
||||
|
||||
struct __initial_stackheap r;
|
||||
r.heap_base = zi_limit;
|
||||
r.heap_limit = sp_limit;
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,153 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128k
|
||||
RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 16k - 0x0C0
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
* _estack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
__etext = .;
|
||||
_sidata = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
_sdata = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
_edata = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
_sbss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
_ebss = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
_estack = __StackTop;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
|
@ -0,0 +1,296 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file startup_stm32f070xb.s
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 05-December-2014
|
||||
* @brief STM32F070xb/STM32F070x8 devices vector table for Atollic TrueSTUDIO toolchain.
|
||||
* This module performs:
|
||||
* - Set the initial SP
|
||||
* - Set the initial PC == Reset_Handler,
|
||||
* - Set the vector table entries with the exceptions ISR address
|
||||
* - Branches to main in the C library (which eventually
|
||||
* calls main()).
|
||||
* After Reset the Cortex-M0 processor is in Thread mode,
|
||||
* priority is Privileged, and the Stack is set to Main.
|
||||
******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m0
|
||||
.fpu softvfp
|
||||
.thumb
|
||||
|
||||
.global g_pfnVectors
|
||||
.global Default_Handler
|
||||
|
||||
/* start address for the initialization values of the .data section.
|
||||
defined in linker script */
|
||||
.word _sidata
|
||||
/* start address for the .data section. defined in linker script */
|
||||
.word _sdata
|
||||
/* end address for the .data section. defined in linker script */
|
||||
.word _edata
|
||||
/* start address for the .bss section. defined in linker script */
|
||||
.word _sbss
|
||||
/* end address for the .bss section. defined in linker script */
|
||||
.word _ebss
|
||||
|
||||
.section .text.Reset_Handler
|
||||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr r0, =_estack
|
||||
mov sp, r0 /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
movs r1, #0
|
||||
b LoopCopyDataInit
|
||||
|
||||
CopyDataInit:
|
||||
ldr r3, =_sidata
|
||||
ldr r3, [r3, r1]
|
||||
str r3, [r0, r1]
|
||||
adds r1, r1, #4
|
||||
|
||||
LoopCopyDataInit:
|
||||
ldr r0, =_sdata
|
||||
ldr r3, =_edata
|
||||
adds r2, r0, r1
|
||||
cmp r2, r3
|
||||
bcc CopyDataInit
|
||||
ldr r2, =_sbss
|
||||
b LoopFillZerobss
|
||||
/* Zero fill the bss segment. */
|
||||
FillZerobss:
|
||||
movs r3, #0
|
||||
str r3, [r2]
|
||||
adds r2, r2, #4
|
||||
|
||||
|
||||
LoopFillZerobss:
|
||||
ldr r3, = _ebss
|
||||
cmp r2, r3
|
||||
bcc FillZerobss
|
||||
|
||||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInit
|
||||
/* Call static constructors */
|
||||
bl __libc_init_array
|
||||
/* Call the application's entry point.*/
|
||||
bl main
|
||||
|
||||
LoopForever:
|
||||
b LoopForever
|
||||
|
||||
|
||||
.size Reset_Handler, .-Reset_Handler
|
||||
|
||||
/**
|
||||
* @brief This is the code that gets called when the processor receives an
|
||||
* unexpected interrupt. This simply enters an infinite loop, preserving
|
||||
* the system state for examination by a debugger.
|
||||
*
|
||||
* @param None
|
||||
* @retval : None
|
||||
*/
|
||||
.section .text.Default_Handler,"ax",%progbits
|
||||
Default_Handler:
|
||||
Infinite_Loop:
|
||||
b Infinite_Loop
|
||||
.size Default_Handler, .-Default_Handler
|
||||
/******************************************************************************
|
||||
*
|
||||
* The minimal vector table for a Cortex M0. Note that the proper constructs
|
||||
* must be placed on this to ensure that it ends up at physical address
|
||||
* 0x0000.0000.
|
||||
*
|
||||
******************************************************************************/
|
||||
.section .isr_vector,"a",%progbits
|
||||
.type g_pfnVectors, %object
|
||||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
|
||||
g_pfnVectors:
|
||||
.word _estack
|
||||
.word Reset_Handler
|
||||
.word NMI_Handler
|
||||
.word HardFault_Handler
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0
|
||||
.word SVC_Handler
|
||||
.word 0
|
||||
.word 0
|
||||
.word PendSV_Handler
|
||||
.word SysTick_Handler
|
||||
.word WWDG_IRQHandler /* Window WatchDog */
|
||||
.word 0 /* Reserved */
|
||||
.word RTC_IRQHandler /* RTC through the EXTI line */
|
||||
.word FLASH_IRQHandler /* FLASH */
|
||||
.word RCC_IRQHandler /* RCC */
|
||||
.word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */
|
||||
.word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */
|
||||
.word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */
|
||||
.word 0 /* Reserved */
|
||||
.word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
|
||||
.word DMA1_Channel2_3_IRQHandler /* DMA1 Channel 2 and Channel 3 */
|
||||
.word DMA1_Channel4_5_IRQHandler /* DMA1 Channel 4 and Channel 5 */
|
||||
.word ADC1_IRQHandler /* ADC1 */
|
||||
.word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */
|
||||
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
|
||||
.word 0 /* Reserved */
|
||||
.word TIM3_IRQHandler /* TIM3 */
|
||||
.word TIM6_IRQHandler /* TIM6 */
|
||||
.word TIM7_IRQHandler /* TIM7 */
|
||||
.word TIM14_IRQHandler /* TIM14 */
|
||||
.word TIM15_IRQHandler /* TIM15 */
|
||||
.word TIM16_IRQHandler /* TIM16 */
|
||||
.word TIM17_IRQHandler /* TIM17 */
|
||||
.word I2C1_IRQHandler /* I2C1 */
|
||||
.word I2C2_IRQHandler /* I2C2 */
|
||||
.word SPI1_IRQHandler /* SPI1 */
|
||||
.word SPI2_IRQHandler /* SPI2 */
|
||||
.word USART1_IRQHandler /* USART1 */
|
||||
.word USART2_IRQHandler /* USART2 */
|
||||
.word USART3_4_IRQHandler /* USART3 and USART4 */
|
||||
.word 0 /* Reserved */
|
||||
.word USB_IRQHandler /* USB */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Provide weak aliases for each Exception handler to the Default_Handler.
|
||||
* As they are weak aliases, any function with the same name will override
|
||||
* this definition.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
.weak NMI_Handler
|
||||
.thumb_set NMI_Handler,Default_Handler
|
||||
|
||||
.weak HardFault_Handler
|
||||
.thumb_set HardFault_Handler,Default_Handler
|
||||
|
||||
.weak SVC_Handler
|
||||
.thumb_set SVC_Handler,Default_Handler
|
||||
|
||||
.weak PendSV_Handler
|
||||
.thumb_set PendSV_Handler,Default_Handler
|
||||
|
||||
.weak SysTick_Handler
|
||||
.thumb_set SysTick_Handler,Default_Handler
|
||||
|
||||
.weak WWDG_IRQHandler
|
||||
.thumb_set WWDG_IRQHandler,Default_Handler
|
||||
|
||||
.weak RTC_IRQHandler
|
||||
.thumb_set RTC_IRQHandler,Default_Handler
|
||||
|
||||
.weak FLASH_IRQHandler
|
||||
.thumb_set FLASH_IRQHandler,Default_Handler
|
||||
|
||||
.weak RCC_IRQHandler
|
||||
.thumb_set RCC_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI0_1_IRQHandler
|
||||
.thumb_set EXTI0_1_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI2_3_IRQHandler
|
||||
.thumb_set EXTI2_3_IRQHandler,Default_Handler
|
||||
|
||||
.weak EXTI4_15_IRQHandler
|
||||
.thumb_set EXTI4_15_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel1_IRQHandler
|
||||
.thumb_set DMA1_Channel1_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel2_3_IRQHandler
|
||||
.thumb_set DMA1_Channel2_3_IRQHandler,Default_Handler
|
||||
|
||||
.weak DMA1_Channel4_5_IRQHandler
|
||||
.thumb_set DMA1_Channel4_5_IRQHandler,Default_Handler
|
||||
|
||||
.weak ADC1_IRQHandler
|
||||
.thumb_set ADC1_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
.thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM1_CC_IRQHandler
|
||||
.thumb_set TIM1_CC_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM3_IRQHandler
|
||||
.thumb_set TIM3_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM6_IRQHandler
|
||||
.thumb_set TIM6_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM7_IRQHandler
|
||||
.thumb_set TIM7_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM14_IRQHandler
|
||||
.thumb_set TIM14_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM15_IRQHandler
|
||||
.thumb_set TIM15_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM16_IRQHandler
|
||||
.thumb_set TIM16_IRQHandler,Default_Handler
|
||||
|
||||
.weak TIM17_IRQHandler
|
||||
.thumb_set TIM17_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C1_IRQHandler
|
||||
.thumb_set I2C1_IRQHandler,Default_Handler
|
||||
|
||||
.weak I2C2_IRQHandler
|
||||
.thumb_set I2C2_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI1_IRQHandler
|
||||
.thumb_set SPI1_IRQHandler,Default_Handler
|
||||
|
||||
.weak SPI2_IRQHandler
|
||||
.thumb_set SPI2_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART1_IRQHandler
|
||||
.thumb_set USART1_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART2_IRQHandler
|
||||
.thumb_set USART2_IRQHandler,Default_Handler
|
||||
|
||||
.weak USART3_4_IRQHandler
|
||||
.thumb_set USART3_4_IRQHandler,Default_Handler
|
||||
|
||||
.weak USB_IRQHandler
|
||||
.thumb_set USB_IRQHandler,Default_Handler
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,305 @@
|
|||
;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
|
||||
;* File Name : startup_stm32f070xb.s
|
||||
;* Author : MCD Application Team
|
||||
;* Version : V2.2.0
|
||||
;* Date : 05-December-2014
|
||||
;* Description : STM32F070xB devices vector table for EWARM toolchain.
|
||||
;* This module performs:
|
||||
;* - Set the initial SP
|
||||
;* - Set the initial PC == __iar_program_start,
|
||||
;* - Set the vector table entries with the exceptions ISR
|
||||
;* address,
|
||||
;* - Branches to main in the C library (which eventually
|
||||
;* calls main()).
|
||||
;* After Reset the Cortex-M0 processor is in Thread mode,
|
||||
;* priority is Privileged, and the Stack is set to Main.
|
||||
;*******************************************************************************
|
||||
;*
|
||||
;* <h2><center>© COPYRIGHT(c) 2014 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.
|
||||
;*
|
||||
;*******************************************************************************
|
||||
;
|
||||
;
|
||||
; The modules in this file are included in the libraries, and may be replaced
|
||||
; by any user-defined modules that define the PUBLIC symbol _program_start or
|
||||
; a user defined start symbol.
|
||||
; To override the cstartup defined in the library, simply add your modified
|
||||
; version to the workbench project.
|
||||
;
|
||||
; The vector table is normally located at address 0.
|
||||
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
|
||||
; The name "__vector_table" has special meaning for C-SPY:
|
||||
; it is where the SP start value is found, and the NVIC vector
|
||||
; table register (VTOR) is initialized to this address if != 0.
|
||||
;
|
||||
; Cortex-M version
|
||||
;
|
||||
|
||||
MODULE ?cstartup
|
||||
|
||||
;; Forward declaration of sections.
|
||||
SECTION CSTACK:DATA:NOROOT(3)
|
||||
|
||||
SECTION .intvec:CODE:NOROOT(2)
|
||||
|
||||
EXTERN __iar_program_start
|
||||
EXTERN SystemInit
|
||||
PUBLIC __vector_table
|
||||
|
||||
DATA
|
||||
__vector_table
|
||||
DCD sfe(CSTACK)
|
||||
DCD Reset_Handler ; Reset Handler
|
||||
|
||||
DCD NMI_Handler ; NMI Handler
|
||||
DCD HardFault_Handler ; Hard Fault Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD SVC_Handler ; SVCall Handler
|
||||
DCD 0 ; Reserved
|
||||
DCD 0 ; Reserved
|
||||
DCD PendSV_Handler ; PendSV Handler
|
||||
DCD SysTick_Handler ; SysTick Handler
|
||||
|
||||
; External Interrupts
|
||||
DCD WWDG_IRQHandler ; Window Watchdog
|
||||
DCD 0 ; Reserved
|
||||
DCD RTC_IRQHandler ; RTC through EXTI Line
|
||||
DCD FLASH_IRQHandler ; FLASH
|
||||
DCD RCC_IRQHandler ; RCC
|
||||
DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
|
||||
DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
|
||||
DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
|
||||
DCD 0 ; Reserved
|
||||
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
|
||||
DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
|
||||
DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5
|
||||
DCD ADC1_IRQHandler ; ADC1
|
||||
DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
|
||||
DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
|
||||
DCD 0 ; Reserved
|
||||
DCD TIM3_IRQHandler ; TIM3
|
||||
DCD TIM6_IRQHandler ; TIM6
|
||||
DCD TIM7_IRQHandler ; TIM7
|
||||
DCD TIM14_IRQHandler ; TIM14
|
||||
DCD TIM15_IRQHandler ; TIM15
|
||||
DCD TIM16_IRQHandler ; TIM16
|
||||
DCD TIM17_IRQHandler ; TIM17
|
||||
DCD I2C1_IRQHandler ; I2C1
|
||||
DCD I2C2_IRQHandler ; I2C2
|
||||
DCD SPI1_IRQHandler ; SPI1
|
||||
DCD SPI2_IRQHandler ; SPI2
|
||||
DCD USART1_IRQHandler ; USART1
|
||||
DCD USART2_IRQHandler ; USART2
|
||||
DCD USART3_4_IRQHandler ; USART3 and USART4
|
||||
DCD 0 ; Reserved
|
||||
DCD USB_IRQHandler ; USB
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Default interrupt handlers.
|
||||
;;
|
||||
THUMB
|
||||
|
||||
PUBWEAK Reset_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(2)
|
||||
Reset_Handler
|
||||
LDR R0, =SystemInit
|
||||
BLX R0
|
||||
LDR R0, =__iar_program_start
|
||||
BX R0
|
||||
|
||||
PUBWEAK NMI_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
NMI_Handler
|
||||
B NMI_Handler
|
||||
|
||||
PUBWEAK HardFault_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
HardFault_Handler
|
||||
B HardFault_Handler
|
||||
|
||||
PUBWEAK SVC_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
SVC_Handler
|
||||
B SVC_Handler
|
||||
|
||||
PUBWEAK PendSV_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
PendSV_Handler
|
||||
B PendSV_Handler
|
||||
|
||||
PUBWEAK SysTick_Handler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
SysTick_Handler
|
||||
B SysTick_Handler
|
||||
|
||||
PUBWEAK WWDG_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
WWDG_IRQHandler
|
||||
B WWDG_IRQHandler
|
||||
|
||||
PUBWEAK RTC_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
RTC_IRQHandler
|
||||
B RTC_IRQHandler
|
||||
|
||||
PUBWEAK FLASH_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
FLASH_IRQHandler
|
||||
B FLASH_IRQHandler
|
||||
|
||||
PUBWEAK RCC_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
RCC_IRQHandler
|
||||
B RCC_IRQHandler
|
||||
|
||||
PUBWEAK EXTI0_1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
EXTI0_1_IRQHandler
|
||||
B EXTI0_1_IRQHandler
|
||||
|
||||
PUBWEAK EXTI2_3_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
EXTI2_3_IRQHandler
|
||||
B EXTI2_3_IRQHandler
|
||||
|
||||
PUBWEAK EXTI4_15_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
EXTI4_15_IRQHandler
|
||||
B EXTI4_15_IRQHandler
|
||||
|
||||
PUBWEAK DMA1_Channel1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
DMA1_Channel1_IRQHandler
|
||||
B DMA1_Channel1_IRQHandler
|
||||
|
||||
PUBWEAK DMA1_Channel2_3_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
DMA1_Channel2_3_IRQHandler
|
||||
B DMA1_Channel2_3_IRQHandler
|
||||
|
||||
PUBWEAK DMA1_Channel4_5_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
DMA1_Channel4_5_IRQHandler
|
||||
B DMA1_Channel4_5_IRQHandler
|
||||
|
||||
PUBWEAK ADC1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
ADC1_IRQHandler
|
||||
B ADC1_IRQHandler
|
||||
|
||||
PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
B TIM1_BRK_UP_TRG_COM_IRQHandler
|
||||
|
||||
PUBWEAK TIM1_CC_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM1_CC_IRQHandler
|
||||
B TIM1_CC_IRQHandler
|
||||
|
||||
PUBWEAK TIM3_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM3_IRQHandler
|
||||
B TIM3_IRQHandler
|
||||
|
||||
PUBWEAK TIM6_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM6_IRQHandler
|
||||
B TIM6_IRQHandler
|
||||
|
||||
PUBWEAK TIM7_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM7_IRQHandler
|
||||
B TIM7_IRQHandler
|
||||
|
||||
PUBWEAK TIM14_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM14_IRQHandler
|
||||
B TIM14_IRQHandler
|
||||
|
||||
PUBWEAK TIM15_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM15_IRQHandler
|
||||
B TIM15_IRQHandler
|
||||
|
||||
PUBWEAK TIM16_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM16_IRQHandler
|
||||
B TIM16_IRQHandler
|
||||
|
||||
PUBWEAK TIM17_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
TIM17_IRQHandler
|
||||
B TIM17_IRQHandler
|
||||
|
||||
PUBWEAK I2C1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
I2C1_IRQHandler
|
||||
B I2C1_IRQHandler
|
||||
|
||||
PUBWEAK I2C2_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
I2C2_IRQHandler
|
||||
B I2C2_IRQHandler
|
||||
|
||||
PUBWEAK SPI1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
SPI1_IRQHandler
|
||||
B SPI1_IRQHandler
|
||||
|
||||
PUBWEAK SPI2_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
SPI2_IRQHandler
|
||||
B SPI2_IRQHandler
|
||||
|
||||
PUBWEAK USART1_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
USART1_IRQHandler
|
||||
B USART1_IRQHandler
|
||||
|
||||
PUBWEAK USART2_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
USART2_IRQHandler
|
||||
B USART2_IRQHandler
|
||||
|
||||
PUBWEAK USART3_4_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
USART3_4_IRQHandler
|
||||
B USART3_4_IRQHandler
|
||||
|
||||
PUBWEAK USB_IRQHandler
|
||||
SECTION .text:CODE:NOROOT:REORDER(1)
|
||||
USB_IRQHandler
|
||||
B USB_IRQHandler
|
||||
|
||||
END
|
||||
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
|
|
@ -0,0 +1,30 @@
|
|||
/* [ROM = 128kb = 0x20000] */
|
||||
define symbol __intvec_start__ = 0x08000000;
|
||||
define symbol __region_ROM_start__ = 0x08000000;
|
||||
define symbol __region_ROM_end__ = 0x0801FFFF;
|
||||
|
||||
/* [RAM = 16kb = 0x4000] Vector table dynamic copy: 48 vectors = 192 bytes (0xC0) to be reserved in RAM */
|
||||
define symbol __NVIC_start__ = 0x20000000;
|
||||
define symbol __NVIC_end__ = 0x200000BF; /* Aligned on 8 bytes */
|
||||
define symbol __region_RAM_start__ = 0x200000C0;
|
||||
define symbol __region_RAM_end__ = 0x20003FFF;
|
||||
|
||||
/* Memory regions */
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
|
||||
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
|
||||
|
||||
/* Stack and Heap */
|
||||
define symbol __size_cstack__ = 0x800;
|
||||
define symbol __size_heap__ = 0x800;
|
||||
define block CSTACK with alignment = 8, size = __size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __size_heap__ { };
|
||||
define block STACKHEAP with fixed order { block HEAP, block CSTACK };
|
||||
|
||||
initialize by copy with packing = zeros { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block STACKHEAP };
|
|
@ -0,0 +1,38 @@
|
|||
/* mbed Microcontroller Library
|
||||
* A generic CMSIS include header
|
||||
*******************************************************************************
|
||||
* 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_CMSIS_H
|
||||
#define MBED_CMSIS_H
|
||||
|
||||
#include "stm32f0xx.h"
|
||||
#include "cmsis_nvic.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,61 @@
|
|||
/* mbed Microcontroller Library
|
||||
* CMSIS-style functionality to support dynamic vectors
|
||||
*******************************************************************************
|
||||
* 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.
|
||||
*******************************************************************************
|
||||
*/
|
||||
#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
|
||||
|
||||
int NVIC_vtor_remap = 0; // To keep track that the vectors remap is done
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
int i;
|
||||
// Space for dynamic vectors, initialised to allocate in R/W
|
||||
uint32_t *vectors = (uint32_t *)NVIC_RAM_VECTOR_ADDRESS;
|
||||
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (NVIC_vtor_remap == 0) {
|
||||
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
||||
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
}
|
||||
SYSCFG->CFGR1 |= 0x03; // Embedded SRAM mapped at 0x00000000
|
||||
NVIC_vtor_remap = 1; // The vectors remap is done
|
||||
}
|
||||
|
||||
// Set the vector
|
||||
vectors[IRQn + 16] = vector;
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
// Return the vector
|
||||
return vectors[IRQn + 16];
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* mbed Microcontroller Library
|
||||
* CMSIS-style functionality to support dynamic vectors
|
||||
*******************************************************************************
|
||||
* 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_CMSIS_NVIC_H
|
||||
#define MBED_CMSIS_NVIC_H
|
||||
|
||||
// CORE: 16 vectors = 64 bytes from 0x00 to 0x3F
|
||||
// MCU Peripherals: 32 vectors = 128 bytes from 0x40 to 0xBF
|
||||
// Total: 48 vectors = 192 bytes (0xC0) to be reserved in RAM
|
||||
#define NVIC_NUM_VECTORS 48
|
||||
#define NVIC_USER_IRQ_OFFSET 16
|
||||
|
||||
#include "cmsis.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,167 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hal_tick.c
|
||||
* @author MCD Application Team
|
||||
* @brief Initialization of HAL tick
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2014 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#include "hal_tick.h"
|
||||
|
||||
TIM_HandleTypeDef TimMasterHandle;
|
||||
uint32_t PreviousVal = 0;
|
||||
|
||||
void us_ticker_irq_handler(void);
|
||||
void set_compare(uint16_t count);
|
||||
|
||||
extern volatile uint32_t SlaveCounter;
|
||||
extern volatile uint32_t oc_int_part;
|
||||
extern volatile uint16_t oc_rem_part;
|
||||
|
||||
// Used to increment the slave counter
|
||||
void timer_update_irq_handler(void)
|
||||
{
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
|
||||
// Clear Update interrupt flag
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_UPDATE) == SET) {
|
||||
__HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_UPDATE);
|
||||
SlaveCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Used for mbed timeout (channel 1) and HAL tick (channel 2)
|
||||
void timer_oc_irq_handler(void)
|
||||
{
|
||||
uint16_t cval = TIM_MST->CNT;
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
|
||||
// Channel 1 for mbed timeout
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||
__HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC1);
|
||||
if (oc_rem_part > 0) {
|
||||
set_compare(oc_rem_part); // Finish the remaining time left
|
||||
oc_rem_part = 0;
|
||||
} else {
|
||||
if (oc_int_part > 0) {
|
||||
set_compare(0xFFFF);
|
||||
oc_rem_part = cval; // To finish the counter loop the next time
|
||||
oc_int_part--;
|
||||
} else {
|
||||
us_ticker_irq_handler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Channel 2 for HAL tick
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
|
||||
__HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC2);
|
||||
uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||
if ((val - PreviousVal) >= HAL_TICK_DELAY) {
|
||||
// Increment HAL variable
|
||||
HAL_IncTick();
|
||||
// Prepare next interrupt
|
||||
__HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY);
|
||||
PreviousVal = val;
|
||||
#if 1 // For DEBUG only
|
||||
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_6);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reconfigure the HAL tick using a standard timer instead of systick.
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) {
|
||||
// Enable timer clock
|
||||
TIM_MST_RCC;
|
||||
|
||||
// Reset timer
|
||||
TIM_MST_RESET_ON;
|
||||
TIM_MST_RESET_OFF;
|
||||
|
||||
// Update the SystemCoreClock variable
|
||||
SystemCoreClockUpdate();
|
||||
|
||||
// Configure time base
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
TimMasterHandle.Init.Period = 0xFFFF;
|
||||
TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 us tick
|
||||
TimMasterHandle.Init.ClockDivision = 0;
|
||||
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
HAL_TIM_Base_Init(&TimMasterHandle);
|
||||
|
||||
// Configure output compare channel 1 for mbed timeout (enabled later when used)
|
||||
HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_1);
|
||||
|
||||
// Configure output compare channel 2 for HAL tick
|
||||
HAL_TIM_OC_Start(&TimMasterHandle, TIM_CHANNEL_2);
|
||||
PreviousVal = __HAL_TIM_GetCounter(&TimMasterHandle);
|
||||
__HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, PreviousVal + HAL_TICK_DELAY);
|
||||
|
||||
// Configure interrupts
|
||||
// Update interrupt used for 32-bit counter
|
||||
// Output compare channel 1 interrupt for mbed timeout
|
||||
// Output compare channel 2 interrupt for HAL tick
|
||||
NVIC_SetVector(TIM_MST_UP_IRQ, (uint32_t)timer_update_irq_handler);
|
||||
NVIC_EnableIRQ(TIM_MST_UP_IRQ);
|
||||
NVIC_SetVector(TIM_MST_OC_IRQ, (uint32_t)timer_oc_irq_handler);
|
||||
NVIC_EnableIRQ(TIM_MST_OC_IRQ);
|
||||
|
||||
// Enable interrupts
|
||||
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_UPDATE); // For 32-bit counter
|
||||
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2); // For HAL tick
|
||||
|
||||
// Enable timer
|
||||
HAL_TIM_Base_Start(&TimMasterHandle);
|
||||
|
||||
#if 1 // For DEBUG only
|
||||
__GPIOB_CLK_ENABLE();
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file hal_tick.h
|
||||
* @author MCD Application Team
|
||||
* @brief Initialization of HAL tick
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef __HAL_TICK_H
|
||||
#define __HAL_TICK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stm32f0xx.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 __TIM1_CLK_ENABLE()
|
||||
|
||||
#define TIM_MST_RESET_ON __TIM1_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM1_RELEASE_RESET()
|
||||
|
||||
#define HAL_TICK_DELAY (1000) // 1 ms
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __HAL_TICK_H
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,237 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f0xx.h
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 05-December-2014
|
||||
* @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
|
||||
*
|
||||
* The file is the unique include file that the application programmer
|
||||
* is using in the C source code, usually in main.c. This file contains:
|
||||
* - Configuration section that allows to select:
|
||||
* - The STM32F0xx device used in the target application
|
||||
* - To use or not the peripheral’s drivers in application code(i.e.
|
||||
* code will be based on direct access to peripheral’s registers
|
||||
* rather than drivers API), this option is controlled by
|
||||
* "#define USE_HAL_DRIVER"
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 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
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __STM32F0xx_H
|
||||
#define __STM32F0xx_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @addtogroup Library_configuration_section
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Uncomment the line below according to the target STM32 device used in your
|
||||
application
|
||||
*/
|
||||
|
||||
#if !defined (STM32F030x6) && !defined (STM32F030x8) && \
|
||||
!defined (STM32F031x6) && !defined (STM32F038xx) && \
|
||||
!defined (STM32F042x6) && !defined (STM32F048xx) && !defined (STM32F070x6) && \
|
||||
!defined (STM32F051x8) && !defined (STM32F058xx) && \
|
||||
!defined (STM32F071xB) && !defined (STM32F072xB) && !defined (STM32F078xx) && !defined (STM32F070xB) && \
|
||||
!defined (STM32F091xC) && !defined (STM32F098xx) && !defined (STM32F030xC)
|
||||
/* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
|
||||
/* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */
|
||||
/* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
|
||||
/* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */
|
||||
/* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
|
||||
/* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */
|
||||
/* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */
|
||||
/* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */
|
||||
/* #define STM32F070x6 */ /*!< STM32F070x6 Devices (STM32F070x6 microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
|
||||
#define STM32F070xB /*!< STM32F070xB Devices (STM32F070xB microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
|
||||
/* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
|
||||
/* #define STM32F072xB */ /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
|
||||
/* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
|
||||
/* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
|
||||
/* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */
|
||||
/* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
|
||||
#endif
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to switch between these
|
||||
devices, you can define the device in your toolchain compiler preprocessor.
|
||||
*/
|
||||
#if !defined (USE_HAL_DRIVER)
|
||||
/**
|
||||
* @brief Comment the line below if you will not use the peripherals drivers.
|
||||
In this case, these drivers will not be included and the application code will
|
||||
be based on direct access to peripherals registers
|
||||
*/
|
||||
#define USE_HAL_DRIVER
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
/**
|
||||
* @brief CMSIS Device version number V2.2.0
|
||||
*/
|
||||
#define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
|
||||
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
|
||||
#define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
|
||||
#define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
|
||||
#define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
|
||||
|(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
|
||||
|(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
|
||||
|(__CMSIS_DEVICE_HAL_VERSION_RC))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Device_Included
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32F030x6)
|
||||
#include "stm32f030x6.h"
|
||||
#elif defined(STM32F030x8)
|
||||
#include "stm32f030x8.h"
|
||||
#elif defined(STM32F031x6)
|
||||
#include "stm32f031x6.h"
|
||||
#elif defined(STM32F038xx)
|
||||
#include "stm32f038xx.h"
|
||||
#elif defined(STM32F042x6)
|
||||
#include "stm32f042x6.h"
|
||||
#elif defined(STM32F048xx)
|
||||
#include "stm32f048xx.h"
|
||||
#elif defined(STM32F051x8)
|
||||
#include "stm32f051x8.h"
|
||||
#elif defined(STM32F058xx)
|
||||
#include "stm32f058xx.h"
|
||||
#elif defined(STM32F070x6)
|
||||
#include "stm32f070x6.h"
|
||||
#elif defined(STM32F070xB)
|
||||
#include "stm32f070xb.h"
|
||||
#elif defined(STM32F071xB)
|
||||
#include "stm32f071xb.h"
|
||||
#elif defined(STM32F072xB)
|
||||
#include "stm32f072xb.h"
|
||||
#elif defined(STM32F078xx)
|
||||
#include "stm32f078xx.h"
|
||||
#elif defined(STM32F091xC)
|
||||
#include "stm32f091xc.h"
|
||||
#elif defined(STM32F098xx)
|
||||
#include "stm32f098xx.h"
|
||||
#elif defined(STM32F030xC)
|
||||
#include "stm32f030xc.h"
|
||||
#else
|
||||
#error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Exported_types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RESET = 0,
|
||||
SET = !RESET
|
||||
} FlagStatus, ITStatus;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DISABLE = 0,
|
||||
ENABLE = !DISABLE
|
||||
} FunctionalState;
|
||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERROR = 0,
|
||||
SUCCESS = !ERROR
|
||||
} ErrorStatus;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup Exported_macros
|
||||
* @{
|
||||
*/
|
||||
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
|
||||
|
||||
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
|
||||
|
||||
#define READ_BIT(REG, BIT) ((REG) & (BIT))
|
||||
|
||||
#define CLEAR_REG(REG) ((REG) = (0x0))
|
||||
|
||||
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
|
||||
|
||||
#define READ_REG(REG) ((REG))
|
||||
|
||||
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined (USE_HAL_DRIVER)
|
||||
#include "stm32f0xx_hal.h"
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __STM32F0xx_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,467 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32f0xx.c
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 05-December-2014
|
||||
* @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Source File.
|
||||
*
|
||||
* 1. This file provides two functions and one global variable to be called from
|
||||
* user application:
|
||||
* - SystemInit(): This function is called at startup just after reset and
|
||||
* before branch to main program. This call is made inside
|
||||
* the "startup_stm32f0xx.s" file.
|
||||
*
|
||||
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
|
||||
* by the user application to setup the SysTick
|
||||
* timer or configure other parameters.
|
||||
*
|
||||
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
|
||||
* be called whenever the core clock is changed
|
||||
* 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:
|
||||
*=============================================================================
|
||||
* System clock source | 1- PLL_HSE_EXTC | 3- PLL_HSI
|
||||
* | (external 8 MHz clock) | (internal 48 MHz)
|
||||
* | 2- PLL_HSE_XTAL |
|
||||
* | (external 8 MHz xtal) |
|
||||
*-----------------------------------------------------------------------------
|
||||
* SYSCLK(MHz) | 48 | 48
|
||||
*-----------------------------------------------------------------------------
|
||||
* AHBCLK (MHz) | 48 | 48
|
||||
*-----------------------------------------------------------------------------
|
||||
* APB1CLK (MHz) | 48 | 48
|
||||
*-----------------------------------------------------------------------------
|
||||
* USB capable (48 MHz precise clock) | YES | YES
|
||||
*=============================================================================
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 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
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "stm32f0xx.h"
|
||||
#include "hal_tick.h"
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)8000000) /*!< Default value of the External oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)8000000) /*!< Default value of the Internal oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSI_VALUE */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Select the clock sources (other than HSI) to start with (0=OFF, 1=ON) */
|
||||
#define USE_PLL_HSE_EXTC (1) /* Use external clock */
|
||||
#define USE_PLL_HSE_XTAL (1) /* Use external xtal */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
/* This variable is updated in three ways:
|
||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
Note: If you use this function to configure the system clock there is no need to
|
||||
call the 2 first functions listed above, since SystemCoreClock variable is
|
||||
updated automatically.
|
||||
*/
|
||||
uint32_t SystemCoreClock = 48000000;
|
||||
|
||||
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass);
|
||||
#endif
|
||||
|
||||
uint8_t SetSysClock_PLL_HSI(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F0xx_System_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern int NVIC_vtor_remap;
|
||||
|
||||
/**
|
||||
* @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)0x00000001;
|
||||
|
||||
#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)0xF8FFB80C;
|
||||
#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)0x08FFB80C;
|
||||
#endif /* STM32F051x8 or STM32F058x8 */
|
||||
|
||||
/* Reset HSEON, CSSON and PLLON bits */
|
||||
RCC->CR &= (uint32_t)0xFEF6FFFF;
|
||||
|
||||
/* Reset HSEBYP bit */
|
||||
RCC->CR &= (uint32_t)0xFFFBFFFF;
|
||||
|
||||
/* Reset PLLSRC, PLLXTPRE and PLLMUL[3:0] bits */
|
||||
RCC->CFGR &= (uint32_t)0xFFC0FFFF;
|
||||
|
||||
/* Reset PREDIV[3:0] bits */
|
||||
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
|
||||
|
||||
#if defined (STM32F072xB) || defined (STM32F078xB)
|
||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFCFE2C;
|
||||
#elif defined (STM32F071xB)
|
||||
/* Reset USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFFCEAC;
|
||||
#elif defined (STM32F091xC) || defined (STM32F098xx)
|
||||
/* Reset USART3SW[1:0], USART2SW[1:0], USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFF0FEAC;
|
||||
#elif defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F031x6) || defined (STM32F038xx) || defined (STM32F030xC)
|
||||
/* Reset USART1SW[1:0], I2C1SW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEEC;
|
||||
#elif defined (STM32F051x8) || defined (STM32F058xx)
|
||||
/* Reset USART1SW[1:0], I2C1SW, CECSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;
|
||||
#elif defined (STM32F042x6) || defined (STM32F048xx)
|
||||
/* Reset USART1SW[1:0], I2C1SW, CECSW, USBSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE2C;
|
||||
#elif defined (STM32F070x6) || defined (STM32F070xB)
|
||||
/* Reset USART1SW[1:0], I2C1SW, USBSW and ADCSW bits */
|
||||
RCC->CFGR3 &= (uint32_t)0xFFFFFE6C;
|
||||
/* Set default USB clock to PLLCLK, since there is no HSI48 */
|
||||
RCC->CFGR3 |= (uint32_t)0x00000080;
|
||||
#else
|
||||
#warning "No target selected"
|
||||
#endif
|
||||
|
||||
/* Reset HSI14 bit */
|
||||
RCC->CR2 &= (uint32_t)0xFFFFFFFE;
|
||||
|
||||
/* Disable all interrupts */
|
||||
RCC->CIR = 0x00000000;
|
||||
|
||||
/* Configure the Cube driver */
|
||||
SystemCoreClock = 8000000; // At this stage the HSI is used as system clock
|
||||
NVIC_vtor_remap = 0; // Because it is not cleared the first time we enter in NVIC_SetVector()
|
||||
HAL_Init();
|
||||
|
||||
/* Configure the System clock source, PLL Multiplier and Divider factors,
|
||||
AHB/APBx prescalers and Flash settings */
|
||||
SetSysClock();
|
||||
|
||||
/* Reset the timer to avoid issues after the RAM initialization */
|
||||
TIM_MST_RESET_ON;
|
||||
TIM_MST_RESET_OFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update SystemCoreClock variable according to Clock Register Values.
|
||||
* The SystemCoreClock variable contains the core clock (HCLK), it can
|
||||
* be used by the user application to setup the SysTick timer or configure
|
||||
* other parameters.
|
||||
*
|
||||
* @note Each time the core clock (HCLK) changes, this function must be called
|
||||
* to update SystemCoreClock variable value. Otherwise, any configuration
|
||||
* based on this variable will be incorrect.
|
||||
*
|
||||
* @note - The system frequency computed by this function is not the real
|
||||
* frequency in the chip. It is calculated based on the predefined
|
||||
* constant and the selected clock source:
|
||||
*
|
||||
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
|
||||
*
|
||||
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
|
||||
*
|
||||
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
|
||||
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
|
||||
*
|
||||
* (*) HSI_VALUE is a constant defined in stm32f0xx_hal.h file (default value
|
||||
* 8 MHz) but the real value may vary depending on the variations
|
||||
* in voltage and temperature.
|
||||
*
|
||||
* (**) HSE_VALUE is a constant defined in stm32f0xx_hal.h file (default value
|
||||
* 8 MHz), user has to ensure that HSE_VALUE is same as the real
|
||||
* frequency of the crystal used. Otherwise, this function may
|
||||
* have wrong result.
|
||||
*
|
||||
* - The result of this function could be not correct when using fractional
|
||||
* value for HSE crystal.
|
||||
*
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SystemCoreClockUpdate (void)
|
||||
{
|
||||
uint32_t tmp = 0, pllmull = 0, pllsource = 0, predivfactor = 0;
|
||||
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
tmp = RCC->CFGR & RCC_CFGR_SWS;
|
||||
|
||||
switch (tmp)
|
||||
{
|
||||
case RCC_CFGR_SWS_HSI: /* HSI used as system clock */
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
case RCC_CFGR_SWS_HSE: /* HSE used as system clock */
|
||||
SystemCoreClock = HSE_VALUE;
|
||||
break;
|
||||
case RCC_CFGR_SWS_PLL: /* PLL used as system clock */
|
||||
/* Get PLL clock source and multiplication factor ----------------------*/
|
||||
pllmull = RCC->CFGR & RCC_CFGR_PLLMUL;
|
||||
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
|
||||
pllmull = ( pllmull >> 18) + 2;
|
||||
predivfactor = (RCC->CFGR2 & RCC_CFGR2_PREDIV) + 1;
|
||||
|
||||
if (pllsource == RCC_CFGR_PLLSRC_HSE_PREDIV)
|
||||
{
|
||||
/* HSE used as PLL clock source : SystemCoreClock = HSE/PREDIV * PLLMUL */
|
||||
SystemCoreClock = (HSE_VALUE/predivfactor) * pllmull;
|
||||
}
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
else if (pllsource == RCC_CFGR_PLLSRC_HSI48_PREDIV)
|
||||
{
|
||||
/* HSI48 used as PLL clock source : SystemCoreClock = HSI48/PREDIV * PLLMUL */
|
||||
SystemCoreClock = (HSI48_VALUE/predivfactor) * pllmull;
|
||||
}
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
else
|
||||
{
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F078xx) || defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
/* HSI used as PLL clock source : SystemCoreClock = HSI/PREDIV * PLLMUL */
|
||||
SystemCoreClock = (HSI_VALUE/predivfactor) * pllmull;
|
||||
#else
|
||||
/* HSI used as PLL clock source : SystemCoreClock = HSI/2 * PLLMUL */
|
||||
SystemCoreClock = (HSI_VALUE >> 1) * pllmull;
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 ||
|
||||
STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB ||
|
||||
STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
}
|
||||
break;
|
||||
default: /* HSI used as system clock */
|
||||
SystemCoreClock = HSI_VALUE;
|
||||
break;
|
||||
}
|
||||
/* Compute HCLK clock frequency ----------------*/
|
||||
/* Get HCLK prescaler */
|
||||
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
|
||||
/* HCLK clock frequency */
|
||||
SystemCoreClock >>= tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the System clock source, PLL Multiplier and Divider factors,
|
||||
* AHB/APBx prescalers and Flash settings
|
||||
* @note This function should be called only once the RCC clock configuration
|
||||
* is reset to the default reset state (done in SystemInit() function).
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void SetSysClock(void)
|
||||
{
|
||||
/* 1- Try to start with HSE and external clock */
|
||||
#if USE_PLL_HSE_EXTC != 0
|
||||
if (SetSysClock_PLL_HSE(1) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 2- If fail try to start with HSE and external xtal */
|
||||
#if USE_PLL_HSE_XTAL != 0
|
||||
if (SetSysClock_PLL_HSE(0) == 0)
|
||||
#endif
|
||||
{
|
||||
/* 3- If fail start with HSI clock */
|
||||
if (SetSysClock_PLL_HSI() == 0)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
// [TODO] Put something here to tell the user that a problem occured...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output clock on MCO pin(PA8) for debugging purpose
|
||||
//HAL_RCC_MCOConfig(RCC_MCO, RCC_MCOSOURCE_SYSCLK, RCC_MCO_NODIV); // 48 MHz
|
||||
}
|
||||
|
||||
#if (USE_PLL_HSE_XTAL != 0) || (USE_PLL_HSE_EXTC != 0)
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSE) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
// Select HSE oscillator as PLL source
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48;
|
||||
if (bypass == 0) {
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; // External 8 MHz xtal on OSC_IN/OSC_OUT
|
||||
} else {
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; // External 8 MHz clock on OSC_IN only
|
||||
}
|
||||
RCC_OscInitStruct.HSI48State = 0; // not used
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
// Select PLL as system clock source and configure the HCLK and PCLK1 clocks dividers
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 48 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 48 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; // 48 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
// Output clock on MCO pin(PA8) for debugging purpose
|
||||
//if (bypass == 0)
|
||||
// HAL_RCC_MCOConfig(RCC_MCO, RCC_MCOSOURCE_HSE, RCC_MCO_DIV2); // 4 MHz with xtal
|
||||
//else
|
||||
// HAL_RCC_MCOConfig(RCC_MCO, RCC_MCOSOURCE_HSE, RCC_MCO_DIV4); // 2 MHz with ST-Link MCO
|
||||
|
||||
return 1; // OK
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* PLL (clocked by HSI) used as System clock source */
|
||||
/******************************************************************************/
|
||||
uint8_t SetSysClock_PLL_HSI(void)
|
||||
{
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
|
||||
// Select PLLCLK = 48 MHz ((HSI 8 MHz / 2) * 12)
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; // HSI div 2
|
||||
RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;
|
||||
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
// Select PLL as system clock source and configure the HCLK and PCLK1 clocks dividers
|
||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1);
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // 48 MHz
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; // 48 MHz
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; // 48 MHz
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
|
||||
return 0; // FAIL
|
||||
}
|
||||
|
||||
// Output clock on MCO1 pin(PA8) for debugging purpose
|
||||
//HAL_RCC_MCOConfig(RCC_MCO, RCC_MCOSOURCE_HSI48, RCC_MCO_DIV1); // 48 MHz
|
||||
|
||||
return 1; // OK
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32f0xx.h
|
||||
* @author MCD Application Team
|
||||
* @version V2.2.0
|
||||
* @date 05-December-2014
|
||||
* @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2014 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) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @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****/
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief HAL module driver.
|
||||
* This is the common part of the HAL initialization
|
||||
*
|
||||
|
@ -70,10 +70,10 @@
|
|||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief STM32F0xx HAL Driver version number V1.1.0
|
||||
* @brief STM32F0xx HAL Driver version number V1.2.0
|
||||
*/
|
||||
#define __STM32F0xx_HAL_VERSION_MAIN (0x01) /*!< [31:24] main version */
|
||||
#define __STM32F0xx_HAL_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
|
||||
#define __STM32F0xx_HAL_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
|
||||
#define __STM32F0xx_HAL_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
|
||||
#define __STM32F0xx_HAL_VERSION_RC (0x00) /*!< [7:0] release candidate */
|
||||
#define __STM32F0xx_HAL_VERSION ((__STM32F0xx_HAL_VERSION_MAIN << 24)\
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file contains all the functions prototypes for the HAL
|
||||
* module driver.
|
||||
******************************************************************************
|
||||
|
@ -154,8 +154,9 @@
|
|||
*/
|
||||
#endif /* SYSCFG_CFGR1_PA11_PA12_RMP */
|
||||
|
||||
#if defined(STM32F091xC)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/** @defgroup HAL_IRDA_ENV_SEL HAL IRDA Enveloppe Selection
|
||||
* @note Applicable on STM32F09x
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SYSCFG_IRDA_ENV_SEL_TIM16 (SYSCFG_CFGR1_IRDA_ENV_SEL_0 & SYSCFG_CFGR1_IRDA_ENV_SEL_1) /* 00: Timer16 is selected as IRDA Modulation enveloppe source */
|
||||
|
@ -168,7 +169,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* STM32F091xC */
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
|
||||
/** @defgroup HAL_FastModePlus_I2C HAL FastModePlus I2C
|
||||
|
@ -211,22 +212,22 @@
|
|||
#endif /* SYSCFG_CFGR1_I2C_FMP_I2C2 */
|
||||
|
||||
#if defined(SYSCFG_CFGR1_I2C_FMP_PA9)
|
||||
#define HAL_SYSCFG_FASTMODEPLUS_I2C2_PA9 (SYSCFG_CFGR1_I2C_FMP_PA9) /*!< Fast Mode Plus (FM+) driving capability activation on the pad
|
||||
#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA9 (SYSCFG_CFGR1_I2C_FMP_PA9) /*!< Fast Mode Plus (FM+) driving capability activation on the pad
|
||||
0: PA9 pin operates in standard mode
|
||||
1: FM+ mode is enabled on PA9 pin, and the Speed control is bypassed */
|
||||
#endif /* SYSCFG_CFGR1_I2C_FMP_PA9 */
|
||||
|
||||
#if defined(SYSCFG_CFGR1_I2C_FMP_PA10)
|
||||
#define HAL_SYSCFG_FASTMODEPLUS_I2C2_PA10 (SYSCFG_CFGR1_I2C_FMP_PA10) /*!< Fast Mode Plus (FM+) driving capability activation on the pad
|
||||
#define HAL_SYSCFG_FASTMODEPLUS_I2C_PA10 (SYSCFG_CFGR1_I2C_FMP_PA10) /*!< Fast Mode Plus (FM+) driving capability activation on the pad
|
||||
0: PA10 pin operates in standard mode
|
||||
1: FM+ mode is enabled on PA10 pin, and the Speed control is bypassed */
|
||||
#endif /* SYSCFG_CFGR1_I2C_FMP_PA10 */
|
||||
|
||||
#if defined(STM32F091xC)|| defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F042x6) || defined(STM32F048xx)
|
||||
#define IS_HAL_SYSCFG_FASTMODEPLUS_CONFIG(CONFIG) (((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C1) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C2) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C2_PA9) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C2_PA10) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PA9) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PA10) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB6) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB7) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB8) || \
|
||||
|
@ -238,20 +239,14 @@
|
|||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB7) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB8) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB9))
|
||||
#elif defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#elif defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || defined(STM32F070xB) || defined(STM32F030x6)
|
||||
#define IS_HAL_SYSCFG_FASTMODEPLUS_CONFIG(CONFIG) (((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C1) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C2_PA9) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C2_PA10) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PA9) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PA10) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB6) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB7) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB8) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB9))
|
||||
#elif defined(STM32F042x6) || defined(STM32F048xx)
|
||||
#define IS_HAL_SYSCFG_FASTMODEPLUS_CONFIG(CONFIG) (((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C1) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB6) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB7) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB8) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB9))
|
||||
#else
|
||||
#define IS_HAL_SYSCFG_FASTMODEPLUS_CONFIG(CONFIG) (((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB6) || \
|
||||
((CONFIG) == HAL_SYSCFG_FASTMODEPLUS_I2C_PB7) || \
|
||||
|
@ -265,113 +260,115 @@
|
|||
|
||||
#if defined(STM32F091xC) || defined (STM32F098xx)
|
||||
/** @defgroup HAL_ISR_Wrapper HAL ISR Wrapper
|
||||
* @brief ISR Wrapper
|
||||
* @note applicable on STM32F09x
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SYSCFG_ITLINE0 ((uint32_t) 0x00000000)
|
||||
#define HAL_SYSCFG_ITLINE1 ((uint32_t) 0x00000001)
|
||||
#define HAL_SYSCFG_ITLINE2 ((uint32_t) 0x00000002)
|
||||
#define HAL_SYSCFG_ITLINE3 ((uint32_t) 0x00000003)
|
||||
#define HAL_SYSCFG_ITLINE4 ((uint32_t) 0x00000004)
|
||||
#define HAL_SYSCFG_ITLINE5 ((uint32_t) 0x00000005)
|
||||
#define HAL_SYSCFG_ITLINE6 ((uint32_t) 0x00000006)
|
||||
#define HAL_SYSCFG_ITLINE7 ((uint32_t) 0x00000007)
|
||||
#define HAL_SYSCFG_ITLINE8 ((uint32_t) 0x00000008)
|
||||
#define HAL_SYSCFG_ITLINE9 ((uint32_t) 0x00000009)
|
||||
#define HAL_SYSCFG_ITLINE10 ((uint32_t) 0x0000000A)
|
||||
#define HAL_SYSCFG_ITLINE11 ((uint32_t) 0x0000000B)
|
||||
#define HAL_SYSCFG_ITLINE12 ((uint32_t) 0x0000000C)
|
||||
#define HAL_SYSCFG_ITLINE13 ((uint32_t) 0x0000000D)
|
||||
#define HAL_SYSCFG_ITLINE14 ((uint32_t) 0x0000000E)
|
||||
#define HAL_SYSCFG_ITLINE15 ((uint32_t) 0x0000000F)
|
||||
#define HAL_SYSCFG_ITLINE16 ((uint32_t) 0x00000010)
|
||||
#define HAL_SYSCFG_ITLINE17 ((uint32_t) 0x00000011)
|
||||
#define HAL_SYSCFG_ITLINE18 ((uint32_t) 0x00000012)
|
||||
#define HAL_SYSCFG_ITLINE19 ((uint32_t) 0x00000013)
|
||||
#define HAL_SYSCFG_ITLINE20 ((uint32_t) 0x00000014)
|
||||
#define HAL_SYSCFG_ITLINE21 ((uint32_t) 0x00000015)
|
||||
#define HAL_SYSCFG_ITLINE22 ((uint32_t) 0x00000016)
|
||||
#define HAL_SYSCFG_ITLINE23 ((uint32_t) 0x00000017)
|
||||
#define HAL_SYSCFG_ITLINE24 ((uint32_t) 0x00000018)
|
||||
#define HAL_SYSCFG_ITLINE25 ((uint32_t) 0x00000019)
|
||||
#define HAL_SYSCFG_ITLINE26 ((uint32_t) 0x0000001A)
|
||||
#define HAL_SYSCFG_ITLINE27 ((uint32_t) 0x0000001B)
|
||||
#define HAL_SYSCFG_ITLINE28 ((uint32_t) 0x0000001C)
|
||||
#define HAL_SYSCFG_ITLINE29 ((uint32_t) 0x0000001D)
|
||||
#define HAL_SYSCFG_ITLINE30 ((uint32_t) 0x0000001E)
|
||||
#define HAL_SYSCFG_ITLINE31 ((uint32_t) 0x0000001F)
|
||||
#define HAL_SYSCFG_ITLINE0 ((uint32_t) 0x00000000) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE1 ((uint32_t) 0x00000001) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE2 ((uint32_t) 0x00000002) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE3 ((uint32_t) 0x00000003) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE4 ((uint32_t) 0x00000004) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE5 ((uint32_t) 0x00000005) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE6 ((uint32_t) 0x00000006) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE7 ((uint32_t) 0x00000007) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE8 ((uint32_t) 0x00000008) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE9 ((uint32_t) 0x00000009) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE10 ((uint32_t) 0x0000000A) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE11 ((uint32_t) 0x0000000B) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE12 ((uint32_t) 0x0000000C) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE13 ((uint32_t) 0x0000000D) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE14 ((uint32_t) 0x0000000E) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE15 ((uint32_t) 0x0000000F) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE16 ((uint32_t) 0x00000010) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE17 ((uint32_t) 0x00000011) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE18 ((uint32_t) 0x00000012) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE19 ((uint32_t) 0x00000013) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE20 ((uint32_t) 0x00000014) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE21 ((uint32_t) 0x00000015) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE22 ((uint32_t) 0x00000016) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE23 ((uint32_t) 0x00000017) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE24 ((uint32_t) 0x00000018) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE25 ((uint32_t) 0x00000019) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE26 ((uint32_t) 0x0000001A) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE27 ((uint32_t) 0x0000001B) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE28 ((uint32_t) 0x0000001C) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE29 ((uint32_t) 0x0000001D) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE30 ((uint32_t) 0x0000001E) /*!< Internal define for macro handling */
|
||||
#define HAL_SYSCFG_ITLINE31 ((uint32_t) 0x0000001F) /*!< Internal define for macro handling */
|
||||
|
||||
#define HAL_ITLINE_EWDG ((uint32_t) ((HAL_SYSCFG_ITLINE0 << 0x18) | SYSCFG_ITLINE0_SR_EWDG)) /* EWDG has expired .... */
|
||||
#define HAL_ITLINE_EWDG ((uint32_t) ((HAL_SYSCFG_ITLINE0 << 0x18) | SYSCFG_ITLINE0_SR_EWDG)) /*!< EWDG has expired .... */
|
||||
#if defined(STM32F091xC)
|
||||
#define HAL_ITLINE_PVDOUT ((uint32_t) ((HAL_SYSCFG_ITLINE1 << 0x18) | SYSCFG_ITLINE1_SR_PVDOUT)) /* Power voltage detection Interrupt .... */
|
||||
#define HAL_ITLINE_PVDOUT ((uint32_t) ((HAL_SYSCFG_ITLINE1 << 0x18) | SYSCFG_ITLINE1_SR_PVDOUT)) /*!< Power voltage detection Interrupt .... */
|
||||
#endif
|
||||
#define HAL_ITLINE_VDDIO2 ((uint32_t) ((HAL_SYSCFG_ITLINE1 << 0x18) | SYSCFG_ITLINE1_SR_VDDIO2)) /* VDDIO2 Interrupt .... */
|
||||
#define HAL_ITLINE_RTC_WAKEUP ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_WAKEUP)) /* RTC WAKEUP -> exti[20] Interrupt */
|
||||
#define HAL_ITLINE_RTC_TSTAMP ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_TSTAMP)) /* RTC Time Stamp -> exti[19] interrupt */
|
||||
#define HAL_ITLINE_RTC_ALRA ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_ALRA)) /* RTC Alarm -> exti[17] interrupt .... */
|
||||
#define HAL_ITLINE_FLASH_ITF ((uint32_t) ((HAL_SYSCFG_ITLINE3 << 0x18) | SYSCFG_ITLINE3_SR_FLASH_ITF)) /* Flash ITF Interrupt */
|
||||
#define HAL_ITLINE_CRS ((uint32_t) ((HAL_SYSCFG_ITLINE4 << 0x18) | SYSCFG_ITLINE4_SR_CRS)) /* CRS Interrupt */
|
||||
#define HAL_ITLINE_CLK_CTRL ((uint32_t) ((HAL_SYSCFG_ITLINE4 << 0x18) | SYSCFG_ITLINE4_SR_CLK_CTRL)) /* CLK Control Interrupt */
|
||||
#define HAL_ITLINE_EXTI0 ((uint32_t) ((HAL_SYSCFG_ITLINE5 << 0x18) | SYSCFG_ITLINE5_SR_EXTI0)) /* External Interrupt 0 */
|
||||
#define HAL_ITLINE_EXTI1 ((uint32_t) ((HAL_SYSCFG_ITLINE5 << 0x18) | SYSCFG_ITLINE5_SR_EXTI1)) /* External Interrupt 1 */
|
||||
#define HAL_ITLINE_EXTI2 ((uint32_t) ((HAL_SYSCFG_ITLINE6 << 0x18) | SYSCFG_ITLINE6_SR_EXTI2)) /* External Interrupt 2 */
|
||||
#define HAL_ITLINE_EXTI3 ((uint32_t) ((HAL_SYSCFG_ITLINE6 << 0x18) | SYSCFG_ITLINE6_SR_EXTI3)) /* External Interrupt 3 */
|
||||
#define HAL_ITLINE_EXTI4 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI4)) /* EXTI4 Interrupt */
|
||||
#define HAL_ITLINE_EXTI5 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI5)) /* EXTI5 Interrupt */
|
||||
#define HAL_ITLINE_EXTI6 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI6)) /* EXTI6 Interrupt */
|
||||
#define HAL_ITLINE_EXTI7 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI7)) /* EXTI7 Interrupt */
|
||||
#define HAL_ITLINE_EXTI8 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI8)) /* EXTI8 Interrupt */
|
||||
#define HAL_ITLINE_EXTI9 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI9)) /* EXTI9 Interrupt */
|
||||
#define HAL_ITLINE_EXTI10 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI10)) /* EXTI10 Interrupt */
|
||||
#define HAL_ITLINE_EXTI11 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI11)) /* EXTI11 Interrupt */
|
||||
#define HAL_ITLINE_EXTI12 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI12)) /* EXTI12 Interrupt */
|
||||
#define HAL_ITLINE_EXTI13 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI13)) /* EXTI13 Interrupt */
|
||||
#define HAL_ITLINE_EXTI14 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI14)) /* EXTI14 Interrupt */
|
||||
#define HAL_ITLINE_EXTI15 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI15)) /* EXTI15 Interrupt */
|
||||
#define HAL_ITLINE_TSC_EOA ((uint32_t) ((HAL_SYSCFG_ITLINE8 << 0x18) | SYSCFG_ITLINE8_SR_TSC_EOA)) /* Touch control EOA Interrupt */
|
||||
#define HAL_ITLINE_TSC_MCE ((uint32_t) ((HAL_SYSCFG_ITLINE8 << 0x18) | SYSCFG_ITLINE8_SR_TSC_MCE)) /* Touch control MCE Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH1 ((uint32_t) ((HAL_SYSCFG_ITLINE9 << 0x18) | SYSCFG_ITLINE9_SR_DMA1_CH1)) /* DMA1 Channel 1 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH2 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA1_CH2)) /* DMA1 Channel 2 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH3 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA1_CH3)) /* DMA1 Channel 3 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH1 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA2_CH1)) /* DMA2 Channel 1 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH2 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA2_CH2)) /* DMA2 Channel 2 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH4 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH4)) /* DMA1 Channel 4 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH5 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH5)) /* DMA1 Channel 5 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH6 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH6)) /* DMA1 Channel 6 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH7 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH7)) /* DMA1 Channel 7 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH3 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH3)) /* DMA2 Channel 3 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH4 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH4)) /* DMA2 Channel 4 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH5 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH5)) /* DMA2 Channel 5 Interrupt */
|
||||
#define HAL_ITLINE_ADC ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_ADC)) /* ADC Interrupt */
|
||||
#define HAL_ITLINE_COMP1 ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_COMP1)) /* COMP1 Interrupt -> exti[21] */
|
||||
#define HAL_ITLINE_COMP2 ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_COMP2)) /* COMP2 Interrupt -> exti[21] */
|
||||
#define HAL_ITLINE_TIM1_BRK ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_BRK)) /* TIM1 BRK Interrupt */
|
||||
#define HAL_ITLINE_TIM1_UPD ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_UPD)) /* TIM1 UPD Interrupt */
|
||||
#define HAL_ITLINE_TIM1_TRG ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_TRG)) /* TIM1 TRG Interrupt */
|
||||
#define HAL_ITLINE_TIM1_CCU ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_CCU)) /* TIM1 CCU Interrupt */
|
||||
#define HAL_ITLINE_TIM1_CC ((uint32_t) ((HAL_SYSCFG_ITLINE14 << 0x18) | SYSCFG_ITLINE14_SR_TIM1_CC)) /* TIM1 CC Interrupt */
|
||||
#define HAL_ITLINE_TIM2 ((uint32_t) ((HAL_SYSCFG_ITLINE15 << 0x18) | SYSCFG_ITLINE15_SR_TIM2_GLB)) /* TIM2 Interrupt */
|
||||
#define HAL_ITLINE_TIM3 ((uint32_t) ((HAL_SYSCFG_ITLINE16 << 0x18) | SYSCFG_ITLINE16_SR_TIM3_GLB)) /* TIM3 Interrupt */
|
||||
#define HAL_ITLINE_DAC ((uint32_t) ((HAL_SYSCFG_ITLINE17 << 0x18) | SYSCFG_ITLINE17_SR_DAC)) /* DAC Interrupt */
|
||||
#define HAL_ITLINE_TIM6 ((uint32_t) ((HAL_SYSCFG_ITLINE17 << 0x18) | SYSCFG_ITLINE17_SR_TIM6_GLB)) /* TIM6 Interrupt */
|
||||
#define HAL_ITLINE_TIM7 ((uint32_t) ((HAL_SYSCFG_ITLINE18 << 0x18) | SYSCFG_ITLINE18_SR_TIM7_GLB)) /* TIM7 Interrupt */
|
||||
#define HAL_ITLINE_TIM14 ((uint32_t) ((HAL_SYSCFG_ITLINE19 << 0x18) | SYSCFG_ITLINE19_SR_TIM14_GLB)) /* TIM14 Interrupt */
|
||||
#define HAL_ITLINE_TIM15 ((uint32_t) ((HAL_SYSCFG_ITLINE20 << 0x18) | SYSCFG_ITLINE20_SR_TIM15_GLB)) /* TIM15 Interrupt */
|
||||
#define HAL_ITLINE_TIM16 ((uint32_t) ((HAL_SYSCFG_ITLINE21 << 0x18) | SYSCFG_ITLINE21_SR_TIM16_GLB)) /* TIM16 Interrupt */
|
||||
#define HAL_ITLINE_TIM17 ((uint32_t) ((HAL_SYSCFG_ITLINE22 << 0x18) | SYSCFG_ITLINE22_SR_TIM17_GLB)) /* TIM17 Interrupt */
|
||||
#define HAL_ITLINE_I2C1 ((uint32_t) ((HAL_SYSCFG_ITLINE23 << 0x18) | SYSCFG_ITLINE23_SR_I2C1_GLB)) /* I2C1 Interrupt -> exti[23] */
|
||||
#define HAL_ITLINE_I2C2 ((uint32_t) ((HAL_SYSCFG_ITLINE24 << 0x18) | SYSCFG_ITLINE24_SR_I2C2_GLB)) /* I2C2 Interrupt */
|
||||
#define HAL_ITLINE_SPI1 ((uint32_t) ((HAL_SYSCFG_ITLINE25 << 0x18) | SYSCFG_ITLINE25_SR_SPI1)) /* I2C1 Interrupt -> exti[23] */
|
||||
#define HAL_ITLINE_SPI2 ((uint32_t) ((HAL_SYSCFG_ITLINE26 << 0x18) | SYSCFG_ITLINE26_SR_SPI2)) /* SPI1 Interrupt */
|
||||
#define HAL_ITLINE_VDDIO2 ((uint32_t) ((HAL_SYSCFG_ITLINE1 << 0x18) | SYSCFG_ITLINE1_SR_VDDIO2)) /*!< VDDIO2 Interrupt .... */
|
||||
#define HAL_ITLINE_RTC_WAKEUP ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_WAKEUP)) /*!< RTC WAKEUP -> exti[20] Interrupt */
|
||||
#define HAL_ITLINE_RTC_TSTAMP ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_TSTAMP)) /*!< RTC Time Stamp -> exti[19] interrupt */
|
||||
#define HAL_ITLINE_RTC_ALRA ((uint32_t) ((HAL_SYSCFG_ITLINE2 << 0x18) | SYSCFG_ITLINE2_SR_RTC_ALRA)) /*!< RTC Alarm -> exti[17] interrupt .... */
|
||||
#define HAL_ITLINE_FLASH_ITF ((uint32_t) ((HAL_SYSCFG_ITLINE3 << 0x18) | SYSCFG_ITLINE3_SR_FLASH_ITF)) /*!< Flash ITF Interrupt */
|
||||
#define HAL_ITLINE_CRS ((uint32_t) ((HAL_SYSCFG_ITLINE4 << 0x18) | SYSCFG_ITLINE4_SR_CRS)) /*!< CRS Interrupt */
|
||||
#define HAL_ITLINE_CLK_CTRL ((uint32_t) ((HAL_SYSCFG_ITLINE4 << 0x18) | SYSCFG_ITLINE4_SR_CLK_CTRL)) /*!< CLK Control Interrupt */
|
||||
#define HAL_ITLINE_EXTI0 ((uint32_t) ((HAL_SYSCFG_ITLINE5 << 0x18) | SYSCFG_ITLINE5_SR_EXTI0)) /*!< External Interrupt 0 */
|
||||
#define HAL_ITLINE_EXTI1 ((uint32_t) ((HAL_SYSCFG_ITLINE5 << 0x18) | SYSCFG_ITLINE5_SR_EXTI1)) /*!< External Interrupt 1 */
|
||||
#define HAL_ITLINE_EXTI2 ((uint32_t) ((HAL_SYSCFG_ITLINE6 << 0x18) | SYSCFG_ITLINE6_SR_EXTI2)) /*!< External Interrupt 2 */
|
||||
#define HAL_ITLINE_EXTI3 ((uint32_t) ((HAL_SYSCFG_ITLINE6 << 0x18) | SYSCFG_ITLINE6_SR_EXTI3)) /*!< External Interrupt 3 */
|
||||
#define HAL_ITLINE_EXTI4 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI4)) /*!< EXTI4 Interrupt */
|
||||
#define HAL_ITLINE_EXTI5 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI5)) /*!< EXTI5 Interrupt */
|
||||
#define HAL_ITLINE_EXTI6 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI6)) /*!< EXTI6 Interrupt */
|
||||
#define HAL_ITLINE_EXTI7 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI7)) /*!< EXTI7 Interrupt */
|
||||
#define HAL_ITLINE_EXTI8 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI8)) /*!< EXTI8 Interrupt */
|
||||
#define HAL_ITLINE_EXTI9 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI9)) /*!< EXTI9 Interrupt */
|
||||
#define HAL_ITLINE_EXTI10 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI10)) /*!< EXTI10 Interrupt */
|
||||
#define HAL_ITLINE_EXTI11 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI11)) /*!< EXTI11 Interrupt */
|
||||
#define HAL_ITLINE_EXTI12 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI12)) /*!< EXTI12 Interrupt */
|
||||
#define HAL_ITLINE_EXTI13 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI13)) /*!< EXTI13 Interrupt */
|
||||
#define HAL_ITLINE_EXTI14 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI14)) /*!< EXTI14 Interrupt */
|
||||
#define HAL_ITLINE_EXTI15 ((uint32_t) ((HAL_SYSCFG_ITLINE7 << 0x18) | SYSCFG_ITLINE7_SR_EXTI15)) /*!< EXTI15 Interrupt */
|
||||
#define HAL_ITLINE_TSC_EOA ((uint32_t) ((HAL_SYSCFG_ITLINE8 << 0x18) | SYSCFG_ITLINE8_SR_TSC_EOA)) /*!< Touch control EOA Interrupt */
|
||||
#define HAL_ITLINE_TSC_MCE ((uint32_t) ((HAL_SYSCFG_ITLINE8 << 0x18) | SYSCFG_ITLINE8_SR_TSC_MCE)) /*!< Touch control MCE Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH1 ((uint32_t) ((HAL_SYSCFG_ITLINE9 << 0x18) | SYSCFG_ITLINE9_SR_DMA1_CH1)) /*!< DMA1 Channel 1 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH2 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA1_CH2)) /*!< DMA1 Channel 2 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH3 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA1_CH3)) /*!< DMA1 Channel 3 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH1 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA2_CH1)) /*!< DMA2 Channel 1 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH2 ((uint32_t) ((HAL_SYSCFG_ITLINE10 << 0x18) | SYSCFG_ITLINE10_SR_DMA2_CH2)) /*!< DMA2 Channel 2 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH4 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH4)) /*!< DMA1 Channel 4 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH5 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH5)) /*!< DMA1 Channel 5 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH6 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH6)) /*!< DMA1 Channel 6 Interrupt */
|
||||
#define HAL_ITLINE_DMA1_CH7 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA1_CH7)) /*!< DMA1 Channel 7 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH3 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH3)) /*!< DMA2 Channel 3 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH4 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH4)) /*!< DMA2 Channel 4 Interrupt */
|
||||
#define HAL_ITLINE_DMA2_CH5 ((uint32_t) ((HAL_SYSCFG_ITLINE11 << 0x18) | SYSCFG_ITLINE11_SR_DMA2_CH5)) /*!< DMA2 Channel 5 Interrupt */
|
||||
#define HAL_ITLINE_ADC ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_ADC)) /*!< ADC Interrupt */
|
||||
#define HAL_ITLINE_COMP1 ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_COMP1)) /*!< COMP1 Interrupt -> exti[21] */
|
||||
#define HAL_ITLINE_COMP2 ((uint32_t) ((HAL_SYSCFG_ITLINE12 << 0x18) | SYSCFG_ITLINE12_SR_COMP2)) /*!< COMP2 Interrupt -> exti[21] */
|
||||
#define HAL_ITLINE_TIM1_BRK ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_BRK)) /*!< TIM1 BRK Interrupt */
|
||||
#define HAL_ITLINE_TIM1_UPD ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_UPD)) /*!< TIM1 UPD Interrupt */
|
||||
#define HAL_ITLINE_TIM1_TRG ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_TRG)) /*!< TIM1 TRG Interrupt */
|
||||
#define HAL_ITLINE_TIM1_CCU ((uint32_t) ((HAL_SYSCFG_ITLINE13 << 0x18) | SYSCFG_ITLINE13_SR_TIM1_CCU)) /*!< TIM1 CCU Interrupt */
|
||||
#define HAL_ITLINE_TIM1_CC ((uint32_t) ((HAL_SYSCFG_ITLINE14 << 0x18) | SYSCFG_ITLINE14_SR_TIM1_CC)) /*!< TIM1 CC Interrupt */
|
||||
#define HAL_ITLINE_TIM2 ((uint32_t) ((HAL_SYSCFG_ITLINE15 << 0x18) | SYSCFG_ITLINE15_SR_TIM2_GLB)) /*!< TIM2 Interrupt */
|
||||
#define HAL_ITLINE_TIM3 ((uint32_t) ((HAL_SYSCFG_ITLINE16 << 0x18) | SYSCFG_ITLINE16_SR_TIM3_GLB)) /*!< TIM3 Interrupt */
|
||||
#define HAL_ITLINE_DAC ((uint32_t) ((HAL_SYSCFG_ITLINE17 << 0x18) | SYSCFG_ITLINE17_SR_DAC)) /*!< DAC Interrupt */
|
||||
#define HAL_ITLINE_TIM6 ((uint32_t) ((HAL_SYSCFG_ITLINE17 << 0x18) | SYSCFG_ITLINE17_SR_TIM6_GLB)) /*!< TIM6 Interrupt */
|
||||
#define HAL_ITLINE_TIM7 ((uint32_t) ((HAL_SYSCFG_ITLINE18 << 0x18) | SYSCFG_ITLINE18_SR_TIM7_GLB)) /*!< TIM7 Interrupt */
|
||||
#define HAL_ITLINE_TIM14 ((uint32_t) ((HAL_SYSCFG_ITLINE19 << 0x18) | SYSCFG_ITLINE19_SR_TIM14_GLB)) /*!< TIM14 Interrupt */
|
||||
#define HAL_ITLINE_TIM15 ((uint32_t) ((HAL_SYSCFG_ITLINE20 << 0x18) | SYSCFG_ITLINE20_SR_TIM15_GLB)) /*!< TIM15 Interrupt */
|
||||
#define HAL_ITLINE_TIM16 ((uint32_t) ((HAL_SYSCFG_ITLINE21 << 0x18) | SYSCFG_ITLINE21_SR_TIM16_GLB)) /*!< TIM16 Interrupt */
|
||||
#define HAL_ITLINE_TIM17 ((uint32_t) ((HAL_SYSCFG_ITLINE22 << 0x18) | SYSCFG_ITLINE22_SR_TIM17_GLB)) /*!< TIM17 Interrupt */
|
||||
#define HAL_ITLINE_I2C1 ((uint32_t) ((HAL_SYSCFG_ITLINE23 << 0x18) | SYSCFG_ITLINE23_SR_I2C1_GLB)) /*!< I2C1 Interrupt -> exti[23] */
|
||||
#define HAL_ITLINE_I2C2 ((uint32_t) ((HAL_SYSCFG_ITLINE24 << 0x18) | SYSCFG_ITLINE24_SR_I2C2_GLB)) /*!< I2C2 Interrupt */
|
||||
#define HAL_ITLINE_SPI1 ((uint32_t) ((HAL_SYSCFG_ITLINE25 << 0x18) | SYSCFG_ITLINE25_SR_SPI1)) /*!< I2C1 Interrupt -> exti[23] */
|
||||
#define HAL_ITLINE_SPI2 ((uint32_t) ((HAL_SYSCFG_ITLINE26 << 0x18) | SYSCFG_ITLINE26_SR_SPI2)) /*!< SPI1 Interrupt */
|
||||
#define HAL_ITLINE_USART1 ((uint32_t) ((HAL_SYSCFG_ITLINE27 << 0x18) | SYSCFG_ITLINE27_SR_USART1_GLB)) /*!< USART1 GLB Interrupt -> exti[25] */
|
||||
#define HAL_ITLINE_USART2 ((uint32_t) ((HAL_SYSCFG_ITLINE28 << 0x18) | SYSCFG_ITLINE28_SR_USART2_GLB)) /*!< USART2 GLB Interrupt -> exti[26] */
|
||||
#define HAL_ITLINE_USART3 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART3_GLB)) /* USART3 Interrupt .... */
|
||||
#define HAL_ITLINE_USART4 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART4_GLB)) /* USART4 Interrupt .... */
|
||||
#define HAL_ITLINE_USART5 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART5_GLB)) /* USART5 Interrupt .... */
|
||||
#define HAL_ITLINE_USART6 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART6_GLB)) /* USART6 Interrupt .... */
|
||||
#define HAL_ITLINE_USART7 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART7_GLB)) /* USART7 Interrupt .... */
|
||||
#define HAL_ITLINE_USART8 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART8_GLB)) /* USART8 Interrupt .... */
|
||||
#define HAL_ITLINE_CAN ((uint32_t) ((HAL_SYSCFG_ITLINE30 << 0x18) | SYSCFG_ITLINE30_SR_CAN)) /* CAN Interrupt */
|
||||
#define HAL_ITLINE_CEC ((uint32_t) ((HAL_SYSCFG_ITLINE30 << 0x18) | SYSCFG_ITLINE30_SR_CEC)) /* CEC Interrupt -> exti[27] */
|
||||
#define HAL_ITLINE_USART3 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART3_GLB)) /*!< USART3 Interrupt .... */
|
||||
#define HAL_ITLINE_USART4 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART4_GLB)) /*!< USART4 Interrupt .... */
|
||||
#define HAL_ITLINE_USART5 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART5_GLB)) /*!< USART5 Interrupt .... */
|
||||
#define HAL_ITLINE_USART6 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART6_GLB)) /*!< USART6 Interrupt .... */
|
||||
#define HAL_ITLINE_USART7 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART7_GLB)) /*!< USART7 Interrupt .... */
|
||||
#define HAL_ITLINE_USART8 ((uint32_t) ((HAL_SYSCFG_ITLINE29 << 0x18) | SYSCFG_ITLINE29_SR_USART8_GLB)) /*!< USART8 Interrupt .... */
|
||||
#define HAL_ITLINE_CAN ((uint32_t) ((HAL_SYSCFG_ITLINE30 << 0x18) | SYSCFG_ITLINE30_SR_CAN)) /*!< CAN Interrupt */
|
||||
#define HAL_ITLINE_CEC ((uint32_t) ((HAL_SYSCFG_ITLINE30 << 0x18) | SYSCFG_ITLINE30_SR_CEC)) /*!< CEC Interrupt -> exti[27] */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -608,7 +605,8 @@
|
|||
#if defined(STM32F091xC) || defined (STM32F098xx)
|
||||
/** @defgroup HAL_ISR_wrapper_check HAL ISR wrapper check
|
||||
* @brief ISR wrapper check
|
||||
* @note Allow to determine interrupt source per line.
|
||||
* @note This feature is applicable on STM32F09x
|
||||
* @note Allow to determine interrupt source per line.
|
||||
* @{
|
||||
*/
|
||||
#define __HAL_GET_PENDING_IT(__SOURCE__) (SYSCFG->IT_LINE_SR[((__SOURCE__) >> 0x18)] & ((__SOURCE__) & 0x00FFFFFF))
|
||||
|
@ -620,6 +618,7 @@
|
|||
#if defined(STM32F091xC) || defined (STM32F098xx)
|
||||
/** @defgroup HAL_SYSCFG_IRDA_modulation_envelope_selection HAL SYSCFG IRDA modulation envelope selection
|
||||
* @brief selection of the modulation envelope signal macro, using bits [7:6] of SYS_CTRL(CFGR1) register
|
||||
* @note This feature is applicable on STM32F09x
|
||||
* @param __SOURCE__: This parameter can be a value of @ref HAL_IRDA_ENV_SEL
|
||||
* @{
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_adc.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file provides firmware functions to manage the following
|
||||
* functionalities of the Analog to Digital Convertor (ADC)
|
||||
* peripheral:
|
||||
|
@ -251,7 +251,7 @@ HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
|
|||
uint32_t tmpCFGR1 = 0;
|
||||
|
||||
/* Check ADC handle */
|
||||
if(hadc == HAL_NULL)
|
||||
if(hadc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc)
|
|||
|
||||
/* Enable external trigger if trigger selection is different of software */
|
||||
/* start. */
|
||||
/* Note: This configuration keeps the hardware feature of parameter */
|
||||
/* @Note: This configuration keeps the hardware feature of parameter */
|
||||
/* ExternalTrigConvEdge "trigger edge none" equivalent to */
|
||||
/* software start. */
|
||||
if (hadc->Init.ExternalTrigConv != ADC_SOFTWARE_START)
|
||||
|
@ -431,7 +431,7 @@ HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef* hadc)
|
|||
HAL_StatusTypeDef tmpHALStatus = HAL_OK;
|
||||
|
||||
/* Check ADC handle */
|
||||
if(hadc == HAL_NULL)
|
||||
if(hadc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef* hadc)
|
|||
ADC_CFGR1_SCANDIR | ADC_CFGR1_DMACFG | ADC_CFGR1_DMAEN );
|
||||
|
||||
/* Reset register CFGR2 */
|
||||
/* Note: Update of ADC clock mode is conditioned to ADC state disabled: */
|
||||
/* @Note: Update of ADC clock mode is conditioned to ADC state disabled: */
|
||||
/* already done above. */
|
||||
hadc->Instance->CFGR2 &= ~ADC_CFGR2_CKMODE;
|
||||
|
||||
|
@ -601,40 +601,49 @@ HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc)
|
|||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
{
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
}
|
||||
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
/* Perform ADC enable and conversion start if no conversion is on going */
|
||||
if (__HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(hadc) == RESET)
|
||||
{
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
{
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
}
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC */
|
||||
/* operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
}
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpHALStatus = HAL_BUSY;
|
||||
}
|
||||
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
|
||||
/* Return function status */
|
||||
return tmpHALStatus;
|
||||
|
@ -822,8 +831,11 @@ HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventTy
|
|||
|
||||
/**
|
||||
* @brief Enables ADC, starts conversion of regular group with interruption.
|
||||
* Interruptions enabled in this function: EOC (end of conversion),
|
||||
* overrun.
|
||||
* Interruptions enabled in this function:
|
||||
* - EOC (end of conversion of regular group) or EOS (end of
|
||||
* sequence of regular group) depending on ADC initialization
|
||||
* parameter "EOCSelection"
|
||||
* - overrun (if available)
|
||||
* Each of these interruptions has its dedicated callback function.
|
||||
* @param hadc: ADC handle
|
||||
* @retval HAL status
|
||||
|
@ -835,54 +847,63 @@ HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc)
|
|||
/* Check the parameters */
|
||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
/* Perform ADC enable and conversion start if no conversion is on going */
|
||||
if (__HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(hadc) == RESET)
|
||||
{
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
}
|
||||
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
|
||||
/* Enable ADC end of conversion interrupt */
|
||||
/* Enable ADC overrun interrupt */
|
||||
switch(hadc->Init.EOCSelection)
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
{
|
||||
case EOC_SEQ_CONV:
|
||||
__HAL_ADC_DISABLE_IT(hadc, ADC_IT_EOC);
|
||||
__HAL_ADC_ENABLE_IT(hadc, (ADC_IT_EOS | ADC_IT_OVR));
|
||||
break;
|
||||
/* case EOC_SINGLE_CONV */
|
||||
default:
|
||||
__HAL_ADC_ENABLE_IT(hadc, (ADC_IT_EOC | ADC_IT_EOS | ADC_IT_OVR));
|
||||
break;
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
}
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC */
|
||||
/* operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
|
||||
/* Enable ADC end of conversion interrupt */
|
||||
/* Enable ADC overrun interrupt */
|
||||
switch(hadc->Init.EOCSelection)
|
||||
{
|
||||
case EOC_SEQ_CONV:
|
||||
__HAL_ADC_DISABLE_IT(hadc, ADC_IT_EOC);
|
||||
__HAL_ADC_ENABLE_IT(hadc, (ADC_IT_EOS | ADC_IT_OVR));
|
||||
break;
|
||||
/* case EOC_SINGLE_CONV */
|
||||
default:
|
||||
__HAL_ADC_ENABLE_IT(hadc, (ADC_IT_EOC | ADC_IT_EOS | ADC_IT_OVR));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
}
|
||||
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
}
|
||||
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
|
||||
else
|
||||
{
|
||||
tmpHALStatus = HAL_BUSY;
|
||||
}
|
||||
|
||||
/* Return function status */
|
||||
return tmpHALStatus;
|
||||
}
|
||||
|
@ -936,7 +957,9 @@ HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc)
|
|||
* @brief Enables ADC, starts conversion of regular group and transfers result
|
||||
* through DMA.
|
||||
* Interruptions enabled in this function:
|
||||
* overrun, DMA half transfer, DMA transfer complete.
|
||||
* - DMA transfer complete
|
||||
* - DMA half transfer
|
||||
* - overrun
|
||||
* Each of these interruptions has its dedicated callback function.
|
||||
* @param hadc: ADC handle
|
||||
* @param pData: The destination Buffer address.
|
||||
|
@ -949,66 +972,73 @@ HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, ui
|
|||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||
|
||||
/* Perform ADC enable and conversion start if no conversion is on going */
|
||||
if (__HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(hadc) == RESET)
|
||||
{
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
{
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
}
|
||||
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Enable the ADC peripheral */
|
||||
/* If low power mode AutoPowerOff is enabled, power-on/off phases are */
|
||||
/* performed automatically by hardware. */
|
||||
if (hadc->Init.LowPowerAutoPowerOff != ENABLE)
|
||||
{
|
||||
tmpHALStatus = ADC_Enable(hadc);
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
|
||||
|
||||
/* Set the DMA transfer complete callback */
|
||||
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
||||
|
||||
/* Set the DMA half transfer complete callback */
|
||||
hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;
|
||||
|
||||
/* Set the DMA error callback */
|
||||
hadc->DMA_Handle->XferErrorCallback = ADC_DMAError;
|
||||
|
||||
|
||||
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
||||
/* start (in case of SW start): */
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC */
|
||||
/* operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
|
||||
/* Enable ADC overrun interrupt */
|
||||
__HAL_ADC_ENABLE_IT(hadc, ADC_IT_OVR);
|
||||
|
||||
/* Enable ADC DMA mode */
|
||||
hadc->Instance->CFGR1 |= ADC_CFGR1_DMAEN;
|
||||
|
||||
/* Start the DMA channel */
|
||||
HAL_DMA_Start_IT(hadc->DMA_Handle, (uint32_t)&hadc->Instance->DR, (uint32_t)pData, Length);
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
}
|
||||
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
}
|
||||
|
||||
/* Start conversion if ADC is effectively enabled */
|
||||
if (tmpHALStatus != HAL_ERROR)
|
||||
else
|
||||
{
|
||||
/* State machine update: Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_BUSY_REG;
|
||||
|
||||
/* Set ADC error code to none */
|
||||
__HAL_ADC_CLEAR_ERRORCODE(hadc);
|
||||
|
||||
|
||||
/* Set the DMA transfer complete callback */
|
||||
hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
|
||||
|
||||
/* Set the DMA half transfer complete callback */
|
||||
hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;
|
||||
|
||||
/* Set the DMA error callback */
|
||||
hadc->DMA_Handle->XferErrorCallback = ADC_DMAError;
|
||||
|
||||
|
||||
/* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
|
||||
/* start (in case of SW start): */
|
||||
|
||||
/* Clear regular group conversion flag and overrun flag */
|
||||
/* (To ensure of no unknown state from potential previous ADC */
|
||||
/* operations) */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS | ADC_FLAG_OVR));
|
||||
|
||||
/* Enable ADC overrun interrupt */
|
||||
__HAL_ADC_ENABLE_IT(hadc, ADC_IT_OVR);
|
||||
|
||||
/* Enable ADC DMA mode */
|
||||
hadc->Instance->CFGR1 |= ADC_CFGR1_DMAEN;
|
||||
|
||||
/* Start the DMA channel */
|
||||
HAL_DMA_Start_IT(hadc->DMA_Handle, (uint32_t)&hadc->Instance->DR, (uint32_t)pData, Length);
|
||||
|
||||
/* Enable conversion of regular group. */
|
||||
/* If software start has been selected, conversion starts immediately. */
|
||||
/* If external trigger has been selected, conversion will start at next */
|
||||
/* trigger event. */
|
||||
hadc->Instance->CR |= ADC_CR_ADSTART;
|
||||
tmpHALStatus = HAL_BUSY;
|
||||
}
|
||||
|
||||
|
||||
/* Process unlocked */
|
||||
__HAL_UNLOCK(hadc);
|
||||
|
||||
|
||||
/* Return function status */
|
||||
return tmpHALStatus;
|
||||
}
|
||||
|
@ -1083,6 +1113,10 @@ HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc)
|
|||
|
||||
/**
|
||||
* @brief Get ADC regular group conversion result.
|
||||
* @note Reading DR register automatically clears EOC (end of conversion of
|
||||
* regular group) flag.
|
||||
* Additionally, this functions clears EOS (end of sequence of
|
||||
* regular group) flag, in case of the end of the sequence is reached.
|
||||
* @param hadc: ADC handle
|
||||
* @retval Converted value
|
||||
*/
|
||||
|
@ -1091,11 +1125,11 @@ uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc)
|
|||
/* Check the parameters */
|
||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||
|
||||
/* Note: EOC flag is automatically cleared by hardware when reading */
|
||||
/* register DR. Additionally, clear flag EOS by software. */
|
||||
/* @Note: EOC flag is not cleared here by software because automatically */
|
||||
/* cleared by hardware when reading register DR. */
|
||||
|
||||
/* Clear regular group conversion flag */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, (ADC_FLAG_EOC | ADC_FLAG_EOS) );
|
||||
/* Clear regular group end of sequence flag */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_EOS);
|
||||
|
||||
/* Return ADC converted value */
|
||||
return hadc->Instance->DR;
|
||||
|
@ -1193,7 +1227,7 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc)
|
|||
if (__HAL_ADC_IS_CONVERSION_ONGOING_REGULAR(hadc) == RESET)
|
||||
{
|
||||
/* Disable ADC end of sequence conversion interrupt */
|
||||
/* Note: Overrun interrupt was enabled with EOC interrupt in */
|
||||
/* @Note: Overrun interrupt was enabled with EOC interrupt in */
|
||||
/* HAL_Start_IT(), but is not disabled here because can be used */
|
||||
/* by overrun IRQ process below. */
|
||||
__HAL_ADC_DISABLE_IT(hadc, ADC_IT_EOC | ADC_IT_EOS);
|
||||
|
@ -1210,14 +1244,14 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc)
|
|||
}
|
||||
|
||||
/* Conversion complete callback */
|
||||
/* Note: into callback, to determine if conversion has been triggered */
|
||||
/* @Note: into callback, to determine if conversion has been triggered */
|
||||
/* from EOC or EOS, possibility to use: */
|
||||
/* " if( __HAL_ADC_GET_FLAG(&hadc, ADC_FLAG_EOS)) " */
|
||||
HAL_ADC_ConvCpltCallback(hadc);
|
||||
|
||||
|
||||
/* Clear regular group conversion flag */
|
||||
/* Note: in case of overrun set to OVR_DATA_PRESERVED, end of conversion */
|
||||
/* @Note: in case of overrun set to OVR_DATA_PRESERVED, end of conversion */
|
||||
/* flags clear induces the release of the preserved data. */
|
||||
/* Therefore, if the preserved data value is needed, it must be */
|
||||
/* read preliminarily into HAL_ADC_ConvCpltCallback(). */
|
||||
|
@ -1230,11 +1264,12 @@ void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc)
|
|||
/* Change ADC state */
|
||||
hadc->State = HAL_ADC_STATE_AWD;
|
||||
|
||||
/* Clear ADC Analog watchdog flag */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_AWD);
|
||||
|
||||
/* Level out of window callback */
|
||||
HAL_ADC_LevelOutOfWindowCallback(hadc);
|
||||
|
||||
/* Clear ADC Analog watchdog flag */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_FLAG_AWD);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1406,7 +1441,7 @@ HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConf
|
|||
/* Management of internal measurement channels: Vbat/VrefInt/TempSensor */
|
||||
/* internal measurement paths enable: If internal channel selected, */
|
||||
/* enable dedicated internal buffers and path. */
|
||||
/* Note: these internal measurement paths can be disabled using */
|
||||
/* @Note: these internal measurement paths can be disabled using */
|
||||
/* HAL_ADC_DeInit() or removing the channel from sequencer with */
|
||||
/* channel configuration parameter "Rank". */
|
||||
|
||||
|
@ -1505,13 +1540,17 @@ HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDG
|
|||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_ADC_ALL_INSTANCE(hadc->Instance));
|
||||
assert_param(IS_ADC_CHANNEL(AnalogWDGConfig->Channel));
|
||||
assert_param(IS_FUNCTIONAL_STATE(AnalogWDGConfig->ITMode));
|
||||
|
||||
/* Verify if threshold is within the selected ADC resolution */
|
||||
assert_param(IS_ADC_RANGE(__HAL_ADC_GET_RESOLUTION(hadc), AnalogWDGConfig->HighThreshold));
|
||||
assert_param(IS_ADC_RANGE(__HAL_ADC_GET_RESOLUTION(hadc), AnalogWDGConfig->LowThreshold));
|
||||
|
||||
if(AnalogWDGConfig->WatchdogMode == ADC_ANALOGWATCHDOG_SINGLE_REG)
|
||||
{
|
||||
assert_param(IS_ADC_CHANNEL(AnalogWDGConfig->Channel));
|
||||
}
|
||||
|
||||
/* Process locked */
|
||||
__HAL_LOCK(hadc);
|
||||
|
||||
|
@ -1544,7 +1583,7 @@ HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDG
|
|||
hadc->Instance->TR |= ( __HAL_ADC_TRX_HIGHTHRESHOLD (tmpAWDHighThresholdShifted) |
|
||||
tmpAWDLowThresholdShifted );
|
||||
|
||||
/* Clear the ADC Analog watchdog flag (in case of let enabled by */
|
||||
/* Clear the ADC Analog watchdog flag (in case of left enabled by */
|
||||
/* previous ADC operations) to be ready to use for HAL_ADC_IRQHandler() */
|
||||
/* or HAL_ADC_PollForEvent(). */
|
||||
__HAL_ADC_CLEAR_FLAG(hadc, ADC_IT_AWD);
|
||||
|
@ -1715,7 +1754,7 @@ static HAL_StatusTypeDef ADC_Disable(ADC_HandleTypeDef* hadc)
|
|||
uint32_t tickstart = 0;
|
||||
|
||||
/* Verification if ADC is not already disabled: */
|
||||
/* Note: forbidden to disable ADC (set bit ADC_CR_ADDIS) if ADC is already */
|
||||
/* @Note: forbidden to disable ADC (set bit ADC_CR_ADDIS) if ADC is already */
|
||||
/* disabled. */
|
||||
if (__HAL_ADC_IS_ENABLED(hadc) != RESET )
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_adc.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file containing functions prototypes of ADC HAL library.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -66,7 +66,7 @@
|
|||
* - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ClockPrescaler')
|
||||
* - For all parameters except 'ClockPrescaler': ADC enabled without conversion on going on regular group.
|
||||
* If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed
|
||||
* without error reporting without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly).
|
||||
* without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly).
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
|
@ -726,7 +726,7 @@ typedef struct
|
|||
|
||||
/**
|
||||
* @brief Enable ADC discontinuous conversion mode for regular group
|
||||
* @param _REG_DISCONTINUOUS_MODE_: Regulat discontinuous mode.
|
||||
* @param _REG_DISCONTINUOUS_MODE_: Regular discontinuous mode.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_ADC_CFGR1_REG_DISCCONTINUOUS(_REG_DISCONTINUOUS_MODE_) ((_REG_DISCONTINUOUS_MODE_) << 16)
|
||||
|
@ -781,14 +781,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_ADC_CFGR1_DMACONTREQ(_DMACONTREQ_MODE_) ((_DMACONTREQ_MODE_) << 1)
|
||||
|
||||
/**
|
||||
* @brief Configure the channel number into offset OFRx register
|
||||
* @param _CHANNEL_: ADC Channel
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_ADC_OFR_CHANNEL(_CHANNEL_) ((_CHANNEL_) << 26)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Configure the analog watchdog high threshold into register TR.
|
||||
* @param _Threshold_: Threshold value
|
||||
|
@ -810,7 +803,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_ADC_ENABLING_CONDITIONS(__HANDLE__) \
|
||||
(( ( ((__HANDLE__)->Instance->CR) & \
|
||||
(ADC_CR_ADCAL | ADC_CR_ADSTP | \
|
||||
(ADC_CR_ADCAL | ADC_CR_ADSTP | \
|
||||
ADC_CR_ADSTART | ADC_CR_ADDIS | ADC_CR_ADEN ) \
|
||||
) == RESET \
|
||||
) ? SET : RESET)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_adc_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file provides firmware functions to manage the following
|
||||
* functionalities of the Analog to Digital Convertor (ADC)
|
||||
* peripheral:
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_adc_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of ADC HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_can.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief CAN HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Controller Area Network (CAN) peripheral:
|
||||
|
@ -101,6 +101,10 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_CAN_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F072xB) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -110,10 +114,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_CAN_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F072xB) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/** @defgroup CAN_Private_Constants CAN Private Constants
|
||||
|
@ -169,7 +169,7 @@ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef* hcan)
|
|||
uint32_t tickstart = 0;
|
||||
|
||||
/* Check CAN handle */
|
||||
if(hcan == HAL_NULL)
|
||||
if(hcan == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef* hcan, CAN_FilterConfTy
|
|||
HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef* hcan)
|
||||
{
|
||||
/* Check CAN handle */
|
||||
if(hcan == HAL_NULL)
|
||||
if(hcan == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1381,6 +1381,14 @@ static HAL_StatusTypeDef CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONum
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1388,12 +1396,5 @@ static HAL_StatusTypeDef CAN_Receive_IT(CAN_HandleTypeDef* hcan, uint8_t FIFONum
|
|||
#endif /* defined(STM32F072xB) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
|
||||
#endif /* HAL_CAN_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_can.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of CAN HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(STM32F072xB) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F072xB) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -76,23 +76,6 @@ typedef enum
|
|||
|
||||
}HAL_CAN_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL CAN Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_CAN_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_CAN_ERROR_EWG = 0x01, /*!< EWG error */
|
||||
HAL_CAN_ERROR_EPV = 0x02, /*!< EPV error */
|
||||
HAL_CAN_ERROR_BOF = 0x04, /*!< BOF error */
|
||||
HAL_CAN_ERROR_STF = 0x08, /*!< Stuff error */
|
||||
HAL_CAN_ERROR_FOR = 0x10, /*!< Form error */
|
||||
HAL_CAN_ERROR_ACK = 0x20, /*!< Acknowledgment error */
|
||||
HAL_CAN_ERROR_BR = 0x40, /*!< Bit recessive */
|
||||
HAL_CAN_ERROR_BD = 0x80, /*!< LEC dominant */
|
||||
HAL_CAN_ERROR_CRC = 0x100 /*!< LEC transfer error */
|
||||
}HAL_CAN_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief CAN init structure definition
|
||||
*/
|
||||
|
@ -250,7 +233,8 @@ typedef struct
|
|||
|
||||
__IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */
|
||||
|
||||
__IO HAL_CAN_ErrorTypeDef ErrorCode; /*!< CAN Error code */
|
||||
__IO uint32_t ErrorCode; /*!< CAN Error code
|
||||
This parameter can be a value of @ref CAN_Error */
|
||||
|
||||
}CAN_HandleTypeDef;
|
||||
/**
|
||||
|
@ -263,6 +247,23 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup CAN_Error CAN Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_CAN_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_CAN_ERROR_EWG ((uint32_t)0x00000001) /*!< EWG error */
|
||||
#define HAL_CAN_ERROR_EPV ((uint32_t)0x00000002) /*!< EPV error */
|
||||
#define HAL_CAN_ERROR_BOF ((uint32_t)0x00000004) /*!< BOF error */
|
||||
#define HAL_CAN_ERROR_STF ((uint32_t)0x00000008) /*!< Stuff error */
|
||||
#define HAL_CAN_ERROR_FOR ((uint32_t)0x00000010) /*!< Form error */
|
||||
#define HAL_CAN_ERROR_ACK ((uint32_t)0x00000020) /*!< Acknowledgment error */
|
||||
#define HAL_CAN_ERROR_BR ((uint32_t)0x00000040) /*!< Bit recessive */
|
||||
#define HAL_CAN_ERROR_BD ((uint32_t)0x00000080) /*!< LEC dominant */
|
||||
#define HAL_CAN_ERROR_CRC ((uint32_t)0x00000100) /*!< LEC transfer error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup CAN_InitStatus CAN InitStatus
|
||||
* @{
|
||||
*/
|
||||
|
@ -796,7 +797,7 @@ HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef* hcan);
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F072xB || STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F072xB || STM32F042x6 || STM32F048xx || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_cec.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief CEC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the High Definition Multimedia Interface
|
||||
|
@ -77,6 +77,13 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) ||\
|
||||
defined(STM32F051x8) || defined(STM32F058xx) ||\
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) ||\
|
||||
defined(STM32F091xC) || defined (STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -85,12 +92,6 @@
|
|||
* @brief HAL CEC module driver
|
||||
* @{
|
||||
*/
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) ||\
|
||||
defined(STM32F051x8) || defined(STM32F058xx) ||\
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) ||\
|
||||
defined(STM32F091xC) || defined (STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
|
@ -155,7 +156,7 @@ HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec)
|
|||
uint32_t tmpreg = 0x0;
|
||||
|
||||
/* Check the CEC handle allocation */
|
||||
if(hcec == HAL_NULL)
|
||||
if(hcec == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -215,7 +216,7 @@ HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec)
|
|||
HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec)
|
||||
{
|
||||
/* Check the CEC handle allocation */
|
||||
if(hcec == HAL_NULL)
|
||||
if(hcec == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationA
|
|||
if((hcec->State == HAL_CEC_STATE_READY) && (__HAL_CEC_GET_TRANSMISSION_START_FLAG(hcec) == RESET))
|
||||
{
|
||||
hcec->ErrorCode = HAL_CEC_ERROR_NONE;
|
||||
if((pData == HAL_NULL ) && (Size > 0))
|
||||
if((pData == NULL ) && (Size > 0))
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_ERROR;
|
||||
return HAL_ERROR;
|
||||
|
@ -370,7 +371,7 @@ HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationA
|
|||
{
|
||||
if((Timeout == 0) || ((HAL_GetTick() - tickstart) > Timeout))
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_TIMEOUT;
|
||||
hcec->State = HAL_CEC_STATE_READY;
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hcec);
|
||||
return HAL_TIMEOUT;
|
||||
|
@ -478,7 +479,7 @@ HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint3
|
|||
if (hcec->State == HAL_CEC_STATE_READY)
|
||||
{
|
||||
hcec->ErrorCode = HAL_CEC_ERROR_NONE;
|
||||
if (pData == HAL_NULL )
|
||||
if (pData == NULL )
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_ERROR;
|
||||
return HAL_ERROR;
|
||||
|
@ -500,7 +501,7 @@ HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint3
|
|||
{
|
||||
if((Timeout == 0) || ((HAL_GetTick() - tickstart) > Timeout))
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_TIMEOUT;
|
||||
hcec->State = HAL_CEC_STATE_READY;
|
||||
__HAL_UNLOCK(hcec);
|
||||
return HAL_TIMEOUT;
|
||||
}
|
||||
|
@ -582,7 +583,7 @@ HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t Destinati
|
|||
if (((hcec->State == HAL_CEC_STATE_READY) || (hcec->State == HAL_CEC_STATE_STANDBY_RX))
|
||||
&& (__HAL_CEC_GET_TRANSMISSION_START_FLAG(hcec) == RESET))
|
||||
{
|
||||
if((pData == HAL_NULL ) && (Size > 0))
|
||||
if((pData == NULL ) && (Size > 0))
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_ERROR;
|
||||
return HAL_ERROR;
|
||||
|
@ -712,7 +713,7 @@ HAL_StatusTypeDef HAL_CEC_Receive_IT(CEC_HandleTypeDef *hcec, uint8_t *pData)
|
|||
{
|
||||
if(hcec->State == HAL_CEC_STATE_READY)
|
||||
{
|
||||
if(pData == HAL_NULL )
|
||||
if(pData == NULL )
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_ERROR;
|
||||
return HAL_ERROR;
|
||||
|
@ -990,8 +991,16 @@ static HAL_StatusTypeDef CEC_Transmit_IT(CEC_HandleTypeDef *hcec)
|
|||
__HAL_CEC_ENABLE(hcec);
|
||||
|
||||
__HAL_CEC_CLEAR_FLAG(hcec,CEC_ISR_TXBR|CEC_ISR_TXEND);
|
||||
|
||||
hcec->State = HAL_CEC_STATE_READY;
|
||||
|
||||
/* If RX interruptions are enabled, return to HAL_CEC_STATE_STANDBY_RX state */
|
||||
if (__HAL_CEC_GET_IT_SOURCE(hcec, (CEC_IER_RXBRIE|CEC_IER_RXENDIE) ) != RESET)
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_STANDBY_RX;
|
||||
}
|
||||
else
|
||||
{
|
||||
hcec->State = HAL_CEC_STATE_READY;
|
||||
}
|
||||
|
||||
HAL_CEC_TxCpltCallback(hcec);
|
||||
|
||||
|
@ -1093,17 +1102,18 @@ static HAL_StatusTypeDef CEC_Receive_IT(CEC_HandleTypeDef *hcec)
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F051x8) || defined(STM32F058xx) || */
|
||||
/* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */
|
||||
/* defined(STM32F091xC) || defined (STM32F098xx) */
|
||||
|
||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_cec.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of CEC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -178,8 +178,8 @@ typedef struct
|
|||
|
||||
uint16_t RxXferSize; /* CEC Rx Transfer size, 0: header received only */
|
||||
|
||||
uint32_t ErrorCode; /* For errors handling purposes, copy of ISR register
|
||||
in case error is reported */
|
||||
__IO uint32_t ErrorCode; /* For errors handling purposes, copy of ISR register
|
||||
in case error is reported */
|
||||
|
||||
HAL_LockTypeDef Lock; /* Locking object */
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_comp.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief COMP HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the COMP peripheral:
|
||||
|
@ -40,7 +40,7 @@
|
|||
(++) COMP_EXTI_LINE_COMP2_EVENT
|
||||
|
||||
|
||||
[..] Table 1. COMP Inputs for the STM32F05x and STM32F07x devices
|
||||
[..] Table 1. COMP Inputs for the STM32F05x, STM32F07x and STM32F09x devices
|
||||
+--------------------------------------------------+
|
||||
| | | COMP1 | COMP2 |
|
||||
|-----------------|----------------|---------------|
|
||||
|
@ -56,7 +56,7 @@
|
|||
| Input | | | |
|
||||
+--------------------------------------------------+
|
||||
|
||||
[..] Table 2. COMP Outputs for the STM32F05x and STM32F07x devices
|
||||
[..] Table 2. COMP Outputs for the STM32F05x, STM32F07x and STM32F09x devices
|
||||
+---------------+
|
||||
| COMP1 | COMP2 |
|
||||
|-------|-------|
|
||||
|
@ -65,7 +65,7 @@
|
|||
| PA11 | PA12 |
|
||||
+---------------+
|
||||
|
||||
[..] Table 3. COMP Outputs redirection to embedded timers for the STM32F05x and STM32F07x devices
|
||||
[..] Table 3. COMP Outputs redirection to embedded timers for the STM32F05x, STM32F07x and STM32F09x devices
|
||||
+---------------------------------+
|
||||
| COMP1 | COMP2 |
|
||||
|----------------|----------------|
|
||||
|
@ -87,7 +87,7 @@
|
|||
##### How to use this driver #####
|
||||
================================================================================
|
||||
[..]
|
||||
This driver provides functions to configure and program the Comparators of STM32F05x and STM32F07x devices.
|
||||
This driver provides functions to configure and program the Comparators of STM32F05x, STM32F07x and STM32F09x devices.
|
||||
|
||||
To use the comparator, perform the following steps:
|
||||
|
||||
|
@ -143,13 +143,15 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined (STM32F098xx)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -159,8 +161,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_COMP_MODULE_ENABLED
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/** @defgroup COMP_Private_Constants COMP Private Constants
|
||||
|
@ -215,7 +215,7 @@ HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp)
|
|||
uint32_t regshift = COMP_CSR_COMP1_SHIFT;
|
||||
|
||||
/* Check the COMP handle allocation and lock status */
|
||||
if((hcomp == HAL_NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
if((hcomp == NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp)
|
|||
uint32_t regshift = COMP_CSR_COMP1_SHIFT;
|
||||
|
||||
/* Check the COMP handle allocation and lock status */
|
||||
if((hcomp == HAL_NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
if((hcomp == NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp)
|
|||
uint32_t regshift = COMP_CSR_COMP1_SHIFT;
|
||||
|
||||
/* Check the COMP handle allocation and lock status */
|
||||
if((hcomp == HAL_NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
if((hcomp == NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp)
|
|||
uint32_t regshift = COMP_CSR_COMP1_SHIFT;
|
||||
|
||||
/* Check the COMP handle allocation and lock status */
|
||||
if((hcomp == HAL_NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
if((hcomp == NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp)
|
|||
uint32_t regshift = COMP_CSR_COMP1_SHIFT;
|
||||
|
||||
/* Check the COMP handle allocation and lock status */
|
||||
if((hcomp == HAL_NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
if((hcomp == NULL) || ((hcomp->State & COMP_STATE_BIT_LOCK) != RESET))
|
||||
{
|
||||
status = HAL_ERROR;
|
||||
}
|
||||
|
@ -657,10 +657,10 @@ __weak void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp)
|
|||
* @param hcomp : COMP handle
|
||||
* @retval HAL state
|
||||
*/
|
||||
HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp)
|
||||
uint32_t HAL_COMP_GetState(COMP_HandleTypeDef *hcomp)
|
||||
{
|
||||
/* Check the COMP handle allocation */
|
||||
if(hcomp == HAL_NULL)
|
||||
if(hcomp == NULL)
|
||||
{
|
||||
return HAL_COMP_STATE_RESET;
|
||||
}
|
||||
|
@ -678,7 +678,6 @@ HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp)
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -691,4 +690,6 @@ HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp)
|
|||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || defined (STM32F098xx) */
|
||||
|
||||
#endif /* HAL_COMP_MODULE_ENABLED */
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_comp.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of COMP HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -96,18 +96,6 @@ typedef struct
|
|||
|
||||
}COMP_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL State structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_COMP_STATE_RESET = 0x00, /*!< COMP not yet initialized or disabled */
|
||||
HAL_COMP_STATE_READY = 0x01, /*!< COMP initialized and ready for use */
|
||||
HAL_COMP_STATE_READY_LOCKED = 0x11, /*!< COMP initialized but the configuration is locked */
|
||||
HAL_COMP_STATE_BUSY = 0x02, /*!< COMP is running */
|
||||
HAL_COMP_STATE_BUSY_LOCKED = 0x12 /*!< COMP is running and the configuration is locked */
|
||||
}HAL_COMP_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief COMP Handle Structure definition
|
||||
*/
|
||||
|
@ -116,7 +104,8 @@ typedef struct
|
|||
COMP_TypeDef *Instance; /*!< Register base address */
|
||||
COMP_InitTypeDef Init; /*!< COMP required parameters */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
__IO HAL_COMP_StateTypeDef State; /*!< COMP communication state */
|
||||
__IO uint32_t State; /*!< COMP communication state
|
||||
This parameter can be a value of @ref COMP_State */
|
||||
}COMP_HandleTypeDef;
|
||||
|
||||
/**
|
||||
|
@ -128,6 +117,18 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup COMP_State COMP State
|
||||
* @{
|
||||
*/
|
||||
#define HAL_COMP_STATE_RESET ((uint32_t)0x00000000) /*!< COMP not yet initialized or disabled */
|
||||
#define HAL_COMP_STATE_READY ((uint32_t)0x00000001) /*!< COMP initialized and ready for use */
|
||||
#define HAL_COMP_STATE_READY_LOCKED ((uint32_t)0x00000011) /*!< COMP initialized but the configuration is locked */
|
||||
#define HAL_COMP_STATE_BUSY ((uint32_t)0x00000002) /*!< COMP is running */
|
||||
#define HAL_COMP_STATE_BUSY_LOCKED ((uint32_t)0x00000012) /*!< COMP is running and the configuration is locked */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup COMP_OutputPolarity COMP OutputPolarity
|
||||
* @{
|
||||
*/
|
||||
|
@ -447,7 +448,7 @@ void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp);
|
|||
* @{
|
||||
*/
|
||||
/* Peripheral State and Error functions ***************************************/
|
||||
HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
|
||||
uint32_t HAL_COMP_GetState(COMP_HandleTypeDef *hcomp);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_conf_template.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_cortex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief CORTEX HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the CORTEX:
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_cortex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of CORTEX HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_crc.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief CRC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Cyclic Redundancy Check (CRC) peripheral:
|
||||
|
@ -120,7 +120,7 @@ static uint32_t CRC_Handle_16(CRC_HandleTypeDef *hcrc, uint16_t pBuffer[], uint3
|
|||
HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)
|
||||
{
|
||||
/* Check the CRC handle allocation */
|
||||
if(hcrc == HAL_NULL)
|
||||
if(hcrc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)
|
|||
HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc)
|
||||
{
|
||||
/* Check the CRC handle allocation */
|
||||
if(hcrc == HAL_NULL)
|
||||
if(hcrc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_crc.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of CRC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -92,7 +92,7 @@ typedef struct
|
|||
e.g., for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65.
|
||||
No need to specify it if DefaultPolynomialUse is set to DEFAULT_POLYNOMIAL_ENABLE */
|
||||
|
||||
uint32_t CRCLength; /*!< This parameter is a value of @ref CRCEx_Polynomial_Size_Definitions and indicates CRC length.
|
||||
uint32_t CRCLength; /*!< This parameter is a value of @ref CRCEx_Polynomial_Sizes and indicates CRC length.
|
||||
Value can be either one of
|
||||
CRC_POLYLENGTH_32B (32-bit CRC)
|
||||
CRC_POLYLENGTH_16B (16-bit CRC)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_crc_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended CRC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the CRC peripheral:
|
||||
|
@ -104,7 +104,7 @@
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_CRCEx_Init(CRC_HandleTypeDef *hcrc)
|
||||
{
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined (STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined (STM32F098xx)
|
||||
/* check whether or not non-default generating polynomial has been
|
||||
* picked up by user */
|
||||
assert_param(IS_DEFAULT_POLYNOMIAL(hcrc->Init.DefaultPolynomialUse));
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_crc_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of CRC HAL extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -87,10 +87,10 @@
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/** @defgroup CRCEx_Polynomial_Sizes Polynomial sizes to configure the IP
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#define CRC_POLYLENGTH_32B ((uint32_t)0x00000000)
|
||||
#define CRC_POLYLENGTH_16B ((uint32_t)CRC_CR_POLYSIZE_0)
|
||||
#define CRC_POLYLENGTH_8B ((uint32_t)CRC_CR_POLYSIZE_1)
|
||||
|
@ -99,6 +99,10 @@
|
|||
((LENGTH) == CRC_POLYLENGTH_16B) || \
|
||||
((LENGTH) == CRC_POLYLENGTH_8B) || \
|
||||
((LENGTH) == CRC_POLYLENGTH_7B))
|
||||
#else
|
||||
#define CRC_POLYLENGTH_32B ((uint32_t)0x00000000)
|
||||
#define IS_CRC_POL_LENGTH(LENGTH) ((LENGTH) == CRC_POLYLENGTH_32B)
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -106,14 +110,18 @@
|
|||
/** @defgroup CRCEx_Polynomial_Size_Definitions CRC polynomial possible sizes actual definitions
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#define HAL_CRC_LENGTH_32B 32
|
||||
#define HAL_CRC_LENGTH_16B 16
|
||||
#define HAL_CRC_LENGTH_8B 8
|
||||
#define HAL_CRC_LENGTH_7B 7
|
||||
#else
|
||||
#define HAL_CRC_LENGTH_32B 32
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -137,7 +145,7 @@
|
|||
*/
|
||||
#define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT))
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Set CRC non-default polynomial
|
||||
* @param __HANDLE__ : CRC handle
|
||||
|
@ -145,7 +153,7 @@
|
|||
* @retval None.
|
||||
*/
|
||||
#define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -165,9 +173,9 @@ HAL_StatusTypeDef HAL_CRCEx_Init(CRC_HandleTypeDef *hcrc);
|
|||
HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode);
|
||||
HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode);
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength);
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dac.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief DAC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Digital to Analog Converter (DAC) peripheral:
|
||||
|
@ -177,6 +177,12 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined (STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -186,12 +192,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined (STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
@ -229,7 +229,7 @@
|
|||
HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac)
|
||||
{
|
||||
/* Check DAC handle */
|
||||
if(hdac == HAL_NULL)
|
||||
if(hdac == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac)
|
|||
HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac)
|
||||
{
|
||||
/* Check DAC handle */
|
||||
if(hdac == HAL_NULL)
|
||||
if(hdac == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -442,11 +442,19 @@ HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel)
|
|||
{
|
||||
status = HAL_DMA_Abort(hdac->DMA_Handle2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Check if DMA Channel effectively disabled */
|
||||
if (status != HAL_OK)
|
||||
{
|
||||
/* Update DAC state machine to error */
|
||||
hdac->State = HAL_DAC_STATE_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Change DAC state */
|
||||
hdac->State = HAL_DAC_STATE_READY;
|
||||
|
||||
}
|
||||
|
||||
/* Return function status */
|
||||
return status;
|
||||
}
|
||||
|
@ -667,18 +675,19 @@ __weak void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dac.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of DAC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dac_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief DAC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of DAC extension peripheral:
|
||||
|
@ -56,6 +56,12 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -65,12 +71,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
@ -775,7 +775,7 @@ HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32
|
|||
hdac->State = HAL_DAC_STATE_BUSY;
|
||||
|
||||
/* Enable the selected wave generation for the selected DAC channel */
|
||||
hdac->Instance->CR |= (DAC_WAVE_TRIANGLE | Amplitude) << Channel;
|
||||
MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_WAVE_TRIANGLE | Amplitude) << Channel);
|
||||
|
||||
/* Change DAC state */
|
||||
hdac->State = HAL_DAC_STATE_READY;
|
||||
|
@ -823,7 +823,7 @@ HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t
|
|||
hdac->State = HAL_DAC_STATE_BUSY;
|
||||
|
||||
/* Enable the selected wave generation for the selected DAC channel */
|
||||
hdac->Instance->CR |= (DAC_WAVE_NOISE | Amplitude) << Channel;
|
||||
MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_WAVE_NOISE | Amplitude) << Channel);
|
||||
|
||||
/* Change DAC state */
|
||||
hdac->State = HAL_DAC_STATE_READY;
|
||||
|
@ -1066,17 +1066,18 @@ void DAC_DMAErrorCh2(DMA_HandleTypeDef *hdma)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F071xB STM32F072xB STM32F078xx */
|
||||
/* STM32F091xC STM32F098xx */
|
||||
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dac_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of DAC HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_def.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file contains HAL common defines, enumeration, macros and
|
||||
* structures definitions.
|
||||
******************************************************************************
|
||||
|
@ -70,8 +70,8 @@ typedef enum
|
|||
} HAL_LockTypeDef;
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifndef HAL_NULL
|
||||
#define HAL_NULL (void *) 0
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define HAL_MAX_DELAY 0xFFFFFFFF
|
||||
|
@ -85,6 +85,8 @@ typedef enum
|
|||
(__DMA_HANDLE_).Parent = (__HANDLE__); \
|
||||
} while(0)
|
||||
|
||||
#define UNUSED(x) ((void)(x))
|
||||
|
||||
/** @brief Reset the Handle's State field.
|
||||
* @param __HANDLE__: specifies the Peripheral Handle.
|
||||
* @note This macro can be used for the following purpose:
|
||||
|
@ -154,6 +156,23 @@ typedef enum
|
|||
#endif /* __ALIGN_BEGIN */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
/**
|
||||
* @brief __NOINLINE definition
|
||||
*/
|
||||
#if defined ( __CC_ARM ) || defined ( __GNUC__ )
|
||||
/* ARM & GNUCompiler
|
||||
----------------
|
||||
*/
|
||||
#define __NOINLINE __attribute__ ( (noinline) )
|
||||
|
||||
#elif defined ( __ICCARM__ )
|
||||
/* ICCARM Compiler
|
||||
---------------
|
||||
*/
|
||||
#define __NOINLINE _Pragma("optimize = no_inline")
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dma.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief DMA HAL module driver.
|
||||
*
|
||||
* This file provides firmware functions to manage the following
|
||||
|
@ -172,7 +172,7 @@ HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
|
|||
uint32_t tmp = 0;
|
||||
|
||||
/* Check the DMA handle allocation */
|
||||
if(hdma == HAL_NULL)
|
||||
if(hdma == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
|
|||
HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma)
|
||||
{
|
||||
/* Check the DMA handle allocation */
|
||||
if(hdma == HAL_NULL)
|
||||
if(hdma == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
|
|||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hdma);
|
||||
|
||||
if (hdma->XferErrorCallback != HAL_NULL)
|
||||
if (hdma->XferErrorCallback != (void (*)(DMA_HandleTypeDef *))NULL)
|
||||
{
|
||||
/* Transfer error callback */
|
||||
hdma->XferErrorCallback(hdma);
|
||||
|
@ -560,7 +560,7 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
|
|||
/* Change DMA peripheral state */
|
||||
hdma->State = HAL_DMA_STATE_READY_HALF;
|
||||
|
||||
if(hdma->XferHalfCpltCallback != HAL_NULL)
|
||||
if(hdma->XferHalfCpltCallback != (void (*)(DMA_HandleTypeDef *))NULL)
|
||||
{
|
||||
/* Half transfer callback */
|
||||
hdma->XferHalfCpltCallback(hdma);
|
||||
|
@ -590,7 +590,7 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
|
|||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hdma);
|
||||
|
||||
if(hdma->XferCpltCallback != HAL_NULL)
|
||||
if(hdma->XferCpltCallback != (void (*)(DMA_HandleTypeDef *))NULL)
|
||||
{
|
||||
/* Transfer complete callback */
|
||||
hdma->XferCpltCallback(hdma);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dma.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of DMA HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -288,34 +288,34 @@ typedef struct __DMA_HandleTypeDef
|
|||
* @{
|
||||
*/
|
||||
|
||||
#define DMA_FLAG_GL1 ((uint32_t)0x00000001)
|
||||
#define DMA_FLAG_TC1 ((uint32_t)0x00000002)
|
||||
#define DMA_FLAG_HT1 ((uint32_t)0x00000004)
|
||||
#define DMA_FLAG_TE1 ((uint32_t)0x00000008)
|
||||
#define DMA_FLAG_GL2 ((uint32_t)0x00000010)
|
||||
#define DMA_FLAG_TC2 ((uint32_t)0x00000020)
|
||||
#define DMA_FLAG_HT2 ((uint32_t)0x00000040)
|
||||
#define DMA_FLAG_TE2 ((uint32_t)0x00000080)
|
||||
#define DMA_FLAG_GL3 ((uint32_t)0x00000100)
|
||||
#define DMA_FLAG_TC3 ((uint32_t)0x00000200)
|
||||
#define DMA_FLAG_HT3 ((uint32_t)0x00000400)
|
||||
#define DMA_FLAG_TE3 ((uint32_t)0x00000800)
|
||||
#define DMA_FLAG_GL4 ((uint32_t)0x00001000)
|
||||
#define DMA_FLAG_TC4 ((uint32_t)0x00002000)
|
||||
#define DMA_FLAG_HT4 ((uint32_t)0x00004000)
|
||||
#define DMA_FLAG_TE4 ((uint32_t)0x00008000)
|
||||
#define DMA_FLAG_GL5 ((uint32_t)0x00010000)
|
||||
#define DMA_FLAG_TC5 ((uint32_t)0x00020000)
|
||||
#define DMA_FLAG_HT5 ((uint32_t)0x00040000)
|
||||
#define DMA_FLAG_TE5 ((uint32_t)0x00080000)
|
||||
#define DMA_FLAG_GL6 ((uint32_t)0x00100000)
|
||||
#define DMA_FLAG_TC6 ((uint32_t)0x00200000)
|
||||
#define DMA_FLAG_HT6 ((uint32_t)0x00400000)
|
||||
#define DMA_FLAG_TE6 ((uint32_t)0x00800000)
|
||||
#define DMA_FLAG_GL7 ((uint32_t)0x01000000)
|
||||
#define DMA_FLAG_TC7 ((uint32_t)0x02000000)
|
||||
#define DMA_FLAG_HT7 ((uint32_t)0x04000000)
|
||||
#define DMA_FLAG_TE7 ((uint32_t)0x08000000)
|
||||
#define DMA_FLAG_GL1 ((uint32_t)0x00000001) /*!< Channel 1 global interrupt flag */
|
||||
#define DMA_FLAG_TC1 ((uint32_t)0x00000002) /*!< Channel 1 transfer complete flag */
|
||||
#define DMA_FLAG_HT1 ((uint32_t)0x00000004) /*!< Channel 1 half transfer flag */
|
||||
#define DMA_FLAG_TE1 ((uint32_t)0x00000008) /*!< Channel 1 transfer error flag */
|
||||
#define DMA_FLAG_GL2 ((uint32_t)0x00000010) /*!< Channel 2 global interrupt flag */
|
||||
#define DMA_FLAG_TC2 ((uint32_t)0x00000020) /*!< Channel 2 transfer complete flag */
|
||||
#define DMA_FLAG_HT2 ((uint32_t)0x00000040) /*!< Channel 2 half transfer flag */
|
||||
#define DMA_FLAG_TE2 ((uint32_t)0x00000080) /*!< Channel 2 transfer error flag */
|
||||
#define DMA_FLAG_GL3 ((uint32_t)0x00000100) /*!< Channel 3 global interrupt flag */
|
||||
#define DMA_FLAG_TC3 ((uint32_t)0x00000200) /*!< Channel 3 transfer complete flag */
|
||||
#define DMA_FLAG_HT3 ((uint32_t)0x00000400) /*!< Channel 3 half transfer flag */
|
||||
#define DMA_FLAG_TE3 ((uint32_t)0x00000800) /*!< Channel 3 transfer error flag */
|
||||
#define DMA_FLAG_GL4 ((uint32_t)0x00001000) /*!< Channel 4 global interrupt flag */
|
||||
#define DMA_FLAG_TC4 ((uint32_t)0x00002000) /*!< Channel 4 transfer complete flag */
|
||||
#define DMA_FLAG_HT4 ((uint32_t)0x00004000) /*!< Channel 4 half transfer flag */
|
||||
#define DMA_FLAG_TE4 ((uint32_t)0x00008000) /*!< Channel 4 transfer error flag */
|
||||
#define DMA_FLAG_GL5 ((uint32_t)0x00010000) /*!< Channel 5 global interrupt flag */
|
||||
#define DMA_FLAG_TC5 ((uint32_t)0x00020000) /*!< Channel 5 transfer complete flag */
|
||||
#define DMA_FLAG_HT5 ((uint32_t)0x00040000) /*!< Channel 5 half transfer flag */
|
||||
#define DMA_FLAG_TE5 ((uint32_t)0x00080000) /*!< Channel 5 transfer error flag */
|
||||
#define DMA_FLAG_GL6 ((uint32_t)0x00100000) /*!< Channel 6 global interrupt flag */
|
||||
#define DMA_FLAG_TC6 ((uint32_t)0x00200000) /*!< Channel 6 transfer complete flag */
|
||||
#define DMA_FLAG_HT6 ((uint32_t)0x00400000) /*!< Channel 6 half transfer flag */
|
||||
#define DMA_FLAG_TE6 ((uint32_t)0x00800000) /*!< Channel 6 transfer error flag */
|
||||
#define DMA_FLAG_GL7 ((uint32_t)0x01000000) /*!< Channel 7 global interrupt flag */
|
||||
#define DMA_FLAG_TC7 ((uint32_t)0x02000000) /*!< Channel 7 transfer complete flag */
|
||||
#define DMA_FLAG_HT7 ((uint32_t)0x04000000) /*!< Channel 7 half transfer flag */
|
||||
#define DMA_FLAG_TE7 ((uint32_t)0x08000000) /*!< Channel 7 transfer error flag */
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_dma_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of DMA HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -56,201 +56,229 @@
|
|||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
/** @defgroup DMAEx_Exported_Constants DMAEx Exported Constants
|
||||
* @{
|
||||
*/
|
||||
#define DMA1_CHANNEL1_RMP 0x00000000
|
||||
#define DMA1_CHANNEL2_RMP 0x10000000
|
||||
#define DMA1_CHANNEL3_RMP 0x20000000
|
||||
#define DMA1_CHANNEL4_RMP 0x30000000
|
||||
#define DMA1_CHANNEL5_RMP 0x40000000
|
||||
#define DMA1_CHANNEL6_RMP 0x50000000
|
||||
#define DMA1_CHANNEL7_RMP 0x60000000
|
||||
#define DMA2_CHANNEL1_RMP 0x00000000
|
||||
#define DMA2_CHANNEL2_RMP 0x10000000
|
||||
#define DMA2_CHANNEL3_RMP 0x20000000
|
||||
#define DMA2_CHANNEL4_RMP 0x30000000
|
||||
#define DMA2_CHANNEL5_RMP 0x40000000
|
||||
#define DMA1_CHANNEL1_RMP 0x00000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA1_CHANNEL2_RMP 0x10000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA1_CHANNEL3_RMP 0x20000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA1_CHANNEL4_RMP 0x30000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA1_CHANNEL5_RMP 0x40000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#if !defined(STM32F030xC)
|
||||
#define DMA1_CHANNEL6_RMP 0x50000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA1_CHANNEL7_RMP 0x60000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA2_CHANNEL1_RMP 0x00000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA2_CHANNEL2_RMP 0x10000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA2_CHANNEL3_RMP 0x20000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA2_CHANNEL4_RMP 0x30000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#define DMA2_CHANNEL5_RMP 0x40000000 /*!< Internal define for remaping on STM32F09x/30xC */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
/****************** DMA1 remap bit field definition********************/
|
||||
/* DMA1 - Channel 1 */
|
||||
#define HAL_DMA1_CH1_DEFAULT (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH1_ADC (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_ADC) /*!< Remap ADC on DMA1 Channel 1*/
|
||||
#define HAL_DMA1_CH1_TIM17_CH1 (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_TIM17_UP (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART1_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART2_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART3_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART4_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART5_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART6_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART7_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART8_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA_RMPCR1_CH1_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_DEFAULT (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH1_ADC (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_ADC) /*!< Remap ADC on DMA1 Channel 1*/
|
||||
#define HAL_DMA1_CH1_TIM17_CH1 (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_TIM17_UP (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART1_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART2_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART3_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART4_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART5_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART6_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 1 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH1_USART7_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 1 */
|
||||
#define HAL_DMA1_CH1_USART8_RX (uint32_t) (DMA1_CHANNEL1_RMP | DMA1_CSELR_CH1_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 1 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
/* DMA1 - Channel 2 */
|
||||
#define HAL_DMA1_CH2_DEFAULT (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH2_ADC (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_ADC) /*!< Remap ADC on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_I2C1_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_I2C1_TX) /*!< Remap I2C1 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_SPI1_RX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_SPI1_RX) /*!< Remap SPI1 Rx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM1_CH1 (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_TIM1_CH1) /*!< Remap TIM1 channel 1 on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM17_CH1 (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM17_UP (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART1_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART2_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART3_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART4_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART5_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART6_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART7_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART8_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA_RMPCR1_CH2_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_DEFAULT (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH2_ADC (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_ADC) /*!< Remap ADC on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_I2C1_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_I2C1_TX) /*!< Remap I2C1 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_SPI1_RX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_SPI1_RX) /*!< Remap SPI1 Rx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM1_CH1 (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_TIM1_CH1) /*!< Remap TIM1 channel 1 on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM17_CH1 (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_TIM17_UP (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART1_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART2_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART3_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART4_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART5_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART6_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 2 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH2_USART7_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 2 */
|
||||
#define HAL_DMA1_CH2_USART8_TX (uint32_t) (DMA1_CHANNEL2_RMP | DMA1_CSELR_CH2_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 2 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
/* DMA1 - Channel 3 */
|
||||
#define HAL_DMA1_CH3_DEFAULT (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH3_TIM6_UP (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_TIM6_UP) /*!< Remap TIM6 up on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_DAC_CH1 (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_DAC_CH1) /*!< Remap DAC Channel 1on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_I2C1_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_I2C1_RX) /*!< Remap I2C1 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_SPI1_TX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_SPI1_TX) /*!< Remap SPI1 Tx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM1_CH2 (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_TIM1_CH2) /*!< Remap TIM1 channel 2 on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM2_CH2 (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_TIM2_CH2) /*!< Remap TIM2 channel 2 on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM16_CH1 (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM16_UP (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART1_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART2_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART3_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART4_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART5_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART6_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART7_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART8_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA_RMPCR1_CH3_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_DEFAULT (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH3_TIM6_UP (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_TIM6_UP) /*!< Remap TIM6 up on DMA1 channel 3 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH3_DAC_CH1 (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_DAC_CH1) /*!< Remap DAC Channel 1on DMA1 channel 3 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
#define HAL_DMA1_CH3_I2C1_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_I2C1_RX) /*!< Remap I2C1 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_SPI1_TX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_SPI1_TX) /*!< Remap SPI1 Tx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM1_CH2 (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_TIM1_CH2) /*!< Remap TIM1 channel 2 on DMA1 channel 3 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH3_TIM2_CH2 (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_TIM2_CH2) /*!< Remap TIM2 channel 2 on DMA1 channel 3 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
#define HAL_DMA1_CH3_TIM16_CH1 (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_TIM16_UP (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART1_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART2_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART3_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART4_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART5_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART6_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 3 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH3_USART7_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 3 */
|
||||
#define HAL_DMA1_CH3_USART8_RX (uint32_t) (DMA1_CHANNEL3_RMP | DMA1_CSELR_CH3_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 3 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
/* DMA1 - Channel 4 */
|
||||
#define HAL_DMA1_CH4_DEFAULT (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH4_TIM7_UP (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM7_UP) /*!< Remap TIM7 up on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_DAC_CH2 (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_DAC_CH2) /*!< Remap DAC Channel 2 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_I2C2_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_I2C2_TX) /*!< Remap I2C2 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_SPI2_RX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_SPI2_RX) /*!< Remap SPI2 Rx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM2_CH4 (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM2_CH4) /*!< Remap TIM2 channel 4 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM3_CH1 (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM3_CH1) /*!< Remap TIM3 channel 1 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM3_TRIG (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM3_TRIG) /*!< Remap TIM3 Trig on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM16_CH1 (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM16_UP (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART1_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART2_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART3_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART4_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART5_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART6_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART7_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART8_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA_RMPCR1_CH4_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_DEFAULT (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH4_TIM7_UP (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM7_UP) /*!< Remap TIM7 up on DMA1 channel 4 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH4_DAC_CH2 (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_DAC_CH2) /*!< Remap DAC Channel 2 on DMA1 channel 4 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
#define HAL_DMA1_CH4_I2C2_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_I2C2_TX) /*!< Remap I2C2 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_SPI2_RX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_SPI2_RX) /*!< Remap SPI2 Rx on DMA1 channel 4 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH4_TIM2_CH4 (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM2_CH4) /*!< Remap TIM2 channel 4 on DMA1 channel 4 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
#define HAL_DMA1_CH4_TIM3_CH1 (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM3_CH1) /*!< Remap TIM3 channel 1 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM3_TRIG (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM3_TRIG) /*!< Remap TIM3 Trig on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM16_CH1 (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_TIM16_UP (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART1_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART2_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART3_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART4_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART5_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART6_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 4 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH4_USART7_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 4 */
|
||||
#define HAL_DMA1_CH4_USART8_TX (uint32_t) (DMA1_CHANNEL4_RMP | DMA1_CSELR_CH4_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 4 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
/* DMA1 - Channel 5 */
|
||||
#define HAL_DMA1_CH5_DEFAULT (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH5_I2C2_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_I2C2_RX) /*!< Remap I2C2 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_SPI2_TX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_SPI2_TX) /*!< Remap SPI1 Tx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_TIM1_CH3 (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_TIM1_CH3) /*!< Remap TIM1 channel 3 on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART1_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART2_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART3_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART4_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART5_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART6_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART7_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART8_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA_RMPCR1_CH5_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_DEFAULT (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH5_I2C2_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_I2C2_RX) /*!< Remap I2C2 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_SPI2_TX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_SPI2_TX) /*!< Remap SPI1 Tx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_TIM1_CH3 (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_TIM1_CH3) /*!< Remap TIM1 channel 3 on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART1_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART2_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART3_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART4_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART5_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART6_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 5 */
|
||||
#if !defined(STM32F030xC)
|
||||
#define HAL_DMA1_CH5_USART7_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 5 */
|
||||
#define HAL_DMA1_CH5_USART8_RX (uint32_t) (DMA1_CHANNEL5_RMP | DMA1_CSELR_CH5_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 5 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
#if !defined(STM32F030xC)
|
||||
/* DMA1 - Channel 6 */
|
||||
#define HAL_DMA1_CH6_DEFAULT (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH6_I2C1_TX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_I2C1_TX) /*!< Remap I2C1 Tx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_SPI2_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_SPI2_RX) /*!< Remap SPI2 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM1_CH1) /*!< Remap TIM1 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH2 (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM1_CH2) /*!< Remap TIM1 channel 2 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH3 (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM1_CH3) /*!< Remap TIM1 channel 3 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM3_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM3_CH1) /*!< Remap TIM3 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM3_TRIG (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM3_TRIG) /*!< Remap TIM3 Trig on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM16_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM16_UP (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART1_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART2_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART3_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART4_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART5_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART6_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART7_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART8_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA_RMPCR1_CH6_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_DEFAULT (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH6_I2C1_TX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_I2C1_TX) /*!< Remap I2C1 Tx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_SPI2_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_SPI2_RX) /*!< Remap SPI2 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM1_CH1) /*!< Remap TIM1 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH2 (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM1_CH2) /*!< Remap TIM1 channel 2 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM1_CH3 (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM1_CH3) /*!< Remap TIM1 channel 3 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM3_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM3_CH1) /*!< Remap TIM3 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM3_TRIG (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM3_TRIG) /*!< Remap TIM3 Trig on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM16_CH1 (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM16_CH1) /*!< Remap TIM16 channel 1 on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_TIM16_UP (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_TIM16_UP) /*!< Remap TIM16 up on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART1_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART1_RX) /*!< Remap USART1 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART2_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART2_RX) /*!< Remap USART2 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART3_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART3_RX) /*!< Remap USART3 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART4_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART4_RX) /*!< Remap USART4 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART5_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART5_RX) /*!< Remap USART5 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART6_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART6_RX) /*!< Remap USART6 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART7_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART7_RX) /*!< Remap USART7 Rx on DMA1 channel 6 */
|
||||
#define HAL_DMA1_CH6_USART8_RX (uint32_t) (DMA1_CHANNEL6_RMP | DMA1_CSELR_CH6_USART8_RX) /*!< Remap USART8 Rx on DMA1 channel 6 */
|
||||
/* DMA1 - Channel 7 */
|
||||
#define HAL_DMA1_CH7_DEFAULT (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH7_I2C1_RX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_I2C1_RX) /*!< Remap I2C1 Rx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_SPI2_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_SPI2_TX) /*!< Remap SPI2 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM2_CH2 (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_TIM2_CH2) /*!< Remap TIM2 channel 2 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM2_CH4 (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_TIM2_CH4) /*!< Remap TIM2 channel 4 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM17_CH1 (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM17_UP (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART1_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART2_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART3_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART4_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART5_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART6_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART7_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART8_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA_RMPCR1_CH7_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_DEFAULT (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_DEFAULT) /*!< Default remap position for DMA1 */
|
||||
#define HAL_DMA1_CH7_I2C1_RX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_I2C1_RX) /*!< Remap I2C1 Rx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_SPI2_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_SPI2_TX) /*!< Remap SPI2 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM2_CH2 (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_TIM2_CH2) /*!< Remap TIM2 channel 2 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM2_CH4 (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_TIM2_CH4) /*!< Remap TIM2 channel 4 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM17_CH1 (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_TIM17_CH1) /*!< Remap TIM17 channel 1 on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_TIM17_UP (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_TIM17_UP) /*!< Remap TIM17 up on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART1_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART1_TX) /*!< Remap USART1 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART2_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART2_TX) /*!< Remap USART2 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART3_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART3_TX) /*!< Remap USART3 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART4_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART4_TX) /*!< Remap USART4 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART5_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART5_TX) /*!< Remap USART5 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART6_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART6_TX) /*!< Remap USART6 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART7_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART7_TX) /*!< Remap USART7 Tx on DMA1 channel 7 */
|
||||
#define HAL_DMA1_CH7_USART8_TX (uint32_t) (DMA1_CHANNEL7_RMP | DMA1_CSELR_CH7_USART8_TX) /*!< Remap USART8 Tx on DMA1 channel 7 */
|
||||
|
||||
/****************** DMA2 remap bit field definition********************/
|
||||
/* DMA2 - Channel 1 */
|
||||
#define HAL_DMA2_CH1_DEFAULT (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH1_I2C2_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_I2C2_TX) /*!< Remap I2C2 TX on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART1_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART2_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART3_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART4_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART5_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART6_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART7_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART8_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA_RMPCR2_CH1_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_DEFAULT (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH1_I2C2_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_I2C2_TX) /*!< Remap I2C2 TX on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART1_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART2_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART3_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART4_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART5_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART6_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART7_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 1 */
|
||||
#define HAL_DMA2_CH1_USART8_TX (uint32_t) (DMA2_CHANNEL1_RMP | DMA2_CSELR_CH1_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 1 */
|
||||
/* DMA2 - Channel 2 */
|
||||
#define HAL_DMA2_CH2_DEFAULT (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH2_I2C2_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_I2C2_RX) /*!< Remap I2C2 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART1_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART1_RX) /*!< Remap USART1 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART2_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART2_RX) /*!< Remap USART2 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART3_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART3_RX) /*!< Remap USART3 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART4_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART4_RX) /*!< Remap USART4 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART5_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART5_RX) /*!< Remap USART5 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART6_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART6_RX) /*!< Remap USART6 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART7_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART7_RX) /*!< Remap USART7 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART8_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA_RMPCR2_CH2_USART8_RX) /*!< Remap USART8 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_DEFAULT (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH2_I2C2_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_I2C2_RX) /*!< Remap I2C2 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART1_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART1_RX) /*!< Remap USART1 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART2_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART2_RX) /*!< Remap USART2 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART3_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART3_RX) /*!< Remap USART3 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART4_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART4_RX) /*!< Remap USART4 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART5_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART5_RX) /*!< Remap USART5 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART6_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART6_RX) /*!< Remap USART6 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART7_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART7_RX) /*!< Remap USART7 Rx on DMA2 channel 2 */
|
||||
#define HAL_DMA2_CH2_USART8_RX (uint32_t) (DMA2_CHANNEL2_RMP | DMA2_CSELR_CH2_USART8_RX) /*!< Remap USART8 Rx on DMA2 channel 2 */
|
||||
/* DMA2 - Channel 3 */
|
||||
#define HAL_DMA2_CH3_DEFAULT (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH3_TIM6_UP (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_TIM6_UP) /*!< Remap TIM6 up on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_DAC_CH1 (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_DAC_CH1) /*!< Remap DAC channel 1 on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_SPI1_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_SPI1_RX) /*!< Remap SPI1 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART1_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART1_RX) /*!< Remap USART1 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART2_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART2_RX) /*!< Remap USART2 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART3_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART3_RX) /*!< Remap USART3 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART4_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART4_RX) /*!< Remap USART4 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART5_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART5_RX) /*!< Remap USART5 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART6_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART6_RX) /*!< Remap USART6 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART7_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART7_RX) /*!< Remap USART7 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART8_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA_RMPCR2_CH3_USART8_RX) /*!< Remap USART8 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_DEFAULT (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH3_TIM6_UP (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_TIM6_UP) /*!< Remap TIM6 up on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_DAC_CH1 (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_DAC_CH1) /*!< Remap DAC channel 1 on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_SPI1_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_SPI1_RX) /*!< Remap SPI1 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART1_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART1_RX) /*!< Remap USART1 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART2_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART2_RX) /*!< Remap USART2 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART3_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART3_RX) /*!< Remap USART3 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART4_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART4_RX) /*!< Remap USART4 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART5_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART5_RX) /*!< Remap USART5 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART6_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART6_RX) /*!< Remap USART6 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART7_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART7_RX) /*!< Remap USART7 Rx on DMA2 channel 3 */
|
||||
#define HAL_DMA2_CH3_USART8_RX (uint32_t) (DMA2_CHANNEL3_RMP | DMA2_CSELR_CH3_USART8_RX) /*!< Remap USART8 Rx on DMA2 channel 3 */
|
||||
/* DMA2 - Channel 4 */
|
||||
#define HAL_DMA2_CH4_DEFAULT (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH4_TIM7_UP (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_TIM7_UP) /*!< Remap TIM7 up on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_DAC_CH2 (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_DAC_CH2) /*!< Remap DAC channel 2 on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_SPI1_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_SPI1_TX) /*!< Remap SPI1 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART1_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART2_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART3_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART4_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART5_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART6_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART7_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART8_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA_RMPCR2_CH4_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_DEFAULT (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH4_TIM7_UP (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_TIM7_UP) /*!< Remap TIM7 up on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_DAC_CH2 (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_DAC_CH2) /*!< Remap DAC channel 2 on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_SPI1_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_SPI1_TX) /*!< Remap SPI1 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART1_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART2_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART3_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART4_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART5_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART6_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART7_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 4 */
|
||||
#define HAL_DMA2_CH4_USART8_TX (uint32_t) (DMA2_CHANNEL4_RMP | DMA2_CSELR_CH4_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 4 */
|
||||
/* DMA2 - Channel 5 */
|
||||
#define HAL_DMA2_CH5_DEFAULT (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH5_ADC (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_ADC) /*!< Remap ADC on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART1_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART2_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART3_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART4_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART5_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART6_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART7_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART8_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA_RMPCR2_CH5_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_DEFAULT (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_DEFAULT) /*!< Default remap position for DMA2 */
|
||||
#define HAL_DMA2_CH5_ADC (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_ADC) /*!< Remap ADC on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART1_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART1_TX) /*!< Remap USART1 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART2_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART2_TX) /*!< Remap USART2 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART3_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART3_TX) /*!< Remap USART3 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART4_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART4_TX) /*!< Remap USART4 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART5_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART5_TX) /*!< Remap USART5 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART6_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART6_TX) /*!< Remap USART6 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART7_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART7_TX) /*!< Remap USART7 Tx on DMA2 channel 5 */
|
||||
#define HAL_DMA2_CH5_USART8_TX (uint32_t) (DMA2_CHANNEL5_RMP | DMA2_CSELR_CH5_USART8_TX) /*!< Remap USART8 Tx on DMA2 channel 5 */
|
||||
#endif /* !defined(STM32F030xC) */
|
||||
|
||||
#define IS_HAL_DMA1_REMAP(REQUEST) (((REQUEST) == HAL_DMA1_CH1_DEFAULT) ||\
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#define IS_HAL_DMA1_REMAP(REQUEST) (((REQUEST) == HAL_DMA1_CH1_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_ADC) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_TIM17_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_TIM17_UP) ||\
|
||||
|
@ -413,10 +441,76 @@
|
|||
((REQUEST) == HAL_DMA2_CH5_USART6_TX) ||\
|
||||
((REQUEST) == HAL_DMA2_CH5_USART7_TX) ||\
|
||||
((REQUEST) == HAL_DMA2_CH5_USART8_TX ))
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F030xC)
|
||||
#define IS_HAL_DMA1_REMAP(REQUEST) (((REQUEST) == HAL_DMA1_CH1_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_ADC) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_TIM17_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_TIM17_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART1_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART2_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART3_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART4_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART5_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH1_USART6_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_ADC) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_I2C1_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_SPI1_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_TIM1_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_I2C1_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_TIM17_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_TIM17_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART1_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART2_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART3_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART4_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART5_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH2_USART6_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_TIM6_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_I2C1_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_SPI1_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_TIM1_CH2) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_TIM16_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_TIM16_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART1_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART2_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART3_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART4_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART5_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH3_USART6_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_TIM7_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_I2C2_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_SPI2_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_TIM3_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_TIM3_TRIG) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_TIM16_CH1) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_TIM16_UP) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART1_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART2_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART3_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART4_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART5_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH4_USART6_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_DEFAULT) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_I2C2_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_SPI2_TX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_TIM1_CH3) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART1_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART2_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART3_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART4_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART5_RX) ||\
|
||||
((REQUEST) == HAL_DMA1_CH5_USART6_RX))
|
||||
#endif /* STM32F030xC */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
/* Exported macros -----------------------------------------------------------*/
|
||||
|
||||
|
@ -473,9 +567,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: Get the specified flag.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 1_7 to select the DMA Channel flag.
|
||||
* @retval The state of FLAG (SET or RESET).
|
||||
*/
|
||||
|
@ -487,9 +581,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: specifies the flag to clear.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 1_7 to select the DMA Channel flag.
|
||||
* @retval None
|
||||
*/
|
||||
|
@ -558,9 +652,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: Get the specified flag.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Channel flag.
|
||||
* @retval The state of FLAG (SET or RESET).
|
||||
*/
|
||||
|
@ -574,9 +668,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: specifies the flag to clear.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 0_4, 1_5, 2_6 or 3_7 to select the DMA Channel flag.
|
||||
* @retval None
|
||||
*/
|
||||
|
@ -584,7 +678,7 @@
|
|||
(((uint32_t)((__HANDLE__)->Instance) > (uint32_t)DMA1_Channel7)? (DMA2->IFCR = (__FLAG__)) :\
|
||||
(DMA1->IFCR = (__FLAG__)))
|
||||
|
||||
#else /* STM32F030x8_STM32F031x6_STM32F038xx_STM32F051x8_STM32F058xx Product devices */
|
||||
#else /* STM32F030x8_STM32F030xC_STM32F031x6_STM32F038xx_STM32F051x8_STM32F058xx_STM32F070x6_STM32F070xB Product devices */
|
||||
/**
|
||||
* @brief Returns the current DMA Channel transfer complete flag.
|
||||
* @param __HANDLE__: DMA handle
|
||||
|
@ -626,9 +720,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: Get the specified flag.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 1_5 to select the DMA Channel flag.
|
||||
* @retval The state of FLAG (SET or RESET).
|
||||
*/
|
||||
|
@ -640,9 +734,9 @@
|
|||
* @param __HANDLE__: DMA handle
|
||||
* @param __FLAG__: specifies the flag to clear.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DMA_FLAG_TCIFx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTIFx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEIFx: Transfer error flag
|
||||
* @arg DMA_FLAG_TCx: Transfer complete flag
|
||||
* @arg DMA_FLAG_HTx: Half transfer complete flag
|
||||
* @arg DMA_FLAG_TEx: Transfer error flag
|
||||
* Where x can be 1_5 to select the DMA Channel flag.
|
||||
* @retval None
|
||||
*/
|
||||
|
@ -651,20 +745,22 @@
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define __HAL_DMA1_REMAP(__REQUEST__) \
|
||||
do { assert_param(IS_HAL_DMA1_REMAP(__REQUEST__)); \
|
||||
DMA1->RMPCR &= ~((uint32_t)0x0F << (uint32_t)(((__REQUEST__) >> 28) * 4)); \
|
||||
DMA1->RMPCR |= (uint32_t)((__REQUEST__) & 0x0FFFFFFF); \
|
||||
DMA1->CSELR &= ~((uint32_t)0x0F << (uint32_t)(((__REQUEST__) >> 28) * 4)); \
|
||||
DMA1->CSELR |= (uint32_t)((__REQUEST__) & 0x0FFFFFFF); \
|
||||
}while(0)
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#define __HAL_DMA2_REMAP(__REQUEST__) \
|
||||
do { assert_param(IS_HAL_DMA2_REMAP(__REQUEST__)); \
|
||||
DMA2->RMPCR &= ~((uint32_t)0x0F << (uint32_t)(((__REQUEST__) >> 28) * 4)); \
|
||||
DMA2->RMPCR |= (uint32_t)((__REQUEST__) & 0x0FFFFFFF); \
|
||||
DMA2->CSELR &= ~((uint32_t)0x0F << (uint32_t)(((__REQUEST__) >> 28) * 4)); \
|
||||
DMA2->CSELR |= (uint32_t)((__REQUEST__) & 0x0FFFFFFF); \
|
||||
}while(0)
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_flash.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief FLASH HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the internal FLASH memory:
|
||||
|
@ -14,8 +14,7 @@
|
|||
@verbatim
|
||||
==============================================================================
|
||||
##### FLASH peripheral features #####
|
||||
==============================================================================
|
||||
|
||||
==============================================================================
|
||||
[..] The Flash memory interface manages CPU AHB I-Code and D-Code accesses
|
||||
to the Flash memory. It implements the erase and program Flash memory operations
|
||||
and the read and write protection mechanisms.
|
||||
|
@ -40,7 +39,7 @@
|
|||
functions to erase and program the main memory:
|
||||
(++) Lock and Unlock the FLASH interface
|
||||
(++) Erase function: Erase page, erase all pages
|
||||
(++) Program functions: half word and word
|
||||
(++) Program functions: half word, word and doubleword
|
||||
|
||||
(#) Option Bytes Programming functions: this group includes all needed
|
||||
functions to manage the Option Bytes:
|
||||
|
@ -113,9 +112,23 @@
|
|||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/** @defgroup FLASH_Private_Defines FLASH Private Define
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/** @defgroup FLASH_Private_Macros FLASH Private Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/** @defgroup FLASH_Private_Variables FLASH Private Variables
|
||||
* @{
|
||||
*/
|
||||
|
@ -126,7 +139,6 @@ FLASH_ProcessTypeDef pFlash;
|
|||
*/
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
|
||||
/** @defgroup FLASH_Private_Functions FLASH Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
@ -143,8 +155,7 @@ static void FLASH_SetErrorCode(void);
|
|||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
/** @defgroup FLASH_Exported_Functions FLASH Exported Functions
|
||||
* @{
|
||||
*/
|
||||
|
@ -172,6 +183,9 @@ static void FLASH_SetErrorCode(void);
|
|||
* @note If an erase and a program operations are requested simultaneously,
|
||||
* the erase operation is performed before the program one.
|
||||
*
|
||||
* @note FLASH should be previously erased before new programmation (only exception to this
|
||||
* is when 0x0000 is programmed)
|
||||
*
|
||||
* @param TypeProgram: Indicate the way to program at a specified address.
|
||||
* This parameter can be a value of @ref FLASH_Type_Program
|
||||
* @param Address: Specifies the address to be programmed.
|
||||
|
@ -220,15 +234,14 @@ HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Check FLASH End of Operation flag */
|
||||
if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
|
||||
{
|
||||
/* Clear FLASH End of Operation pending bit */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
|
||||
}
|
||||
|
||||
/* If the program operation is completed, disable the PG Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_PG);
|
||||
|
||||
/* In case of error, stop programation procedure */
|
||||
if (status != HAL_OK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,9 +314,21 @@ HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, u
|
|||
*/
|
||||
void HAL_FLASH_IRQHandler(void)
|
||||
{
|
||||
uint32_t addresstmp;
|
||||
/* If the operation is completed, disable the PG, PER and MER Bits */
|
||||
CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_PER | FLASH_CR_MER));
|
||||
uint32_t addresstmp = 0;
|
||||
|
||||
/* Check FLASH operation error flags */
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) ||__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
|
||||
{
|
||||
/*Save the Error code*/
|
||||
FLASH_SetErrorCode();
|
||||
|
||||
/* FLASH error interrupt user callback */
|
||||
HAL_FLASH_OperationErrorCallback(pFlash.Address);
|
||||
|
||||
/* Reset address and stop the procedure ongoing*/
|
||||
pFlash.Address = 0xFFFFFFFF;
|
||||
pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
|
||||
}
|
||||
|
||||
/* Check FLASH End of Operation flag */
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
|
||||
|
@ -311,6 +336,9 @@ void HAL_FLASH_IRQHandler(void)
|
|||
/* Clear FLASH End of Operation pending bit */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
|
||||
|
||||
/* Process can continue only if no error detected */
|
||||
if(pFlash.ProcedureOnGoing != FLASH_PROC_NONE)
|
||||
{
|
||||
if(pFlash.ProcedureOnGoing == FLASH_PROC_PAGEERASE)
|
||||
{
|
||||
/* Nb of pages to erased can be decreased */
|
||||
|
@ -325,6 +353,10 @@ void HAL_FLASH_IRQHandler(void)
|
|||
/* Increment page address to next page */
|
||||
pFlash.Address += FLASH_PAGE_SIZE;
|
||||
addresstmp = pFlash.Address;
|
||||
|
||||
/* Operation is completed, disable the PER Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_PER);
|
||||
|
||||
FLASH_PageErase(addresstmp);
|
||||
}
|
||||
else
|
||||
|
@ -338,6 +370,9 @@ void HAL_FLASH_IRQHandler(void)
|
|||
}
|
||||
else if(pFlash.ProcedureOnGoing == FLASH_PROC_MASSERASE)
|
||||
{
|
||||
/* Operation is completed, disable the MER Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_MER);
|
||||
|
||||
/*MassErase ended. Return the selected bank*/
|
||||
/* FLASH EOP interrupt user callback */
|
||||
HAL_FLASH_EndOfOperationCallback(0);
|
||||
|
@ -360,6 +395,9 @@ void HAL_FLASH_IRQHandler(void)
|
|||
/* Shift to have next 16-bit data */
|
||||
pFlash.Data = (pFlash.Data >> 16);
|
||||
|
||||
/* Operation is completed, disable the PG Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_PG);
|
||||
|
||||
/*Program halfword (16-bit) at a specified address.*/
|
||||
FLASH_Program_HalfWord(addresstmp, (uint16_t)pFlash.Data);
|
||||
}
|
||||
|
@ -385,27 +423,14 @@ void HAL_FLASH_IRQHandler(void)
|
|||
pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check FLASH operation error flags */
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR))
|
||||
{
|
||||
/*Save the Error code*/
|
||||
FLASH_SetErrorCode();
|
||||
|
||||
/* FLASH error interrupt user callback */
|
||||
HAL_FLASH_OperationErrorCallback(pFlash.Address);
|
||||
|
||||
/* Clear FLASH error pending bits */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
/* Reset address and stop the procedure ongoing*/
|
||||
pFlash.Address = 0xFFFFFFFF;
|
||||
pFlash.ProcedureOnGoing = FLASH_PROC_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if(pFlash.ProcedureOnGoing == FLASH_PROC_NONE)
|
||||
{
|
||||
/* Operation is completed, disable the PG, PER and MER Bits */
|
||||
CLEAR_BIT(FLASH->CR, (FLASH_CR_PG | FLASH_CR_PER | FLASH_CR_MER));
|
||||
|
||||
/* Disable End of FLASH Operation and Error source interrupts */
|
||||
__HAL_FLASH_DISABLE_IT((FLASH_IT_EOP | FLASH_IT_ERR));
|
||||
|
||||
|
@ -535,6 +560,9 @@ HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Set the bit to force the option byte reloading */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH);
|
||||
|
||||
|
@ -566,11 +594,10 @@ HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
|
|||
* @arg FLASH_ERROR_PG: FLASH Programming error flag
|
||||
* @arg FLASH_ERROR_WRP: FLASH Write protected error flag
|
||||
*/
|
||||
FLASH_ErrorTypeDef HAL_FLASH_GetError(void)
|
||||
uint32_t HAL_FLASH_GetError(void)
|
||||
{
|
||||
return pFlash.ErrorCode;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -591,8 +618,8 @@ FLASH_ErrorTypeDef HAL_FLASH_GetError(void)
|
|||
*/
|
||||
void FLASH_PageErase(uint32_t PageAddress)
|
||||
{
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Proceed to erase the page */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_PER);
|
||||
|
@ -608,9 +635,9 @@ void FLASH_PageErase(uint32_t PageAddress)
|
|||
*/
|
||||
static void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data)
|
||||
{
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Proceed to program the new data */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_PG);
|
||||
|
||||
|
@ -641,6 +668,13 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check FLASH End of Operation flag */
|
||||
if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
|
||||
{
|
||||
/* Clear FLASH End of Operation pending bit */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
|
||||
}
|
||||
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR) || __HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
|
||||
{
|
||||
/*Save the error code*/
|
||||
|
@ -648,7 +682,7 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
|
|||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* If there is an error flag set */
|
||||
/* If there is no error flag set */
|
||||
return HAL_OK;
|
||||
|
||||
}
|
||||
|
@ -658,16 +692,18 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
|
|||
* @retval None
|
||||
*/
|
||||
static void FLASH_SetErrorCode(void)
|
||||
{
|
||||
{
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_WRPERR))
|
||||
{
|
||||
pFlash.ErrorCode = FLASH_ERROR_WRP;
|
||||
pFlash.ErrorCode |= FLASH_ERROR_WRP;
|
||||
}
|
||||
if(__HAL_FLASH_GET_FLAG(FLASH_FLAG_PGERR))
|
||||
{
|
||||
pFlash.ErrorCode |= FLASH_ERROR_PG;
|
||||
}
|
||||
}
|
||||
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_flash.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of Flash HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -60,15 +60,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief FLASH Error source
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
FLASH_ERROR_PG = 0x01,
|
||||
FLASH_ERROR_WRP = 0x02
|
||||
} FLASH_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief FLASH Erase structure definition
|
||||
*/
|
||||
|
@ -134,17 +125,18 @@ typedef enum
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
__IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
|
||||
__IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */
|
||||
|
||||
__IO uint32_t DataRemaining; /* Internal variable to save the remaining pages to erase or half-word to program in IT context */
|
||||
__IO uint32_t DataRemaining; /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */
|
||||
|
||||
__IO uint32_t Address; /* Internal variable to save address selected for program or erase */
|
||||
__IO uint32_t Address; /*!< Internal variable to save address selected for program or erase */
|
||||
|
||||
__IO uint64_t Data; /* Internal variable to save data to be programmed */
|
||||
__IO uint64_t Data; /*!< Internal variable to save data to be programmed */
|
||||
|
||||
HAL_LockTypeDef Lock; /* FLASH locking object */
|
||||
HAL_LockTypeDef Lock; /*!< FLASH locking object */
|
||||
|
||||
__IO FLASH_ErrorTypeDef ErrorCode; /* FLASH error code */
|
||||
__IO uint32_t ErrorCode; /*!< FLASH error code
|
||||
This parameter can be a value of @ref FLASH_Error */
|
||||
|
||||
} FLASH_ProcessTypeDef;
|
||||
|
||||
|
@ -158,6 +150,16 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup FLASH_Error FLASH Error
|
||||
* @{
|
||||
*/
|
||||
#define FLASH_ERROR_NONE ((uint32_t)0x00000000)
|
||||
#define FLASH_ERROR_PG ((uint32_t)0x00000001)
|
||||
#define FLASH_ERROR_WRP ((uint32_t)0x00000002)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup FLASH_Type_Erase FLASH Type Erase
|
||||
* @{
|
||||
*/
|
||||
|
@ -204,7 +206,7 @@ typedef struct
|
|||
#define OPTIONBYTE_USER ((uint32_t)0x04) /*!<USER option byte configuration*/
|
||||
#define OPTIONBYTE_DATA ((uint32_t)0x08) /*!<DATA option byte configuration*/
|
||||
|
||||
#define IS_OPTIONBYTE(VALUE) (((VALUE) < (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA)))
|
||||
#define IS_OPTIONBYTE(VALUE) ((VALUE) <= (OPTIONBYTE_WRP | OPTIONBYTE_RDP | OPTIONBYTE_USER | OPTIONBYTE_DATA))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -485,7 +487,7 @@ HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
|
|||
* @{
|
||||
*/
|
||||
/* Peripheral State and Error functions ***************************************/
|
||||
FLASH_ErrorTypeDef HAL_FLASH_GetError(void);
|
||||
uint32_t HAL_FLASH_GetError(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_flash_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended FLASH HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the FLASH peripheral:
|
||||
|
@ -181,13 +181,6 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Check FLASH End of Operation flag */
|
||||
if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
|
||||
{
|
||||
/* Clear FLASH End of Operation pending bit */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
|
||||
}
|
||||
|
||||
/* If the erase operation is completed, disable the MER Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_MER);
|
||||
}
|
||||
|
@ -209,14 +202,7 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t
|
|||
|
||||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Check FLASH End of Operation flag */
|
||||
if (__HAL_FLASH_GET_FLAG(FLASH_FLAG_EOP))
|
||||
{
|
||||
/* Clear FLASH End of Operation pending bit */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
|
||||
}
|
||||
|
||||
|
||||
/* If the erase operation is completed, disable the PER Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_PER);
|
||||
|
||||
|
@ -252,6 +238,12 @@ HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit)
|
|||
/* Process Locked */
|
||||
__HAL_LOCK(&pFlash);
|
||||
|
||||
/* If procedure already ongoing, reject the next one */
|
||||
if (pFlash.ProcedureOnGoing != FLASH_PROC_NONE)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_TYPEERASE(pEraseInit->TypeErase));
|
||||
|
||||
|
@ -327,11 +319,11 @@ HAL_StatusTypeDef HAL_FLASHEx_OBErase(void)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* If the previous operation is completed, proceed to erase the option bytes */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTER);
|
||||
SET_BIT(FLASH->CR, FLASH_CR_STRT);
|
||||
|
@ -450,9 +442,10 @@ void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit)
|
|||
*/
|
||||
static void FLASH_MassErase(void)
|
||||
{
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Proceed to erase all sectors */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_MER);
|
||||
SET_BIT(FLASH->CR, FLASH_CR_STRT);
|
||||
|
@ -471,33 +464,33 @@ static void FLASH_MassErase(void)
|
|||
static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
uint16_t WRP0_Data = 0xFFFF;
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
uint16_t WRP1_Data = 0xFFFF;
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
uint16_t WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF, WRP2_Data = 0xFFFF, WRP3_Data = 0xFFFF;
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_OB_WRP(WriteProtectPage));
|
||||
|
||||
WriteProtectPage = (uint32_t)(~WriteProtectPage);
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)|| defined(STM32F030xC)
|
||||
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK);
|
||||
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8);
|
||||
WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO47MASK) >> 16);
|
||||
|
@ -507,16 +500,16 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
|||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24);
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
|
||||
|
||||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
|
||||
if(WRP0_Data != 0xFF)
|
||||
|
@ -528,8 +521,8 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
|||
}
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
if((status == HAL_OK) && (WRP1_Data != 0xFF))
|
||||
{
|
||||
OB->WRP1 &= WRP1_Data;
|
||||
|
@ -537,11 +530,11 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
}
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx || STM32F071xB ||
|
||||
STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx || STM32F071xB || STM32F070xB ||
|
||||
STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)|| defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
if((status == HAL_OK) && (WRP2_Data != 0xFF))
|
||||
{
|
||||
OB->WRP2 &= WRP2_Data;
|
||||
|
@ -557,14 +550,13 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
}
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC*/
|
||||
|
||||
/* if the program operation is completed, disable the OPTPG Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -580,32 +572,32 @@ static HAL_StatusTypeDef FLASH_OB_EnableWRP(uint32_t WriteProtectPage)
|
|||
static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
|
||||
{
|
||||
HAL_StatusTypeDef status = HAL_OK;
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
uint16_t WRP0_Data = 0xFFFF;
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
uint16_t WRP1_Data = 0xFFFF;
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
uint16_t WRP0_Data = 0xFFFF, WRP1_Data = 0xFFFF, WRP2_Data = 0xFFFF, WRP3_Data = 0xFFFF;
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_OB_WRP(WriteProtectPage));
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || STM32F070x6 || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO31MASK);
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO63MASK) >> 8);
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
WRP0_Data = (uint16_t)(WriteProtectPage & OB_WRP_PAGES0TO15MASK);
|
||||
WRP1_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES16TO31MASK) >> 8);
|
||||
WRP2_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES32TO47MASK) >> 16);
|
||||
|
@ -615,16 +607,16 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
|
|||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
WRP3_Data = (uint16_t)((WriteProtectPage & OB_WRP_PAGES48TO127MASK) >> 24);
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070xB */
|
||||
|
||||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
|
||||
if(WRP0_Data != 0xFF)
|
||||
|
@ -636,8 +628,8 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
|
|||
}
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
if((status == HAL_OK) && (WRP1_Data != 0xFF))
|
||||
{
|
||||
OB->WRP1 |= WRP1_Data;
|
||||
|
@ -645,11 +637,11 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
}
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx || STM32F071xB ||
|
||||
STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx || STM32F071xB || STM32F070xB ||
|
||||
STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
if((status == HAL_OK) && (WRP2_Data != 0xFF))
|
||||
{
|
||||
OB->WRP2 |= WRP2_Data;
|
||||
|
@ -665,12 +657,11 @@ static HAL_StatusTypeDef FLASH_OB_DisableWRP(uint32_t WriteProtectPage)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
}
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F070xB || STM32F030xC */
|
||||
|
||||
/* if the program operation is completed, disable the OPTPG Bit */
|
||||
CLEAR_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
}
|
||||
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -696,11 +687,11 @@ static HAL_StatusTypeDef FLASH_OB_RDP_LevelConfig(uint8_t ReadProtectLevel)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Enable the Option Bytes Programming operation */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
|
||||
|
@ -734,27 +725,27 @@ static HAL_StatusTypeDef FLASH_OB_UserConfig(uint8_t UserConfig)
|
|||
assert_param(IS_OB_BOOT1((UserConfig&OB_BOOT1_SET)));
|
||||
assert_param(IS_OB_VDDA_ANALOG((UserConfig&OB_VDDA_ANALOG_ON)));
|
||||
assert_param(IS_OB_SRAM_PARITY((UserConfig&OB_RAM_PARITY_CHECK_RESET)));
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)|| defined(STM32F070x6)
|
||||
assert_param(IS_OB_BOOT_SEL((UserConfig&OB_BOOT_SEL_SET)));
|
||||
assert_param(IS_OB_BOOT0((UserConfig&OB_BOOT0_SET)));
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070x6 */
|
||||
|
||||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Enable the Option Bytes Programming operation */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)|| defined(STM32F070x6)
|
||||
OB->USER = UserConfig;
|
||||
#else
|
||||
OB->USER = (UserConfig | 0x88);
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070x6 */
|
||||
|
||||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
@ -788,11 +779,11 @@ static HAL_StatusTypeDef FLASH_OB_ProgramData(uint32_t Address, uint8_t Data)
|
|||
/* Wait for last operation to be completed */
|
||||
status = FLASH_WaitForLastOperation((uint32_t)HAL_FLASH_TIMEOUT_VALUE);
|
||||
|
||||
/* Clear pending flags (if any) */
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
|
||||
|
||||
if(status == HAL_OK)
|
||||
{
|
||||
/* Clean the error context */
|
||||
pFlash.ErrorCode = FLASH_ERROR_NONE;
|
||||
|
||||
/* Enables the Option Bytes Programming operation */
|
||||
SET_BIT(FLASH->CR, FLASH_CR_OPTPG);
|
||||
*(__IO uint16_t*)Address = Data;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_flash_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of FLASH HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -62,21 +62,21 @@
|
|||
/** @defgroup FLASHEx_Address FLASHEx Address
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx) || defined(STM32F070x6)
|
||||
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x08007FFF))
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0800FFFF))
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0801FFFF))
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB*/
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) <= 0x0803FFFF))
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -85,14 +85,14 @@
|
|||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F070x6)
|
||||
#define FLASH_PAGE_SIZE 0x400
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define FLASH_PAGE_SIZE 0x800
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -101,21 +101,21 @@
|
|||
/** @defgroup FLASHEx_Nb_Pages FLASHEx Nb Pages
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)|| defined(STM32F070x6)
|
||||
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x08007FFF)
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0800FFFF)
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0801FFFF)
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define IS_FLASH_NB_PAGES(ADDRESS,NBPAGES) ((ADDRESS)+((NBPAGES)*FLASH_PAGE_SIZE)-1 <= 0x0803FFFF)
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@
|
|||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx)
|
||||
defined(STM32F051x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F070x6)
|
||||
#define OB_WRP_PAGES0TO3 ((uint32_t)0x00000001) /* Write protection of page 0 to 3 */
|
||||
#define OB_WRP_PAGES4TO7 ((uint32_t)0x00000002) /* Write protection of page 4 to 7 */
|
||||
#define OB_WRP_PAGES8TO11 ((uint32_t)0x00000004) /* Write protection of page 8 to 11 */
|
||||
|
@ -149,17 +149,17 @@
|
|||
#define OB_WRP_PAGES32TO63MASK ((uint32_t)0x0000FF00)
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F038xx)|| defined(STM32F070x6)
|
||||
#define OB_WRP_ALLPAGES ((uint32_t)0x000000FF) /*!< Write protection of all pages */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
#define OB_WRP_ALLPAGES ((uint32_t)0x0000FFFF) /*!< Write protection of all pages */
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F058xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F051x8 || STM32F042x6 || STM32F048xx || STM32F038xx || STM32F058xx || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define OB_WRP_PAGES0TO1 ((uint32_t)0x00000001) /* Write protection of page 0 to 1 */
|
||||
#define OB_WRP_PAGES2TO3 ((uint32_t)0x00000002) /* Write protection of page 2 to 3 */
|
||||
#define OB_WRP_PAGES4TO5 ((uint32_t)0x00000004) /* Write protection of page 4 to 5 */
|
||||
|
@ -191,32 +191,32 @@
|
|||
#define OB_WRP_PAGES56TO57 ((uint32_t)0x10000000) /* Write protection of page 56 to 57 */
|
||||
#define OB_WRP_PAGES58TO59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */
|
||||
#define OB_WRP_PAGES60TO61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
#define OB_WRP_PAGES62TO63 ((uint32_t)0x80000000) /* Write protection of page 62 to 63 */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx */
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define OB_WRP_PAGES62TO127 ((uint32_t)0x80000000) /* Write protection of page 62 to 127 */
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#define OB_WRP_PAGES0TO15MASK ((uint32_t)0x000000FF)
|
||||
#define OB_WRP_PAGES16TO31MASK ((uint32_t)0x0000FF00)
|
||||
#define OB_WRP_PAGES32TO47MASK ((uint32_t)0x00FF0000)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
#define OB_WRP_PAGES48TO63MASK ((uint32_t)0xFF000000)
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx */
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB */
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
#define OB_WRP_PAGES48TO127MASK ((uint32_t)0xFF000000)
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#define OB_WRP_ALLPAGES ((uint32_t)0xFFFFFFFF) /*!< Write protection of all pages */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070xB */
|
||||
|
||||
#define IS_OB_WRP(PAGE) (((PAGE) != 0x0000000))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)|| defined(STM32F070x6)
|
||||
/** @defgroup FLASHEx_OB_BOOT_SEL FLASHEx OB BOOT SEL
|
||||
* @{
|
||||
*/
|
||||
|
@ -236,7 +236,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F091xC || STM32F098xx || STM32F030xC || STM32F070x6 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_gpio.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief GPIO HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the General Purpose Input/Output (GPIO) peripheral:
|
||||
|
@ -47,11 +47,11 @@
|
|||
connected to the 16 external interrupt/event lines from EXTI0 to EXTI15.
|
||||
|
||||
[..]
|
||||
The external interrupt/event controller consists of up to 23 edge detectors
|
||||
(16 lines are connected to GPIO) for generating event/interrupt requests (each
|
||||
input line can be independently configured to select the type (interrupt or event)
|
||||
and the corresponding trigger event (rising or falling or both). Each line can
|
||||
also be masked independently.
|
||||
The external interrupt/event controller consists of up to 28 edge detectors
|
||||
(depending on products 16 lines are connected to GPIO) for generating event/interrupt
|
||||
requests (each input line can be independently configured to select the type
|
||||
(interrupt or event) and the corresponding trigger event (rising or falling or both).
|
||||
Each line can also be masked independently.
|
||||
|
||||
##### How to use this driver #####
|
||||
==============================================================================
|
||||
|
@ -64,7 +64,7 @@
|
|||
structure.
|
||||
(++) In case of Output or alternate function mode selection: the speed is
|
||||
configured through "Speed" member from GPIO_InitTypeDef structure,
|
||||
the speed is configurable: 2 MHz, 10 MHz and 50 MHz.
|
||||
the speed is configurable: Low, Medium and High.
|
||||
(++) If alternate mode is selected, the alternate function connected to the IO
|
||||
is configured through "Alternate" member from GPIO_InitTypeDef structure
|
||||
(++) Analog mode is required when a pin is to be used as ADC channel
|
||||
|
@ -77,6 +77,11 @@
|
|||
mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using
|
||||
HAL_NVIC_EnableIRQ().
|
||||
|
||||
(#) HAL_GPIO_DeInit allows to set register values to their reset value. It's also
|
||||
recommended to use it to unconfigure pin which was used as an external interrupt
|
||||
or in event mode. That's the only way to reset corresponding bit in EXTI & SYSCFG
|
||||
registers.
|
||||
|
||||
(#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin().
|
||||
|
||||
(#) To set/reset the level of a pin configured in output mode use
|
||||
|
@ -192,8 +197,7 @@
|
|||
*/
|
||||
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
|
||||
{
|
||||
uint32_t position;
|
||||
uint32_t ioposition = 0x00;
|
||||
uint32_t position = 0x00;
|
||||
uint32_t iocurrent = 0x00;
|
||||
uint32_t temp = 0x00;
|
||||
|
||||
|
@ -204,21 +208,21 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
|
|||
assert_param(IS_GPIO_PULL(GPIO_Init->Pull));
|
||||
|
||||
/* Configure the port pins */
|
||||
for (position = 0; position < GPIO_NUMBER; position++)
|
||||
while ((GPIO_Init->Pin) >> position)
|
||||
{
|
||||
/* Get the IO position */
|
||||
ioposition = ((uint32_t)0x01) << position;
|
||||
/* Get the current IO position */
|
||||
iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition;
|
||||
|
||||
if (iocurrent == ioposition)
|
||||
/* Get current io position */
|
||||
iocurrent = (GPIO_Init->Pin) & (1 << position);
|
||||
|
||||
if(iocurrent)
|
||||
{
|
||||
/*--------------------- GPIO Mode Configuration ------------------------*/
|
||||
/* In case of Alternate function mode selection */
|
||||
if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD))
|
||||
{
|
||||
/* Check the Alternate function parameter */
|
||||
/* Check the Alternate function parameters */
|
||||
assert_param(IS_GPIO_AF_INSTANCE(GPIOx));
|
||||
assert_param(IS_GPIO_AF(GPIO_Init->Alternate));
|
||||
|
||||
/* Configure Alternate function mapped with the current IO */
|
||||
temp = GPIOx->AFR[position >> 3];
|
||||
temp &= ~((uint32_t)0xF << ((uint32_t)(position & (uint32_t)0x07) * 4)) ;
|
||||
|
@ -266,7 +270,7 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
|
|||
|
||||
temp = SYSCFG->EXTICR[position >> 2];
|
||||
temp &= ~(((uint32_t)0x0F) << (4 * (position & 0x03)));
|
||||
temp |= (GET_GPIO_INDEX(GPIOx) << (4 * (position & 0x03)));
|
||||
temp |= (GPIO_GET_INDEX(GPIOx) << (4 * (position & 0x03)));
|
||||
SYSCFG->EXTICR[position >> 2] = temp;
|
||||
|
||||
/* Clear EXTI line configuration */
|
||||
|
@ -303,26 +307,9 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
|
|||
}
|
||||
EXTI->FTSR = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = SYSCFG->EXTICR[position >> 2];
|
||||
temp &= (((uint32_t)0x0F) << (4 * (position & 0x03)));
|
||||
if(temp == (GET_GPIO_INDEX(GPIOx) << (4 * (position & 0x03))))
|
||||
{
|
||||
/* Configure the External Interrupt or event for the current IO */
|
||||
temp = ((uint32_t)0x0F) << (4 * (position & 0x03));
|
||||
SYSCFG->EXTICR[position >> 2] &= ~temp;
|
||||
|
||||
/* Clear EXTI line configuration */
|
||||
EXTI->IMR &= ~((uint32_t)iocurrent);
|
||||
EXTI->EMR &= ~((uint32_t)iocurrent);
|
||||
|
||||
/* Clear Rising Falling edge configuration */
|
||||
EXTI->RTSR &= ~((uint32_t)iocurrent);
|
||||
EXTI->FTSR &= ~((uint32_t)iocurrent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,23 +324,21 @@ void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
|
|||
*/
|
||||
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
|
||||
{
|
||||
uint32_t position;
|
||||
uint32_t ioposition = 0x00;
|
||||
uint32_t position = 0x00;
|
||||
uint32_t iocurrent = 0x00;
|
||||
uint32_t tmp = 0x00;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
|
||||
assert_param(IS_GPIO_PIN(GPIO_Pin));
|
||||
|
||||
/* Configure the port pins */
|
||||
for (position = 0; position < GPIO_NUMBER; position++)
|
||||
while (GPIO_Pin >> position)
|
||||
{
|
||||
/* Get the IO position */
|
||||
ioposition = ((uint32_t)0x01) << position;
|
||||
/* Get the current IO position */
|
||||
iocurrent = (GPIO_Pin) & ioposition;
|
||||
/* Get current io position */
|
||||
iocurrent = (GPIO_Pin) & (1 << position);
|
||||
|
||||
if (iocurrent == ioposition)
|
||||
if (iocurrent)
|
||||
{
|
||||
/*------------------------- GPIO Mode Configuration --------------------*/
|
||||
/* Configure IO Direction in Input Floting Mode */
|
||||
|
@ -376,7 +361,7 @@ void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
|
|||
|
||||
tmp = SYSCFG->EXTICR[position >> 2];
|
||||
tmp &= (((uint32_t)0x0F) << (4 * (position & 0x03)));
|
||||
if(tmp == (GET_GPIO_INDEX(GPIOx) << (4 * (position & 0x03))))
|
||||
if(tmp == (GPIO_GET_INDEX(GPIOx) << (4 * (position & 0x03))))
|
||||
{
|
||||
tmp = ((uint32_t)0x0F) << (4 * (position & 0x03));
|
||||
SYSCFG->EXTICR[position >> 2] &= ~tmp;
|
||||
|
@ -390,6 +375,8 @@ void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
|
|||
EXTI->FTSR &= ~((uint32_t)iocurrent);
|
||||
}
|
||||
}
|
||||
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_gpio.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of GPIO HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_gpio_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of GPIO HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -431,6 +431,71 @@
|
|||
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F030xC)
|
||||
/*--------------------------- STM32F030xC ----------------------------------------------------*/
|
||||
/* AF 0 */
|
||||
#define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
|
||||
#define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
|
||||
#define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
|
||||
#define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
|
||||
#define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1 Alternate Function mapping */
|
||||
#define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM3 ((uint8_t)0x00) /*!< AF0: TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
|
||||
#define GPIO_AF0_USART4 ((uint8_t)0x00) /*!< AF0: USART4 Alternate Function mapping */
|
||||
|
||||
/* AF 1 */
|
||||
#define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART3 ((uint8_t)0x01) /*!< AF1: USART3 Alternate Function mapping */
|
||||
#define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
|
||||
#define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C2 Alternate Function mapping */
|
||||
#define GPIO_AF1_SPI2 ((uint8_t)0x01) /*!< AF1: SPI2 Alternate Function mapping */
|
||||
|
||||
/* AF 2 */
|
||||
#define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF2_USART5 ((uint8_t)0x02) /*!< AF2: USART5 Alternate Function mapping */
|
||||
#define GPIO_AF2_USART6 ((uint8_t)0x02) /*!< AF2: USART6 Alternate Function mapping */
|
||||
|
||||
/* AF 3 */
|
||||
#define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
|
||||
|
||||
/* AF 4 */
|
||||
#define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF4_USART4 ((uint8_t)0x04) /*!< AF4: USART4 Alternate Function mapping */
|
||||
#define GPIO_AF4_USART3 ((uint8_t)0x04) /*!< AF4: USART3 Alternate Function mapping */
|
||||
#define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF4_USART5 ((uint8_t)0x04) /*!< AF4: USART5 Alternate Function mapping */
|
||||
|
||||
/* AF 5 */
|
||||
#define GPIO_AF5_TIM15 ((uint8_t)0x05) /*!< AF5: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
|
||||
#define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
|
||||
#define GPIO_AF5_MCO ((uint8_t)0x05) /*!< AF5: MCO Alternate Function mapping */
|
||||
#define GPIO_AF5_USART6 ((uint8_t)0x05) /*!< AF5: USART6 Alternate Function mapping */
|
||||
|
||||
/* AF 6 */
|
||||
#define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
|
||||
|
||||
#define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
|
||||
|
||||
#endif /* STM32F030xC */
|
||||
|
||||
#if defined (STM32F072xB) || defined (STM32F078xx)
|
||||
/*--------------------------- STM32F072xB/STM32F078xx ---------------------------*/
|
||||
/* AF 0 */
|
||||
|
@ -510,6 +575,65 @@
|
|||
|
||||
#endif /* STM32F072xB || STM32F078xx */
|
||||
|
||||
#if defined (STM32F070xB)
|
||||
/*---------------------------------- STM32F070xB ---------------------------------------------*/
|
||||
/* AF 0 */
|
||||
#define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
|
||||
#define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
|
||||
#define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
|
||||
#define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
|
||||
#define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1 Alternate Function mapping */
|
||||
#define GPIO_AF0_SPI2 ((uint8_t)0x00) /*!< AF0: SPI2 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM3 ((uint8_t)0x00) /*!< AF0: TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM15 ((uint8_t)0x00) /*!< AF0: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
|
||||
#define GPIO_AF0_USART4 ((uint8_t)0x00) /*!< AF0: USART4 Alternate Function mapping */
|
||||
|
||||
/* AF 1 */
|
||||
#define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF1_TIM15 ((uint8_t)0x01) /*!< AF1: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART3 ((uint8_t)0x01) /*!< AF1: USART4 Alternate Function mapping */
|
||||
#define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
|
||||
#define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF1_I2C2 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF1_SPI2 ((uint8_t)0x01) /*!< AF1: SPI2 Alternate Function mapping */
|
||||
|
||||
/* AF 2 */
|
||||
#define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF2_USB ((uint8_t)0x02) /*!< AF2: USB Alternate Function mapping */
|
||||
|
||||
/* AF 3 */
|
||||
#define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF3_TIM15 ((uint8_t)0x03) /*!< AF3: TIM15 Alternate Function mapping */
|
||||
|
||||
/* AF 4 */
|
||||
#define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF4_USART4 ((uint8_t)0x04) /*!< AF4: USART4 Alternate Function mapping */
|
||||
#define GPIO_AF4_USART3 ((uint8_t)0x04) /*!< AF4: USART3 Alternate Function mapping */
|
||||
|
||||
/* AF 5 */
|
||||
#define GPIO_AF5_TIM15 ((uint8_t)0x05) /*!< AF5: TIM15 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< AF5: SPI2 Alternate Function mapping */
|
||||
#define GPIO_AF5_I2C2 ((uint8_t)0x05) /*!< AF5: I2C2 Alternate Function mapping */
|
||||
|
||||
/* AF 6 */
|
||||
#define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
|
||||
|
||||
#define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
|
||||
|
||||
#endif /* STM32F070xB */
|
||||
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx)
|
||||
/*--------------------------- STM32F042x6/STM32F048xx ---------------------------*/
|
||||
/* AF 0 */
|
||||
|
@ -569,6 +693,56 @@
|
|||
#define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx */
|
||||
|
||||
#if defined (STM32F070x6)
|
||||
/*--------------------------------------- STM32F070x6 ----------------------------------------*/
|
||||
/* AF 0 */
|
||||
#define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /*!< AF0: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF0_IR ((uint8_t)0x00) /*!< AF0: IR Alternate Function mapping */
|
||||
#define GPIO_AF0_MCO ((uint8_t)0x00) /*!< AF0: MCO Alternate Function mapping */
|
||||
#define GPIO_AF0_SPI1 ((uint8_t)0x00) /*!< AF0: SPI1 Alternate Function mapping */
|
||||
#define GPIO_AF0_SWDIO ((uint8_t)0x00) /*!< AF0: SWDIO Alternate Function mapping */
|
||||
#define GPIO_AF0_SWCLK ((uint8_t)0x00) /*!< AF0: SWCLK Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM14 ((uint8_t)0x00) /*!< AF0: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF0_TIM17 ((uint8_t)0x00) /*!< AF0: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF0_USART1 ((uint8_t)0x00) /*!< AF0: USART1 Alternate Function mapping */
|
||||
|
||||
/* AF 1 */
|
||||
#define GPIO_AF1_EVENTOUT ((uint8_t)0x01) /*!< AF1: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF1_I2C1 ((uint8_t)0x01) /*!< AF1: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF1_IR ((uint8_t)0x01) /*!< AF1: IR Alternate Function mapping */
|
||||
#define GPIO_AF1_USART1 ((uint8_t)0x01) /*!< AF1: USART1 Alternate Function mapping */
|
||||
#define GPIO_AF1_USART2 ((uint8_t)0x01) /*!< AF1: USART2 Alternate Function mapping */
|
||||
#define GPIO_AF1_TIM3 ((uint8_t)0x01) /*!< AF1: TIM3 Alternate Function mapping */
|
||||
|
||||
/* AF 2 */
|
||||
#define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /*!< AF2: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM1 ((uint8_t)0x02) /*!< AF2: TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM16 ((uint8_t)0x02) /*!< AF2: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF2_TIM17 ((uint8_t)0x02) /*!< AF2: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF2_USB ((uint8_t)0x02) /*!< AF2: USB Alternate Function mapping */
|
||||
|
||||
/* AF 3 */
|
||||
#define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /*!< AF3: EVENTOUT Alternate Function mapping */
|
||||
#define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< AF3: I2C1 Alternate Function mapping */
|
||||
|
||||
/* AF 4 */
|
||||
#define GPIO_AF4_TIM14 ((uint8_t)0x04) /*!< AF4: TIM14 Alternate Function mapping */
|
||||
#define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< AF4: I2C1 Alternate Function mapping */
|
||||
|
||||
/* AF 5 */
|
||||
#define GPIO_AF5_MCO ((uint8_t)0x05) /*!< AF5: MCO Alternate Function mapping */
|
||||
#define GPIO_AF5_I2C1 ((uint8_t)0x05) /*!< AF5: I2C1 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM16 ((uint8_t)0x05) /*!< AF5: TIM16 Alternate Function mapping */
|
||||
#define GPIO_AF5_TIM17 ((uint8_t)0x05) /*!< AF5: TIM17 Alternate Function mapping */
|
||||
#define GPIO_AF5_USB ((uint8_t)0x05) /*!< AF5: USB Alternate Function mapping */
|
||||
|
||||
/* AF 6 */
|
||||
#define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /*!< AF6: EVENTOUT Alternate Function mapping */
|
||||
|
||||
#define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x06)
|
||||
|
||||
#endif /* STM32F070x6 */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -587,24 +761,24 @@
|
|||
*/
|
||||
#if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
#define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
((__GPIOx__) == (GPIOB))? 1U :\
|
||||
((__GPIOx__) == (GPIOC))? 2U :\
|
||||
((__GPIOx__) == (GPIOD))? 3U :\
|
||||
((__GPIOx__) == (GPIOE))? 4U : 5U)
|
||||
#endif
|
||||
|
||||
#if defined (STM32F030x6) || defined (STM32F030x8) || \
|
||||
#if defined (STM32F030x6) || defined (STM32F030x8) || defined (STM32F070xB) || defined (STM32F030xC) || \
|
||||
defined (STM32F051x8) || defined (STM32F058xx)
|
||||
#define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
((__GPIOx__) == (GPIOB))? 1U :\
|
||||
((__GPIOx__) == (GPIOC))? 2U :\
|
||||
((__GPIOx__) == (GPIOD))? 3U : 5U)
|
||||
#endif
|
||||
|
||||
#if defined (STM32F031x6) || defined (STM32F038xx) || \
|
||||
defined (STM32F042x6) || defined (STM32F048xx)
|
||||
#define GET_GPIO_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6)
|
||||
#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
|
||||
((__GPIOx__) == (GPIOB))? 1U :\
|
||||
((__GPIOx__) == (GPIOC))? 2U : 5U)
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2c.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief I2C HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Inter Integrated Circuit (I2C) peripheral:
|
||||
|
@ -293,7 +293,7 @@ static void I2C_TransferConfig(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, ui
|
|||
HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
/* Check the I2C handle allocation */
|
||||
if(hi2c == HAL_NULL)
|
||||
if(hi2c == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c)
|
|||
HAL_StatusTypeDef HAL_I2C_DeInit(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
/* Check the I2C handle allocation */
|
||||
if(hi2c == HAL_NULL)
|
||||
if(hi2c == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevA
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c, uint16_t DevAd
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Transmit(I2C_HandleTypeDef *hi2c, uint8_t *pData
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive(I2C_HandleTypeDef *hi2c, uint8_t *pData,
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t D
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Receive_IT(I2C_HandleTypeDef *hi2c, uint16_t De
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1117,7 +1117,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pD
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pDa
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1309,7 +1309,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Receive_DMA(I2C_HandleTypeDef *hi2c, uint16_t D
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint8_t *p
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1475,7 +1475,7 @@ HAL_StatusTypeDef HAL_I2C_Slave_Receive_DMA(I2C_HandleTypeDef *hi2c, uint8_t *pD
|
|||
{
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1555,7 +1555,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1698,7 +1698,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress,
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1833,7 +1833,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddr
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1926,7 +1926,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddre
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAdd
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -2127,7 +2127,7 @@ HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddr
|
|||
|
||||
if(hi2c->State == HAL_I2C_STATE_READY)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2c.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of I2C HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -117,27 +117,6 @@ typedef enum
|
|||
|
||||
}HAL_I2C_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2C_Error_Code_structure_definition I2C Error Code structure definition
|
||||
* @brief I2C Error Code structure definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HAL_I2C_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_I2C_ERROR_BERR = 0x01, /*!< BERR error */
|
||||
HAL_I2C_ERROR_ARLO = 0x02, /*!< ARLO error */
|
||||
HAL_I2C_ERROR_AF = 0x04, /*!< AF error */
|
||||
HAL_I2C_ERROR_OVR = 0x08, /*!< OVR error */
|
||||
HAL_I2C_ERROR_DMA = 0x10, /*!< DMA transfer error */
|
||||
HAL_I2C_ERROR_TIMEOUT = 0x20, /*!< Timeout error */
|
||||
HAL_I2C_ERROR_SIZE = 0x40 /*!< Size Management error */
|
||||
}HAL_I2C_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -167,7 +146,8 @@ typedef struct
|
|||
|
||||
__IO HAL_I2C_StateTypeDef State; /*!< I2C communication state */
|
||||
|
||||
__IO HAL_I2C_ErrorTypeDef ErrorCode; /* I2C Error code */
|
||||
__IO uint32_t ErrorCode; /*!< I2C Error code
|
||||
This parameter can be a value of @ref I2C_Error */
|
||||
|
||||
}I2C_HandleTypeDef;
|
||||
/**
|
||||
|
@ -183,6 +163,25 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup I2C_Error I2C Error
|
||||
* @brief I2C Error
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define HAL_I2C_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_I2C_ERROR_BERR ((uint32_t)0x00000001) /*!< BERR error */
|
||||
#define HAL_I2C_ERROR_ARLO ((uint32_t)0x00000002) /*!< ARLO error */
|
||||
#define HAL_I2C_ERROR_AF ((uint32_t)0x00000004) /*!< AF error */
|
||||
#define HAL_I2C_ERROR_OVR ((uint32_t)0x00000008) /*!< OVR error */
|
||||
#define HAL_I2C_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
|
||||
#define HAL_I2C_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */
|
||||
#define HAL_I2C_ERROR_SIZE ((uint32_t)0x00000040) /*!< Size Management error */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup I2C_addressing_mode I2C addressing mode
|
||||
* @{
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2c_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief I2C Extension HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of I2C extension peripheral:
|
||||
|
@ -194,6 +194,7 @@ HAL_StatusTypeDef HAL_I2CEx_DigitalFilter_Config(I2C_HandleTypeDef *hi2c, uint32
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Enables I2C wakeup from stop mode.
|
||||
* @param hi2c : pointer to a I2C_HandleTypeDef structure that contains
|
||||
|
@ -270,7 +271,7 @@ HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp (I2C_HandleTypeDef *hi2c)
|
|||
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
#endif /* !(STM32F030x6) && !(STM32F030x8) && !(STM32F070x6) && !(STM32F070xB) && !(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2c_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of I2C HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -100,8 +100,10 @@
|
|||
/* Peripheral Control functions ************************************************/
|
||||
HAL_StatusTypeDef HAL_I2CEx_AnalogFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
|
||||
HAL_StatusTypeDef HAL_I2CEx_DigitalFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp (I2C_HandleTypeDef *hi2c);
|
||||
HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp (I2C_HandleTypeDef *hi2c);
|
||||
#endif /* !(STM32F030x6) && !(STM32F030x8) && !(STM32F070x6) && !(STM32F070xB) && !(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2s.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief I2S HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Integrated Interchip Sound (I2S) peripheral:
|
||||
|
@ -93,7 +93,7 @@
|
|||
*** I2S HAL driver macros list ***
|
||||
=============================================
|
||||
[..]
|
||||
Below the list of most used macros in USART HAL driver.
|
||||
Below the list of most used macros in I2S HAL driver.
|
||||
|
||||
(+) __HAL_I2S_ENABLE: Enable the specified SPI peripheral (in I2S mode)
|
||||
(+) __HAL_I2S_DISABLE: Disable the specified SPI peripheral (in I2S mode)
|
||||
|
@ -138,6 +138,14 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -147,19 +155,14 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/** @defgroup I2S_Private_Functions I2S Private Functions
|
||||
* @{
|
||||
*/
|
||||
static void I2S_DMATxCplt(DMA_HandleTypeDef *hdma);
|
||||
static void I2S_DMATxHalfCplt(DMA_HandleTypeDef *hdma);
|
||||
static void I2S_DMARxCplt(DMA_HandleTypeDef *hdma);
|
||||
|
@ -168,8 +171,11 @@ static void I2S_DMAError(DMA_HandleTypeDef *hdma);
|
|||
static void I2S_Transmit_IT(I2S_HandleTypeDef *hi2s);
|
||||
static void I2S_Receive_IT(I2S_HandleTypeDef *hi2s);
|
||||
static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s, uint32_t Flag, uint32_t State, uint32_t Timeout);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
|
||||
/** @defgroup I2S_Exported_Functions I2S Exported Functions
|
||||
* @{
|
||||
|
@ -216,7 +222,7 @@ HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s)
|
|||
uint32_t tmp = 0, i2sclk = 0;
|
||||
|
||||
/* Check the I2S handle allocation */
|
||||
if(hi2s == HAL_NULL)
|
||||
if(hi2s == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -329,7 +335,7 @@ HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s)
|
|||
HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
|
||||
{
|
||||
/* Check the I2S handle allocation */
|
||||
if(hi2s == HAL_NULL)
|
||||
if(hi2s == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -443,7 +449,7 @@ HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -533,7 +539,7 @@ HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uin
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -611,7 +617,7 @@ HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -678,7 +684,7 @@ HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData,
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -743,7 +749,7 @@ HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, u
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -824,7 +830,7 @@ HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData,
|
|||
*/
|
||||
HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -981,12 +987,12 @@ HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s)
|
|||
__HAL_DMA_DISABLE(hi2s->hdmarx);
|
||||
|
||||
/* Abort the I2S DMA tx channel */
|
||||
if(hi2s->hdmatx != HAL_NULL)
|
||||
if(hi2s->hdmatx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(hi2s->hdmatx);
|
||||
}
|
||||
/* Abort the I2S DMA rx channel */
|
||||
if(hi2s->hdmarx != HAL_NULL)
|
||||
if(hi2s->hdmarx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(hi2s->hdmarx);
|
||||
}
|
||||
|
@ -1157,7 +1163,7 @@ HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s)
|
|||
* the configuration information for I2S module
|
||||
* @retval I2S Error Code
|
||||
*/
|
||||
HAL_I2S_ErrorTypeDef HAL_I2S_GetError(I2S_HandleTypeDef *hi2s)
|
||||
uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s)
|
||||
{
|
||||
return hi2s->ErrorCode;
|
||||
}
|
||||
|
@ -1169,8 +1175,7 @@ HAL_I2S_ErrorTypeDef HAL_I2S_GetError(I2S_HandleTypeDef *hi2s)
|
|||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup I2S_Private_Functions I2S Private Functions
|
||||
/** @addtogroup I2S_Private_Functions I2S Private Functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
|
@ -1361,6 +1366,14 @@ static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s,
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1372,12 +1385,5 @@ static HAL_StatusTypeDef I2S_WaitFlagStateUntilTimeout(I2S_HandleTypeDef *hi2s,
|
|||
/* defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_i2s.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of I2S HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -103,54 +103,42 @@ typedef enum
|
|||
HAL_I2S_STATE_ERROR = 0x07 /*!< I2S error state */
|
||||
}HAL_I2S_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL I2S Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_I2S_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_I2S_ERROR_TIMEOUT = 0x01, /*!< Timeout error */
|
||||
HAL_I2S_ERROR_OVR = 0x02, /*!< OVR error */
|
||||
HAL_I2S_ERROR_UDR = 0x04, /*!< UDR error */
|
||||
HAL_I2S_ERROR_DMA = 0x08, /*!< DMA transfer error */
|
||||
HAL_I2S_ERROR_UNKNOW = 0x10 /*!< Unknow Error error */
|
||||
}HAL_I2S_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief I2S handle Structure definition
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
SPI_TypeDef *Instance; /* I2S registers base address */
|
||||
SPI_TypeDef *Instance; /*!< I2S registers base address */
|
||||
|
||||
I2S_InitTypeDef Init; /* I2S communication parameters */
|
||||
I2S_InitTypeDef Init; /*!< I2S communication parameters */
|
||||
|
||||
uint16_t *pTxBuffPtr; /* Pointer to I2S Tx transfer buffer */
|
||||
uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */
|
||||
|
||||
__IO uint16_t TxXferSize; /* I2S Tx transfer size */
|
||||
__IO uint16_t TxXferSize; /*!< I2S Tx transfer size */
|
||||
|
||||
__IO uint16_t TxXferCount; /* I2S Tx transfer Counter */
|
||||
__IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */
|
||||
|
||||
uint16_t *pRxBuffPtr; /* Pointer to I2S Rx transfer buffer */
|
||||
uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */
|
||||
|
||||
__IO uint16_t RxXferSize; /* I2S Rx transfer size */
|
||||
__IO uint16_t RxXferSize; /*!< I2S Rx transfer size */
|
||||
|
||||
__IO uint16_t RxXferCount; /* I2S Rx transfer counter
|
||||
__IO uint16_t RxXferCount; /*!< I2S Rx transfer counter
|
||||
(This field is initialized at the
|
||||
same value as transfer size at the
|
||||
beginning of the transfer and
|
||||
decremented when a sample is received.
|
||||
NbSamplesReceived = RxBufferSize-RxBufferCount) */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /* I2S Tx DMA handle parameters */
|
||||
DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /* I2S Rx DMA handle parameters */
|
||||
DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */
|
||||
|
||||
__IO HAL_LockTypeDef Lock; /* I2S locking object */
|
||||
__IO HAL_LockTypeDef Lock; /*!< I2S locking object */
|
||||
|
||||
__IO HAL_I2S_StateTypeDef State; /* I2S communication state */
|
||||
__IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */
|
||||
|
||||
__IO HAL_I2S_ErrorTypeDef ErrorCode; /* I2S Error code */
|
||||
__IO uint32_t ErrorCode; /*!< I2S Error code
|
||||
This parameter can be a value of @ref I2S_Error */
|
||||
|
||||
}I2S_HandleTypeDef;
|
||||
/**
|
||||
|
@ -161,6 +149,18 @@ typedef struct
|
|||
/** @defgroup I2S_Exported_Constants I2S Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/** @defgroup I2S_Error I2S Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_I2S_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_I2S_ERROR_TIMEOUT ((uint32_t)0x00000001) /*!< Timeout error */
|
||||
#define HAL_I2S_ERROR_OVR ((uint32_t)0x00000002) /*!< OVR error */
|
||||
#define HAL_I2S_ERROR_UDR ((uint32_t)0x00000004) /*!< UDR error */
|
||||
#define HAL_I2S_ERROR_DMA ((uint32_t)0x00000008) /*!< DMA transfer error */
|
||||
#define HAL_I2S_ERROR_UNKNOW ((uint32_t)0x00000010) /*!< Unknow Error error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup I2S_Mode I2S Mode
|
||||
* @{
|
||||
|
@ -348,13 +348,21 @@ typedef struct
|
|||
* @param __HANDLE__: specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) do{__IO uint32_t tmpreg = (__HANDLE__)->Instance->DR;\
|
||||
tmpreg = (__HANDLE__)->Instance->SR;}while(0)
|
||||
#define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg; \
|
||||
tmpreg = (__HANDLE__)->Instance->DR; \
|
||||
tmpreg = (__HANDLE__)->Instance->SR; \
|
||||
UNUSED(tmpreg); \
|
||||
}while(0)
|
||||
/** @brief Clears the I2S UDR pending flag.
|
||||
* @param __HANDLE__: specifies the I2S Handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__)((__HANDLE__)->Instance->SR)
|
||||
#define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) do{\
|
||||
__IO uint32_t tmpreg;\
|
||||
tmpreg = ((__HANDLE__)->Instance->SR);\
|
||||
UNUSED(tmpreg); \
|
||||
}while(0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -412,7 +420,7 @@ void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s);
|
|||
*/
|
||||
/* Peripheral Control and State functions ************************************/
|
||||
HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s);
|
||||
HAL_I2S_ErrorTypeDef HAL_I2S_GetError(I2S_HandleTypeDef *hi2s);
|
||||
uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_irda.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief IRDA HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the IrDA (Infrared Data Association) Peripheral
|
||||
|
@ -131,6 +131,10 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -139,16 +143,13 @@
|
|||
* @brief HAL IRDA module driver
|
||||
* @{
|
||||
*/
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/** @defgroup IRDA_Private_Constants IRDA Private Constants
|
||||
* @{
|
||||
*/
|
||||
#define TEACK_REACK_TIMEOUT 1000
|
||||
#define TEACK_REACK_TIMEOUT 1000
|
||||
#define IRDA_TXDMA_TIMEOUTVALUE 22000
|
||||
#define IRDA_TIMEOUT_VALUE 22000
|
||||
#define IRDA_CR1_FIELDS ((uint32_t)(USART_CR1_M | USART_CR1_PCE \
|
||||
|
@ -238,7 +239,7 @@ static HAL_StatusTypeDef IRDA_Receive_IT(IRDA_HandleTypeDef *hirda);
|
|||
HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda)
|
||||
{
|
||||
/* Check the IRDA handle allocation */
|
||||
if(hirda == HAL_NULL)
|
||||
if(hirda == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -287,7 +288,7 @@ HAL_StatusTypeDef HAL_IRDA_Init(IRDA_HandleTypeDef *hirda)
|
|||
HAL_StatusTypeDef HAL_IRDA_DeInit(IRDA_HandleTypeDef *hirda)
|
||||
{
|
||||
/* Check the IRDA handle allocation */
|
||||
if(hirda == HAL_NULL)
|
||||
if(hirda == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -407,7 +408,7 @@ HAL_StatusTypeDef HAL_IRDA_Transmit(IRDA_HandleTypeDef *hirda, uint8_t *pData, u
|
|||
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -487,7 +488,7 @@ HAL_StatusTypeDef HAL_IRDA_Receive(IRDA_HandleTypeDef *hirda, uint8_t *pData, ui
|
|||
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -565,7 +566,7 @@ HAL_StatusTypeDef HAL_IRDA_Transmit_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData
|
|||
{
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -615,7 +616,7 @@ HAL_StatusTypeDef HAL_IRDA_Receive_IT(IRDA_HandleTypeDef *hirda, uint8_t *pData,
|
|||
{
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -674,7 +675,7 @@ HAL_StatusTypeDef HAL_IRDA_Transmit_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pDat
|
|||
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -737,7 +738,7 @@ HAL_StatusTypeDef HAL_IRDA_Receive_DMA(IRDA_HandleTypeDef *hirda, uint8_t *pData
|
|||
|
||||
if ((hirda->State == HAL_IRDA_STATE_READY) || (hirda->State == HAL_IRDA_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1305,7 +1306,7 @@ static HAL_StatusTypeDef IRDA_WaitOnFlagUntilTimeout(IRDA_HandleTypeDef *hirda,
|
|||
__HAL_IRDA_DISABLE_IT(hirda, IRDA_IT_PE);
|
||||
__HAL_IRDA_DISABLE_IT(hirda, IRDA_IT_ERR);
|
||||
|
||||
hirda->State= HAL_IRDA_STATE_TIMEOUT;
|
||||
hirda->State= HAL_IRDA_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hirda);
|
||||
|
@ -1330,7 +1331,7 @@ static HAL_StatusTypeDef IRDA_WaitOnFlagUntilTimeout(IRDA_HandleTypeDef *hirda,
|
|||
__HAL_IRDA_DISABLE_IT(hirda, IRDA_IT_PE);
|
||||
__HAL_IRDA_DISABLE_IT(hirda, IRDA_IT_ERR);
|
||||
|
||||
hirda->State= HAL_IRDA_STATE_TIMEOUT;
|
||||
hirda->State= HAL_IRDA_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hirda);
|
||||
|
@ -1347,15 +1348,16 @@ static HAL_StatusTypeDef IRDA_WaitOnFlagUntilTimeout(IRDA_HandleTypeDef *hirda,
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_irda.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file contains all the functions prototypes for the IRDA
|
||||
* firmware library.
|
||||
******************************************************************************
|
||||
|
@ -44,7 +44,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -107,19 +107,6 @@ typedef enum
|
|||
HAL_IRDA_STATE_ERROR = 0x04 /*!< Error */
|
||||
}HAL_IRDA_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL IRDA Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_IRDA_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_IRDA_ERROR_PE = 0x01, /*!< Parity error */
|
||||
HAL_IRDA_ERROR_NE = 0x02, /*!< Noise error */
|
||||
HAL_IRDA_ERROR_FE = 0x04, /*!< frame error */
|
||||
HAL_IRDA_ERROR_ORE = 0x08, /*!< Overrun error */
|
||||
HAL_IRDA_ERROR_DMA = 0x10 /*!< DMA transfer error */
|
||||
}HAL_IRDA_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief IRDA clock sources definition
|
||||
*/
|
||||
|
@ -137,34 +124,35 @@ typedef enum
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
USART_TypeDef *Instance; /* USART registers base address */
|
||||
USART_TypeDef *Instance; /*!< USART registers base address */
|
||||
|
||||
IRDA_InitTypeDef Init; /* IRDA communication parameters */
|
||||
IRDA_InitTypeDef Init; /*!< IRDA communication parameters */
|
||||
|
||||
uint8_t *pTxBuffPtr; /* Pointer to IRDA Tx transfer Buffer */
|
||||
uint8_t *pTxBuffPtr; /*!< Pointer to IRDA Tx transfer Buffer */
|
||||
|
||||
uint16_t TxXferSize; /* IRDA Tx Transfer size */
|
||||
uint16_t TxXferSize; /*!< IRDA Tx Transfer size */
|
||||
|
||||
uint16_t TxXferCount; /* IRDA Tx Transfer Counter */
|
||||
uint16_t TxXferCount; /*!< IRDA Tx Transfer Counter */
|
||||
|
||||
uint8_t *pRxBuffPtr; /* Pointer to IRDA Rx transfer Buffer */
|
||||
uint8_t *pRxBuffPtr; /*!< Pointer to IRDA Rx transfer Buffer */
|
||||
|
||||
uint16_t RxXferSize; /* IRDA Rx Transfer size */
|
||||
uint16_t RxXferSize; /*!< IRDA Rx Transfer size */
|
||||
|
||||
uint16_t RxXferCount; /* IRDA Rx Transfer Counter */
|
||||
uint16_t RxXferCount; /*!< IRDA Rx Transfer Counter */
|
||||
|
||||
uint16_t Mask; /* USART RX RDR register mask */
|
||||
uint16_t Mask; /*!< USART RX RDR register mask */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /* IRDA Tx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmatx; /*!< IRDA Tx DMA Handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /* IRDA Rx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmarx; /*!< IRDA Rx DMA Handle parameters */
|
||||
|
||||
HAL_LockTypeDef Lock; /* Locking object */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
|
||||
HAL_IRDA_StateTypeDef State; /* IRDA communication state */
|
||||
|
||||
HAL_IRDA_ErrorTypeDef ErrorCode; /* IRDA Error code */
|
||||
HAL_IRDA_StateTypeDef State; /*!< IRDA communication state */
|
||||
|
||||
__IO uint32_t ErrorCode; /*!< IRDA Error code
|
||||
This parameter can be a value of @ref IRDA_Error */
|
||||
|
||||
}IRDA_HandleTypeDef;
|
||||
|
||||
/**
|
||||
|
@ -189,6 +177,19 @@ typedef enum
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup IRDA_Error IRDA Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_IRDA_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_IRDA_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */
|
||||
#define HAL_IRDA_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */
|
||||
#define HAL_IRDA_ERROR_FE ((uint32_t)0x00000004) /*!< frame error */
|
||||
#define HAL_IRDA_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */
|
||||
#define HAL_IRDA_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup IRDA_Parity IRDA Parity
|
||||
* @{
|
||||
*/
|
||||
|
@ -551,7 +552,7 @@ typedef enum
|
|||
* @}
|
||||
*/
|
||||
|
||||
/* Include IRDA HAL Extension module */
|
||||
/* Include IRDA HAL Extended module */
|
||||
#include "stm32f0xx_hal_irda_ex.h"
|
||||
|
||||
/* Exported functions --------------------------------------------------------*/
|
||||
|
@ -618,7 +619,7 @@ uint32_t HAL_IRDA_GetError(IRDA_HandleTypeDef *hirda);
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_irda_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of IRDA HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -103,7 +103,7 @@
|
|||
* @retval IRDA clocking source, written in __CLOCKSOURCE__.
|
||||
*/
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#if defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
switch(__HAL_RCC_GET_USART1_SOURCE()) \
|
||||
|
@ -125,8 +125,7 @@
|
|||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined (STM32F030x8) || \
|
||||
defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
#elif defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F051x8) || defined (STM32F058xx)
|
||||
#define __HAL_IRDA_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
|
@ -310,7 +309,7 @@
|
|||
} \
|
||||
} while(0)
|
||||
|
||||
#endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */
|
||||
#endif /* defined(STM32F031x6) || defined(STM32F038xx) */
|
||||
|
||||
|
||||
/** @brief Computes the mask to apply to retrieve the received data
|
||||
|
@ -404,7 +403,7 @@
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_iwdg.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief IWDG HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the IWDG peripheral:
|
||||
* functionalities of the Independent Watchdog (IWDG) peripheral:
|
||||
* + Initialization and Configuration functions
|
||||
* + IO operation functions
|
||||
* + Peripheral State functions
|
||||
|
@ -37,7 +37,6 @@
|
|||
can be used to have an IWDG timeout with an acceptable accuracy.
|
||||
For more information, please refer to the STM32F0x Reference manual.
|
||||
|
||||
===============================================================================
|
||||
##### How to use this driver #####
|
||||
===============================================================================
|
||||
[..]
|
||||
|
@ -171,7 +170,7 @@ HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg)
|
|||
uint32_t tickstart = 0;
|
||||
|
||||
/* Check the IWDG handle allocation */
|
||||
if(hiwdg == HAL_NULL)
|
||||
if(hiwdg == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_iwdg.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of IWDG HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pcd.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief PCD HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the USB Peripheral Controller:
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)|| defined(STM32F070x6)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
|
@ -142,7 +142,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
|
|||
uint32_t wInterrupt_Mask = 0;
|
||||
|
||||
/* Check the PCD handle allocation */
|
||||
if(hpcd == HAL_NULL)
|
||||
if(hpcd == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
|
|||
HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd)
|
||||
{
|
||||
/* Check the PCD handle allocation */
|
||||
if(hpcd == HAL_NULL)
|
||||
if(hpcd == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
|
|||
*/
|
||||
|
||||
/**
|
||||
* @brief Send an amount of data in blocking mode
|
||||
* @brief Connect the USB device
|
||||
* @param hpcd: PCD handle
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -784,7 +784,7 @@ HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Send an amount of data in blocking mode
|
||||
* @brief Disconnect the USB device
|
||||
* @param hpcd: PCD handle
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -1353,7 +1353,7 @@ PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */
|
||||
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pcd.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of PCD HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)|| defined(STM32F070x6)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -98,13 +98,13 @@ typedef struct
|
|||
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||
|
||||
uint32_t speed; /*!< USB Core speed.
|
||||
This parameter can be any value of @ref USB_Core_Speed */
|
||||
This parameter can be any value of @ref PCD_Core_Speed */
|
||||
|
||||
uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size.
|
||||
This parameter can be any value of @ref USB_EP0_MPS */
|
||||
This parameter can be any value of @ref PCD_EP0_MPS */
|
||||
|
||||
uint32_t phy_itface; /*!< Select the used PHY interface.
|
||||
This parameter can be any value of @ref USB_Core_PHY */
|
||||
This parameter can be any value of @ref PCD_Core_PHY */
|
||||
|
||||
uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal.
|
||||
This parameter can be set to ENABLE or DISABLE */
|
||||
|
@ -132,7 +132,7 @@ typedef struct
|
|||
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||
|
||||
uint8_t type; /*!< Endpoint type
|
||||
This parameter can be any value of @ref USB_EP_Type */
|
||||
This parameter can be any value of @ref PCD_EP_Type */
|
||||
|
||||
uint16_t pmaadress; /*!< PMA Address
|
||||
This parameter can be any value between Min_addr = 0 and Max_addr = 1K */
|
||||
|
@ -190,7 +190,7 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USB_Core_Speed USB Core Speed
|
||||
/** @defgroup PCD_Core_Speed PCD Core Speed
|
||||
* @{
|
||||
*/
|
||||
#define PCD_SPEED_HIGH 0 /* Not Supported */
|
||||
|
@ -199,7 +199,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_Core_PHY USB Core PHY
|
||||
/** @defgroup PCD_Core_PHY PCD Core PHY
|
||||
* @{
|
||||
*/
|
||||
#define PCD_PHY_EMBEDDED 2
|
||||
|
@ -207,7 +207,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_EP0_MPS USB EP0 MPS
|
||||
/** @defgroup PCD_EP0_MPS PCD EP0 MPS
|
||||
* @{
|
||||
*/
|
||||
#define DEP0CTL_MPS_64 0
|
||||
|
@ -223,7 +223,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_EP_Type USB EP Type
|
||||
/** @defgroup PCD_EP_Type PCD EP Type
|
||||
* @{
|
||||
*/
|
||||
#define PCD_EP_TYPE_CTRL 0
|
||||
|
@ -234,7 +234,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_ENDP USB ENDP
|
||||
/** @defgroup PCD_ENDP_Type PCD_ENDP_Type
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -267,7 +267,7 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
#define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISTR) & (__INTERRUPT__)) == (__INTERRUPT__))
|
||||
#define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->ISTR) = ~(__INTERRUPT__))
|
||||
#define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->ISTR) &= ~(__INTERRUPT__))
|
||||
|
||||
#define USB_EXTI_LINE_WAKEUP ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the USB FS EXTI Line */
|
||||
|
||||
|
@ -770,7 +770,7 @@ PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd);
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pcd_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended PCD HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the USB Peripheral Controller:
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)|| defined(STM32F070x6)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
|
@ -65,7 +65,7 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup PCDEx_Exported_Functions_Group1 Initialization and de-initialization functions
|
||||
/** @defgroup PCDEx_Exported_Functions_Group2 Initialization and de-initialization functions
|
||||
* @brief Initialization and Configuration functions
|
||||
*
|
||||
@verbatim
|
||||
|
@ -146,7 +146,7 @@ HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */
|
||||
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pcd_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of PCD HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)|| defined(STM32F070xB)|| defined(STM32F070x6)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -65,8 +65,8 @@
|
|||
/** @addtogroup PCDEx_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
/** @addtogroup PCDEx_Exported_Functions_Group1 Initialization and de-initialization functions
|
||||
* @brief Initialization and Configuration functions
|
||||
|
||||
/** @addtogroup PCDEx_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -90,7 +90,7 @@ HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pwr.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief PWR HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Power Controller (PWR) peripheral:
|
||||
|
@ -271,9 +271,9 @@ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx)
|
|||
* @brief Enters Sleep mode.
|
||||
* @note In Sleep mode, all I/O pins keep the same state as in Run mode.
|
||||
* @param Regulator: Specifies the regulator state in SLEEP mode.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg PWR_MAINREGULATOR_ON: SLEEP mode with regulator ON
|
||||
* @arg PWR_LOWPOWERREGULATOR_ON: SLEEP mode with low power regulator ON
|
||||
* On STM32F0 devices, this parameter is a dummy value and it is ignored
|
||||
* as regulator can't be modified in this mode. Parameter is kept for platform
|
||||
* compatibility.
|
||||
* @param SLEEPEntry: Specifies if SLEEP mode is entered with WFI or WFE instruction.
|
||||
* When WFI entry is used, tick interrupt have to be disabled if not desired as
|
||||
* the interrupt wake up source.
|
||||
|
@ -284,24 +284,10 @@ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx)
|
|||
*/
|
||||
void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry)
|
||||
{
|
||||
uint32_t tmpreg = 0;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_PWR_REGULATOR(Regulator));
|
||||
assert_param(IS_PWR_SLEEP_ENTRY(SLEEPEntry));
|
||||
|
||||
/* Select the regulator state in SLEEP mode ---------------------------------*/
|
||||
tmpreg = PWR->CR;
|
||||
|
||||
/* Clear PDDS and LPDS bits */
|
||||
tmpreg &= (uint32_t)~(PWR_CR_PDDS | PWR_CR_LPDS);
|
||||
|
||||
/* Set LPDS bit according to Regulator value */
|
||||
tmpreg |= Regulator;
|
||||
|
||||
/* Store the new value */
|
||||
PWR->CR = tmpreg;
|
||||
|
||||
/* Clear SLEEPDEEP bit of Cortex System Control Register */
|
||||
SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
|
||||
|
||||
|
@ -410,6 +396,60 @@ void HAL_PWR_EnterSTANDBYMode(void)
|
|||
__WFI();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Indicates Sleep-On-Exit when returning from Handler mode to Thread mode.
|
||||
* @note Set SLEEPONEXIT bit of SCR register. When this bit is set, the processor
|
||||
* re-enters SLEEP mode when an interruption handling is over.
|
||||
* Setting this bit is useful when the processor is expected to run only on
|
||||
* interruptions handling.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PWR_EnableSleepOnExit(void)
|
||||
{
|
||||
/* Set SLEEPONEXIT bit of Cortex System Control Register */
|
||||
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Disables Sleep-On-Exit feature when returning from Handler mode to Thread mode.
|
||||
* @note Clears SLEEPONEXIT bit of SCR register. When this bit is set, the processor
|
||||
* re-enters SLEEP mode when an interruption handling is over.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PWR_DisableSleepOnExit(void)
|
||||
{
|
||||
/* Clear SLEEPONEXIT bit of Cortex System Control Register */
|
||||
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enables CORTEX M4 SEVONPEND bit.
|
||||
* @note Sets SEVONPEND bit of SCR register. When this bit is set, this causes
|
||||
* WFE to wake up when an interrupt moves from inactive to pended.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PWR_EnableSEVOnPend(void)
|
||||
{
|
||||
/* Set SEVONPEND bit of Cortex System Control Register */
|
||||
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Disables CORTEX M4 SEVONPEND bit.
|
||||
* @note Clears SEVONPEND bit of SCR register. When this bit is set, this causes
|
||||
* WFE to wake up when an interrupt moves from inactive to pended.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_PWR_DisableSEVOnPend(void)
|
||||
{
|
||||
/* Clear SEVONPEND bit of Cortex System Control Register */
|
||||
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pwr.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of PWR HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -175,6 +175,11 @@ void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry);
|
|||
void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry);
|
||||
void HAL_PWR_EnterSTANDBYMode(void);
|
||||
|
||||
void HAL_PWR_EnableSleepOnExit(void);
|
||||
void HAL_PWR_DisableSleepOnExit(void);
|
||||
void HAL_PWR_EnableSEVOnPend(void);
|
||||
void HAL_PWR_DisableSEVOnPend(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pwr_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended PWR HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Power Controller (PWR) peripheral:
|
||||
|
@ -217,7 +217,6 @@ __weak void HAL_PWR_PVDCallback(void)
|
|||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
/**
|
||||
* @brief Enable VDDIO2 monitor: enable Exti 31 and falling edge detection.
|
||||
* @param None
|
||||
* @note If Exti 31 is enable correlty and VDDIO2 voltage goes below Vrefint,
|
||||
an interrupt is generated Irq line 1.
|
||||
NVIS has to be enable by user.
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_pwr_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of PWR HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -92,8 +92,8 @@ typedef struct
|
|||
/** @defgroup PWREx_WakeUp_Pins PWREx Wakeup Pins
|
||||
* @{
|
||||
*/
|
||||
#if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
#if defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
|
||||
#define PWR_WAKEUP_PIN1 ((uint32_t)0x00)
|
||||
#define PWR_WAKEUP_PIN2 ((uint32_t)0x01)
|
||||
#define PWR_WAKEUP_PIN3 ((uint32_t)0x02)
|
||||
|
@ -117,8 +117,8 @@ typedef struct
|
|||
|
||||
#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WAKEUP_PIN1) || \
|
||||
((PIN) == PWR_WAKEUP_PIN2))
|
||||
#endif /* defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || */
|
||||
/* defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
#endif /* defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || */
|
||||
/* defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -142,9 +142,9 @@ typedef struct
|
|||
|
||||
#define PWR_EXTI_LINE_VDDIO2 ((uint32_t)0x80000000) /*!< External interrupt line 31 Connected to the Vddio2 Monitor EXTI Line */
|
||||
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
defined (STM32F091xC) || defined (STM32F098xx) ||*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -204,6 +204,10 @@ typedef struct
|
|||
#define PWR_FLAG_SB PWR_CSR_SBF
|
||||
#define PWR_FLAG_PVDO PWR_CSR_PVDO
|
||||
#define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
|
||||
#elif defined (STM32F070x6) || defined (STM32F070xB) || defined (STM32F030xC)
|
||||
#define PWR_FLAG_WU PWR_CSR_WUF
|
||||
#define PWR_FLAG_SB PWR_CSR_SBF
|
||||
#define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
|
||||
#else
|
||||
#define PWR_FLAG_WU PWR_CSR_WUF
|
||||
#define PWR_FLAG_SB PWR_CSR_SBF
|
||||
|
@ -339,7 +343,7 @@ typedef struct
|
|||
#define __HAL_PWR_VDDIO2_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (PWR_EXTI_LINE_VDDIO2))
|
||||
|
||||
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) ||\
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rcc.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief RCC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Reset and Clock Control (RCC) peripheral:
|
||||
* + Initialization/de-initialization function
|
||||
* + Peripheral Control function
|
||||
* + Initialization and de-initialization functions
|
||||
* + Peripheral Control functions
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
|
@ -23,9 +23,7 @@
|
|||
(+) The clock for all peripherals is switched off, except the SRAM and FLASH.
|
||||
(+) All GPIOs are in input floating state, except the JTAG pins which
|
||||
are assigned to be used for debug purpose.
|
||||
|
||||
[..]
|
||||
Once the device started from reset, the user application has to:
|
||||
[..] Once the device started from reset, the user application has to:
|
||||
(+) Configure the clock source to be used to drive the System clock
|
||||
(if the application needs higher frequency/performance)
|
||||
(+) Configure the System clock frequency and Flash settings
|
||||
|
@ -33,7 +31,27 @@
|
|||
(+) Enable the clock for the peripheral(s) to be used
|
||||
(+) Configure the clock source(s) for peripherals which clocks are not
|
||||
derived from the System clock (RTC, ADC, I2C, USART, TIM, USB FS, etc..)
|
||||
@endverbatim
|
||||
|
||||
##### RCC Limitations #####
|
||||
==============================================================================
|
||||
[..]
|
||||
A delay between an RCC peripheral clock enable and the effective peripheral
|
||||
enabling should be taken into account in order to manage the peripheral read/write
|
||||
from/to registeres.
|
||||
(+) This delay depends on the peripheral mapping.
|
||||
(+) If peripheral is mapped on AHB: the delay is 2 AHB clock cycle
|
||||
after the clock enable bit is set on the hardware register
|
||||
(+) If peripheral is mapped on APB: the delay is 2 APB clock cycle
|
||||
after the clock enable bit is set on the hardware register
|
||||
|
||||
[..]
|
||||
Possible Workarounds:
|
||||
(#) Enable the peripheral clock sometimes before the peripheral read/write
|
||||
register is required.
|
||||
(#) For AHB peripheral, insert two dummy read to the peripheral register.
|
||||
(#) For APB peripheral, insert a dummy read to the peripheral register.
|
||||
|
||||
@endverbatim
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rcc.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of RCC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -105,7 +105,7 @@ typedef struct
|
|||
uint32_t HSI14CalibrationValue; /*!< The HSI14 calibration trimming value (default is RCC_HSI14CALIBRATION_DEFAULT).
|
||||
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
|
||||
|
||||
uint32_t HSI48State; /*!< The new state of the HSI48 (only applicable to STM32F07x and STM32F0x2 devices).
|
||||
uint32_t HSI48State; /*!< The new state of the HSI48 (only applicable to STM32F07x, STM32F0x2 and STM32F09x devices).
|
||||
This parameter can be a value of @ref RCCEx_HSI48_Config */
|
||||
|
||||
uint32_t LSIState; /*!< The new state of the LSI.
|
||||
|
@ -963,32 +963,6 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup RCC_USARTx_Clock_Config RCC USARTx Clock Config
|
||||
* @{
|
||||
*/
|
||||
/** @brief Macro to configure the USART2 clock (USART2CLK).
|
||||
* @param __USART2CLKSource__: specifies the USART2 clock source.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
|
||||
*/
|
||||
#define __HAL_RCC_USART2_CONFIG(__USART2CLKSource__) \
|
||||
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART2SW, (uint32_t)(__USART2CLKSource__))
|
||||
|
||||
/** @brief Macro to get the USART2 clock source.
|
||||
* @retval The clock source can be one of the following values:
|
||||
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
|
||||
*/
|
||||
#define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART2SW)))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
|
||||
* @{
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rcc_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended RCC HAL module driver
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities RCC extension peripheral:
|
||||
|
@ -952,16 +952,17 @@ uint32_t HAL_RCC_GetSysClockFreq(void)
|
|||
/* STM32F091xC || STM32F098xx */
|
||||
else
|
||||
{
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
/* HSI used as PLL clock source : PLLCLK = HSI/PREDIV * PLLMUL */
|
||||
pllclk = (HSI_VALUE/prediv) * pllmul;
|
||||
#else
|
||||
/* HSI used as PLL clock source : PLLCLK = HSI/2 * PLLMUL */
|
||||
pllclk = (HSI_VALUE >> 1) * pllmul;
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 ||
|
||||
STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB
|
||||
STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
}
|
||||
sysclockfreq = pllclk;
|
||||
break;
|
||||
|
@ -1100,7 +1101,7 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
|
|||
__HAL_RCC_I2C1_CONFIG(PeriphClkInit->I2c1ClockSelection);
|
||||
}
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || defined(STM32F070x6)
|
||||
/*------------------------------ USB Configuration ------------------------*/
|
||||
if(((PeriphClkInit->PeriphClockSelection) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB)
|
||||
{
|
||||
|
@ -1110,7 +1111,7 @@ HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClk
|
|||
/* Configure the USB clock source */
|
||||
__HAL_RCC_USB_CONFIG(PeriphClkInit->UsbClockSelection);
|
||||
}
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
|
@ -1167,11 +1168,11 @@ void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
|
|||
PeriphClkInit->Usart3ClockSelection = __HAL_RCC_GET_USART3_SOURCE();
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || defined(STM32F070x6)
|
||||
PeriphClkInit->PeriphClockSelection |= RCC_PERIPHCLK_USB;
|
||||
/* Get the USB clock source ---------------------------------------------*/
|
||||
PeriphClkInit->UsbClockSelection = __HAL_RCC_GET_USB_SOURCE();
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx || STM32F070xB || STM32F070x6 */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
|
@ -1271,7 +1272,7 @@ void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void)
|
|||
void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo)
|
||||
{
|
||||
/* Check the parameter */
|
||||
assert_param(pSynchroInfo != HAL_NULL);
|
||||
assert_param(pSynchroInfo != NULL);
|
||||
|
||||
/* Get the reload value */
|
||||
pSynchroInfo->ReloadValue = (uint32_t)(CRS->CFGR & CRS_CFGR_RELOAD);
|
||||
|
@ -1303,9 +1304,9 @@ void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo
|
|||
* @arg RCC_CRS_SYNCMISS
|
||||
* @arg RCC_CRS_TRIMOV
|
||||
*/
|
||||
RCC_CRSStatusTypeDef HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout)
|
||||
uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout)
|
||||
{
|
||||
RCC_CRSStatusTypeDef crsstatus = RCC_CRS_NONE;
|
||||
uint32_t crsstatus = RCC_CRS_NONE;
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get timeout */
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rcc_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of RCC HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -63,7 +63,8 @@
|
|||
/**
|
||||
* @brief RCC extended clocks structure definition
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F030xC)
|
||||
typedef struct
|
||||
{
|
||||
uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
|
||||
|
@ -79,7 +80,29 @@ typedef struct
|
|||
This parameter can be a value of @ref RCC_I2C1_Clock_Source */
|
||||
|
||||
}RCC_PeriphCLKInitTypeDef;
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx ||
|
||||
STM32F030xC */
|
||||
|
||||
#if defined(STM32F070x6) || defined(STM32F070xB)
|
||||
typedef struct
|
||||
{
|
||||
uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
|
||||
This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
|
||||
|
||||
uint32_t RTCClockSelection; /*!< Specifies RTC Clock Prescalers Selection
|
||||
This parameter can be a value of @ref RCC_RTC_Clock_Source */
|
||||
|
||||
uint32_t Usart1ClockSelection; /*!< USART1 clock source
|
||||
This parameter can be a value of @ref RCC_USART1_Clock_Source */
|
||||
|
||||
uint32_t I2c1ClockSelection; /*!< I2C1 clock source
|
||||
This parameter can be a value of @ref RCC_I2C1_Clock_Source */
|
||||
|
||||
uint32_t UsbClockSelection; /*!< USB clock source
|
||||
This parameter can be a value of @ref RCCEx_USB_Clock_Source */
|
||||
|
||||
}RCC_PeriphCLKInitTypeDef;
|
||||
#endif /* STM32F070x6 || STM32F070xB */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx)
|
||||
typedef struct
|
||||
|
@ -205,23 +228,9 @@ typedef struct
|
|||
}RCC_PeriphCLKInitTypeDef;
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/**
|
||||
* @brief RCC CRS Status structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RCC_CRS_NONE = 0x00,
|
||||
RCC_CRS_TIMEOUT = 0x01,
|
||||
RCC_CRS_SYNCOK = 0x02,
|
||||
RCC_CRS_SYNCWARM = 0x04,
|
||||
RCC_CRS_SYNCERR = 0x08,
|
||||
RCC_CRS_SYNCMISS = 0x10,
|
||||
RCC_CRS_TRIMOV = 0x20
|
||||
} RCC_CRSStatusTypeDef;
|
||||
|
||||
/**
|
||||
* @brief RCC_CRS Init structure definition
|
||||
|
@ -271,7 +280,7 @@ typedef struct
|
|||
|
||||
}RCC_CRSSynchroInfoTypeDef;
|
||||
|
||||
#endif /* STM32F042x6 || */
|
||||
#endif /* STM32F042x6 || STM32F048xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
|
@ -285,17 +294,51 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup RCCEx_CRS_Status RCCEx CRS Status
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
#define RCC_CRS_NONE ((uint32_t)0x00000000)
|
||||
#define RCC_CRS_TIMEOUT ((uint32_t)0x00000001)
|
||||
#define RCC_CRS_SYNCOK ((uint32_t)0x00000002)
|
||||
#define RCC_CRS_SYNCWARM ((uint32_t)0x00000004)
|
||||
#define RCC_CRS_SYNCERR ((uint32_t)0x00000008)
|
||||
#define RCC_CRS_SYNCMISS ((uint32_t)0x00000010)
|
||||
#define RCC_CRS_TRIMOV ((uint32_t)0x00000020)
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup RCCEx_Periph_Clock_Selection RCCEx Periph Clock Selection
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F030xC)
|
||||
#define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000001)
|
||||
#define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00000020)
|
||||
#define RCC_PERIPHCLK_RTC ((uint32_t)0x00010000)
|
||||
|
||||
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
|
||||
RCC_PERIPHCLK_RTC))
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || STM32F031x6 || STM32F038xx ||
|
||||
STM32F030xC */
|
||||
|
||||
#if defined(STM32F070x6) || defined(STM32F070xB)
|
||||
#define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000001)
|
||||
#define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00000020)
|
||||
#define RCC_PERIPHCLK_RTC ((uint32_t)0x00010000)
|
||||
#define RCC_PERIPHCLK_USB ((uint32_t)0x00020000)
|
||||
|
||||
#define IS_RCC_PERIPHCLK(SELECTION) ((SELECTION) <= (RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_I2C1 | \
|
||||
RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_USB))
|
||||
#endif /* STM32F070x6 || STM32F070xB */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx)
|
||||
#define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000001)
|
||||
|
@ -365,7 +408,7 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
|
||||
#define RCC_MCOSOURCE_PLLCLK_NODIV (RCC_CFGR_MCO_PLL | RCC_CFGR_PLLNODIV)
|
||||
|
||||
|
@ -379,7 +422,7 @@ typedef struct
|
|||
((SOURCE) == RCC_MCOSOURCE_PLLCLK_DIV2) || \
|
||||
((SOURCE) == RCC_MCOSOURCE_HSI14))
|
||||
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || STM32F070xB || STM32F030xC */
|
||||
|
||||
#if defined(STM32F030x8) || defined(STM32F051x8) || defined(STM32F058xx)
|
||||
|
||||
|
@ -442,6 +485,20 @@ typedef struct
|
|||
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F072xB || STM32F078xx */
|
||||
|
||||
#if defined(STM32F070x6) || defined(STM32F070xB)
|
||||
|
||||
/** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source
|
||||
* @{
|
||||
*/
|
||||
#define RCC_USBCLKSOURCE_PLLCLK RCC_CFGR3_USBSW_PLLCLK
|
||||
|
||||
#define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_PLLCLK))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F070x6 || STM32F070xB */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
|
@ -554,12 +611,16 @@ typedef struct
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#else
|
||||
/** @defgroup RCCEx_PLL_Clock_Source RCCEx PLL Clock Source
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32F070xB) || defined(STM32F070x6) || defined(STM32F030xC)
|
||||
#define RCC_PLLSOURCE_HSI RCC_CFGR_PLLSRC_HSI_PREDIV
|
||||
#else
|
||||
#define RCC_PLLSOURCE_HSI RCC_CFGR_PLLSRC_HSI_DIV2
|
||||
#endif
|
||||
|
||||
#define IS_RCC_PLLSOURCE(SOURCE) (((SOURCE) == RCC_PLLSOURCE_HSI) || \
|
||||
((SOURCE) == RCC_PLLSOURCE_HSE))
|
||||
|
@ -608,10 +669,10 @@ typedef struct
|
|||
|
||||
#endif /* STM32F030x8 || STM32F051x8 || STM32F058xx */
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F071xB) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F071xB) || defined(STM32F070xB) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define RCC_MCO_DIV1 ((uint32_t)0x00000000)
|
||||
#define RCC_MCO_DIV2 ((uint32_t)0x10000000)
|
||||
|
@ -628,8 +689,8 @@ typedef struct
|
|||
((DIV) == RCC_MCO_DIV64) || ((DIV) == RCC_MCO_DIV128))
|
||||
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070x6 || STM32F070xB */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -760,14 +821,14 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Exported macros ------------------------------------------------------------*/
|
||||
/** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
|
||||
* @{
|
||||
|
@ -780,29 +841,29 @@ typedef struct
|
|||
* using it.
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __GPIOD_CLK_ENABLE() (RCC->AHBENR |= (RCC_AHBENR_GPIODEN))
|
||||
|
||||
#define __GPIOD_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIODEN))
|
||||
|
||||
#endif /* STM32F030x6 || STM32F030x8 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx |[ */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F030x6 || STM32F030x8 || */
|
||||
/* STM32F051x8 || STM32F058xx || STM32F070xB || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __GPIOE_CLK_ENABLE() (RCC->AHBENR |= (RCC_AHBENR_GPIOEEN))
|
||||
|
||||
#define __GPIOE_CLK_DISABLE() (RCC->AHBENR &= ~(RCC_AHBENR_GPIOEEN))
|
||||
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
|
@ -834,8 +895,8 @@ typedef struct
|
|||
#if defined(STM32F030x8) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART2_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_USART2EN))
|
||||
#define __SPI2_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_SPI2EN))
|
||||
|
@ -845,8 +906,8 @@ typedef struct
|
|||
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
|
@ -866,8 +927,8 @@ typedef struct
|
|||
|
||||
#if defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM6_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_TIM6EN))
|
||||
#define __I2C2_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_I2C2EN))
|
||||
|
@ -877,8 +938,8 @@ typedef struct
|
|||
|
||||
#endif /* STM32F030x8 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
|
@ -906,8 +967,8 @@ typedef struct
|
|||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM7_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_TIM7EN))
|
||||
#define __USART3_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_USART3EN))
|
||||
|
@ -917,18 +978,18 @@ typedef struct
|
|||
#define __USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
|
||||
#define __USART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART4EN))
|
||||
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
|
||||
#define __USB_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_USBEN))
|
||||
|
||||
#define __USB_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USBEN))
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 || */
|
||||
/* STM32F072xB || STM32F078xx || STM32F070xB */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
@ -951,40 +1012,46 @@ typedef struct
|
|||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART5_CLK_ENABLE() (RCC->APB1ENR |= (RCC_APB1ENR_USART5EN))
|
||||
|
||||
#define __USART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART5EN))
|
||||
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
/** @brief Enable or disable the High Speed APB (APB2) peripheral clock.
|
||||
* @note After reset, the peripheral clock (used for registers read/write access)
|
||||
* is disabled and the application software has to enable this clock before
|
||||
* using it.
|
||||
*/
|
||||
#if defined(STM32F030x8) || defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
#if defined(STM32F030x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM15_CLK_ENABLE() (RCC->APB2ENR |= (RCC_APB2ENR_TIM15EN))
|
||||
|
||||
#define __TIM15_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM15EN))
|
||||
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || */
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || STM32F070x6 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART6_CLK_ENABLE() (RCC->APB2ENR |= (RCC_APB2ENR_USART6EN))
|
||||
|
||||
#define __USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN))
|
||||
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
#define __USART6_CLK_ENABLE() (RCC->APB2ENR |= (RCC_APB2ENR_USART6EN))
|
||||
#define __USART7_CLK_ENABLE() (RCC->APB2ENR |= (RCC_APB2ENR_USART7EN))
|
||||
#define __USART8_CLK_ENABLE() (RCC->APB2ENR |= (RCC_APB2ENR_USART8EN))
|
||||
|
||||
#define __USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN))
|
||||
#define __USART7_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART7EN))
|
||||
#define __USART8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART8EN))
|
||||
|
||||
|
@ -1002,10 +1069,10 @@ typedef struct
|
|||
|
||||
/** @brief Force or release AHB peripheral reset.
|
||||
*/
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F030x6) || defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __GPIOD_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIODRST))
|
||||
|
||||
|
@ -1013,18 +1080,18 @@ typedef struct
|
|||
|
||||
#endif /* STM32F030x6 || STM32F030x8 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __GPIOE_FORCE_RESET() (RCC->AHBRSTR |= (RCC_AHBRSTR_GPIOERST))
|
||||
|
||||
#define __GPIOE_RELEASE_RESET() (RCC->AHBRSTR &= ~(RCC_AHBRSTR_GPIOERST))
|
||||
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
|
@ -1043,10 +1110,10 @@ typedef struct
|
|||
/** @brief Force or release APB1 peripheral reset.
|
||||
*/
|
||||
#if defined(STM32F030x8) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST))
|
||||
#define __SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST))
|
||||
|
@ -1054,10 +1121,10 @@ typedef struct
|
|||
#define __USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST))
|
||||
#define __SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST))
|
||||
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || */
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || STM32F070x6 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
|
@ -1077,8 +1144,8 @@ typedef struct
|
|||
|
||||
#if defined(STM32F030x8) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) ||\
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
|
||||
#define __I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST))
|
||||
|
@ -1088,8 +1155,8 @@ typedef struct
|
|||
|
||||
#endif /* STM32F030x8 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
|
@ -1117,8 +1184,8 @@ typedef struct
|
|||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
|
||||
#define __USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
|
||||
|
@ -1128,18 +1195,18 @@ typedef struct
|
|||
#define __USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
|
||||
#define __USART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART4RST))
|
||||
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB)
|
||||
|
||||
#define __USB_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USBRST))
|
||||
|
||||
#define __USB_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USBRST))
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F072xB || STM32F078xx */
|
||||
#endif /* STM32F042x6 || STM32F048xx || STM32F070x6 || */
|
||||
/* STM32F072xB || STM32F078xx || STM32F070xB */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F072xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
@ -1163,38 +1230,44 @@ typedef struct
|
|||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART5RST))
|
||||
|
||||
#define __USART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART5RST))
|
||||
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
|
||||
/** @brief Force or release APB2 peripheral reset.
|
||||
*/
|
||||
#if defined(STM32F030x8) || defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
#if defined(STM32F030x8) || defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __TIM15_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM15RST))
|
||||
|
||||
#define __TIM15_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM15RST))
|
||||
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || */
|
||||
#endif /* STM32F030x8 || STM32F042x6 || STM32F048xx || STM32F070x6 || */
|
||||
/* STM32F051x8 || STM32F058xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
#define __USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST))
|
||||
|
||||
#define __USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST))
|
||||
|
||||
#endif /* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
|
||||
#define __USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST))
|
||||
#define __USART7_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART7RST))
|
||||
#define __USART8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART8RST))
|
||||
|
||||
#define __USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST))
|
||||
#define __USART7_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART7RST))
|
||||
#define __USART8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART8RST))
|
||||
|
||||
|
@ -1250,13 +1323,14 @@ typedef struct
|
|||
/** @defgroup RCCEx_Peripheral_Clock_Source_Config RCCEx Peripheral Clock Source Config
|
||||
* @{
|
||||
*/
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F070x6) || defined(STM32F070xB)
|
||||
|
||||
/** @brief Macro to configure the USB clock (USBCLK).
|
||||
* @param __USBCLKSource__: specifies the USB clock source.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock
|
||||
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock (not available for STM32F070x6 & STM32F070xB)
|
||||
* @arg RCC_USBCLKSOURCE_PLLCLK: PLL Clock selected as USB clock
|
||||
*/
|
||||
#define __HAL_RCC_USB_CONFIG(__USBCLKSource__) \
|
||||
|
@ -1264,13 +1338,14 @@ typedef struct
|
|||
|
||||
/** @brief Macro to get the USB clock source.
|
||||
* @retval The clock source can be one of the following values:
|
||||
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock
|
||||
* @arg RCC_USBCLKSOURCE_HSI48: HSI48 selected as USB clock (not available for STM32F070x6 & STM32F070xB)
|
||||
* @arg RCC_USBCLKSOURCE_PLLCLK: PLL Clock selected as USB clock
|
||||
*/
|
||||
#define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USBSW)))
|
||||
|
||||
#endif /* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F072xB || STM32F078xx */
|
||||
/* STM32F072xB || STM32F078xx || */
|
||||
/* STM32F070x6 || STM32F070xB */
|
||||
|
||||
#if defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F051x8) || defined(STM32F058xx) || \
|
||||
|
@ -1299,9 +1374,9 @@ typedef struct
|
|||
/* STM32F091xC || defined(STM32F098xx) */
|
||||
|
||||
#if defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) || \
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
defined(STM32F042x6) || defined(STM32F048xx) || defined(STM32F070x6) || \
|
||||
defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F070xB) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F030xC)
|
||||
|
||||
/** @brief Macro to configure the MCO clock.
|
||||
* @param __MCOCLKSource__: specifies the MCO clock source.
|
||||
|
@ -1348,10 +1423,33 @@ typedef struct
|
|||
#define __HAL_RCC_MCO_CONFIG(__MCOCLKSource__, __MCODiv__) \
|
||||
MODIFY_REG(RCC->CFGR, RCC_CFGR_MCO, __MCOCLKSource__)
|
||||
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || */
|
||||
/* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
#endif /* STM32F030x6 || STM32F031x6 || STM32F038xx || STM32F070x6 || */
|
||||
/* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || STM32F070xB || */
|
||||
/* STM32F091xC || STM32F098xx || STM32F030xC */
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
|
||||
defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/** @brief Macro to configure the USART2 clock (USART2CLK).
|
||||
* @param __USART2CLKSource__: specifies the USART2 clock source.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
|
||||
*/
|
||||
#define __HAL_RCC_USART2_CONFIG(__USART2CLKSource__) \
|
||||
MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USART2SW, (uint32_t)(__USART2CLKSource__))
|
||||
|
||||
/** @brief Macro to get the USART2 clock source.
|
||||
* @retval The clock source can be one of the following values:
|
||||
* @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
|
||||
* @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
|
||||
*/
|
||||
#define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART2SW)))
|
||||
#endif /* STM32F071xB || STM32F072xB || STM32F078xx || STM32F091xC || STM32F098xx*/
|
||||
|
||||
#if defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/** @brief Macro to configure the USART3 clock (USART3CLK).
|
||||
|
@ -1374,7 +1472,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR3, RCC_CFGR3_USART3SW)))
|
||||
|
||||
#endif /*STM32F091xC || STM32F098xx*/
|
||||
#endif /* STM32F091xC || STM32F098xx */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1551,7 +1649,7 @@ void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *Pe
|
|||
void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit);
|
||||
void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void);
|
||||
void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo);
|
||||
RCC_CRSStatusTypeDef HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout);
|
||||
uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout);
|
||||
#endif /* STM32F042x6 || STM32F048xx || */
|
||||
/* STM32F071xB || STM32F072xB || STM32F078xx || */
|
||||
/* STM32F091xC || STM32F098xx */
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rtc.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief RTC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Real-Time Clock (RTC) peripheral:
|
||||
* + Initialization
|
||||
* + Calendar (Time and Date) configuration
|
||||
* + Alarm A configuration
|
||||
* + RTC Time and Date functions
|
||||
* + RTC Alarm functions
|
||||
* + Backup Data Registers configuration
|
||||
* + Interrupts and flags management
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
(#) PC13 to PC15 I/Os (when available)
|
||||
|
||||
[..] When the backup domain is supplied by VDD (analog switch connected
|
||||
to VDD), the following functions are available:
|
||||
to VDD), the following pins are available:
|
||||
(#) PC14 and PC15 can be used as either GPIO or LSE pins
|
||||
(#) PC13 can be used as a GPIO or as the RTC_OUT pin
|
||||
|
||||
[..] When the backup domain is supplied by VBAT (analog switch connected
|
||||
to VBAT because VDD is not present), the following functions are available:
|
||||
to VBAT because VDD is not present), the following pins are available:
|
||||
(#) PC14 and PC15 can be used as LSE pins only
|
||||
(#) PC13 can be used as the RTC_OUT pin
|
||||
|
||||
|
@ -48,15 +48,13 @@
|
|||
occurs:
|
||||
(#) Software reset, triggered by setting the BDRST bit in the
|
||||
RCC Backup domain control register (RCC_BDCR).
|
||||
(#) VDD or VBAT power on, if both supplies have previously been
|
||||
powered off.
|
||||
(#) VDD or VBAT power on, if both supplies have previously been powered off.
|
||||
|
||||
##### Backup Domain Access #####
|
||||
===================================================================
|
||||
[..] After reset, the backup domain (RTC registers, RTC backup data
|
||||
registers and backup SRAM) is protected against possible unwanted write
|
||||
accesses.
|
||||
|
||||
[..] To enable access to the RTC Domain and RTC registers, proceed as follows:
|
||||
(#) Enable the Power Controller (PWR) APB1 interface clock using the
|
||||
__PWR_CLK_ENABLE() function.
|
||||
|
@ -65,7 +63,7 @@
|
|||
(#) Enable RTC Clock using the __HAL_RCC_RTC_ENABLE() function.
|
||||
|
||||
|
||||
##### How to use RTC Driver #####
|
||||
##### How to use this driver #####
|
||||
===================================================================
|
||||
[..]
|
||||
(+) Enable the RTC domain access (see description in the section above).
|
||||
|
@ -83,29 +81,26 @@
|
|||
===========================
|
||||
[..]
|
||||
(+) To configure the RTC Alarm use the HAL_RTC_SetAlarm() function.
|
||||
You can also configure the RTC Alarm with interrupt mode using the
|
||||
HAL_RTC_SetAlarm_IT() function.
|
||||
You can also configure the RTC Alarm with interrupt mode using the HAL_RTC_SetAlarm_IT() function.
|
||||
(+) To read the RTC Alarm, use the HAL_RTC_GetAlarm() function.
|
||||
|
||||
|
||||
##### RTC and low power modes #####
|
||||
===================================================================
|
||||
[..] The MCU can be woken up from a low power mode by an RTC alternate
|
||||
function.
|
||||
[..] The RTC alternate functions are the RTC alarm (Alarm A),
|
||||
RTC wakeup, RTC tamper event detection and RTC time stamp event detection.
|
||||
RTC wake-up, RTC tamper event detection and RTC time stamp event detection.
|
||||
These RTC alternate functions can wake up the system from the Stop and
|
||||
Standby low power modes.
|
||||
[..] The system can also wake up from low power modes without depending
|
||||
on an external interrupt (Auto-wakeup mode), by using the RTC alarm
|
||||
or the RTC wakeup events.
|
||||
on an external interrupt (Auto-wake-up mode), by using the RTC alarm
|
||||
or the RTC wake-up events.
|
||||
[..] The RTC provides a programmable time base for waking up from the
|
||||
Stop or Standby mode at regular intervals.
|
||||
Wakeup from STOP and Standby modes is possible only when the RTC clock source
|
||||
Wake-up from STOP and STANDBY modes is possible only when the RTC clock source
|
||||
is LSE or LSI.
|
||||
|
||||
@endverbatim
|
||||
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
|
@ -168,23 +163,23 @@
|
|||
===============================================================================
|
||||
##### Initialization and de-initialization functions #####
|
||||
===============================================================================
|
||||
[..] This section provide functions allowing to initialize and configure the
|
||||
[..] This section provides functions allowing to initialize and configure the
|
||||
RTC Prescaler (Synchronous and Asynchronous), RTC Hour format, disable
|
||||
RTC registers Write protection, enter and exit the RTC initialization mode,
|
||||
RTC registers synchronization check and reference clock detection enable.
|
||||
(#) The RTC Prescaler is programmed to generate the RTC 1Hz time base.
|
||||
It is split into 2 programmable prescalers to minimize power consumption.
|
||||
(++) A 7-bit asynchronous prescaler and A 15-bit synchronous prescaler.
|
||||
(++) A 7-bit asynchronous prescaler and a 15-bit synchronous prescaler.
|
||||
(++) When both prescalers are used, it is recommended to configure the
|
||||
asynchronous prescaler to a high value to minimize consumption.
|
||||
asynchronous prescaler to a high value to minimize power consumption.
|
||||
(#) All RTC registers are Write protected. Writing to the RTC registers
|
||||
is enabled by writing a key into the Write Protection register, RTC_WPR.
|
||||
(#) To Configure the RTC Calendar, user application should enter
|
||||
(#) To configure the RTC Calendar, user application should enter
|
||||
initialization mode. In this mode, the calendar counter is stopped
|
||||
and its value can be updated. When the initialization sequence is
|
||||
complete, the calendar restarts counting after 4 RTCCLK cycles.
|
||||
(#) To read the calendar through the shadow registers after Calendar
|
||||
initialization, calendar update or after wakeup from low power modes
|
||||
initialization, calendar update or after wake-up from low power modes
|
||||
the software must first clear the RSF flag. The software must then
|
||||
wait until it is set again before reading the calendar, which means
|
||||
that the calendar registers have been correctly copied into the
|
||||
|
@ -197,13 +192,14 @@
|
|||
|
||||
/**
|
||||
* @brief Initializes the RTC peripheral
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc)
|
||||
{
|
||||
/* Check the RTC peripheral state */
|
||||
if(hrtc == HAL_NULL)
|
||||
if(hrtc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -269,7 +265,8 @@ HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief DeInitializes the RTC peripheral
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @note This function doesn't reset the RTC Backup Data registers.
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -345,25 +342,27 @@ HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Initializes the RTC MSP.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
|
||||
{
|
||||
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||
the HAL_RTC_MspInit could be implenetd in the user file
|
||||
the HAL_RTC_MspInit could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes the RTC MSP.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
|
||||
{
|
||||
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||
the HAL_RTC_MspDeInit could be implenetd in the user file
|
||||
the HAL_RTC_MspDeInit could be implemented in the user file
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -387,12 +386,13 @@ __weak void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Sets RTC current time.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTime: Pointer to Time structure
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
|
||||
|
@ -511,14 +511,16 @@ HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTim
|
|||
|
||||
/**
|
||||
* @brief Gets RTC current time.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTime: Pointer to Time structure
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @note Call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values
|
||||
* in the higher-order calendar shadow registers.
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values
|
||||
* in the higher-order calendar shadow registers to ensure consistency between the time and date values.
|
||||
* Reading RTC current time locks the values in calendar shadow registers until Current date is read.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format)
|
||||
|
@ -554,12 +556,13 @@ HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTim
|
|||
|
||||
/**
|
||||
* @brief Sets RTC current date.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sDate: Pointer to date structure
|
||||
* @param Format: specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
|
||||
|
@ -662,12 +665,16 @@ HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDat
|
|||
|
||||
/**
|
||||
* @brief Gets RTC current date.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sDate: Pointer to Date structure
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN : Binary data format
|
||||
* @arg Format_BCD : BCD data format
|
||||
* @arg FORMAT_BIN : Binary data format
|
||||
* @arg FORMAT_BCD : BCD data format
|
||||
* @note You must call HAL_RTC_GetDate() after HAL_RTC_GetTime() to unlock the values
|
||||
* in the higher-order calendar shadow registers to ensure consistency between the time and date values.
|
||||
* Reading RTC current time locks the values in calendar shadow registers until Current date is read.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format)
|
||||
|
@ -709,19 +716,20 @@ HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDat
|
|||
##### RTC Alarm functions #####
|
||||
===============================================================================
|
||||
|
||||
[..] This section provide functions allowing to configure Alarm feature
|
||||
[..] This section provides functions allowing to configure Alarm feature
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Sets the specified RTC Alarm.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sAlarm: Pointer to Alarm structure
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format)
|
||||
|
@ -823,6 +831,7 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
|||
/* In case of interrupt mode is used, the interrupt source must disabled */
|
||||
__HAL_RTC_ALARM_DISABLE_IT(hrtc, RTC_IT_ALRA);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC ALRAWF flag is set and if Time out is reached exit */
|
||||
|
@ -862,12 +871,13 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
|||
|
||||
/**
|
||||
* @brief Sets the specified RTC Alarm with Interrupt
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sAlarm: Pointer to Alarm structure
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @note The Alarm register can only be written when the corresponding Alarm
|
||||
* is disabled (Use the HAL_RTC_DeactivateAlarm()).
|
||||
* @note The HAL_RTC_SetTime() must be called before enabling the Alarm feature.
|
||||
|
@ -1014,10 +1024,11 @@ HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef
|
|||
|
||||
/**
|
||||
* @brief Deactive the specified RTC Alarm
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Alarm: Specifies the Alarm.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ALARM_A : AlarmA
|
||||
* @arg RTC_ALARM_A: AlarmA
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm)
|
||||
|
@ -1040,6 +1051,7 @@ HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alar
|
|||
/* In case of interrupt mode is used, the interrupt source must disabled */
|
||||
__HAL_RTC_ALARM_DISABLE_IT(hrtc, RTC_IT_ALRA);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC ALRxWF flag is set and if Time out is reached exit */
|
||||
|
@ -1071,15 +1083,16 @@ HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alar
|
|||
|
||||
/**
|
||||
* @brief Gets the RTC Alarm value and masks.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sAlarm: Pointer to Date structure
|
||||
* @param Alarm: Specifies the Alarm
|
||||
* @param Alarm: Specifies the Alarm.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg ALARM_A: AlarmA
|
||||
* @arg RTC_ALARM_A: AlarmA
|
||||
* @param Format: Specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format)
|
||||
|
@ -1118,7 +1131,8 @@ HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sA
|
|||
|
||||
/**
|
||||
* @brief This function handles Alarm interrupt request.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1145,7 +1159,8 @@ void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Alarm A callback.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -1157,7 +1172,8 @@ __weak void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief This function handles AlarmA Polling request.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -1165,7 +1181,7 @@ HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t T
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
while(__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRAF) == RESET)
|
||||
|
@ -1214,12 +1230,13 @@ HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t T
|
|||
* @note The RTC Resynchronization mode is write protected, use the
|
||||
* __HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.
|
||||
* @note To read the calendar through the shadow registers after Calendar
|
||||
* initialization, calendar update or after wakeup from low power modes
|
||||
* initialization, calendar update or after wake-up from low power modes
|
||||
* the software must first clear the RSF flag.
|
||||
* The software must then wait until it is set again before reading
|
||||
* the calendar, which means that the calendar registers have been
|
||||
* correctly copied into the RTC_TR and RTC_DR shadow registers.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1229,6 +1246,7 @@ HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc)
|
|||
/* Clear RSF flag */
|
||||
hrtc->Instance->ISR &= (uint32_t)RTC_RSF_MASK;
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait the registers to be synchronised */
|
||||
|
@ -1262,8 +1280,9 @@ HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc)
|
|||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Returns the Alarm state.
|
||||
* @param hrtc: RTC handle
|
||||
* @brief Returns the RTC state.
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL state
|
||||
*/
|
||||
HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1287,8 +1306,9 @@ HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef* hrtc)
|
|||
* @brief Enters the RTC Initialization mode.
|
||||
* @note The RTC Initialization mode is write protected, use the
|
||||
* __HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.
|
||||
* @param hrtc: RTC handle
|
||||
* @retval An ErrorStatus enumeration value:
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status:
|
||||
* - HAL_OK : RTC is in Init mode
|
||||
* - HAL_TIMEOUT : RTC is not in Init mode and in Timeout
|
||||
*/
|
||||
|
@ -1302,6 +1322,7 @@ HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc)
|
|||
/* Set the Initialization mode */
|
||||
hrtc->Instance->ISR = (uint32_t)RTC_INIT_MASK;
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC is in INIT state and if Time out is reached exit */
|
||||
|
@ -1353,7 +1374,6 @@ uint8_t RTC_Bcd2ToByte(uint8_t Value)
|
|||
*/
|
||||
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rtc.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of RTC HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rtc_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended RTC HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Real Time Clock (RTC) Extension peripheral:
|
||||
* + TimeStamp configuration
|
||||
* + Tampers configuration
|
||||
* + WakeUp Timer configuration
|
||||
* + RTC Tamper and TimeStamp Pins Selection
|
||||
* + RTC TimeStamp functions
|
||||
* + RTC Tamper functions
|
||||
* + RTC Wake-up functions
|
||||
* + Extension Control functions
|
||||
* + Extension RTC features functions
|
||||
*
|
||||
|
@ -23,19 +22,20 @@
|
|||
(+) Configure the RTC Prescaler (Asynchronous and Synchronous) and RTC hour
|
||||
format using the HAL_RTC_Init() function.
|
||||
|
||||
*** RTC Wakeup configuration ***
|
||||
*** RTC Wake-up configuration ***
|
||||
================================
|
||||
[..]
|
||||
(+) To configure the RTC Wakeup Clock source and Counter use the HAL_RTCEx_SetWakeUpTimer()
|
||||
function. You can also configure the RTC Wakeup timer with interrupt mode
|
||||
(+) To configure the RTC Wake-up Clock source and Counter use the HAL_RTCEx_SetWakeUpTimer()
|
||||
function. You can also configure the RTC Wake-up timer in interrupt mode
|
||||
using the HAL_RTCEx_SetWakeUpTimer_IT() function.
|
||||
(+) To read the RTC WakeUp Counter register, use the HAL_RTCEx_GetWakeUpTimer()
|
||||
(+) To read the RTC Wake-up Counter register, use the HAL_RTCEx_GetWakeUpTimer()
|
||||
function.
|
||||
(@) Not available on F030x6/x8/xC and F070x6/xB
|
||||
|
||||
*** TimeStamp configuration ***
|
||||
===============================
|
||||
[..]
|
||||
(+) Configure the RTC_AF trigger and enables the RTC TimeStamp using the
|
||||
(+) Configure the RTC_AF trigger and enable the RTC TimeStamp using the
|
||||
HAL_RTCEx_SetTimeStamp() function. You can also configure the RTC TimeStamp with
|
||||
interrupt mode using the HAL_RTCEx_SetTimeStamp_IT() function.
|
||||
(+) To read the RTC TimeStamp Time and Date register, use the HAL_RTCEx_GetTimeStamp()
|
||||
|
@ -44,10 +44,10 @@
|
|||
*** Tamper configuration ***
|
||||
============================
|
||||
[..]
|
||||
(+) Enable the RTC Tamper and Configure the Tamper filter count, trigger Edge
|
||||
(+) Enable the RTC Tamper and configure the Tamper filter count, trigger Edge
|
||||
or Level according to the Tamper filter (if equal to 0 Edge else Level)
|
||||
value, sampling frequency, precharge or discharge and Pull-UP using the
|
||||
HAL_RTCEx_SetTamper() function. You can configure RTC Tamper with interrupt
|
||||
HAL_RTCEx_SetTamper() function. You can configure RTC Tamper in interrupt
|
||||
mode using HAL_RTCEx_SetTamper_IT() function.
|
||||
|
||||
*** Backup Data Registers configuration ***
|
||||
|
@ -57,6 +57,7 @@
|
|||
function.
|
||||
(+) To read the RTC Backup Data registers, use the HAL_RTCEx_BKUPRead()
|
||||
function.
|
||||
(@) Not available on F030x6/x8/xC and F070x6/xB
|
||||
|
||||
|
||||
@endverbatim
|
||||
|
@ -115,7 +116,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup RTCEx_Exported_Functions_Group1 RTC TimeStamp and Tamper functions
|
||||
* @brief RTC TimeStamp and Tamper functions
|
||||
*
|
||||
|
@ -124,7 +124,7 @@
|
|||
##### RTC TimeStamp and Tamper functions #####
|
||||
===============================================================================
|
||||
|
||||
[..] This section provide functions allowing to configure TimeStamp feature
|
||||
[..] This section provides functions allowing to configure TimeStamp feature
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
|
@ -133,13 +133,14 @@
|
|||
/**
|
||||
* @brief Sets TimeStamp.
|
||||
* @note This API must be called before enabling the TimeStamp feature.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is
|
||||
* activated.
|
||||
* This parameter can be one of the following:
|
||||
* @arg TimeStampEdge_Rising: the Time stamp event occurs on the
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the
|
||||
* rising edge of the related pin.
|
||||
* @arg TimeStampEdge_Falling: the Time stamp event occurs on the
|
||||
* @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the
|
||||
* falling edge of the related pin.
|
||||
* @param RTC_TimeStampPin: specifies the RTC TimeStamp Pin.
|
||||
* This parameter can be one of the following values:
|
||||
|
@ -186,14 +187,15 @@ HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t TimeS
|
|||
|
||||
/**
|
||||
* @brief Sets TimeStamp with Interrupt.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @note This API must be called before enabling the TimeStamp feature.
|
||||
* @param TimeStampEdge: Specifies the pin edge on which the TimeStamp is
|
||||
* activated.
|
||||
* This parameter can be one of the following:
|
||||
* @arg TimeStampEdge_Rising: the Time stamp event occurs on the
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RTC_TIMESTAMPEDGE_RISING: the Time stamp event occurs on the
|
||||
* rising edge of the related pin.
|
||||
* @arg TimeStampEdge_Falling: the Time stamp event occurs on the
|
||||
* @arg RTC_TIMESTAMPEDGE_FALLING: the Time stamp event occurs on the
|
||||
* falling edge of the related pin.
|
||||
* @param RTC_TimeStampPin: Specifies the RTC TimeStamp Pin.
|
||||
* This parameter can be one of the following values:
|
||||
|
@ -247,7 +249,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t Ti
|
|||
|
||||
/**
|
||||
* @brief Deactivates TimeStamp.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -284,13 +287,14 @@ HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Gets the RTC TimeStamp value.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTimeStamp: Pointer to Time structure
|
||||
* @param sTimeStampDate: Pointer to Date structure
|
||||
* @param Format: specifies the format of the entered parameters.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg Format_BIN: Binary data format
|
||||
* @arg Format_BCD: BCD data format
|
||||
* @arg FORMAT_BIN: Binary data format
|
||||
* @arg FORMAT_BCD: BCD data format
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef* sTimeStamp, RTC_DateTypeDef* sTimeStampDate, uint32_t Format)
|
||||
|
@ -340,7 +344,8 @@ HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDe
|
|||
/**
|
||||
* @brief Sets Tamper
|
||||
* @note By calling this API we disable the tamper interrupt for all tampers.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTamper: Pointer to Tamper Structure.
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -388,7 +393,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef
|
|||
/**
|
||||
* @brief Sets Tamper with interrupt.
|
||||
* @note By calling this API we force the tamper interrupt for all tampers.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param sTamper: Pointer to RTC Tamper.
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -444,7 +450,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperType
|
|||
|
||||
/**
|
||||
* @brief Deactivates Tamper.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Tamper: Selected tamper pin.
|
||||
* This parameter can be any combination of RTC_TAMPER_1, RTC_TAMPER_2 and RTC_TAMPER_3.
|
||||
* @retval HAL status
|
||||
|
@ -471,7 +478,8 @@ HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t T
|
|||
|
||||
/**
|
||||
* @brief This function handles TimeStamp interrupt request.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -542,7 +550,8 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief TimeStamp callback.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -554,7 +563,8 @@ __weak void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Tamper 1 callback.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -566,7 +576,8 @@ __weak void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Tamper 2 callback.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -576,7 +587,7 @@ __weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
|
|||
*/
|
||||
}
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Tamper 3 callback.
|
||||
* @param hrtc: RTC handle
|
||||
|
@ -592,7 +603,8 @@ __weak void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief This function handles TimeStamp polling request.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -600,14 +612,14 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint3
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
while(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSF) == RESET)
|
||||
{
|
||||
if(__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSOVF) != RESET)
|
||||
{
|
||||
/* Clear the TIMESTAMP OverRun Flag */
|
||||
/* Clear the TIMESTAMP Overrun Flag */
|
||||
__HAL_RTC_TIMESTAMP_CLEAR_FLAG(hrtc, RTC_FLAG_TSOVF);
|
||||
|
||||
/* Change TIMESTAMP state */
|
||||
|
@ -634,7 +646,8 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint3
|
|||
|
||||
/**
|
||||
* @brief This function handles Tamper1 Polling.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -642,7 +655,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Get the status of the Interrupt */
|
||||
|
@ -669,7 +682,8 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
|
||||
/**
|
||||
* @brief This function handles Tamper2 Polling.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -677,7 +691,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Get the status of the Interrupt */
|
||||
|
@ -705,7 +719,8 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
/**
|
||||
* @brief This function handles Tamper3 Polling.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -713,7 +728,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Get the status of the Interrupt */
|
||||
|
@ -752,7 +767,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
##### RTC Wake-up functions #####
|
||||
===============================================================================
|
||||
|
||||
[..] This section provide functions allowing to configure Wake-up feature
|
||||
[..] This section provides functions allowing to configure Wake-up feature
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
|
@ -760,7 +775,8 @@ HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_
|
|||
|
||||
/**
|
||||
* @brief Sets wake up timer.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param WakeUpCounter: Wake up counter
|
||||
* @param WakeUpClock: Wake up clock
|
||||
* @retval HAL status
|
||||
|
@ -783,6 +799,7 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t Wak
|
|||
|
||||
__HAL_RTC_WAKEUPTIMER_DISABLE(hrtc);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC WUTWF flag is set and if Time out is reached exit */
|
||||
|
@ -802,16 +819,16 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t Wak
|
|||
}
|
||||
}
|
||||
|
||||
/* Clear the Wakeup Timer clock source bits in CR register */
|
||||
/* Clear the Wake-up Timer clock source bits in CR register */
|
||||
hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL;
|
||||
|
||||
/* Configure the clock source */
|
||||
hrtc->Instance->CR |= (uint32_t)WakeUpClock;
|
||||
|
||||
/* Configure the Wakeup Timer counter */
|
||||
/* Configure the Wake-up Timer counter */
|
||||
hrtc->Instance->WUTR = (uint32_t)WakeUpCounter;
|
||||
|
||||
/* Enable the Wakeup Timer */
|
||||
/* Enable the Wake-up Timer */
|
||||
__HAL_RTC_WAKEUPTIMER_ENABLE(hrtc);
|
||||
|
||||
/* Enable the write protection for RTC registers */
|
||||
|
@ -827,9 +844,10 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t Wak
|
|||
|
||||
/**
|
||||
* @brief Sets wake up timer with interrupt
|
||||
* @param hrtc: RTC handle
|
||||
* @param WakeUpCounter: wake up counter
|
||||
* @param WakeUpClock: wake up clock
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param WakeUpCounter: Wake up counter
|
||||
* @param WakeUpClock: Wake up clock
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
|
||||
|
@ -850,6 +868,7 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t
|
|||
|
||||
__HAL_RTC_WAKEUPTIMER_DISABLE(hrtc);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC WUTWF flag is set and if Time out is reached exit */
|
||||
|
@ -869,10 +888,10 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t
|
|||
}
|
||||
}
|
||||
|
||||
/* Configure the Wakeup Timer counter */
|
||||
/* Configure the Wake-up Timer counter */
|
||||
hrtc->Instance->WUTR = (uint32_t)WakeUpCounter;
|
||||
|
||||
/* Clear the Wakeup Timer clock source bits in CR register */
|
||||
/* Clear the Wake-up Timer clock source bits in CR register */
|
||||
hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL;
|
||||
|
||||
/* Configure the clock source */
|
||||
|
@ -886,7 +905,7 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t
|
|||
/* Configure the Interrupt in the RTC_CR register */
|
||||
__HAL_RTC_WAKEUPTIMER_ENABLE_IT(hrtc,RTC_IT_WUT);
|
||||
|
||||
/* Enable the Wakeup Timer */
|
||||
/* Enable the Wake-up Timer */
|
||||
__HAL_RTC_WAKEUPTIMER_ENABLE(hrtc);
|
||||
|
||||
/* Enable the write protection for RTC registers */
|
||||
|
@ -902,7 +921,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t
|
|||
|
||||
/**
|
||||
* @brief Deactivates wake up timer counter.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -917,12 +937,13 @@ uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
|
|||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
|
||||
|
||||
/* Disable the Wakeup Timer */
|
||||
/* Disable the Wake-up Timer */
|
||||
__HAL_RTC_WAKEUPTIMER_DISABLE(hrtc);
|
||||
|
||||
/* In case of interrupt mode is used, the interrupt source must disabled */
|
||||
__HAL_RTC_WAKEUPTIMER_DISABLE_IT(hrtc,RTC_IT_WUT);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait till RTC WUTWF flag is set and if Time out is reached exit */
|
||||
|
@ -955,7 +976,8 @@ uint32_t HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Gets wake up timer counter.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval Counter value
|
||||
*/
|
||||
uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -966,7 +988,8 @@ uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief This function handles Wake Up Timer interrupt request.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -993,7 +1016,8 @@ void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief Wake Up Timer callback.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
|
||||
|
@ -1005,7 +1029,8 @@ __weak void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
|
|||
|
||||
/**
|
||||
* @brief This function handles Wake Up Timer Polling.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param Timeout: Timeout duration
|
||||
* @retval HAL status
|
||||
*/
|
||||
|
@ -1013,7 +1038,7 @@ HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uin
|
|||
{
|
||||
uint32_t tickstart = 0;
|
||||
|
||||
/* Get Timeout value */
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
while(__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTF) == RESET)
|
||||
|
@ -1052,27 +1077,28 @@ HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uin
|
|||
===============================================================================
|
||||
[..]
|
||||
This subsection provides functions allowing to
|
||||
(+) Writes a data in a specified RTC Backup data register
|
||||
(+) Write a data in a specified RTC Backup data register
|
||||
(+) Read a data in a specified RTC Backup data register
|
||||
(+) Sets the Coarse calibration parameters.
|
||||
(+) Deactivates the Coarse calibration parameters
|
||||
(+) Sets the Smooth calibration parameters.
|
||||
(+) Configures the Synchronization Shift Control Settings.
|
||||
(+) Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
(+) Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
(+) Enables the RTC reference clock detection.
|
||||
(+) Set the Coarse calibration parameters.
|
||||
(+) Deactivate the Coarse calibration parameters
|
||||
(+) Set the Smooth calibration parameters.
|
||||
(+) Configure the Synchronization Shift Control Settings.
|
||||
(+) Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
(+) Deactivate the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
(+) Enable the RTC reference clock detection.
|
||||
(+) Disable the RTC reference clock detection.
|
||||
(+) Enables the Bypass Shadow feature.
|
||||
(+) Disables the Bypass Shadow feature.
|
||||
(+) Enable the Bypass Shadow feature.
|
||||
(+) Disable the Bypass Shadow feature.
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Writes a data in a specified RTC Backup data register.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param BackupRegister: RTC Backup data Register number.
|
||||
* This parameter can be: RTC_BKP_DRx where x can be from 0 to 4 to
|
||||
* specify the register.
|
||||
|
@ -1095,7 +1121,8 @@ void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint3
|
|||
|
||||
/**
|
||||
* @brief Reads data from the specified RTC Backup data Register.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param BackupRegister: RTC Backup data Register number.
|
||||
* This parameter can be: RTC_BKP_DRx where x can be from 0 to 4 to
|
||||
* specify the register.
|
||||
|
@ -1114,25 +1141,26 @@ uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
|
|||
/* Read the specified register */
|
||||
return (*(__IO uint32_t *)tmp);
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Sets the Smooth calibration parameters.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param SmoothCalibPeriod: Select the Smooth Calibration Period.
|
||||
* This parameter can be can be one of the following values :
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_32SEC: The smooth calibration periode is 32s.
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_16SEC: The smooth calibration periode is 16s.
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_8SEC: The smooth calibartion periode is 8s.
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_32SEC: The smooth calibration period is 32s.
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_16SEC: The smooth calibration period is 16s.
|
||||
* @arg RTC_SMOOTHCALIB_PERIOD_8SEC: The smooth calibration period is 8s.
|
||||
* @param SmoothCalibPlusPulses: Select to Set or reset the CALP bit.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RTC_SMOOTHCALIB_PLUSPULSES_SET: Add one RTCCLK puls every 2*11 pulses.
|
||||
* @arg RTC_SMOOTHCALIB_PLUSPULSES_SET: Add one RTCCLK pulse every 2*11 pulses.
|
||||
* @arg RTC_SMOOTHCALIB_PLUSPULSES_RESET: No RTCCLK pulses are added.
|
||||
* @param SmouthCalibMinusPulsesValue: Select the value of CALM[8:0] bits.
|
||||
* This parameter can be one any value from 0 to 0x000001FF.
|
||||
* @note To deactivate the smooth calibration, the field SmoothCalibPlusPulses
|
||||
* must be equal to SMOOTHCALIB_PLUSPULSES_RESET and the field
|
||||
* SmouthCalibMinusPulsesValue mut be equal to 0.
|
||||
* SmouthCalibMinusPulsesValue must be equal to 0.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef* hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue)
|
||||
|
@ -1155,6 +1183,7 @@ HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef* hrtc, uint32_t Smo
|
|||
/* check if a calibration is pending*/
|
||||
if((hrtc->Instance->ISR & RTC_ISR_RECALPF) != RESET)
|
||||
{
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* check if a calibration is pending*/
|
||||
|
@ -1194,7 +1223,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef* hrtc, uint32_t Smo
|
|||
/**
|
||||
* @brief Configures the Synchronization Shift Control Settings.
|
||||
* @note When REFCKON is set, firmware must not write to Shift control register.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param ShiftAdd1S: Select to add or not 1 second to the time calendar.
|
||||
* This parameter can be one of the following values :
|
||||
* @arg RTC_SHIFTADD1S_SET: Add one second to the clock calendar.
|
||||
|
@ -1219,6 +1249,7 @@ HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef* hrtc, uint32_t Sh
|
|||
/* Disable the write protection for RTC registers */
|
||||
__HAL_RTC_WRITEPROTECTION_DISABLE(hrtc);
|
||||
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
||||
/* Wait until the shift is completed*/
|
||||
|
@ -1289,7 +1320,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef* hrtc, uint32_t Sh
|
|||
|
||||
/**
|
||||
* @brief Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @param CalibOutput : Select the Calibration output Selection .
|
||||
* This parameter can be one of the following values:
|
||||
* @arg RTC_CALIBOUTPUT_512HZ: A signal has a regular waveform at 512Hz.
|
||||
|
@ -1331,7 +1363,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef* hrtc, uint32
|
|||
|
||||
/**
|
||||
* @brief Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1360,7 +1393,8 @@ HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Enables the RTC reference clock detection.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1409,7 +1443,8 @@ HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Disable the RTC reference clock detection.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @retval HAL status
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef* hrtc)
|
||||
|
@ -1458,7 +1493,8 @@ HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Enables the Bypass Shadow feature.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @note When the Bypass Shadow is enabled the calendar value are taken
|
||||
* directly from the Calendar counter.
|
||||
* @retval HAL status
|
||||
|
@ -1490,7 +1526,8 @@ HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef* hrtc)
|
|||
|
||||
/**
|
||||
* @brief Disables the Bypass Shadow feature.
|
||||
* @param hrtc: RTC handle
|
||||
* @param hrtc: pointer to a RTC_HandleTypeDef structure that contains
|
||||
* the configuration information for RTC.
|
||||
* @note When the Bypass Shadow is enabled the calendar value are taken
|
||||
* directly from the Calendar counter.
|
||||
* @retval HAL status
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_rtc_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of RTC HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -116,7 +116,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB)
|
||||
/** @defgroup RTCEx_Backup_Registers_Definitions RTCEx Backup Registers Definition
|
||||
* @{
|
||||
*/
|
||||
|
@ -130,7 +130,7 @@ typedef struct
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB) */
|
||||
|
||||
/** @defgroup RTCEx_Time_Stamp_Edges_definitions RTCEx Time Stamp Edges definition
|
||||
* @{
|
||||
|
@ -288,7 +288,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/** @defgroup RTCEx_Wakeup_Timer_Definitions RTCEx Wakeup Timer Definition
|
||||
* @{
|
||||
*/
|
||||
|
@ -310,7 +310,7 @@ typedef struct
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/** @defgroup RTCEx_Smooth_calib_period_Definitions RTCEx Smooth calib period Definition
|
||||
* @{
|
||||
|
@ -393,14 +393,14 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Enable the RTC WakeUp Timer peripheral.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_WUTE))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Enable the RTC TimeStamp peripheral.
|
||||
|
@ -409,14 +409,14 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_TSE))
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Disable the RTC WakeUp Timer peripheral.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_WUTE))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC TimeStamp peripheral.
|
||||
|
@ -463,7 +463,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Enable the RTC WakeUpTimer interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
|
@ -473,7 +473,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Disable the RTC TimeStamp interrupt.
|
||||
|
@ -485,7 +485,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Disable the RTC WakeUpTimer interrupt.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
|
@ -495,7 +495,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC Tamper interrupt has occurred or not.
|
||||
|
@ -507,7 +507,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TAMPER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Check whether the specified RTC WakeUpTimer interrupt has occurred or not.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
|
@ -517,7 +517,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_GET_IT(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & ((__FLAG__)>> 4)) != RESET)? SET : RESET)
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Check whether the specified RTC TimeStamp interrupt has occurred or not.
|
||||
|
@ -540,7 +540,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Get the selected RTC WakeUpTimer's flag status.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
|
@ -551,7 +551,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET)
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief Get the selected RTC Tamper's flag status.
|
||||
|
@ -593,7 +593,7 @@ typedef struct
|
|||
*/
|
||||
#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Clear the RTC Wake Up timer's pending flags.
|
||||
* @param __HANDLE__: specifies the RTC handle.
|
||||
|
@ -603,7 +603,7 @@ typedef struct
|
|||
* @retval None
|
||||
*/
|
||||
#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~(((__FLAG__) | RTC_ISR_INIT)& 0x0000FFFF)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) */
|
||||
#endif /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -630,21 +630,21 @@ void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc);
|
|||
|
||||
void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc);
|
||||
void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc);
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
void HAL_RTCEx_Tamper3EventCallback(RTC_HandleTypeDef *hrtc);
|
||||
#endif
|
||||
void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc);
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
HAL_StatusTypeDef HAL_RTCEx_PollForTamper3Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx)
|
||||
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || defined(STM32F030xC)
|
||||
/** @addtogroup RTCEx_Exported_Functions_Group2
|
||||
* @{
|
||||
*/
|
||||
|
@ -667,10 +667,10 @@ HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uin
|
|||
*/
|
||||
|
||||
/* Extension Control functions ************************************************/
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB)
|
||||
void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data);
|
||||
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister);
|
||||
#endif
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F030xC) && !defined(STM32F070x6) && !defined(STM32F070xB) */
|
||||
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmouthCalibMinusPulsesValue);
|
||||
HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smartcard.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief SMARTCARD HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the SMARTCARD peripheral:
|
||||
|
@ -134,6 +134,10 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -142,16 +146,13 @@
|
|||
* @brief HAL SMARTCARD module driver
|
||||
* @{
|
||||
*/
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/** @defgroup SMARTCARD_Private_Constants SMARTCARD Private Constants
|
||||
* @{
|
||||
*/
|
||||
#define TEACK_REACK_TIMEOUT 1000
|
||||
#define TEACK_REACK_TIMEOUT 1000
|
||||
#define SMARTCARD_TXDMA_TIMEOUTVALUE 22000
|
||||
#define SMARTCARD_TIMEOUT_VALUE 22000
|
||||
#define USART_CR1_FIELDS ((uint32_t)(USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | \
|
||||
|
@ -258,7 +259,7 @@ static void SMARTCARD_AdvFeatureConfig(SMARTCARD_HandleTypeDef *hsmartcard);
|
|||
HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard)
|
||||
{
|
||||
/* Check the SMARTCARD handle allocation */
|
||||
if(hsmartcard == HAL_NULL)
|
||||
if(hsmartcard == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -313,7 +314,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard)
|
|||
HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard)
|
||||
{
|
||||
/* Check the SMARTCARD handle allocation */
|
||||
if(hsmartcard == HAL_NULL)
|
||||
if(hsmartcard == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -436,7 +437,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, ui
|
|||
{
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -502,7 +503,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uin
|
|||
{
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -566,7 +567,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard,
|
|||
{
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -617,7 +618,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard,
|
|||
{
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -673,7 +674,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard
|
|||
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -736,7 +737,7 @@ HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard,
|
|||
|
||||
if ((hsmartcard->State == HAL_SMARTCARD_STATE_READY) || (hsmartcard->State == HAL_SMARTCARD_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -995,7 +996,7 @@ static HAL_StatusTypeDef SMARTCARD_WaitOnFlagUntilTimeout(SMARTCARD_HandleTypeDe
|
|||
__HAL_SMARTCARD_DISABLE_IT(hsmartcard, SMARTCARD_IT_PE);
|
||||
__HAL_SMARTCARD_DISABLE_IT(hsmartcard, SMARTCARD_IT_ERR);
|
||||
|
||||
hsmartcard->State= HAL_SMARTCARD_STATE_TIMEOUT;
|
||||
hsmartcard->State= HAL_SMARTCARD_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hsmartcard);
|
||||
|
@ -1020,7 +1021,7 @@ static HAL_StatusTypeDef SMARTCARD_WaitOnFlagUntilTimeout(SMARTCARD_HandleTypeDe
|
|||
__HAL_SMARTCARD_DISABLE_IT(hsmartcard, SMARTCARD_IT_PE);
|
||||
__HAL_SMARTCARD_DISABLE_IT(hsmartcard, SMARTCARD_IT_ERR);
|
||||
|
||||
hsmartcard->State= HAL_SMARTCARD_STATE_TIMEOUT;
|
||||
hsmartcard->State= HAL_SMARTCARD_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(hsmartcard);
|
||||
|
@ -1414,16 +1415,17 @@ static void SMARTCARD_AdvFeatureConfig(SMARTCARD_HandleTypeDef *hsmartcard)
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smartcard.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of SMARTCARD HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(STM32F030x4) && !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -106,7 +106,7 @@ typedef struct
|
|||
|
||||
uint16_t NACKEnable; /*!< Specifies whether the SmartCard NACK transmission is enabled
|
||||
in case of parity error.
|
||||
This parameter can be a value of @ref SMARTCARD_NACK_State */
|
||||
This parameter can be a value of @ref SMARTCARD_NACK_Enable */
|
||||
|
||||
uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled.
|
||||
This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/
|
||||
|
@ -172,20 +172,6 @@ typedef enum
|
|||
HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */
|
||||
}HAL_SMARTCARD_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL SMARTCARD Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SMARTCARD_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_SMARTCARD_ERROR_PE = 0x01, /*!< Parity error */
|
||||
HAL_SMARTCARD_ERROR_NE = 0x02, /*!< Noise error */
|
||||
HAL_SMARTCARD_ERROR_FE = 0x04, /*!< frame error */
|
||||
HAL_SMARTCARD_ERROR_ORE = 0x08, /*!< Overrun error */
|
||||
HAL_SMARTCARD_ERROR_DMA = 0x10, /*!< DMA transfer error */
|
||||
HAL_SMARTCARD_ERROR_RTO = 0x20 /*!< Receiver TimeOut error */
|
||||
}HAL_SMARTCARD_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief SMARTCARD clock sources
|
||||
*/
|
||||
|
@ -203,33 +189,34 @@ typedef enum
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
USART_TypeDef *Instance; /* USART registers base address */
|
||||
USART_TypeDef *Instance; /*!< USART registers base address */
|
||||
|
||||
SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */
|
||||
SMARTCARD_InitTypeDef Init; /*!< SmartCard communication parameters */
|
||||
|
||||
SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /* SmartCard advanced features initialization parameters */
|
||||
SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /*!< SmartCard advanced features initialization parameters */
|
||||
|
||||
uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */
|
||||
uint8_t *pTxBuffPtr; /*!< Pointer to SmartCard Tx transfer Buffer */
|
||||
|
||||
uint16_t TxXferSize; /* SmartCard Tx Transfer size */
|
||||
uint16_t TxXferSize; /*!< SmartCard Tx Transfer size */
|
||||
|
||||
uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */
|
||||
uint16_t TxXferCount; /*!< SmartCard Tx Transfer Counter */
|
||||
|
||||
uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */
|
||||
uint8_t *pRxBuffPtr; /*!< Pointer to SmartCard Rx transfer Buffer */
|
||||
|
||||
uint16_t RxXferSize; /* SmartCard Rx Transfer size */
|
||||
uint16_t RxXferSize; /*!< SmartCard Rx Transfer size */
|
||||
|
||||
uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */
|
||||
uint16_t RxXferCount; /*!< SmartCard Rx Transfer Counter */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmatx; /*!< SmartCard Tx DMA Handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmarx; /*!< SmartCard Rx DMA Handle parameters */
|
||||
|
||||
HAL_LockTypeDef Lock; /* Locking object */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
|
||||
HAL_SMARTCARD_StateTypeDef State; /* SmartCard communication state */
|
||||
HAL_SMARTCARD_StateTypeDef State; /*!< SmartCard communication state */
|
||||
|
||||
HAL_SMARTCARD_ErrorTypeDef ErrorCode; /* SmartCard Error code */
|
||||
__IO uint32_t ErrorCode; /*!< SmartCard Error code
|
||||
This parameter can be a value of @ref SMARTCARD_Error */
|
||||
|
||||
}SMARTCARD_HandleTypeDef;
|
||||
|
||||
|
@ -242,6 +229,20 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup SMARTCARD_Error SMARTCARD Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */
|
||||
#define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */
|
||||
#define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x00000004) /*!< frame error */
|
||||
#define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */
|
||||
#define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
|
||||
#define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x00000020) /*!< Receiver TimeOut error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length
|
||||
* @{
|
||||
*/
|
||||
|
@ -324,7 +325,8 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State
|
||||
|
||||
/** @defgroup SMARTCARD_NACK_Enable SMARTCARD NACK Enable
|
||||
* @{
|
||||
*/
|
||||
#define SMARTCARD_NACK_ENABLED ((uint16_t)USART_CR3_NACK)
|
||||
|
@ -741,7 +743,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/* Include SMARTCARD HAL Extension module */
|
||||
/* Include SMARTCARD HAL Extended module */
|
||||
#include "stm32f0xx_hal_smartcard_ex.h"
|
||||
|
||||
|
||||
|
@ -804,7 +806,7 @@ uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard);
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x4) && !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smartcard_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief SMARTCARD HAL module driver.
|
||||
*
|
||||
* This file provides extended firmware functions to manage the following
|
||||
|
@ -60,6 +60,10 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -68,10 +72,7 @@
|
|||
* @brief SMARTCARD Extended HAL module driver
|
||||
* @{
|
||||
*/
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
@ -181,15 +182,16 @@ HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smartcard_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of SMARTCARD HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -43,7 +43,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal_def.h"
|
||||
|
@ -318,7 +318,7 @@ HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smbus.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief SMBUS HAL module driver.
|
||||
*
|
||||
* This file provides firmware functions to manage the following
|
||||
|
@ -12,7 +12,6 @@
|
|||
* + Initialization and de-initialization functions
|
||||
* + IO operation functions
|
||||
* + Peripheral State and Errors functions
|
||||
*
|
||||
@verbatim
|
||||
==============================================================================
|
||||
##### How to use this driver #####
|
||||
|
@ -237,7 +236,7 @@ static void SMBUS_TransferConfig(SMBUS_HandleTypeDef *hsmbus, uint16_t DevAddre
|
|||
HAL_StatusTypeDef HAL_SMBUS_Init(SMBUS_HandleTypeDef *hsmbus)
|
||||
{
|
||||
/* Check the SMBUS handle allocation */
|
||||
if(hsmbus == HAL_NULL)
|
||||
if(hsmbus == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -336,7 +335,7 @@ HAL_StatusTypeDef HAL_SMBUS_Init(SMBUS_HandleTypeDef *hsmbus)
|
|||
HAL_StatusTypeDef HAL_SMBUS_DeInit(SMBUS_HandleTypeDef *hsmbus)
|
||||
{
|
||||
/* Check the SMBUS handle allocation */
|
||||
if(hsmbus == HAL_NULL)
|
||||
if(hsmbus == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -464,7 +463,7 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint
|
|||
|
||||
/* In case of Quick command, remove autoend mode */
|
||||
/* Manage the stop generation by software */
|
||||
if(hsmbus->pBuffPtr == HAL_NULL)
|
||||
if(hsmbus->pBuffPtr == NULL)
|
||||
{
|
||||
hsmbus->XferOptions &= ~SMBUS_AUTOEND_MODE;
|
||||
}
|
||||
|
@ -553,7 +552,7 @@ HAL_StatusTypeDef HAL_SMBUS_Master_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint1
|
|||
|
||||
/* In case of Quick command, remove autoend mode */
|
||||
/* Manage the stop generation by software */
|
||||
if(hsmbus->pBuffPtr == HAL_NULL)
|
||||
if(hsmbus->pBuffPtr == NULL)
|
||||
{
|
||||
hsmbus->XferOptions &= ~SMBUS_AUTOEND_MODE;
|
||||
}
|
||||
|
@ -680,7 +679,7 @@ HAL_StatusTypeDef HAL_SMBUS_Slave_Transmit_IT(SMBUS_HandleTypeDef *hsmbus, uint8
|
|||
|
||||
if(hsmbus->State == HAL_SMBUS_STATE_LISTEN)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -771,7 +770,7 @@ HAL_StatusTypeDef HAL_SMBUS_Slave_Receive_IT(SMBUS_HandleTypeDef *hsmbus, uint8_
|
|||
|
||||
if(hsmbus->State == HAL_SMBUS_STATE_LISTEN)
|
||||
{
|
||||
if((pData == HAL_NULL) || (Size == 0))
|
||||
if((pData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1280,7 +1279,7 @@ __weak void HAL_SMBUS_SlaveListenCpltCallback(SMBUS_HandleTypeDef *hsmbus)
|
|||
* @param hsmbus : SMBUS handle
|
||||
* @retval HAL state
|
||||
*/
|
||||
HAL_SMBUS_StateTypeDef HAL_SMBUS_GetState(SMBUS_HandleTypeDef *hsmbus)
|
||||
uint32_t HAL_SMBUS_GetState(SMBUS_HandleTypeDef *hsmbus)
|
||||
{
|
||||
return hsmbus->State;
|
||||
}
|
||||
|
@ -1462,7 +1461,7 @@ static HAL_StatusTypeDef SMBUS_Master_ISR(SMBUS_HandleTypeDef *hsmbus)
|
|||
if(hsmbus->XferCount == 0)
|
||||
{
|
||||
/* Specific use case for Quick command */
|
||||
if(hsmbus->pBuffPtr == HAL_NULL)
|
||||
if(hsmbus->pBuffPtr == NULL)
|
||||
{
|
||||
/* Generate a Stop command */
|
||||
hsmbus->Instance->CR2 |= I2C_CR2_STOP;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_smbus.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of SMBUS HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -103,42 +103,6 @@ typedef struct
|
|||
section in Reference manual */
|
||||
} SMBUS_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL State structures definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SMBUS_STATE_RESET = 0x00, /*!< SMBUS not yet initialized or disabled */
|
||||
HAL_SMBUS_STATE_READY = 0x01, /*!< SMBUS initialized and ready for use */
|
||||
HAL_SMBUS_STATE_BUSY = 0x02, /*!< SMBUS internal process is ongoing */
|
||||
HAL_SMBUS_STATE_MASTER_BUSY_TX = 0x12, /*!< Master Data Transmission process is ongoing */
|
||||
HAL_SMBUS_STATE_MASTER_BUSY_RX = 0x22, /*!< Master Data Reception process is ongoing */
|
||||
HAL_SMBUS_STATE_SLAVE_BUSY_TX = 0x32, /*!< Slave Data Transmission process is ongoing */
|
||||
HAL_SMBUS_STATE_SLAVE_BUSY_RX = 0x42, /*!< Slave Data Reception process is ongoing */
|
||||
HAL_SMBUS_STATE_TIMEOUT = 0x03, /*!< Timeout state */
|
||||
HAL_SMBUS_STATE_ERROR = 0x04, /*!< Reception process is ongoing */
|
||||
HAL_SMBUS_STATE_SLAVE_LISTEN = 0x08, /*!< Address Listen Mode is ongoing */
|
||||
/* Aliases for inter STM32 series compatibility */
|
||||
HAL_SMBUS_STATE_LISTEN = HAL_SMBUS_STATE_SLAVE_LISTEN
|
||||
}HAL_SMBUS_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL SMBUS Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SMBUS_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_SMBUS_ERROR_BERR = 0x01, /*!< BERR error */
|
||||
HAL_SMBUS_ERROR_ARLO = 0x02, /*!< ARLO error */
|
||||
HAL_SMBUS_ERROR_ACKF = 0x04, /*!< ACKF error */
|
||||
HAL_SMBUS_ERROR_OVR = 0x08, /*!< OVR error */
|
||||
HAL_SMBUS_ERROR_HALTIMEOUT = 0x10, /*!< Timeout error */
|
||||
HAL_SMBUS_ERROR_BUSTIMEOUT = 0x20, /*!< Bus Timeout error */
|
||||
HAL_SMBUS_ERROR_ALERT = 0x40, /*!< Alert error */
|
||||
HAL_SMBUS_ERROR_PECERR = 0x80 /*!< PEC error */
|
||||
|
||||
}HAL_SMBUS_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief SMBUS handle Structure definition
|
||||
*/
|
||||
|
@ -156,13 +120,16 @@ typedef struct
|
|||
|
||||
__IO uint32_t XferOptions; /*!< SMBUS transfer options */
|
||||
|
||||
__IO HAL_SMBUS_StateTypeDef PreviousState; /*!< SMBUS communication Previous tate */
|
||||
__IO uint32_t PreviousState; /*!< SMBUS communication Previous state
|
||||
This parameter can be a value of @ref SMBUS_State */
|
||||
|
||||
HAL_LockTypeDef Lock; /*!< SMBUS locking object */
|
||||
|
||||
__IO HAL_SMBUS_StateTypeDef State; /*!< SMBUS communication state */
|
||||
__IO uint32_t State; /*!< SMBUS communication state
|
||||
This parameter can be a value of @ref SMBUS_State */
|
||||
|
||||
__IO HAL_SMBUS_ErrorTypeDef ErrorCode; /*!< SMBUS Error code */
|
||||
__IO uint32_t ErrorCode; /*!< SMBUS Error code
|
||||
This parameter can be a value of @ref SMBUS_Error */
|
||||
|
||||
}SMBUS_HandleTypeDef;
|
||||
/**
|
||||
|
@ -175,6 +142,43 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup SMBUS_Error SMBUS Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SMBUS_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_SMBUS_ERROR_BERR ((uint32_t)0x00000001) /*!< BERR error */
|
||||
#define HAL_SMBUS_ERROR_ARLO ((uint32_t)0x00000002) /*!< ARLO error */
|
||||
#define HAL_SMBUS_ERROR_ACKF ((uint32_t)0x00000004) /*!< ACKF error */
|
||||
#define HAL_SMBUS_ERROR_OVR ((uint32_t)0x00000008) /*!< OVR error */
|
||||
#define HAL_SMBUS_ERROR_HALTIMEOUT ((uint32_t)0x00000010) /*!< Timeout error */
|
||||
#define HAL_SMBUS_ERROR_BUSTIMEOUT ((uint32_t)0x00000020) /*!< Bus Timeout error */
|
||||
#define HAL_SMBUS_ERROR_ALERT ((uint32_t)0x00000040) /*!< Alert error */
|
||||
#define HAL_SMBUS_ERROR_PECERR ((uint32_t)0x00000080) /*!< PEC error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SMBUS_State SMBUS State
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define HAL_SMBUS_STATE_RESET ((uint32_t)0x00000000) /*!< SMBUS not yet initialized or disabled */
|
||||
#define HAL_SMBUS_STATE_READY ((uint32_t)0x00000001) /*!< SMBUS initialized and ready for use */
|
||||
#define HAL_SMBUS_STATE_BUSY ((uint32_t)0x00000002) /*!< SMBUS internal process is ongoing */
|
||||
#define HAL_SMBUS_STATE_MASTER_BUSY_TX ((uint32_t)0x00000012) /*!< Master Data Transmission process is ongoing */
|
||||
#define HAL_SMBUS_STATE_MASTER_BUSY_RX ((uint32_t)0x00000022) /*!< Master Data Reception process is ongoing */
|
||||
#define HAL_SMBUS_STATE_SLAVE_BUSY_TX ((uint32_t)0x00000032) /*!< Slave Data Transmission process is ongoing */
|
||||
#define HAL_SMBUS_STATE_SLAVE_BUSY_RX ((uint32_t)0x00000042) /*!< Slave Data Reception process is ongoing */
|
||||
#define HAL_SMBUS_STATE_TIMEOUT ((uint32_t)0x00000003) /*!< Timeout state */
|
||||
#define HAL_SMBUS_STATE_ERROR ((uint32_t)0x00000004) /*!< Reception process is ongoing */
|
||||
#define HAL_SMBUS_STATE_SLAVE_LISTEN ((uint32_t)0x00000008) /*!< Address Listen Mode is ongoing */
|
||||
/* Aliases for inter STM32 series compatibility */
|
||||
#define HAL_SMBUS_STATE_LISTEN HAL_SMBUS_STATE_SLAVE_LISTEN
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SMBUS_Analog_Filter SMBUS Analog Filter
|
||||
* @{
|
||||
*/
|
||||
|
@ -584,8 +588,8 @@ void HAL_SMBUS_ErrorCallback(SMBUS_HandleTypeDef *hsmbus);
|
|||
*/
|
||||
|
||||
/* Peripheral State and Errors functions **************************************************/
|
||||
HAL_SMBUS_StateTypeDef HAL_SMBUS_GetState(SMBUS_HandleTypeDef *hsmbus);
|
||||
uint32_t HAL_SMBUS_GetError(SMBUS_HandleTypeDef *hsmbus);
|
||||
uint32_t HAL_SMBUS_GetState(SMBUS_HandleTypeDef *hsmbus);
|
||||
uint32_t HAL_SMBUS_GetError(SMBUS_HandleTypeDef *hsmbus);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_spi.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of SPI HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -106,6 +106,7 @@ typedef struct
|
|||
This parameter must 0 or 1 or 2*/
|
||||
|
||||
uint32_t NSSPMode; /*!< Specifies whether the NSSP signal is enabled or not .
|
||||
This parameter can be a value of @ref SPI_NSSP_Mode
|
||||
This mode is activated by the NSSP bit in the SPIx_CR2 register and
|
||||
it takes effect only if the SPI interface is configured as Motorola SPI
|
||||
master (FRF=0) with capture on the first edge (SPIx_CR1 CPHA = 0,
|
||||
|
@ -117,68 +118,52 @@ typedef struct
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SPI_STATE_RESET = 0x00, /*!< Peripheral not Initialized */
|
||||
HAL_SPI_STATE_RESET = 0x00, /*!< Peripheral not Initialized */
|
||||
HAL_SPI_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
|
||||
HAL_SPI_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_TX = 0x03, /*!< Data Transmission process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_TX = 0x03, /*!< Data Transmission process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_RX = 0x04, /*!< Data Reception process is ongoing */
|
||||
HAL_SPI_STATE_BUSY_TX_RX = 0x05, /*!< Data Transmission and Reception process is ongoing */
|
||||
HAL_SPI_STATE_TIMEOUT = 0x06, /*!< Timeout state */
|
||||
HAL_SPI_STATE_ERROR = 0x07 /*!< Data Transmission and Reception process is ongoing */
|
||||
|
||||
HAL_SPI_STATE_BUSY_TX_RX = 0x05, /*!< Data Transmission and Reception process is ongoing */
|
||||
HAL_SPI_STATE_ERROR = 0x06 /*!< SPI error state */
|
||||
}HAL_SPI_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL SPI Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_SPI_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_SPI_ERROR_MODF = 0x01, /*!< MODF error */
|
||||
HAL_SPI_ERROR_CRC = 0x02, /*!< CRC error */
|
||||
HAL_SPI_ERROR_OVR = 0x04, /*!< OVR error */
|
||||
HAL_SPI_ERROR_FRE = 0x08, /*!< FRE error */
|
||||
HAL_SPI_ERROR_DMA = 0x10, /*!< DMA transfer error */
|
||||
HAL_SPI_ERROR_FLAG = 0x20, /*!< Error on BSY/TXE/FTLVL/FRLVL Flag */
|
||||
HAL_SPI_ERROR_UNKNOW = 0x40, /*!< Unknow Error error */
|
||||
}HAL_SPI_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief SPI handle Structure definition
|
||||
*/
|
||||
typedef struct __SPI_HandleTypeDef
|
||||
{
|
||||
SPI_TypeDef *Instance; /* SPI registers base address */
|
||||
SPI_TypeDef *Instance; /*!< SPI registers base address */
|
||||
|
||||
SPI_InitTypeDef Init; /* SPI communication parameters */
|
||||
SPI_InitTypeDef Init; /*!< SPI communication parameters */
|
||||
|
||||
uint8_t *pTxBuffPtr; /* Pointer to SPI Tx transfer Buffer */
|
||||
uint8_t *pTxBuffPtr; /*!< Pointer to SPI Tx transfer Buffer */
|
||||
|
||||
uint16_t TxXferSize; /* SPI Tx Transfer size */
|
||||
uint16_t TxXferSize; /*!< SPI Tx Transfer size */
|
||||
|
||||
uint16_t TxXferCount; /* SPI Tx Transfer Counter */
|
||||
uint16_t TxXferCount; /*!< SPI Tx Transfer Counter */
|
||||
|
||||
uint8_t *pRxBuffPtr; /* Pointer to SPI Rx transfer Buffer */
|
||||
uint8_t *pRxBuffPtr; /*!< Pointer to SPI Rx transfer Buffer */
|
||||
|
||||
uint16_t RxXferSize; /* SPI Rx Transfer size */
|
||||
uint16_t RxXferSize; /*!< SPI Rx Transfer size */
|
||||
|
||||
uint16_t RxXferCount; /* SPI Rx Transfer Counter */
|
||||
uint16_t RxXferCount; /*!< SPI Rx Transfer Counter */
|
||||
|
||||
uint32_t CRCSize; /* SPI CRC size used for the transfer */
|
||||
uint32_t CRCSize; /*!< SPI CRC size used for the transfer */
|
||||
|
||||
void (*RxISR)(struct __SPI_HandleTypeDef *hspi); /* function pointer on Rx IRQ handler */
|
||||
void (*RxISR)(struct __SPI_HandleTypeDef *hspi); /*!< function pointer on Rx IRQ handler */
|
||||
|
||||
void (*TxISR)(struct __SPI_HandleTypeDef *hspi); /* function pointer on Tx IRQ handler */
|
||||
void (*TxISR)(struct __SPI_HandleTypeDef *hspi); /*!< function pointer on Tx IRQ handler */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /* SPI Tx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmatx; /*!< SPI Tx DMA Handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /* SPI Rx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmarx; /*!< SPI Rx DMA Handle parameters */
|
||||
|
||||
HAL_LockTypeDef Lock; /* Locking object */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
|
||||
HAL_SPI_StateTypeDef State; /* SPI communication state */
|
||||
HAL_SPI_StateTypeDef State; /*!< SPI communication state */
|
||||
|
||||
HAL_SPI_ErrorTypeDef ErrorCode; /* SPI Error code */
|
||||
__IO uint32_t ErrorCode; /*!< SPI Error code
|
||||
This parameter can be a value of @ref SPI_Error */
|
||||
|
||||
}SPI_HandleTypeDef;
|
||||
|
||||
|
@ -192,10 +177,24 @@ typedef struct __SPI_HandleTypeDef
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_Error SPI Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_SPI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_SPI_ERROR_MODF ((uint32_t)0x00000001) /*!< MODF error */
|
||||
#define HAL_SPI_ERROR_CRC ((uint32_t)0x00000002) /*!< CRC error */
|
||||
#define HAL_SPI_ERROR_OVR ((uint32_t)0x00000004) /*!< OVR error */
|
||||
#define HAL_SPI_ERROR_FRE ((uint32_t)0x00000008) /*!< FRE error */
|
||||
#define HAL_SPI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
|
||||
#define HAL_SPI_ERROR_FLAG ((uint32_t)0x00000020) /*!< Error on BSY/TXE/FTLVL/FRLVL Flag */
|
||||
#define HAL_SPI_ERROR_UNKNOW ((uint32_t)0x00000040) /*!< Unknow Error error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_mode SPI mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_MODE_SLAVE ((uint32_t)0x00000000)
|
||||
#define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
|
||||
#define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_SLAVE) || \
|
||||
|
@ -223,23 +222,22 @@ typedef struct __SPI_HandleTypeDef
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_data_size SPI data size
|
||||
/** @defgroup SPI_data_size SPI Data size
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_DATASIZE_4BIT ((uint16_t)0x0300)
|
||||
#define SPI_DATASIZE_5BIT ((uint16_t)0x0400)
|
||||
#define SPI_DATASIZE_6BIT ((uint16_t)0x0500)
|
||||
#define SPI_DATASIZE_7BIT ((uint16_t)0x0600)
|
||||
#define SPI_DATASIZE_8BIT ((uint16_t)0x0700)
|
||||
#define SPI_DATASIZE_9BIT ((uint16_t)0x0800)
|
||||
#define SPI_DATASIZE_10BIT ((uint16_t)0x0900)
|
||||
#define SPI_DATASIZE_11BIT ((uint16_t)0x0A00)
|
||||
#define SPI_DATASIZE_12BIT ((uint16_t)0x0B00)
|
||||
#define SPI_DATASIZE_13BIT ((uint16_t)0x0C00)
|
||||
#define SPI_DATASIZE_14BIT ((uint16_t)0x0D00)
|
||||
#define SPI_DATASIZE_15BIT ((uint16_t)0x0E00)
|
||||
#define SPI_DATASIZE_16BIT ((uint16_t)0x0F00)
|
||||
#define SPI_DATASIZE_4BIT ((uint32_t)0x0300) /*!< SPI Datasize = 4bits */
|
||||
#define SPI_DATASIZE_5BIT ((uint32_t)0x0400) /*!< SPI Datasize = 5bits */
|
||||
#define SPI_DATASIZE_6BIT ((uint32_t)0x0500) /*!< SPI Datasize = 6bits */
|
||||
#define SPI_DATASIZE_7BIT ((uint32_t)0x0600) /*!< SPI Datasize = 7bits */
|
||||
#define SPI_DATASIZE_8BIT ((uint32_t)0x0700) /*!< SPI Datasize = 8bits */
|
||||
#define SPI_DATASIZE_9BIT ((uint32_t)0x0800) /*!< SPI Datasize = 9bits */
|
||||
#define SPI_DATASIZE_10BIT ((uint32_t)0x0900) /*!< SPI Datasize = 10bits */
|
||||
#define SPI_DATASIZE_11BIT ((uint32_t)0x0A00) /*!< SPI Datasize = 11bits */
|
||||
#define SPI_DATASIZE_12BIT ((uint32_t)0x0B00) /*!< SPI Datasize = 12bits */
|
||||
#define SPI_DATASIZE_13BIT ((uint32_t)0x0C00) /*!< SPI Datasize = 13bits */
|
||||
#define SPI_DATASIZE_14BIT ((uint32_t)0x0D00) /*!< SPI Datasize = 14bits */
|
||||
#define SPI_DATASIZE_15BIT ((uint32_t)0x0E00) /*!< SPI Datasize = 15bits */
|
||||
#define SPI_DATASIZE_16BIT ((uint32_t)0x0F00) /*!< SPI Datasize = 16bits */
|
||||
#define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DATASIZE_16BIT) || \
|
||||
((DATASIZE) == SPI_DATASIZE_15BIT) || \
|
||||
((DATASIZE) == SPI_DATASIZE_14BIT) || \
|
||||
|
@ -261,9 +259,8 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_Clock_Polarity SPI Clock Polarity
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_POLARITY_LOW ((uint32_t)0x00000000)
|
||||
#define SPI_POLARITY_HIGH SPI_CR1_CPOL
|
||||
#define SPI_POLARITY_LOW ((uint32_t)0x00000000) /*!< SPI polarity Low */
|
||||
#define SPI_POLARITY_HIGH SPI_CR1_CPOL /*!< SPI polarity High */
|
||||
#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_POLARITY_LOW) || \
|
||||
((CPOL) == SPI_POLARITY_HIGH))
|
||||
/**
|
||||
|
@ -273,9 +270,8 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_Clock_Phase SPI Clock Phase
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_PHASE_1EDGE ((uint32_t)0x00000000)
|
||||
#define SPI_PHASE_2EDGE SPI_CR1_CPHA
|
||||
#define SPI_PHASE_1EDGE ((uint32_t)0x00000000) /*!< SPI Phase 1EDGE */
|
||||
#define SPI_PHASE_2EDGE SPI_CR1_CPHA /*!< SPI Phase 2EDGE */
|
||||
#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_PHASE_1EDGE) || \
|
||||
((CPHA) == SPI_PHASE_2EDGE))
|
||||
/**
|
||||
|
@ -285,19 +281,17 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_Slave_Select_management SPI Slave Select management
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_NSS_SOFT SPI_CR1_SSM
|
||||
#define SPI_NSS_HARD_INPUT ((uint32_t)0x00000000)
|
||||
#define SPI_NSS_HARD_OUTPUT ((uint32_t)0x00040000)
|
||||
#define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_SOFT) || \
|
||||
((NSS) == SPI_NSS_HARD_INPUT) || \
|
||||
((NSS) == SPI_NSS_HARD_OUTPUT))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SPI_NSS_pulse_management SPI NSS pulse management
|
||||
/** @defgroup SPI_NSSP_Mode SPI NSS pulse management
|
||||
* @{
|
||||
*/
|
||||
#define SPI_NSS_PULSE_ENABLED SPI_CR2_NSSP
|
||||
|
@ -305,16 +299,13 @@ typedef struct __SPI_HandleTypeDef
|
|||
|
||||
#define IS_SPI_NSSP(NSSP) (((NSSP) == SPI_NSS_PULSE_ENABLED) || \
|
||||
((NSSP) == SPI_NSS_PULSE_DISABLED))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_BAUDRATEPRESCALER_2 ((uint32_t)0x00000000)
|
||||
#define SPI_BAUDRATEPRESCALER_4 ((uint32_t)0x00000008)
|
||||
#define SPI_BAUDRATEPRESCALER_8 ((uint32_t)0x00000010)
|
||||
|
@ -338,7 +329,6 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB transmission
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_FIRSTBIT_MSB ((uint32_t)0x00000000)
|
||||
#define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
|
||||
#define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \
|
||||
|
@ -350,7 +340,6 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_TI_mode SPI TI mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_TIMODE_DISABLED ((uint32_t)0x00000000)
|
||||
#define SPI_TIMODE_ENABLED SPI_CR2_FRF
|
||||
#define IS_SPI_TIMODE(MODE) (((MODE) == SPI_TIMODE_DISABLED) || \
|
||||
|
@ -362,7 +351,6 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_CRC_Calculation SPI CRC Calculation
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SPI_CRCCALCULATION_DISABLED ((uint32_t)0x00000000)
|
||||
#define SPI_CRCCALCULATION_ENABLED SPI_CR1_CRCEN
|
||||
#define IS_SPI_CRC_CALCULATION(CALCULATION) (((CALCULATION) == SPI_CRCCALCULATION_DISABLED) || \
|
||||
|
@ -391,11 +379,11 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_FIFO_reception_threshold SPI FIFO reception threshold
|
||||
* @{
|
||||
* This parameter can be one of the following values:
|
||||
* SPI_RxFIFOThreshold_HF: RXNE event is generated if the FIFO
|
||||
* SPI_RXFIFO_THRESHOLD or SPI_RXFIFO_THRESHOLD_QF :
|
||||
* RXNE event is generated if the FIFO
|
||||
* level is greater or equal to 1/2(16-bits).
|
||||
* SPI_RxFIFOThreshold_QF: RXNE event is generated if the FIFO
|
||||
* level is greater or equal to 1/4(8 bits).
|
||||
*/
|
||||
* SPI_RXFIFO_THRESHOLD_HF: RXNE event is generated if the FIFO
|
||||
* level is greater or equal to 1/4(8 bits). */
|
||||
#define SPI_RXFIFO_THRESHOLD SPI_CR2_FRXTH
|
||||
#define SPI_RXFIFO_THRESHOLD_QF SPI_CR2_FRXTH
|
||||
#define SPI_RXFIFO_THRESHOLD_HF ((uint32_t)0x0)
|
||||
|
@ -408,8 +396,8 @@ typedef struct __SPI_HandleTypeDef
|
|||
* @brief SPI Interrupt definition
|
||||
* Elements values convention: 0xXXXXXXXX
|
||||
* - XXXXXXXX : Interrupt control mask
|
||||
* @{
|
||||
*/
|
||||
* @{
|
||||
*/
|
||||
#define SPI_IT_TXE SPI_CR2_TXEIE
|
||||
#define SPI_IT_RXNE SPI_CR2_RXNEIE
|
||||
#define SPI_IT_ERR SPI_CR2_ERRIE
|
||||
|
@ -441,12 +429,11 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_transmission_fifo_status_level SPI transmission fifo status level
|
||||
* @{
|
||||
*/
|
||||
#define SPI_FTLVL_EMPTY ((uint32_t)0x0000)
|
||||
#define SPI_FTLVL_QUARTER_FULL ((uint32_t)0x0800)
|
||||
#define SPI_FTLVL_HALF_FULL ((uint32_t)0x1000)
|
||||
#define SPI_FTLVL_FULL ((uint32_t)0x1800)
|
||||
|
||||
#define SPI_FTLVL_EMPTY ((uint16_t)0x0000)
|
||||
#define SPI_FTLVL_QUARTER_FULL ((uint16_t)0x0800)
|
||||
#define SPI_FTLVL_HALF_FULL ((uint16_t)0x1000)
|
||||
#define SPI_FTLVL_FULL ((uint16_t)0x1800)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -454,11 +441,10 @@ typedef struct __SPI_HandleTypeDef
|
|||
/** @defgroup SPI_reception_fifo_status_level SPI reception fifo status level
|
||||
* @{
|
||||
*/
|
||||
#define SPI_FRLVL_EMPTY ((uint16_t)0x0000)
|
||||
#define SPI_FRLVL_QUARTER_FULL ((uint16_t)0x0200)
|
||||
#define SPI_FRLVL_HALF_FULL ((uint16_t)0x0400)
|
||||
#define SPI_FRLVL_FULL ((uint16_t)0x0600)
|
||||
|
||||
#define SPI_FRLVL_EMPTY ((uint32_t)0x0000)
|
||||
#define SPI_FRLVL_QUARTER_FULL ((uint32_t)0x0200)
|
||||
#define SPI_FRLVL_HALF_FULL ((uint32_t)0x0400)
|
||||
#define SPI_FRLVL_FULL ((uint32_t)0x0600)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -480,23 +466,22 @@ typedef struct __SPI_HandleTypeDef
|
|||
#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
|
||||
|
||||
/** @brief Enables or disables the specified SPI interrupts.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __INTERRUPT__: specifies the interrupt source to enable or disable.
|
||||
* @param __INTERRUPT__ : specifies the interrupt source to enable or disable.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
* @arg SPI_IT_ERR: Error interrupt enable
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
|
||||
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (uint16_t)(~(__INTERRUPT__)))
|
||||
#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
|
||||
|
||||
/** @brief Checks if the specified SPI interrupt source is enabled or disabled.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __INTERRUPT__: specifies the SPI interrupt source to check.
|
||||
* @param __INTERRUPT__ : specifies the SPI interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_IT_TXE: Tx buffer empty interrupt enable
|
||||
* @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
|
||||
|
@ -506,9 +491,9 @@ typedef struct __SPI_HandleTypeDef
|
|||
#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
|
||||
|
||||
/** @brief Checks whether the specified SPI flag is set or not.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @param __FLAG__: specifies the flag to check.
|
||||
* @param __FLAG__ : specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg SPI_FLAG_RXNE: Receive buffer not empty flag
|
||||
* @arg SPI_FLAG_TXE: Transmit buffer empty flag
|
||||
|
@ -517,73 +502,86 @@ typedef struct __SPI_HandleTypeDef
|
|||
* @arg SPI_FLAG_OVR: Overrun flag
|
||||
* @arg SPI_FLAG_BSY: Busy flag
|
||||
* @arg SPI_FLAG_FRE: Frame format error flag
|
||||
* @arg SPI_FLAG_FTLVL: SPI fifo transmission level
|
||||
* @arg SPI_FLAG_FRLVL: SPI fifo reception level
|
||||
* @retval The new state of __FLAG__ (TRUE or FALSE).
|
||||
*/
|
||||
#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
|
||||
|
||||
/** @brief Clears the SPI CRCERR pending flag.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = (uint16_t)(~SPI_FLAG_CRCERR))
|
||||
|
||||
/** @brief Clears the SPI MODF pending flag.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
*
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) do{(__HANDLE__)->Instance->SR;\
|
||||
(__HANDLE__)->Instance->CR1 &= (uint16_t)(~SPI_CR1_SPE);}while(0)
|
||||
#define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) do{\
|
||||
__IO uint32_t tmpreg;\
|
||||
tmpreg = (__HANDLE__)->Instance->SR;\
|
||||
UNUSED(tmpreg); \
|
||||
(__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE);\
|
||||
}while(0)
|
||||
|
||||
/** @brief Clears the SPI OVR pending flag.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
*
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) do{(__HANDLE__)->Instance->DR;\
|
||||
(__HANDLE__)->Instance->SR;}while(0)
|
||||
|
||||
#define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) do{ \
|
||||
__IO uint32_t tmpreg; \
|
||||
tmpreg = (__HANDLE__)->Instance->DR; \
|
||||
tmpreg = (__HANDLE__)->Instance->SR; \
|
||||
UNUSED(tmpreg); \
|
||||
} while(0)
|
||||
|
||||
/** @brief Clears the SPI FRE pending flag.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
*
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR)
|
||||
|
||||
#define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) do{\
|
||||
__IO uint32_t tmpreg;\
|
||||
tmpreg = ((__HANDLE__)->Instance->SR);\
|
||||
UNUSED(tmpreg); \
|
||||
}while(0)
|
||||
/** @brief Enables the SPI.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_SPE)
|
||||
|
||||
/** @brief Disables the SPI.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (uint16_t)(~SPI_CR1_SPE))
|
||||
#define __HAL_SPI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE))
|
||||
|
||||
/** @brief Sets the SPI transmit-only mode.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_1LINE_TX(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_BIDIOE)
|
||||
|
||||
/** @brief Sets the SPI receive-only mode.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
#define __HAL_SPI_1LINE_RX(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (uint16_t)(~SPI_CR1_BIDIOE))
|
||||
#define __HAL_SPI_1LINE_RX(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= (~SPI_CR1_BIDIOE))
|
||||
|
||||
/** @brief Resets the CRC calculation of the SPI.
|
||||
* @param __HANDLE__: specifies the SPI Handle.
|
||||
* @param __HANDLE__ : specifies the SPI Handle.
|
||||
* This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
|
@ -629,10 +627,18 @@ HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *p
|
|||
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
|
||||
HAL_StatusTypeDef HAL_SPI_FlushRxFifo(SPI_HandleTypeDef *hspi);
|
||||
|
||||
void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
|
||||
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
|
||||
/**
|
||||
* @}
|
||||
|
@ -644,6 +650,7 @@ void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
|
|||
|
||||
/* Peripheral State and Error functions ***************************************/
|
||||
HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi);
|
||||
uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tim.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief TIM HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Timer (TIM) peripheral:
|
||||
|
@ -207,7 +207,7 @@ static void TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
|
|||
HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim)
|
|||
HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef* htim)
|
||||
{
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -972,7 +972,7 @@ HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
|
|||
HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1472,7 +1472,7 @@ HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel
|
|||
HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1938,7 +1938,7 @@ HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
|
|||
HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
|
||||
{
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -2205,7 +2205,7 @@ HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_Ini
|
|||
uint32_t tmpccer = 0;
|
||||
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tim.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of TIM HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -290,7 +290,7 @@ typedef struct
|
|||
TIM_Base_InitTypeDef Init; /*!< TIM Time Base required parameters */
|
||||
HAL_TIM_ActiveChannel Channel; /*!< Active channel */
|
||||
DMA_HandleTypeDef *hdma[7]; /*!< DMA Handlers array
|
||||
This array is accessed by a @ref DMA_Handle_index */
|
||||
This array is accessed by a @ref TIM_DMA_Handle_index */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
__IO HAL_TIM_StateTypeDef State; /*!< TIM operation state */
|
||||
}TIM_HandleTypeDef;
|
||||
|
@ -1117,7 +1117,7 @@ typedef struct
|
|||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup DMA_Handle_index TIM DMA Handle Index
|
||||
/** @defgroup TIM_DMA_Handle_index TIM DMA Handle Index
|
||||
* @{
|
||||
*/
|
||||
#define TIM_DMA_ID_UPDATE ((uint16_t) 0x0) /*!< Index of the DMA handle used for Update DMA requests */
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tim_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief TIM HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Timer Extended peripheral:
|
||||
|
@ -162,7 +162,7 @@ HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSen
|
|||
TIM_OC_InitTypeDef OC_Config;
|
||||
|
||||
/* Check the TIM handle allocation */
|
||||
if(htim == HAL_NULL)
|
||||
if(htim == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tim_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of TIM HAL Extended module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tsc.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file provides firmware functions to manage the following
|
||||
* functionalities of the Touch Sensing Controller (TSC) peripheral:
|
||||
* + Initialization and DeInitialization
|
||||
|
@ -111,6 +111,12 @@
|
|||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f0xx_hal.h"
|
||||
|
||||
#ifdef HAL_TSC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F071xB) || defined(STM32F091xC) || \
|
||||
defined(STM32F042x6) || defined(STM32F072xB) || \
|
||||
defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F078xx) || defined(STM32F098xx)
|
||||
|
||||
/** @addtogroup STM32F0xx_HAL_Driver
|
||||
* @{
|
||||
*/
|
||||
|
@ -120,12 +126,6 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifdef HAL_TSC_MODULE_ENABLED
|
||||
|
||||
#if defined(STM32F051x8) || defined(STM32F071xB) || defined(STM32F091xC) || \
|
||||
defined(STM32F042x6) || defined(STM32F072xB) || \
|
||||
defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F078xx) || defined(STM32F098xx)
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
@ -161,7 +161,7 @@ static uint32_t TSC_extract_groups(uint32_t iomask);
|
|||
HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef* htsc)
|
||||
{
|
||||
/* Check TSC handle allocation */
|
||||
if (htsc == HAL_NULL)
|
||||
if (htsc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef* htsc)
|
|||
HAL_StatusTypeDef HAL_TSC_DeInit(TSC_HandleTypeDef* htsc)
|
||||
{
|
||||
/* Check TSC handle allocation */
|
||||
if (htsc == HAL_NULL)
|
||||
if (htsc == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -774,18 +774,18 @@ static uint32_t TSC_extract_groups(uint32_t iomask)
|
|||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* defined(STM32F051x8) || defined(STM32F071xB) || defined(STM32F091xC) || */
|
||||
/* defined(STM32F042x6) || defined(STM32F072xB) || */
|
||||
/* defined(STM32F048xx) || defined(STM32F058xx) || defined(STM32F078xx) || defined(STM32F098xx) */
|
||||
|
||||
#endif /* HAL_TSC_MODULE_ENABLED */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_tsc.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief This file contains all the functions prototypes for the TSC firmware
|
||||
* library.
|
||||
******************************************************************************
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_uart.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief UART HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Universal Asynchronous Receiver Transmitter (UART) peripheral:
|
||||
|
@ -264,7 +264,7 @@ static void UART_DMAError(DMA_HandleTypeDef *hdma);
|
|||
HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ HAL_StatusTypeDef HAL_UART_Init(UART_HandleTypeDef *huart)
|
|||
HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ HAL_StatusTypeDef HAL_HalfDuplex_Init(UART_HandleTypeDef *huart)
|
|||
HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Address, uint32_t WakeUpMethod)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ HAL_StatusTypeDef HAL_MultiProcessor_Init(UART_HandleTypeDef *huart, uint8_t Add
|
|||
HAL_StatusTypeDef HAL_UART_DeInit(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, u
|
|||
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, ui
|
|||
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData
|
|||
{
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ HAL_StatusTypeDef HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pData,
|
|||
{
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pDat
|
|||
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_RX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData
|
|||
|
||||
if((huart->State == HAL_UART_STATE_READY) || (huart->State == HAL_UART_STATE_BUSY_TX))
|
||||
{
|
||||
if((pData == HAL_NULL ) || (Size == 0))
|
||||
if((pData == NULL ) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1050,12 +1050,12 @@ HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart)
|
|||
huart->Instance->CR3 &= ~USART_CR3_DMAR;
|
||||
|
||||
/* Abort the UART DMA tx channel */
|
||||
if(huart->hdmatx != HAL_NULL)
|
||||
if(huart->hdmatx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(huart->hdmatx);
|
||||
}
|
||||
/* Abort the UART DMA rx channel */
|
||||
if(huart->hdmarx != HAL_NULL)
|
||||
if(huart->hdmarx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(huart->hdmarx);
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_
|
|||
__HAL_UART_DISABLE_IT(huart, UART_IT_PE);
|
||||
__HAL_UART_DISABLE_IT(huart, UART_IT_ERR);
|
||||
|
||||
huart->State = HAL_UART_STATE_TIMEOUT;
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(huart);
|
||||
|
@ -1502,7 +1502,7 @@ HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_
|
|||
__HAL_UART_DISABLE_IT(huart, UART_IT_PE);
|
||||
__HAL_UART_DISABLE_IT(huart, UART_IT_ERR);
|
||||
|
||||
huart->State = HAL_UART_STATE_TIMEOUT;
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(huart);
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_uart.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of UART HAL module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -141,22 +141,6 @@ typedef struct
|
|||
This parameter can be a value of @ref UART_MSB_First */
|
||||
} UART_AdvFeatureInitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief UART wake up from stop mode parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF).
|
||||
This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection.
|
||||
If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must
|
||||
be filled up. */
|
||||
|
||||
uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long.
|
||||
This parameter can be a value of @ref UART_WakeUp_Address_Length */
|
||||
|
||||
uint8_t Address; /*!< UART/USART node address (7-bit long max) */
|
||||
} UART_WakeUpTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL UART State structures definition
|
||||
*/
|
||||
|
@ -172,19 +156,6 @@ typedef enum
|
|||
HAL_UART_STATE_ERROR = 0x04 /*!< Error */
|
||||
}HAL_UART_StateTypeDef;
|
||||
|
||||
/**
|
||||
* @brief HAL UART Error Code structure definition
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAL_UART_ERROR_NONE = 0x00, /*!< No error */
|
||||
HAL_UART_ERROR_PE = 0x01, /*!< Parity error */
|
||||
HAL_UART_ERROR_NE = 0x02, /*!< Noise error */
|
||||
HAL_UART_ERROR_FE = 0x04, /*!< frame error */
|
||||
HAL_UART_ERROR_ORE = 0x08, /*!< Overrun error */
|
||||
HAL_UART_ERROR_DMA = 0x10 /*!< DMA transfer error */
|
||||
}HAL_UART_ErrorTypeDef;
|
||||
|
||||
/**
|
||||
* @brief UART clock sources definition
|
||||
*/
|
||||
|
@ -202,35 +173,36 @@ typedef enum
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
USART_TypeDef *Instance; /* UART registers base address */
|
||||
USART_TypeDef *Instance; /*!< UART registers base address */
|
||||
|
||||
UART_InitTypeDef Init; /* UART communication parameters */
|
||||
UART_InitTypeDef Init; /*!< UART communication parameters */
|
||||
|
||||
UART_AdvFeatureInitTypeDef AdvancedInit; /* UART Advanced Features initialization parameters */
|
||||
UART_AdvFeatureInitTypeDef AdvancedInit; /*!< UART Advanced Features initialization parameters */
|
||||
|
||||
uint8_t *pTxBuffPtr; /* Pointer to UART Tx transfer Buffer */
|
||||
uint8_t *pTxBuffPtr; /*!< Pointer to UART Tx transfer Buffer */
|
||||
|
||||
uint16_t TxXferSize; /* UART Tx Transfer size */
|
||||
uint16_t TxXferSize; /*!< UART Tx Transfer size */
|
||||
|
||||
uint16_t TxXferCount; /* UART Tx Transfer Counter */
|
||||
uint16_t TxXferCount; /*!< UART Tx Transfer Counter */
|
||||
|
||||
uint8_t *pRxBuffPtr; /* Pointer to UART Rx transfer Buffer */
|
||||
uint8_t *pRxBuffPtr; /*!< Pointer to UART Rx transfer Buffer */
|
||||
|
||||
uint16_t RxXferSize; /* UART Rx Transfer size */
|
||||
uint16_t RxXferSize; /*!< UART Rx Transfer size */
|
||||
|
||||
uint16_t RxXferCount; /* UART Rx Transfer Counter */
|
||||
uint16_t RxXferCount; /*!< UART Rx Transfer Counter */
|
||||
|
||||
uint16_t Mask; /* UART Rx RDR register mask */
|
||||
uint16_t Mask; /*!< UART Rx RDR register mask */
|
||||
|
||||
DMA_HandleTypeDef *hdmatx; /* UART Tx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmatx; /*!< UART Tx DMA Handle parameters */
|
||||
|
||||
DMA_HandleTypeDef *hdmarx; /* UART Rx DMA Handle parameters */
|
||||
DMA_HandleTypeDef *hdmarx; /*!< UART Rx DMA Handle parameters */
|
||||
|
||||
HAL_LockTypeDef Lock; /* Locking object */
|
||||
HAL_LockTypeDef Lock; /*!< Locking object */
|
||||
|
||||
HAL_UART_StateTypeDef State; /* UART communication state */
|
||||
HAL_UART_StateTypeDef State; /*!< UART communication state */
|
||||
|
||||
HAL_UART_ErrorTypeDef ErrorCode; /* UART Error code */
|
||||
__IO uint32_t ErrorCode; /*!< UART Error code
|
||||
This parameter can be a value of @ref UART_Error */
|
||||
|
||||
}UART_HandleTypeDef;
|
||||
|
||||
|
@ -243,13 +215,28 @@ typedef struct
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup UART_Error UART Error
|
||||
* @{
|
||||
*/
|
||||
#define HAL_UART_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
|
||||
#define HAL_UART_ERROR_PE ((uint32_t)0x00000001) /*!< Parity error */
|
||||
#define HAL_UART_ERROR_NE ((uint32_t)0x00000002) /*!< Noise error */
|
||||
#define HAL_UART_ERROR_FE ((uint32_t)0x00000004) /*!< frame error */
|
||||
#define HAL_UART_ERROR_ORE ((uint32_t)0x00000008) /*!< Overrun error */
|
||||
#define HAL_UART_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UART_Stop_Bits UART Number of Stop Bits
|
||||
* @{
|
||||
*/
|
||||
#define UART_STOPBITS_1 ((uint32_t)0x0000)
|
||||
#define UART_STOPBITS_2 ((uint32_t)USART_CR2_STOP_1)
|
||||
#define UART_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1))
|
||||
#define IS_UART_STOPBITS(STOPBITS) (((STOPBITS) == UART_STOPBITS_1) || \
|
||||
((STOPBITS) == UART_STOPBITS_2))
|
||||
((STOPBITS) == UART_STOPBITS_2) || \
|
||||
((STOPBITS) == UART_STOPBITS_1_5))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_uart_ex.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Extended UART HAL module driver.
|
||||
*
|
||||
* This file provides firmware functions to manage the following extended
|
||||
|
@ -79,9 +79,9 @@
|
|||
/** @defgroup UARTEx_Private_Functions UARTEx Private Functions
|
||||
* @{
|
||||
*/
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
static void UART_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
static HAL_StatusTypeDef UART_EndTransmit_IT(UART_HandleTypeDef *huart);
|
||||
|
||||
/**
|
||||
|
@ -94,164 +94,39 @@ static HAL_StatusTypeDef UART_EndTransmit_IT(UART_HandleTypeDef *huart);
|
|||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_Exported_Functions_Group2 Extended IO operation function
|
||||
* @brief UART Interrupt handling function
|
||||
*
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### IO operation function #####
|
||||
===============================================================================
|
||||
This subsection provides functions allowing to manage the UART interrupts
|
||||
and to handle Wake up interrupt call-back.
|
||||
|
||||
(#) Non-Blocking mode API with Interrupt is :
|
||||
(+) HAL_UART_IRQHandler()
|
||||
|
||||
(#) Callback provided in No_Blocking mode:
|
||||
(+) HAL_UART_WakeupCallback()
|
||||
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This function handles UART interrupt request.
|
||||
* @param huart: uart handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* UART parity error interrupt occurred -------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_PE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_PE) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_PEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_PE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART frame error interrupt occured --------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_FE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_FEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_FE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART noise error interrupt occured --------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_NE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_NEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_NE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART Over-Run interrupt occured -----------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_ORE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_OREF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_ORE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* Call UART Error Call back function if need be --------------------------*/
|
||||
if(huart->ErrorCode != HAL_UART_ERROR_NONE)
|
||||
{
|
||||
HAL_UART_ErrorCallback(huart);
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
/* UART wakeup from Stop mode interrupt occurred -------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_WUF) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_WUF) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_WUF);
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
HAL_UART_WakeupCallback(huart);
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
|
||||
/* UART in mode Receiver ---------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_RXNE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_RXNE) != RESET))
|
||||
{
|
||||
UART_Receive_IT(huart);
|
||||
/* Clear RXNE interrupt flag */
|
||||
__HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
/* UART in mode Transmitter ------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET) &&(__HAL_UART_GET_IT_SOURCE(huart, UART_IT_TXE) != RESET))
|
||||
{
|
||||
UART_Transmit_IT(huart);
|
||||
}
|
||||
|
||||
/* UART in mode Transmitter ------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_TC) != RESET) &&(__HAL_UART_GET_IT_SOURCE(huart, UART_IT_TC) != RESET))
|
||||
{
|
||||
UART_EndTransmit_IT(huart);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
/**
|
||||
* @brief UART wakeup from Stop mode callback
|
||||
* @param huart: uart handle
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* NOTE : This function should not be modified, when the callback is needed,
|
||||
the HAL_UART_WakeupCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
#endif /*!defined(STM32F030x6) && !defined(STM32F030x8)*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_Exported_Functions_Group1 Extended Initialization/de-initialization functions
|
||||
* @brief Extended Initialization and Configuration Functions
|
||||
*
|
||||
@verbatim
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### Initialization and Configuration functions #####
|
||||
===============================================================================
|
||||
==============================================================================
|
||||
[..]
|
||||
This subsection provides a set of functions allowing to initialize the USARTx or the UARTy
|
||||
This subsection provides a set of functions allowing to initialize the USARTx or the UARTy
|
||||
in asynchronous mode.
|
||||
(+) For the asynchronous mode only these parameters can be configured:
|
||||
(++) Baud Rate
|
||||
(++) Word Length
|
||||
(++) Word Length (Fixed to 8-bits only for LIN mode)
|
||||
(++) Stop Bit
|
||||
(++) Parity: If the parity is enabled, then the MSB bit of the data written
|
||||
in the data register is transmitted but is changed by the parity bit.
|
||||
Depending on the frame length defined by the M bit (8-bits or 9-bits),
|
||||
the possible UART frame formats are as listed in the following table:
|
||||
|-----------|-----------|---------------------------------------|
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| M1M0 bits | PCE bit | UART frame |
|
||||
|-----------------------|---------------------------------------|
|
||||
|-----------------------|---------------------------------------|
|
||||
| 00 | 0 | | SB | 8-bit data | STB | |
|
||||
|-----------|-----------|---------------------------------------|
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| 00 | 1 | | SB | 7-bit data | PB | STB | |
|
||||
|-----------|-----------|---------------------------------------|
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| 01 | 0 | | SB | 9-bit data | STB | |
|
||||
|-----------|-----------|---------------------------------------|
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| 01 | 1 | | SB | 8-bit data | PB | STB | |
|
||||
+---------------------------------------------------------------+
|
||||
+---------------------------------------------------------------+
|
||||
| 10 | 0 | | SB | 7-bit data | STB | |
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| 10 | 1 | | SB | 6-bit data | PB | STB | |
|
||||
+---------------------------------------------------------------+
|
||||
|-----------|-----------|---------------------------------------|
|
||||
| 10 | 1 | | SB | 6-bit data | PB | STB | |
|
||||
+---------------------------------------------------------------+
|
||||
(++) Hardware flow control
|
||||
(++) Receiver/transmitter modes
|
||||
(++) Over Sampling Method
|
||||
|
@ -273,7 +148,7 @@ void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Initializes the RS485 Driver enable feature according to the specified
|
||||
* parameters in the UART_InitTypeDef and creates the associated handle .
|
||||
|
@ -298,7 +173,7 @@ HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPo
|
|||
uint32_t temp = 0x0;
|
||||
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -353,12 +228,12 @@ HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPo
|
|||
/* TEACK and/or REACK to check before moving huart->State to Ready */
|
||||
return (UART_CheckIdleState(huart));
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)*/
|
||||
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Initializes the LIN mode according to the specified
|
||||
* parameters in the UART_InitTypeDef and creates the associated handle .
|
||||
* parameters in the UART_InitTypeDef and creates the associated handle.
|
||||
* @param huart: uart handle
|
||||
* @param BreakDetectLength: specifies the LIN break detection length.
|
||||
* This parameter can be one of the following values:
|
||||
|
@ -369,7 +244,7 @@ HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPo
|
|||
HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -384,6 +259,12 @@ HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLe
|
|||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* in LIN mode, data length is limited to 8-bit only */
|
||||
if(huart->Init.WordLength!= UART_WORDLENGTH_8B)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
||||
/* Init the low level hardware : GPIO, CLOCK, CORTEX */
|
||||
HAL_UART_MspInit(huart);
|
||||
|
||||
|
@ -419,11 +300,138 @@ HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLe
|
|||
/* TEACK and/or REACK to check before moving huart->State to Ready */
|
||||
return (UART_CheckIdleState(huart));
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup UARTEx_Exported_Functions_Group2 Extended IO operation function
|
||||
* @brief Extended UART Interrupt handling function
|
||||
*
|
||||
@verbatim
|
||||
===============================================================================
|
||||
##### IO operation function #####
|
||||
===============================================================================
|
||||
[..]
|
||||
This subsection provides functions allowing to manage the UART interrupts
|
||||
and to handle Wake up interrupt call-back.
|
||||
|
||||
(#) Non-Blocking mode API with Interrupt is :
|
||||
(++) HAL_UART_IRQHandler()
|
||||
|
||||
(#) Callback provided in No_Blocking mode:
|
||||
(++) HAL_UART_WakeupCallback()
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function handles UART interrupt request.
|
||||
* @param huart: uart handle
|
||||
* @retval None
|
||||
*/
|
||||
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* UART parity error interrupt occurred -------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_PE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_PE) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_PEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_PE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART frame error interrupt occured --------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_FE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_FEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_FE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART noise error interrupt occured --------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_NE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_NEF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_NE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* UART Over-Run interrupt occured -----------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_ORE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_ERR) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_OREF);
|
||||
|
||||
huart->ErrorCode |= HAL_UART_ERROR_ORE;
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
}
|
||||
|
||||
/* Call UART Error Call back function if need be --------------------------*/
|
||||
if(huart->ErrorCode != HAL_UART_ERROR_NONE)
|
||||
{
|
||||
HAL_UART_ErrorCallback(huart);
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/* UART wakeup from Stop mode interrupt occurred -------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_WUF) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_WUF) != RESET))
|
||||
{
|
||||
__HAL_UART_CLEAR_IT(huart, UART_CLEAR_WUF);
|
||||
/* Set the UART state ready to be able to start again the process */
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
HAL_UART_WakeupCallback(huart);
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
|
||||
/* UART in mode Receiver ---------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_RXNE) != RESET) && (__HAL_UART_GET_IT_SOURCE(huart, UART_IT_RXNE) != RESET))
|
||||
{
|
||||
UART_Receive_IT(huart);
|
||||
/* Clear RXNE interrupt flag */
|
||||
__HAL_UART_SEND_REQ(huart, UART_RXDATA_FLUSH_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
/* UART in mode Transmitter ------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_TXE) != RESET) &&(__HAL_UART_GET_IT_SOURCE(huart, UART_IT_TXE) != RESET))
|
||||
{
|
||||
UART_Transmit_IT(huart);
|
||||
}
|
||||
|
||||
/* UART in mode Transmitter ------------------------------------------------*/
|
||||
if((__HAL_UART_GET_IT(huart, UART_IT_TC) != RESET) &&(__HAL_UART_GET_IT_SOURCE(huart, UART_IT_TC) != RESET))
|
||||
{
|
||||
UART_EndTransmit_IT(huart);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief UART wakeup from Stop mode callback
|
||||
* @param huart: uart handle
|
||||
* @retval None
|
||||
*/
|
||||
__weak void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* NOTE : This function should not be modified, when the callback is needed,
|
||||
the HAL_UART_WakeupCallback can be implemented in the user file
|
||||
*/
|
||||
}
|
||||
#endif /*!defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup UARTEx_Exported_Functions_Group3 Extended Peripheral Control functions
|
||||
* @brief Extended Peripheral Control functions
|
||||
*
|
||||
|
@ -435,19 +443,17 @@ HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLe
|
|||
This subsection provides extended functions allowing to control the UART.
|
||||
(+) HAL_MultiProcessorEx_AddressLength_Set() API optionally sets the UART node address
|
||||
detection length to more than 4 bits for multiprocessor address mark wake up.
|
||||
(+) HAL_UART_EnableStopMode() API allows the UART to wake up the MCU from Stop mode as
|
||||
(+) HAL_UARTEx_StopModeWakeUpSourceConfig() API sets Wakeup from Stop mode interrupt flag selection
|
||||
(+) HAL_UARTEx_EnableStopMode() API allows the UART to wake up the MCU from Stop mode as
|
||||
long as UART clock is HSI or LSE
|
||||
(+) HAL_UART_DisableStopMode() API disables the above feature
|
||||
(+) HAL_MultiProcessorEx_AddressLength_Set() API configures the address length when the
|
||||
wake-up event is the address match feature
|
||||
(+) UART_Wakeup_AddressConfig() API sets the reference address used when address
|
||||
match feature is carried out
|
||||
(+) HAL_UARTEx_DisableStopMode() API disables the above feature
|
||||
(+) HAL_LIN_SendBreak() API transmits the break characters
|
||||
|
||||
@endverbatim
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Set Wakeup from Stop mode interrupt flag selection
|
||||
* @param huart: uart handle,
|
||||
|
@ -551,7 +557,7 @@ HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart)
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @brief By default in multiprocessor mode, when the wake up method is set
|
||||
|
@ -570,7 +576,7 @@ HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart)
|
|||
HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength)
|
||||
{
|
||||
/* Check the UART handle allocation */
|
||||
if(huart == HAL_NULL)
|
||||
if(huart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -594,26 +600,34 @@ HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *hua
|
|||
}
|
||||
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Initializes the UART wake-up from stop mode parameters when triggered by address detection.
|
||||
* @param huart: uart handle
|
||||
* @param WakeUpSelection: UART wake up from stop mode parameters
|
||||
* @brief Transmits break characters.
|
||||
* @param huart: UART handle
|
||||
* @retval HAL status
|
||||
*/
|
||||
static void UART_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
|
||||
*/
|
||||
HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart)
|
||||
{
|
||||
/* Check parmeters */
|
||||
assert_param(IS_UART_WAKEUP_INSTANCE(huart->Instance));
|
||||
assert_param(IS_UART_ADDRESSLENGTH_DETECT(WakeUpSelection.AddressLength));
|
||||
|
||||
/* Set the USART address length */
|
||||
MODIFY_REG(huart->Instance->CR2, USART_CR2_ADDM7, WakeUpSelection.AddressLength);
|
||||
|
||||
/* Set the USART address node */
|
||||
MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)WakeUpSelection.Address << UART_CR2_ADDRESS_LSB_POS));
|
||||
/* Check the parameters */
|
||||
assert_param(IS_UART_INSTANCE(huart->Instance));
|
||||
|
||||
/* Process Locked */
|
||||
__HAL_LOCK(huart);
|
||||
|
||||
huart->State = HAL_UART_STATE_BUSY;
|
||||
|
||||
/* Send break characters */
|
||||
huart->Instance->RQR |= UART_SENDBREAK_REQUEST;
|
||||
|
||||
huart->State = HAL_UART_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(huart);
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -656,6 +670,27 @@ static HAL_StatusTypeDef UART_EndTransmit_IT(UART_HandleTypeDef *huart)
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
/**
|
||||
* @brief Initializes the UART wake-up from stop mode parameters when triggered by address detection.
|
||||
* @param huart: uart handle
|
||||
* @param WakeUpSelection: UART wake up from stop mode parameters
|
||||
* @retval HAL status
|
||||
*/
|
||||
static void UART_Wakeup_AddressConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection)
|
||||
{
|
||||
/* Check parmeters */
|
||||
assert_param(IS_UART_WAKEUP_INSTANCE(huart->Instance));
|
||||
assert_param(IS_UART_ADDRESSLENGTH_DETECT(WakeUpSelection.AddressLength));
|
||||
|
||||
/* Set the USART address length */
|
||||
MODIFY_REG(huart->Instance->CR2, USART_CR2_ADDM7, WakeUpSelection.AddressLength);
|
||||
|
||||
/* Set the USART address node */
|
||||
MODIFY_REG(huart->Instance->CR2, USART_CR2_ADD, ((uint32_t)WakeUpSelection.Address << UART_CR2_ADDRESS_LSB_POS));
|
||||
}
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_uart_ex.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief Header file of UART HAL Extension module.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
|
@ -55,6 +55,31 @@
|
|||
*/
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
/** @defgroup UARTEx_Exported_Types UARTEx Exported Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief UART wake up from stop mode parameters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t WakeUpEvent; /*!< Specifies which event will activat the Wakeup from Stop mode flag (WUF).
|
||||
This parameter can be a value of @ref UART_WakeUp_from_Stop_Selection.
|
||||
If set to UART_WAKEUP_ON_ADDRESS, the two other fields below must
|
||||
be filled up. */
|
||||
|
||||
uint16_t AddressLength; /*!< Specifies whether the address is 4 or 7-bit long.
|
||||
This parameter can be a value of @ref UART_WakeUp_Address_Length */
|
||||
|
||||
uint8_t Address; /*!< UART/USART node address (7-bit long max) */
|
||||
} UART_WakeUpTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/** @defgroup UARTEx_Exported_Constants UARTEx Exported Constants
|
||||
* @{
|
||||
|
@ -63,9 +88,9 @@
|
|||
/** @defgroup UARTEx_Word_Length UARTEx Word Length
|
||||
* @{
|
||||
*/
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
|
||||
#define UART_WORDLENGTH_7B ((uint32_t)USART_CR1_M1)
|
||||
#define UART_WORDLENGTH_8B ((uint32_t)0x00000000)
|
||||
#define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M0)
|
||||
|
@ -77,9 +102,9 @@
|
|||
#define UART_WORDLENGTH_9B ((uint32_t)USART_CR1_M)
|
||||
#define IS_UART_WORD_LENGTH(LENGTH) (((LENGTH) == UART_WORDLENGTH_8B) || \
|
||||
((LENGTH) == UART_WORDLENGTH_9B))
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -87,9 +112,9 @@
|
|||
/** @defgroup UARTEx_AutoBaud_Rate_Mode UARTEx Advanced Feature AutoBaud Rate Mode
|
||||
* @{
|
||||
*/
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
|
||||
#define UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT ((uint32_t)0x0000)
|
||||
#define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0)
|
||||
#define UART_ADVFEATURE_AUTOBAUDRATE_ON0X7FFRAME ((uint32_t)USART_CR2_ABRMODE_1)
|
||||
|
@ -103,15 +128,15 @@
|
|||
#define UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE ((uint32_t)USART_CR2_ABRMODE_0)
|
||||
#define IS_UART_ADVFEATURE_AUTOBAUDRATEMODE(MODE) (((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONSTARTBIT) || \
|
||||
((MODE) == UART_ADVFEATURE_AUTOBAUDRATE_ONFALLINGEDGE))
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
/** @defgroup UARTEx_LIN UARTEx Local Interconnection Network mode
|
||||
* @{
|
||||
*/
|
||||
|
@ -133,7 +158,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
/** @defgroup UART_Flags UARTEx Status Flags
|
||||
* Elements values convention: 0xXXXX
|
||||
|
@ -142,24 +167,24 @@
|
|||
*/
|
||||
#define UART_FLAG_REACK ((uint32_t)0x00400000)
|
||||
#define UART_FLAG_TEACK ((uint32_t)0x00200000)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_FLAG_WUF ((uint32_t)0x00100000)
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
#define UART_FLAG_RWU ((uint32_t)0x00080000)
|
||||
#define UART_FLAG_SBKF ((uint32_t)0x00040000
|
||||
#define UART_FLAG_CMF ((uint32_t)0x00020000)
|
||||
#define UART_FLAG_BUSY ((uint32_t)0x00010000)
|
||||
#define UART_FLAG_ABRF ((uint32_t)0x00008000)
|
||||
#define UART_FLAG_ABRE ((uint32_t)0x00004000)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#define UART_FLAG_EOBF ((uint32_t)0x00001000)
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#define UART_FLAG_RTOF ((uint32_t)0x00000800)
|
||||
#define UART_FLAG_CTS ((uint32_t)0x00000400)
|
||||
#define UART_FLAG_CTSIF ((uint32_t)0x00000200)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_FLAG_LBDF ((uint32_t)0x00000100)
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
#define UART_FLAG_TXE ((uint32_t)0x00000080)
|
||||
#define UART_FLAG_TC ((uint32_t)0x00000040)
|
||||
#define UART_FLAG_RXNE ((uint32_t)0x00000020)
|
||||
|
@ -173,13 +198,13 @@
|
|||
*/
|
||||
|
||||
/** @defgroup UART_Interrupt_definition UARTEx Interrupts Definition
|
||||
* Elements values convention: 0000ZZZZ0XXYYYYYb
|
||||
* Elements values convention: 0000ZZZZZ0XXYYYYYb
|
||||
* - YYYYY : Interrupt source position in the XX register (5bits)
|
||||
* - XX : Interrupt source register (2bits)
|
||||
* - 01: CR1 register
|
||||
* - 10: CR2 register
|
||||
* - 11: CR3 register
|
||||
* - ZZZZ : Flag position in the ISR register(4bits)
|
||||
* - ZZZZZ : Flag position in the ISR register(5bits)
|
||||
* @{
|
||||
*/
|
||||
#define UART_IT_PE ((uint16_t)0x0028)
|
||||
|
@ -187,14 +212,14 @@
|
|||
#define UART_IT_TC ((uint16_t)0x0626)
|
||||
#define UART_IT_RXNE ((uint16_t)0x0525)
|
||||
#define UART_IT_IDLE ((uint16_t)0x0424)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_IT_LBD ((uint16_t)0x0846)
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
#define UART_IT_CTS ((uint16_t)0x096A)
|
||||
#define UART_IT_CM ((uint16_t)0x142E)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#define UART_IT_CM ((uint16_t)0x112E)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_IT_WUF ((uint16_t)0x1476)
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -209,16 +234,16 @@
|
|||
#define UART_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
|
||||
#define UART_CLEAR_IDLEF USART_ICR_IDLECF /*!< IDLE line detected Clear Flag */
|
||||
#define UART_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_CLEAR_LBDF USART_ICR_LBDCF /*!< LIN Break Detection Clear Flag (not available on F030xx devices)*/
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
#define UART_CLEAR_CTSF USART_ICR_CTSCF /*!< CTS Interrupt Clear Flag */
|
||||
#define UART_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
|
||||
#define UART_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
|
||||
#define UART_CLEAR_CMF USART_ICR_CMCF /*!< Character Match Clear Flag */
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
#define UART_CLEAR_WUF USART_ICR_WUCF /*!< Wake Up from stop mode Clear Flag */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -247,7 +272,7 @@
|
|||
* @}
|
||||
*/
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC)
|
||||
/** @defgroup UART_Stop_Mode_Enable UARTEx Advanced Feature Stop Mode Enable
|
||||
* @{
|
||||
*/
|
||||
|
@ -271,7 +296,7 @@
|
|||
/**
|
||||
* @}
|
||||
*/
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) */
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -312,7 +337,7 @@
|
|||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined (STM32F030x8) || \
|
||||
#elif defined (STM32F030x8) || defined (STM32F070x6) || \
|
||||
defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F051x8) || defined (STM32F058xx)
|
||||
#define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
|
@ -347,6 +372,47 @@
|
|||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(STM32F070xB)
|
||||
#define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
if((__HANDLE__)->Instance == USART1) \
|
||||
{ \
|
||||
switch(__HAL_RCC_GET_USART1_SOURCE()) \
|
||||
{ \
|
||||
case RCC_USART1CLKSOURCE_PCLK1: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_HSI: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_SYSCLK: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_LSE: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
|
||||
break; \
|
||||
default: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART2) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART3) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART4) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx)
|
||||
#define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
|
@ -496,6 +562,55 @@
|
|||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
} \
|
||||
} while(0)
|
||||
#elif defined(STM32F030xC)
|
||||
#define __HAL_UART_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
|
||||
do { \
|
||||
if((__HANDLE__)->Instance == USART1) \
|
||||
{ \
|
||||
switch(__HAL_RCC_GET_USART1_SOURCE()) \
|
||||
{ \
|
||||
case RCC_USART1CLKSOURCE_PCLK1: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_HSI: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_HSI; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_SYSCLK: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_SYSCLK; \
|
||||
break; \
|
||||
case RCC_USART1CLKSOURCE_LSE: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_LSE; \
|
||||
break; \
|
||||
default: \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART2) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART3) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART4) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART5) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else if((__HANDLE__)->Instance == USART6) \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_PCLK1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(__CLOCKSOURCE__) = UART_CLOCKSOURCE_UNDEFINED; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#endif /* defined(STM32F030x6) || defined(STM32F031x6) || defined(STM32F038xx) */
|
||||
|
||||
|
@ -509,9 +624,9 @@
|
|||
* @param __HANDLE__: specifies the UART Handle
|
||||
* @retval none
|
||||
*/
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx)
|
||||
#if defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC)
|
||||
#define __HAL_UART_MASK_COMPUTATION(__HANDLE__) \
|
||||
do { \
|
||||
if ((__HANDLE__)->Init.WordLength == UART_WORDLENGTH_9B) \
|
||||
|
@ -574,9 +689,9 @@
|
|||
} \
|
||||
} \
|
||||
} while(0)
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) */
|
||||
#endif /* defined (STM32F042x6) || defined (STM32F048xx) || defined (STM32F070x6) || \
|
||||
defined (STM32F071xB) || defined (STM32F072xB) || defined (STM32F078xx) || defined (STM32F070xB) || \
|
||||
defined (STM32F091xC) || defined (STM32F098xx) || defined (STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -591,23 +706,25 @@
|
|||
* @{
|
||||
*/
|
||||
/* Initialization and de-initialization functions ****************************/
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
HAL_StatusTypeDef HAL_RS485Ex_Init(UART_HandleTypeDef *huart, uint32_t UART_DEPolarity, uint32_t UART_DEAssertionTime, uint32_t UART_DEDeassertionTime);
|
||||
HAL_StatusTypeDef HAL_LIN_Init(UART_HandleTypeDef *huart, uint32_t BreakDetectLength);
|
||||
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
|
||||
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart);
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup UARTEx_Exported_Functions_Group2
|
||||
* @brief Extended I/O operation functions
|
||||
* @brief Extended UART Interrupt handling function
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* I/O operation functions ***************************************************/
|
||||
/* IO operation functions ***************************************************/
|
||||
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart);
|
||||
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC)
|
||||
void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart);
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -618,9 +735,13 @@ void HAL_UART_WakeupCallback(UART_HandleTypeDef *huart);
|
|||
*/
|
||||
|
||||
/* Peripheral Control functions **********************************************/
|
||||
void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_MultiProcessorEx_AddressLength_Set(UART_HandleTypeDef *huart, uint32_t AddressLength);
|
||||
#if !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6) && !defined(STM32F030xC)
|
||||
HAL_StatusTypeDef HAL_UARTEx_StopModeWakeUpSourceConfig(UART_HandleTypeDef *huart, UART_WakeUpTypeDef WakeUpSelection);
|
||||
HAL_StatusTypeDef HAL_UARTEx_EnableStopMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_UARTEx_DisableStopMode(UART_HandleTypeDef *huart);
|
||||
HAL_StatusTypeDef HAL_LIN_SendBreak(UART_HandleTypeDef *huart);
|
||||
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070xB)&& !defined(STM32F070x6)&& !defined(STM32F030xC) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
******************************************************************************
|
||||
* @file stm32f0xx_hal_usart.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 03-Oct-2014
|
||||
* @version V1.2.0
|
||||
* @date 11-December-2014
|
||||
* @brief USART HAL module driver.
|
||||
* This file provides firmware functions to manage the following
|
||||
* functionalities of the Universal Synchronous Asynchronous Receiver Transmitter (USART) peripheral:
|
||||
|
@ -253,7 +253,7 @@ static HAL_StatusTypeDef USART_TransmitReceive_IT(USART_HandleTypeDef *husart);
|
|||
HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart)
|
||||
{
|
||||
/* Check the USART handle allocation */
|
||||
if(husart == HAL_NULL)
|
||||
if(husart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ HAL_StatusTypeDef HAL_USART_Init(USART_HandleTypeDef *husart)
|
|||
HAL_StatusTypeDef HAL_USART_DeInit(USART_HandleTypeDef *husart)
|
||||
{
|
||||
/* Check the USART handle allocation */
|
||||
if(husart == HAL_NULL)
|
||||
if(husart == NULL)
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ HAL_StatusTypeDef HAL_USART_Transmit(USART_HandleTypeDef *husart, uint8_t *pTxDa
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ HAL_StatusTypeDef HAL_USART_Receive(USART_HandleTypeDef *husart, uint8_t *pRxDat
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ HAL_StatusTypeDef HAL_USART_TransmitReceive(USART_HandleTypeDef *husart, uint8_t
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ HAL_StatusTypeDef HAL_USART_Transmit_IT(USART_HandleTypeDef *husart, uint8_t *pT
|
|||
{
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ HAL_StatusTypeDef HAL_USART_Receive_IT(USART_HandleTypeDef *husart, uint8_t *pRx
|
|||
{
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ HAL_StatusTypeDef HAL_USART_TransmitReceive_IT(USART_HandleTypeDef *husart, uint
|
|||
{
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ HAL_StatusTypeDef HAL_USART_Transmit_DMA(USART_HandleTypeDef *husart, uint8_t *p
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ HAL_StatusTypeDef HAL_USART_Receive_DMA(USART_HandleTypeDef *husart, uint8_t *pR
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ HAL_StatusTypeDef HAL_USART_TransmitReceive_DMA(USART_HandleTypeDef *husart, uin
|
|||
|
||||
if(husart->State == HAL_USART_STATE_READY)
|
||||
{
|
||||
if((pTxData == HAL_NULL) || (pRxData == HAL_NULL) || (Size == 0))
|
||||
if((pTxData == NULL) || (pRxData == NULL) || (Size == 0))
|
||||
{
|
||||
return HAL_ERROR;
|
||||
}
|
||||
|
@ -1095,12 +1095,12 @@ HAL_StatusTypeDef HAL_USART_DMAStop(USART_HandleTypeDef *husart)
|
|||
husart->Instance->CR3 &= ~USART_CR3_DMAR;
|
||||
|
||||
/* Abort the USART DMA tx Channel */
|
||||
if(husart->hdmatx != HAL_NULL)
|
||||
if(husart->hdmatx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(husart->hdmatx);
|
||||
}
|
||||
/* Abort the USART DMA rx Channel */
|
||||
if(husart->hdmarx != HAL_NULL)
|
||||
if(husart->hdmarx != NULL)
|
||||
{
|
||||
HAL_DMA_Abort(husart->hdmarx);
|
||||
}
|
||||
|
@ -1466,7 +1466,7 @@ static HAL_StatusTypeDef USART_WaitOnFlagUntilTimeout(USART_HandleTypeDef *husar
|
|||
__HAL_USART_DISABLE_IT(husart, USART_IT_PE);
|
||||
__HAL_USART_DISABLE_IT(husart, USART_IT_ERR);
|
||||
|
||||
husart->State= HAL_USART_STATE_TIMEOUT;
|
||||
husart->State= HAL_USART_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(husart);
|
||||
|
@ -1491,7 +1491,7 @@ static HAL_StatusTypeDef USART_WaitOnFlagUntilTimeout(USART_HandleTypeDef *husar
|
|||
__HAL_USART_DISABLE_IT(husart, USART_IT_PE);
|
||||
__HAL_USART_DISABLE_IT(husart, USART_IT_ERR);
|
||||
|
||||
husart->State= HAL_USART_STATE_TIMEOUT;
|
||||
husart->State= HAL_USART_STATE_READY;
|
||||
|
||||
/* Process Unlocked */
|
||||
__HAL_UNLOCK(husart);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue