├── README ├── .gitignore ├── stm32vl-discovery ├── main ├── lib │ ├── inc │ │ ├── peripherals │ │ │ ├── stm32f10x_fsmc.h │ │ │ ├── stm32f10x_crc.h │ │ │ ├── stm32f10x_wwdg.h │ │ │ ├── stm32f10x_dbgmcu.h │ │ │ ├── stm32f10x_rtc.h │ │ │ ├── stm32f10x_iwdg.h │ │ │ ├── stm32f10x_pwr.h │ │ │ ├── stm32f10x_cec.h │ │ │ ├── stm32f10x_exti.h │ │ │ └── stm32f10x_bkp.h │ │ ├── core │ │ │ └── system_stm32f10x.h │ │ ├── stm32f10x_conf.h │ │ └── STM32vldiscovery.h │ ├── src │ │ ├── peripherals │ │ │ ├── stm32f10x_adc.c │ │ │ ├── stm32f10x_can.c │ │ │ ├── stm32f10x_dac.c │ │ │ ├── stm32f10x_dma.c │ │ │ ├── stm32f10x_exti.c │ │ │ ├── stm32f10x_fsmc.c │ │ │ ├── stm32f10x_i2c.c │ │ │ ├── stm32f10x_rcc.c │ │ │ ├── stm32f10x_rtc.c │ │ │ ├── stm32f10x_sdio.c │ │ │ ├── stm32f10x_tim.c │ │ │ ├── stm32f10x_flash.c │ │ │ ├── stm32f10x_usart.c │ │ │ ├── stm32f10x_crc.c │ │ │ ├── stm32f10x_iwdg.c │ │ │ ├── stm32f10x_dbgmcu.c │ │ │ ├── stm32f10x_wwdg.c │ │ │ └── misc.c │ │ └── STM32vldiscovery.c │ └── Makefile ├── Makefile ├── inc │ ├── stm32f10x_it.h │ └── stm32f10x_conf.h ├── src │ ├── stm32f10x_it.c │ └── main.c └── stm32f100.ld └── stm32f4-discovery ├── stm32_flash.ld ├── lib ├── .Makefile.swp ├── inc │ ├── stm32f4xx.h │ ├── stm32f4xx.h~ │ ├── core │ │ └── arm_common_tables.h │ ├── peripherals │ │ ├── stm32f4xx_crc.h │ │ ├── stm32f4xx_wwdg.h │ │ ├── stm32f4xx_rng.h │ │ ├── stm32f4xx_dbgmcu.h │ │ ├── stm32f4xx_iwdg.h │ │ ├── stm32f4xx_pwr.h │ │ ├── misc.h │ │ └── stm32f4xx_syscfg.h │ ├── system_stm32f4xx.h │ ├── pdm_filter.h │ ├── stm32f4xx_conf.h │ ├── stm32f4xx_conf.h~ │ ├── stm32f4_discovery.h │ └── stm32f4_discovery.h~ ├── src │ └── peripherals │ │ ├── stm32f4xx_flash.c │ │ ├── stm32f4xx_crc.c │ │ └── stm32f4xx_dbgmcu.c └── Makefile ├── inc ├── .stm32f4xx_conf.h.swp ├── stm32f4xx_it.h └── stm32f4xx_conf.h ├── Makefile └── src ├── main.c └── stm32f4xx_it.c /README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.hex 4 | *.bin 5 | *.elf 6 | -------------------------------------------------------------------------------- /stm32vl-discovery/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/main -------------------------------------------------------------------------------- /stm32f4-discovery/stm32_flash.ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/stm32_flash.ld -------------------------------------------------------------------------------- /stm32f4-discovery/lib/.Makefile.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/lib/.Makefile.swp -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/lib/inc/stm32f4xx.h -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4xx.h~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/lib/inc/stm32f4xx.h~ -------------------------------------------------------------------------------- /stm32f4-discovery/inc/.stm32f4xx_conf.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/inc/.stm32f4xx_conf.h.swp -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_fsmc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/inc/peripherals/stm32f10x_fsmc.h -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_adc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_adc.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_can.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_can.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_dac.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_dac.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_dma.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_dma.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_exti.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_exti.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_fsmc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_fsmc.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_i2c.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_rcc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_rcc.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_rtc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_rtc.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_sdio.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_sdio.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_tim.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_tim.c -------------------------------------------------------------------------------- /stm32f4-discovery/lib/src/peripherals/stm32f4xx_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32f4-discovery/lib/src/peripherals/stm32f4xx_flash.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_flash.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeremyherbert/stm32-templates/HEAD/stm32vl-discovery/lib/src/peripherals/stm32f10x_usart.c -------------------------------------------------------------------------------- /stm32vl-discovery/lib/Makefile: -------------------------------------------------------------------------------- 1 | vpath %.c $(LIB_ROOT)/src $(LIB_ROOT)/src/core $(LIB_ROOT)/src/peripherals 2 | 3 | CFLAGS+= -I$(LIB_ROOT)/inc -I$(LIB_ROOT)/inc/core -I$(LIB_ROOT)/inc/peripherals 4 | 5 | SRCS = STM32vldiscovery.c 6 | SRCS += misc.c stm32f10x_dac.c stm32f10x_gpio.c stm32f10x_sdio.c \ 7 | stm32f10x_adc.c stm32f10x_dbgmcu.c stm32f10x_i2c.c stm32f10x_spi.c \ 8 | stm32f10x_bkp.c stm32f10x_dma.c stm32f10x_iwdg.c stm32f10x_tim.c \ 9 | stm32f10x_can.c stm32f10x_exti.c stm32f10x_pwr.c stm32f10x_usart.c \ 10 | stm32f10x_cec.c stm32f10x_flash.c stm32f10x_rcc.c stm32f10x_wwdg.c \ 11 | stm32f10x_crc.c stm32f10x_fsmc.c stm32f10x_rtc.c 12 | SRCS += core_cm3.c system_stm32f10x.c 13 | 14 | OBJS = $(SRCS:.c=.o) 15 | 16 | libstm32f10x.a: $(OBJS) 17 | $(AR) rcs $@ $(OBJS) 18 | 19 | clean: 20 | rm -f $(OBJS) libstm32f10x.a 21 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/Makefile: -------------------------------------------------------------------------------- 1 | CC=arm-none-eabi-gcc 2 | AR=arm-none-eabi-ar 3 | 4 | ########################################### 5 | 6 | vpath %.c src src/peripherals 7 | 8 | CFLAGS = -g -O2 -Wall 9 | CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork 10 | CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 11 | CFLAGS += -ffreestanding -nostdlib 12 | CFLAGS += -Iinc -Iinc/core -Iinc/peripherals 13 | 14 | #SRCS = stm32f4_discovery.c 15 | SRCS = misc.c stm32f4xx_dma.c stm32f4xx_rcc.c stm32f4xx_adc.c \ 16 | stm32f4xx_exti.c stm32f4xx_rng.c stm32f4xx_can.c stm32f4xx_flash.c \ 17 | stm32f4xx_rtc.c stm32f4xx_crc.c stm32f4xx_fsmc.c stm32f4xx_sdio.c \ 18 | stm32f4xx_cryp_aes.c stm32f4xx_gpio.c stm32f4xx_spi.c \ 19 | stm32f4xx_cryp.c stm32f4xx_hash.c stm32f4xx_syscfg.c \ 20 | stm32f4xx_cryp_des.c stm32f4xx_hash_md5.c stm32f4xx_tim.c \ 21 | stm32f4xx_cryp_tdes.c stm32f4xx_hash_sha1.c stm32f4xx_usart.c \ 22 | stm32f4xx_dac.c stm32f4xx_i2c.c stm32f4xx_wwdg.c \ 23 | stm32f4xx_dbgmcu.c stm32f4xx_iwdg.c \ 24 | stm32f4xx_dcmi.c stm32f4xx_pwr.c 25 | 26 | OBJS = $(SRCS:.c=.o) 27 | 28 | .PHONY: libstm32f4.a 29 | 30 | all: libstm32f4.a 31 | 32 | %.o : %.c 33 | $(CC) $(CFLAGS) -c -o $@ $^ 34 | 35 | libstm32f4.a: $(OBJS) 36 | $(AR) -r $@ $(OBJS) 37 | 38 | clean: 39 | rm -f $(OBJS) libstm32f4.a 40 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/core/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern uint16_t armBitRevTable[256]; 30 | extern q15_t armRecipTableQ15[64]; 31 | extern q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | 35 | #endif /* ARM_COMMON_TABLES_H */ 36 | -------------------------------------------------------------------------------- /stm32f4-discovery/Makefile: -------------------------------------------------------------------------------- 1 | # put your *.o targets here, make should handle the rest! 2 | 3 | SRCS = main.c stm32f4xx_it.c system_stm32f4xx.c 4 | 5 | # all the files will be generated with this name (main.elf, main.bin, main.hex, etc) 6 | 7 | PROJ_NAME=main 8 | 9 | # that's it, no need to change anything below this line! 10 | 11 | ################################################### 12 | 13 | CC=arm-none-eabi-gcc 14 | OBJCOPY=arm-none-eabi-objcopy 15 | 16 | CFLAGS = -g -O2 -Wall -Tstm32_flash.ld 17 | CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork 18 | CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 19 | 20 | ################################################### 21 | 22 | vpath %.c src 23 | vpath %.a lib 24 | 25 | ROOT=$(shell pwd) 26 | 27 | CFLAGS += -Iinc -Ilib -Ilib/inc 28 | CFLAGS += -Ilib/inc/core -Ilib/inc/peripherals 29 | 30 | SRCS += lib/startup_stm32f4xx.s # add startup file to build 31 | 32 | OBJS = $(SRCS:.c=.o) 33 | 34 | ################################################### 35 | 36 | .PHONY: lib proj 37 | 38 | all: lib proj 39 | 40 | lib: 41 | $(MAKE) -C lib 42 | 43 | proj: $(PROJ_NAME).elf 44 | 45 | $(PROJ_NAME).elf: $(SRCS) 46 | $(CC) $(CFLAGS) $^ -o $@ -Llib -lstm32f4 47 | $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex 48 | $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin 49 | 50 | clean: 51 | $(MAKE) -C lib clean 52 | rm -f $(PROJ_NAME).elf 53 | rm -f $(PROJ_NAME).hex 54 | rm -f $(PROJ_NAME).bin 55 | -------------------------------------------------------------------------------- /stm32vl-discovery/Makefile: -------------------------------------------------------------------------------- 1 | # put your *.o targets here, make should handle the rest! 2 | 3 | OBJS = main.o stm32f10x_it.o 4 | 5 | # all the files will be generated with this name (main.elf, main.bin, main.hex, etc) 6 | 7 | PROJ_NAME=main 8 | 9 | # that's it, no need to change anything below this line! 10 | 11 | ################################################### 12 | 13 | export CC=arm-none-eabi-gcc 14 | export LD=arm-none-eabi-gcc 15 | export AR=arm-none-eabi-ar 16 | export AS=arm-none-eabi-as 17 | export OBJCOPY=arm-none-eabi-objcopy 18 | 19 | export ASFLAGS=-g 20 | export LDFLAGS=-Tstm32f100.ld -Llib 21 | export CFLAGS=-g -O1 -c -fno-common -mcpu=cortex-m3 -mthumb -DSTM32F10X_MD_VL=1 -DUSE_STDPERIPH_DRIVER=1 22 | 23 | CWD = $(shell pwd) 24 | export ROOT=$(CWD) 25 | export LIB_ROOT=$(ROOT)/lib 26 | 27 | ################################################### 28 | 29 | vpath %.c $(ROOT)/src 30 | 31 | CFLAGS += -I$(ROOT)/inc -I$(LIB_ROOT) -I$(LIB_ROOT)/inc 32 | CFLAGS += -I$(LIB_ROOT)/inc/core -I$(LIB_ROOT)/inc/peripherals 33 | 34 | OBJS += $(LIB_ROOT)/startup_stm32f10x_md_vl.s # add startup file to build 35 | 36 | ################################################### 37 | 38 | .PHONY: lib proj 39 | 40 | all: lib proj 41 | 42 | lib: 43 | $(MAKE) -C lib 44 | 45 | proj: $(PROJ_NAME).elf 46 | 47 | $(PROJ_NAME).elf: $(OBJS) 48 | $(LD) $(LDFLAGS) -o $@ $(OBJS) -lstm32f10x 49 | $(OBJCOPY) -O ihex $(PROJ_NAME).elf $(PROJ_NAME).hex 50 | $(OBJCOPY) -O binary $(PROJ_NAME).elf $(PROJ_NAME).bin 51 | 52 | clean: 53 | rm -f *.o 54 | rm -f lib/*.o 55 | rm -f lib/libstm32f10x.a 56 | rm -f $(PROJ_NAME).elf 57 | rm -f $(PROJ_NAME).hex 58 | rm -f $(PROJ_NAME).bin 59 | -------------------------------------------------------------------------------- /stm32vl-discovery/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Demo/inc/stm32f10x_it.h 4 | * @author MCD Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_IT_H 23 | #define __STM32F10x_IT_H 24 | 25 | /* Includes ------------------------------------------------------------------*/ 26 | #include "stm32f10x.h" 27 | 28 | /* Exported types ------------------------------------------------------------*/ 29 | extern vu32 TickValue; 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported functions ------------------------------------------------------- */ 33 | 34 | void NMI_Handler(void); 35 | void HardFault_Handler(void); 36 | void MemManage_Handler(void); 37 | void BusFault_Handler(void); 38 | void UsageFault_Handler(void); 39 | void SVC_Handler(void); 40 | void DebugMon_Handler(void); 41 | void PendSV_Handler(void); 42 | void SysTick_Handler(void); 43 | 44 | #endif /* __STM32F10x_IT_H */ 45 | 46 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /stm32f4-discovery/inc/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_IT_H 24 | #define __STM32F4xx_IT_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F4xx_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CRC_H 24 | #define __STM32F10x_CRC_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup CRC 38 | * @{ 39 | */ 40 | 41 | /** @defgroup CRC_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup CRC_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | /** @defgroup CRC_Exported_Macros 58 | * @{ 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup CRC_Exported_Functions 66 | * @{ 67 | */ 68 | 69 | void CRC_ResetDR(void); 70 | uint32_t CRC_CalcCRC(uint32_t Data); 71 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 72 | uint32_t CRC_GetCRC(void); 73 | void CRC_SetIDRegister(uint8_t IDValue); 74 | uint8_t CRC_GetIDRegister(void); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* __STM32F10x_CRC_H */ 81 | /** 82 | * @} 83 | */ 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/core/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * 10 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 11 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 12 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 13 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 14 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 15 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 16 | * 17 | *

© COPYRIGHT 2010 STMicroelectronics

18 | ****************************************************************************** 19 | */ 20 | 21 | /** @addtogroup CMSIS 22 | * @{ 23 | */ 24 | 25 | /** @addtogroup stm32f10x_system 26 | * @{ 27 | */ 28 | 29 | /** 30 | * @brief Define to prevent recursive inclusion 31 | */ 32 | #ifndef __SYSTEM_STM32F10X_H 33 | #define __SYSTEM_STM32F10X_H 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /** @addtogroup STM32F10x_System_Includes 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @} 45 | */ 46 | 47 | 48 | /** @addtogroup STM32F10x_System_Exported_types 49 | * @{ 50 | */ 51 | 52 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @addtogroup STM32F10x_System_Exported_Constants 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F10x_System_Exported_Macros 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F10x_System_Exported_Functions 75 | * @{ 76 | */ 77 | 78 | extern void SystemInit(void); 79 | extern void SystemCoreClockUpdate(void); 80 | /** 81 | * @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /*__SYSTEM_STM32F10X_H */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 98 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_CRC_H 25 | #define __STM32F4xx_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup CRC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions --------------------------------------------------------*/ 55 | 56 | void CRC_ResetDR(void); 57 | uint32_t CRC_CalcCRC(uint32_t Data); 58 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 59 | uint32_t CRC_GetCRC(void); 60 | void CRC_SetIDRegister(uint8_t IDValue); 61 | uint8_t CRC_GetIDRegister(void); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F4xx_CRC_H */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/pdm_filter.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file pdm_filter.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 28-October-2011 7 | * @brief Header file for PDM audio software decoding Library. 8 | * This Library is used to decode and reconstruct the audio signal 9 | * produced by MP45DT02 MEMS microphone from STMicroelectronics. 10 | * For more details about this Library, please refer to document 11 | * "PDM audio software decoding on STM32 microcontrollers (AN3998)". 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 16 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 17 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 18 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 19 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 20 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 21 | * 22 | *

© COPYRIGHT 2011 STMicroelectronics

23 | ****************************************************************************** 24 | */ 25 | 26 | /* Define to prevent recursive inclusion -------------------------------------*/ 27 | #ifndef __PDM_FILTER_H 28 | #define __PDM_FILTER_H 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | #include 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | typedef struct { 39 | uint16_t Fs; 40 | float LP_HZ; 41 | float HP_HZ; 42 | uint16_t In_MicChannels; 43 | uint16_t Out_MicChannels; 44 | char InternalFilter[34]; 45 | } PDMFilter_InitStruct; 46 | 47 | /* Exported constants --------------------------------------------------------*/ 48 | /* Exported macros -----------------------------------------------------------*/ 49 | #define HTONS(A) ((((u16)(A) & 0xff00) >> 8) | \ 50 | (((u16)(A) & 0x00ff) << 8)) 51 | 52 | /* Exported functions ------------------------------------------------------- */ 53 | void PDM_Filter_Init(PDMFilter_InitStruct * Filter); 54 | 55 | int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 56 | int32_t PDM_Filter_80_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 57 | int32_t PDM_Filter_64_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 58 | int32_t PDM_Filter_80_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* __PDM_FILTER_H */ 65 | 66 | /*******************(C)COPYRIGHT 2011 STMicroelectronics *****END OF FILE******/ 67 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Demo/inc/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_CONF_H 23 | #define __STM32F10x_CONF_H 24 | 25 | /* Includes ------------------------------------------------------------------*/ 26 | /* Uncomment the line below to enable peripheral header file inclusion */ 27 | #include "stm32f10x_adc.h" 28 | #include "stm32f10x_bkp.h" 29 | #include "stm32f10x_can.h" 30 | #include "stm32f10x_crc.h" 31 | #include "stm32f10x_dac.h" 32 | #include "stm32f10x_dbgmcu.h" 33 | #include "stm32f10x_dma.h" 34 | #include "stm32f10x_exti.h" 35 | #include "stm32f10x_flash.h" 36 | #include "stm32f10x_fsmc.h" 37 | #include "stm32f10x_gpio.h" 38 | #include "stm32f10x_i2c.h" 39 | #include "stm32f10x_iwdg.h" 40 | #include "stm32f10x_pwr.h" 41 | #include "stm32f10x_rcc.h" 42 | #include "stm32f10x_rtc.h" 43 | #include "stm32f10x_sdio.h" 44 | #include "stm32f10x_spi.h" 45 | #include "stm32f10x_tim.h" 46 | #include "stm32f10x_usart.h" 47 | #include "stm32f10x_wwdg.h" 48 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 49 | 50 | /* Exported types ------------------------------------------------------------*/ 51 | /* Exported constants --------------------------------------------------------*/ 52 | /* Uncomment the line below to expanse the "assert_param" macro in the 53 | Standard Peripheral Library drivers code */ 54 | /* #define USE_FULL_ASSERT 1 */ 55 | 56 | /* Exported macro ------------------------------------------------------------*/ 57 | #ifdef USE_FULL_ASSERT 58 | 59 | /** 60 | * @brief The assert_param macro is used for function's parameters check. 61 | * @param expr: If expr is false, it calls assert_failed function 62 | * which reports the name of the source file and the source 63 | * line number of the call that failed. 64 | * If expr is true, it returns no value. 65 | * @retval None 66 | */ 67 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 68 | /* Exported functions ------------------------------------------------------- */ 69 | void assert_failed(uint8_t* file, uint32_t line); 70 | #else 71 | #define assert_param(expr) ((void)0) 72 | #endif /* USE_FULL_ASSERT */ 73 | 74 | #endif /* __STM32F10x_CONF_H */ 75 | 76 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /stm32vl-discovery/inc/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Demo/inc/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_CONF_H 23 | #define __STM32F10x_CONF_H 24 | 25 | /* Includes ------------------------------------------------------------------*/ 26 | /* Uncomment the line below to enable peripheral header file inclusion */ 27 | /* #include "stm32f10x_adc.h" */ 28 | /* #include "stm32f10x_bkp.h" */ 29 | /* #include "stm32f10x_can.h" */ 30 | /* #include "stm32f10x_crc.h" */ 31 | /* #include "stm32f10x_dac.h" */ 32 | /* #include "stm32f10x_dbgmcu.h" */ 33 | /* #include "stm32f10x_dma.h" */ 34 | #include "stm32f10x_exti.h" 35 | #include "stm32f10x_flash.h" 36 | /* #include "stm32f10x_fsmc.h" */ 37 | #include "stm32f10x_gpio.h" 38 | /* #include "stm32f10x_i2c.h" */ 39 | /* #include "stm32f10x_iwdg.h" */ 40 | #include "stm32f10x_pwr.h" 41 | #include "stm32f10x_rcc.h" 42 | /* #include "stm32f10x_rtc.h" */ 43 | /* #include "stm32f10x_sdio.h" */ 44 | /* #include "stm32f10x_spi.h" */ 45 | /* #include "stm32f10x_tim.h" */ 46 | /* #include "stm32f10x_usart.h" */ 47 | /* #include "stm32f10x_wwdg.h" */ 48 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 49 | 50 | /* Exported types ------------------------------------------------------------*/ 51 | /* Exported constants --------------------------------------------------------*/ 52 | /* Uncomment the line below to expanse the "assert_param" macro in the 53 | Standard Peripheral Library drivers code */ 54 | /* #define USE_FULL_ASSERT 1 */ 55 | 56 | /* Exported macro ------------------------------------------------------------*/ 57 | #ifdef USE_FULL_ASSERT 58 | 59 | /** 60 | * @brief The assert_param macro is used for function's parameters check. 61 | * @param expr: If expr is false, it calls assert_failed function 62 | * which reports the name of the source file and the source 63 | * line number of the call that failed. 64 | * If expr is true, it returns no value. 65 | * @retval None 66 | */ 67 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 68 | /* Exported functions ------------------------------------------------------- */ 69 | void assert_failed(uint8_t* file, uint32_t line); 70 | #else 71 | #define assert_param(expr) ((void)0) 72 | #endif /* USE_FULL_ASSERT */ 73 | 74 | #endif /* __STM32F10x_CONF_H */ 75 | 76 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_WWDG_H 24 | #define __STM32F10x_WWDG_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup WWDG 38 | * @{ 39 | */ 40 | 41 | /** @defgroup WWDG_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup WWDG_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** @defgroup WWDG_Prescaler 54 | * @{ 55 | */ 56 | 57 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 58 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 59 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 60 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 61 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 62 | ((PRESCALER) == WWDG_Prescaler_2) || \ 63 | ((PRESCALER) == WWDG_Prescaler_4) || \ 64 | ((PRESCALER) == WWDG_Prescaler_8)) 65 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 66 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup WWDG_Exported_Macros 77 | * @{ 78 | */ 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup WWDG_Exported_Functions 84 | * @{ 85 | */ 86 | 87 | void WWDG_DeInit(void); 88 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 89 | void WWDG_SetWindowValue(uint8_t WindowValue); 90 | void WWDG_EnableIT(void); 91 | void WWDG_SetCounter(uint8_t Counter); 92 | void WWDG_Enable(uint8_t Counter); 93 | FlagStatus WWDG_GetFlagStatus(void); 94 | void WWDG_ClearFlag(void); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* __STM32F10x_WWDG_H */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_WWDG_H 25 | #define __STM32F4xx_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup WWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup WWDG_Prescaler 50 | * @{ 51 | */ 52 | 53 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 54 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 55 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 56 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 57 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 58 | ((PRESCALER) == WWDG_Prescaler_2) || \ 59 | ((PRESCALER) == WWDG_Prescaler_4) || \ 60 | ((PRESCALER) == WWDG_Prescaler_8)) 61 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 62 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /* Exported macro ------------------------------------------------------------*/ 73 | /* Exported functions --------------------------------------------------------*/ 74 | 75 | /* Function used to set the WWDG configuration to the default reset state ****/ 76 | void WWDG_DeInit(void); 77 | 78 | /* Prescaler, Refresh window and Counter configuration functions **************/ 79 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 80 | void WWDG_SetWindowValue(uint8_t WindowValue); 81 | void WWDG_EnableIT(void); 82 | void WWDG_SetCounter(uint8_t Counter); 83 | 84 | /* WWDG activation function ***************************************************/ 85 | void WWDG_Enable(uint8_t Counter); 86 | 87 | /* Interrupts and flags management functions **********************************/ 88 | FlagStatus WWDG_GetFlagStatus(void); 89 | void WWDG_ClearFlag(void); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* __STM32F4xx_WWDG_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/src/peripherals/stm32f4xx_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f4xx_crc.h" 24 | 25 | /** @addtogroup STM32F4xx_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /* Private typedef -----------------------------------------------------------*/ 35 | /* Private define ------------------------------------------------------------*/ 36 | /* Private macro -------------------------------------------------------------*/ 37 | /* Private variables ---------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | /* Private functions ---------------------------------------------------------*/ 40 | 41 | /** @defgroup CRC_Private_Functions 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief Resets the CRC Data register (DR). 47 | * @param None 48 | * @retval None 49 | */ 50 | void CRC_ResetDR(void) 51 | { 52 | /* Reset CRC generator */ 53 | CRC->CR = CRC_CR_RESET; 54 | } 55 | 56 | /** 57 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 58 | * @param Data: data word(32-bit) to compute its CRC 59 | * @retval 32-bit CRC 60 | */ 61 | uint32_t CRC_CalcCRC(uint32_t Data) 62 | { 63 | CRC->DR = Data; 64 | 65 | return (CRC->DR); 66 | } 67 | 68 | /** 69 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 70 | * @param pBuffer: pointer to the buffer containing the data to be computed 71 | * @param BufferLength: length of the buffer to be computed 72 | * @retval 32-bit CRC 73 | */ 74 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 75 | { 76 | uint32_t index = 0; 77 | 78 | for(index = 0; index < BufferLength; index++) 79 | { 80 | CRC->DR = pBuffer[index]; 81 | } 82 | return (CRC->DR); 83 | } 84 | 85 | /** 86 | * @brief Returns the current CRC value. 87 | * @param None 88 | * @retval 32-bit CRC 89 | */ 90 | uint32_t CRC_GetCRC(void) 91 | { 92 | return (CRC->DR); 93 | } 94 | 95 | /** 96 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 97 | * @param IDValue: 8-bit value to be stored in the ID register 98 | * @retval None 99 | */ 100 | void CRC_SetIDRegister(uint8_t IDValue) 101 | { 102 | CRC->IDR = IDValue; 103 | } 104 | 105 | /** 106 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 107 | * @param None 108 | * @retval 8-bit value of the ID register 109 | */ 110 | uint8_t CRC_GetIDRegister(void) 111 | { 112 | return (CRC->IDR); 113 | } 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /stm32f4-discovery/inc/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | #if defined (HSE_VALUE) 27 | /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */ 28 | #undef HSE_VALUE 29 | #define HSE_VALUE ((uint32_t)8000000) 30 | #endif /* HSE_VALUE */ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Uncomment the line below to enable peripheral header file inclusion */ 34 | #include "stm32f4xx_adc.h" 35 | #include "stm32f4xx_can.h" 36 | #include "stm32f4xx_crc.h" 37 | #include "stm32f4xx_cryp.h" 38 | #include "stm32f4xx_dac.h" 39 | #include "stm32f4xx_dbgmcu.h" 40 | #include "stm32f4xx_dcmi.h" 41 | #include "stm32f4xx_dma.h" 42 | #include "stm32f4xx_exti.h" 43 | #include "stm32f4xx_flash.h" 44 | #include "stm32f4xx_fsmc.h" 45 | #include "stm32f4xx_hash.h" 46 | #include "stm32f4xx_gpio.h" 47 | #include "stm32f4xx_i2c.h" 48 | #include "stm32f4xx_iwdg.h" 49 | #include "stm32f4xx_pwr.h" 50 | #include "stm32f4xx_rcc.h" 51 | #include "stm32f4xx_rng.h" 52 | #include "stm32f4xx_rtc.h" 53 | #include "stm32f4xx_sdio.h" 54 | #include "stm32f4xx_spi.h" 55 | #include "stm32f4xx_syscfg.h" 56 | #include "stm32f4xx_tim.h" 57 | #include "stm32f4xx_usart.h" 58 | #include "stm32f4xx_wwdg.h" 59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 60 | 61 | /* Exported types ------------------------------------------------------------*/ 62 | /* Exported constants --------------------------------------------------------*/ 63 | 64 | /* If an external clock source is used, then the value of the following define 65 | should be set to the value of the external clock source, else, if no external 66 | clock is used, keep this define commented */ 67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 68 | 69 | 70 | /* Uncomment the line below to expanse the "assert_param" macro in the 71 | Standard Peripheral Library drivers code */ 72 | /* #define USE_FULL_ASSERT 1 */ 73 | 74 | /* Exported macro ------------------------------------------------------------*/ 75 | #ifdef USE_FULL_ASSERT 76 | 77 | /** 78 | * @brief The assert_param macro is used for function's parameters check. 79 | * @param expr: If expr is false, it calls assert_failed function 80 | * which reports the name of the source file and the source 81 | * line number of the call that failed. 82 | * If expr is true, it returns no value. 83 | * @retval None 84 | */ 85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 86 | /* Exported functions ------------------------------------------------------- */ 87 | void assert_failed(uint8_t* file, uint32_t line); 88 | #else 89 | #define assert_param(expr) ((void)0) 90 | #endif /* USE_FULL_ASSERT */ 91 | 92 | #endif /* __STM32F4xx_CONF_H */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4xx_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file IO_Toggle/stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | #if defined (HSE_VALUE) 27 | /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */ 28 | #undef HSE_VALUE 29 | #define HSE_VALUE ((uint32_t)8000000) 30 | #endif /* HSE_VALUE */ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Uncomment the line below to enable peripheral header file inclusion */ 34 | #include "stm32f4xx_adc.h" 35 | #include "stm32f4xx_can.h" 36 | #include "stm32f4xx_crc.h" 37 | #include "stm32f4xx_cryp.h" 38 | #include "stm32f4xx_dac.h" 39 | #include "stm32f4xx_dbgmcu.h" 40 | #include "stm32f4xx_dcmi.h" 41 | #include "stm32f4xx_dma.h" 42 | #include "stm32f4xx_exti.h" 43 | #include "stm32f4xx_flash.h" 44 | #include "stm32f4xx_fsmc.h" 45 | #include "stm32f4xx_hash.h" 46 | #include "stm32f4xx_gpio.h" 47 | #include "stm32f4xx_i2c.h" 48 | #include "stm32f4xx_iwdg.h" 49 | #include "stm32f4xx_pwr.h" 50 | #include "stm32f4xx_rcc.h" 51 | #include "stm32f4xx_rng.h" 52 | #include "stm32f4xx_rtc.h" 53 | #include "stm32f4xx_sdio.h" 54 | #include "stm32f4xx_spi.h" 55 | #include "stm32f4xx_syscfg.h" 56 | #include "stm32f4xx_tim.h" 57 | #include "stm32f4xx_usart.h" 58 | #include "stm32f4xx_wwdg.h" 59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 60 | 61 | /* Exported types ------------------------------------------------------------*/ 62 | /* Exported constants --------------------------------------------------------*/ 63 | 64 | /* If an external clock source is used, then the value of the following define 65 | should be set to the value of the external clock source, else, if no external 66 | clock is used, keep this define commented */ 67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 68 | 69 | 70 | /* Uncomment the line below to expanse the "assert_param" macro in the 71 | Standard Peripheral Library drivers code */ 72 | /* #define USE_FULL_ASSERT 1 */ 73 | 74 | /* Exported macro ------------------------------------------------------------*/ 75 | #ifdef USE_FULL_ASSERT 76 | 77 | /** 78 | * @brief The assert_param macro is used for function's parameters check. 79 | * @param expr: If expr is false, it calls assert_failed function 80 | * which reports the name of the source file and the source 81 | * line number of the call that failed. 82 | * If expr is true, it returns no value. 83 | * @retval None 84 | */ 85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 86 | /* Exported functions ------------------------------------------------------- */ 87 | void assert_failed(uint8_t* file, uint32_t line); 88 | #else 89 | #define assert_param(expr) ((void)0) 90 | #endif /* USE_FULL_ASSERT */ 91 | 92 | #endif /* __STM32F4xx_CONF_H */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4xx_conf.h~: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file IO_Toggle/stm32f4xx_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_CONF_H 24 | #define __STM32F4xx_CONF_H 25 | 26 | #if defined (HSE_VALUE) 27 | /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */ 28 | #undef HSE_VALUE 29 | #define HSE_VALUE ((uint32_t)8000000) 30 | #endif /* HSE_VALUE */ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Uncomment the line below to enable peripheral header file inclusion */ 34 | #include "stm32f4xx_adc.h" 35 | #include "stm32f4xx_can.h" 36 | #include "stm32f4xx_crc.h" 37 | #include "stm32f4xx_cryp.h" 38 | #include "stm32f4xx_dac.h" 39 | #include "stm32f4xx_dbgmcu.h" 40 | #include "stm32f4xx_dcmi.h" 41 | #include "stm32f4xx_dma.h" 42 | #include "stm32f4xx_exti.h" 43 | #include "stm32f4xx_flash.h" 44 | #include "stm32f4xx_fsmc.h" 45 | #include "stm32f4xx_hash.h" 46 | #include "stm32f4xx_gpio.h" 47 | #include "stm32f4xx_i2c.h" 48 | #include "stm32f4xx_iwdg.h" 49 | #include "stm32f4xx_pwr.h" 50 | #include "stm32f4xx_rcc.h" 51 | #include "stm32f4xx_rng.h" 52 | #include "stm32f4xx_rtc.h" 53 | #include "stm32f4xx_sdio.h" 54 | #include "stm32f4xx_spi.h" 55 | #include "stm32f4xx_syscfg.h" 56 | #include "stm32f4xx_tim.h" 57 | #include "stm32f4xx_usart.h" 58 | #include "stm32f4xx_wwdg.h" 59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 60 | 61 | /* Exported types ------------------------------------------------------------*/ 62 | /* Exported constants --------------------------------------------------------*/ 63 | 64 | /* If an external clock source is used, then the value of the following define 65 | should be set to the value of the external clock source, else, if no external 66 | clock is used, keep this define commented */ 67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ 68 | 69 | 70 | /* Uncomment the line below to expanse the "assert_param" macro in the 71 | Standard Peripheral Library drivers code */ 72 | /* #define USE_FULL_ASSERT 1 */ 73 | 74 | /* Exported macro ------------------------------------------------------------*/ 75 | #ifdef USE_FULL_ASSERT 76 | 77 | /** 78 | * @brief The assert_param macro is used for function's parameters check. 79 | * @param expr: If expr is false, it calls assert_failed function 80 | * which reports the name of the source file and the source 81 | * line number of the call that failed. 82 | * If expr is true, it returns no value. 83 | * @retval None 84 | */ 85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 86 | /* Exported functions ------------------------------------------------------- */ 87 | void assert_failed(uint8_t* file, uint32_t line); 88 | #else 89 | //#define assert_param(expr) ((void)0) 90 | #endif /* USE_FULL_ASSERT */ 91 | 92 | #endif /* __STM32F4xx_CONF_H */ 93 | #define assert_param(expr) ((void)0) 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f10x_crc.h" 23 | 24 | /** @addtogroup STM32F10x_StdPeriph_Driver 25 | * @{ 26 | */ 27 | 28 | /** @defgroup CRC 29 | * @brief CRC driver modules 30 | * @{ 31 | */ 32 | 33 | /** @defgroup CRC_Private_TypesDefinitions 34 | * @{ 35 | */ 36 | 37 | /** 38 | * @} 39 | */ 40 | 41 | /** @defgroup CRC_Private_Defines 42 | * @{ 43 | */ 44 | 45 | /* CR register bit mask */ 46 | 47 | #define CR_RESET_Set ((uint32_t)0x00000001) 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /** @defgroup CRC_Private_Macros 54 | * @{ 55 | */ 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup CRC_Private_Variables 62 | * @{ 63 | */ 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup CRC_Private_FunctionPrototypes 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup CRC_Private_Functions 78 | * @{ 79 | */ 80 | 81 | /** 82 | * @brief Resets the CRC Data register (DR). 83 | * @param None 84 | * @retval None 85 | */ 86 | void CRC_ResetDR(void) 87 | { 88 | /* Reset CRC generator */ 89 | CRC->CR = CR_RESET_Set; 90 | } 91 | 92 | /** 93 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 94 | * @param Data: data word(32-bit) to compute its CRC 95 | * @retval 32-bit CRC 96 | */ 97 | uint32_t CRC_CalcCRC(uint32_t Data) 98 | { 99 | CRC->DR = Data; 100 | 101 | return (CRC->DR); 102 | } 103 | 104 | /** 105 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 106 | * @param pBuffer: pointer to the buffer containing the data to be computed 107 | * @param BufferLength: length of the buffer to be computed 108 | * @retval 32-bit CRC 109 | */ 110 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 111 | { 112 | uint32_t index = 0; 113 | 114 | for(index = 0; index < BufferLength; index++) 115 | { 116 | CRC->DR = pBuffer[index]; 117 | } 118 | return (CRC->DR); 119 | } 120 | 121 | /** 122 | * @brief Returns the current CRC value. 123 | * @param None 124 | * @retval 32-bit CRC 125 | */ 126 | uint32_t CRC_GetCRC(void) 127 | { 128 | return (CRC->DR); 129 | } 130 | 131 | /** 132 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 133 | * @param IDValue: 8-bit value to be stored in the ID register 134 | * @retval None 135 | */ 136 | void CRC_SetIDRegister(uint8_t IDValue) 137 | { 138 | CRC->IDR = IDValue; 139 | } 140 | 141 | /** 142 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 143 | * @param None 144 | * @retval 8-bit value of the ID register 145 | */ 146 | uint8_t CRC_GetIDRegister(void) 147 | { 148 | return (CRC->IDR); 149 | } 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | /** 156 | * @} 157 | */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 164 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_DBGMCU_H 24 | #define __STM32F10x_DBGMCU_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup DBGMCU 38 | * @{ 39 | */ 40 | 41 | /** @defgroup DBGMCU_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup DBGMCU_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 54 | #define DBGMCU_STOP ((uint32_t)0x00000002) 55 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 56 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 57 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 58 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 59 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 60 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 61 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 62 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 63 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 64 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 65 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 66 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 67 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 68 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 69 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 70 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 71 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 72 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 73 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 74 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 75 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 76 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 77 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 78 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 79 | 80 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @defgroup DBGMCU_Exported_Macros 86 | * @{ 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup DBGMCU_Exported_Functions 94 | * @{ 95 | */ 96 | 97 | uint32_t DBGMCU_GetREVID(void); 98 | uint32_t DBGMCU_GetDEVID(void); 99 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif /* __STM32F10x_DBGMCU_H */ 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 119 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_rng.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_rng.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the Random 8 | * Number Generator(RNG) firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_RNG_H 25 | #define __STM32F4xx_RNG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RNG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup RNG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup RNG_flags_definition 50 | * @{ 51 | */ 52 | #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */ 53 | #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */ 54 | #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */ 55 | 56 | #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \ 57 | ((RNG_FLAG) == RNG_FLAG_CECS) || \ 58 | ((RNG_FLAG) == RNG_FLAG_SECS)) 59 | #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \ 60 | ((RNG_FLAG) == RNG_FLAG_SECS)) 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup RNG_interrupts_definition 66 | * @{ 67 | */ 68 | #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */ 69 | #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */ 70 | 71 | #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00)) 72 | #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI)) 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Exported macro ------------------------------------------------------------*/ 82 | /* Exported functions --------------------------------------------------------*/ 83 | 84 | /* Function used to set the RNG configuration to the default reset state *****/ 85 | void RNG_DeInit(void); 86 | 87 | /* Configuration function *****************************************************/ 88 | void RNG_Cmd(FunctionalState NewState); 89 | 90 | /* Get 32 bit Random number function ******************************************/ 91 | uint32_t RNG_GetRandomNumber(void); 92 | 93 | /* Interrupts and flags management functions **********************************/ 94 | void RNG_ITConfig(FunctionalState NewState); 95 | FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG); 96 | void RNG_ClearFlag(uint8_t RNG_FLAG); 97 | ITStatus RNG_GetITStatus(uint8_t RNG_IT); 98 | void RNG_ClearITPendingBit(uint8_t RNG_IT); 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif /*__STM32F4xx_RNG_H */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/STM32vldiscovery.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file STM32vldiscovery.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief Header file for STM32vldiscovery.c module. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F100_Dicovery_H 23 | #define __STM32F100_Dicovery_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f10x.h" 31 | 32 | /** @addtogroup Utilities 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup STM32vldiscovery 37 | * @{ 38 | */ 39 | 40 | /** @defgroup STM32vldiscovery_Abstraction_Layer 41 | * @{ 42 | */ 43 | 44 | /** @defgroup STM32vldiscovery_HARDWARE_RESOURCES 45 | * @{ 46 | */ 47 | 48 | /** @defgroup STM32vldiscovery_Exported_Types 49 | * @{ 50 | */ 51 | typedef enum 52 | { 53 | LED3 = 0, 54 | LED4 = 1 55 | } Led_TypeDef; 56 | 57 | typedef enum 58 | { 59 | BUTTON_USER = 0 60 | } Button_TypeDef; 61 | 62 | typedef enum 63 | { 64 | BUTTON_MODE_GPIO = 0, 65 | BUTTON_MODE_EXTI = 1 66 | } ButtonMode_TypeDef; 67 | 68 | /** 69 | * @brief STM32F100 Button Defines Legacy 70 | */ 71 | 72 | #define Button_USER BUTTON_USER 73 | #define Mode_GPIO BUTTON_MODE_GPIO 74 | #define Mode_EXTI BUTTON_MODE_EXTI 75 | #define Button_Mode_TypeDef ButtonMode_TypeDef 76 | 77 | 78 | /** @addtogroup STM32vldiscovery_LOW_LEVEL_LED 79 | * @{ 80 | */ 81 | #define LEDn 2 82 | #define LED3_PIN GPIO_Pin_9 83 | #define LED3_GPIO_PORT GPIOC 84 | #define LED3_GPIO_CLK RCC_APB2Periph_GPIOC 85 | 86 | #define LED4_PIN GPIO_Pin_8 87 | #define LED4_GPIO_PORT GPIOC 88 | #define LED4_GPIO_CLK RCC_APB2Periph_GPIOC 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @addtogroup STM32vldiscovery_LOW_LEVEL_BUTTON 95 | * @{ 96 | */ 97 | #define BUTTONn 1 98 | 99 | /* * @brief USER push-button 100 | */ 101 | #define USER_BUTTON_PIN GPIO_Pin_0 102 | #define USER_BUTTON_GPIO_PORT GPIOA 103 | #define USER_BUTTON_GPIO_CLK RCC_APB2Periph_GPIOA 104 | #define USER_BUTTON_EXTI_PORT_SOURCE GPIO_PortSourceGPIOA 105 | #define USER_BUTTON_EXTI_PIN_SOURCE GPIO_PinSource0 106 | #define USER_BUTTON_EXTI_LINE EXTI_Line0 107 | #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** @defgroup STM32vldiscovery_LOW_LEVEL__Exported_Functions 114 | * @{ 115 | */ 116 | void STM32vldiscovery_LEDInit(Led_TypeDef Led); 117 | void STM32vldiscovery_LEDOn(Led_TypeDef Led); 118 | void STM32vldiscovery_LEDOff(Led_TypeDef Led); 119 | void STM32vldiscovery_LEDToggle(Led_TypeDef Led); 120 | void STM32vldiscovery_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode); 121 | uint32_t STM32vldiscovery_PBGetState(Button_TypeDef Button); 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | #ifdef __cplusplus 128 | } 129 | #endif 130 | 131 | 132 | #endif /* __STM32vldiscovery_H */ 133 | 134 | /** 135 | * @} 136 | */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 147 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_RTC_H 24 | #define __STM32F10x_RTC_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup RTC 38 | * @{ 39 | */ 40 | 41 | /** @defgroup RTC_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup RTC_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** @defgroup RTC_interrupts_define 54 | * @{ 55 | */ 56 | 57 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 58 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 59 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 60 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 61 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 62 | ((IT) == RTC_IT_SEC)) 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup RTC_interrupts_flags 68 | * @{ 69 | */ 70 | 71 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 72 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 73 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 74 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 75 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 76 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 77 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 78 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 79 | ((FLAG) == RTC_FLAG_SEC)) 80 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup RTC_Exported_Macros 91 | * @{ 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** @defgroup RTC_Exported_Functions 99 | * @{ 100 | */ 101 | 102 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 103 | void RTC_EnterConfigMode(void); 104 | void RTC_ExitConfigMode(void); 105 | uint32_t RTC_GetCounter(void); 106 | void RTC_SetCounter(uint32_t CounterValue); 107 | void RTC_SetPrescaler(uint32_t PrescalerValue); 108 | void RTC_SetAlarm(uint32_t AlarmValue); 109 | uint32_t RTC_GetDivider(void); 110 | void RTC_WaitForLastTask(void); 111 | void RTC_WaitForSynchro(void); 112 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 113 | void RTC_ClearFlag(uint16_t RTC_FLAG); 114 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 115 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 116 | 117 | #ifdef __cplusplus 118 | } 119 | #endif 120 | 121 | #endif /* __STM32F10x_RTC_H */ 122 | /** 123 | * @} 124 | */ 125 | 126 | /** 127 | * @} 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 135 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_IWDG_H 24 | #define __STM32F10x_IWDG_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup IWDG 38 | * @{ 39 | */ 40 | 41 | /** @defgroup IWDG_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup IWDG_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** @defgroup IWDG_WriteAccess 54 | * @{ 55 | */ 56 | 57 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 58 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 59 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 60 | ((ACCESS) == IWDG_WriteAccess_Disable)) 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup IWDG_prescaler 66 | * @{ 67 | */ 68 | 69 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 70 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 71 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 72 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 73 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 74 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 75 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 76 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 77 | ((PRESCALER) == IWDG_Prescaler_8) || \ 78 | ((PRESCALER) == IWDG_Prescaler_16) || \ 79 | ((PRESCALER) == IWDG_Prescaler_32) || \ 80 | ((PRESCALER) == IWDG_Prescaler_64) || \ 81 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 82 | ((PRESCALER) == IWDG_Prescaler_256)) 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @defgroup IWDG_Flag 88 | * @{ 89 | */ 90 | 91 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 92 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 93 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 94 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup IWDG_Exported_Macros 104 | * @{ 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** @defgroup IWDG_Exported_Functions 112 | * @{ 113 | */ 114 | 115 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 116 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 117 | void IWDG_SetReload(uint16_t Reload); 118 | void IWDG_ReloadCounter(void); 119 | void IWDG_Enable(void); 120 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | 126 | #endif /* __STM32F10x_IWDG_H */ 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 140 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU firmware library. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_DBGMCU_H 24 | #define __STM32F4xx_DBGMCU_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx.h" 32 | 33 | /** @addtogroup STM32F4xx_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup DBGMCU 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /* Exported constants --------------------------------------------------------*/ 43 | 44 | /** @defgroup DBGMCU_Exported_Constants 45 | * @{ 46 | */ 47 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 48 | #define DBGMCU_STOP ((uint32_t)0x00000002) 49 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 50 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFFF8) == 0x00) && ((PERIPH) != 0x00)) 51 | 52 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000001) 53 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00000002) 54 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00000004) 55 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00000008) 56 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00000010) 57 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00000020) 58 | #define DBGMCU_TIM12_STOP ((uint32_t)0x00000040) 59 | #define DBGMCU_TIM13_STOP ((uint32_t)0x00000080) 60 | #define DBGMCU_TIM14_STOP ((uint32_t)0x00000100) 61 | #define DBGMCU_RTC_STOP ((uint32_t)0x00000400) 62 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000800) 63 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00001000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000) 66 | #define DBGMCU_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000) 67 | #define DBGMCU_CAN1_STOP ((uint32_t)0x02000000) 68 | #define DBGMCU_CAN2_STOP ((uint32_t)0x04000000) 69 | #define IS_DBGMCU_APB1PERIPH(PERIPH) ((((PERIPH) & 0xF91FE200) == 0x00) && ((PERIPH) != 0x00)) 70 | 71 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000001) 72 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00000002) 73 | #define DBGMCU_TIM9_STOP ((uint32_t)0x00010000) 74 | #define DBGMCU_TIM10_STOP ((uint32_t)0x00020000) 75 | #define DBGMCU_TIM11_STOP ((uint32_t)0x00040000) 76 | #define IS_DBGMCU_APB2PERIPH(PERIPH) ((((PERIPH) & 0xFFF8FFFC) == 0x00) && ((PERIPH) != 0x00)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Exported macro ------------------------------------------------------------*/ 82 | /* Exported functions --------------------------------------------------------*/ 83 | uint32_t DBGMCU_GetREVID(void); 84 | uint32_t DBGMCU_GetDEVID(void); 85 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 86 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 87 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif /* __STM32F4xx_DBGMCU_H */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4_discovery.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4_discovery.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief This file contains definitions for STM32F4-Discovery Kit's Leds and 8 | * push-button hardware resources. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4_DISCOVERY_H 25 | #define __STM32F4_DISCOVERY_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup Utilities 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup STM32F4_DISCOVERY 39 | * @{ 40 | */ 41 | 42 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL 43 | * @{ 44 | */ 45 | 46 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Types 47 | * @{ 48 | */ 49 | typedef enum 50 | { 51 | LED4 = 0, 52 | LED3 = 1, 53 | LED5 = 2, 54 | LED6 = 3 55 | } Led_TypeDef; 56 | 57 | typedef enum 58 | { 59 | BUTTON_USER = 0, 60 | } Button_TypeDef; 61 | 62 | typedef enum 63 | { 64 | BUTTON_MODE_GPIO = 0, 65 | BUTTON_MODE_EXTI = 1 66 | } ButtonMode_TypeDef; 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Constants 72 | * @{ 73 | */ 74 | 75 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_LED 76 | * @{ 77 | */ 78 | #define LEDn 4 79 | 80 | #define LED4_PIN GPIO_Pin_12 81 | #define LED4_GPIO_PORT GPIOD 82 | #define LED4_GPIO_CLK RCC_AHB1Periph_GPIOD 83 | 84 | #define LED3_PIN GPIO_Pin_13 85 | #define LED3_GPIO_PORT GPIOD 86 | #define LED3_GPIO_CLK RCC_AHB1Periph_GPIOD 87 | 88 | #define LED5_PIN GPIO_Pin_14 89 | #define LED5_GPIO_PORT GPIOD 90 | #define LED5_GPIO_CLK RCC_AHB1Periph_GPIOD 91 | 92 | #define LED6_PIN GPIO_Pin_15 93 | #define LED6_GPIO_PORT GPIOD 94 | #define LED6_GPIO_CLK RCC_AHB1Periph_GPIOD 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_BUTTON 100 | * @{ 101 | */ 102 | #define BUTTONn 1 103 | 104 | /** 105 | * @brief Wakeup push-button 106 | */ 107 | #define USER_BUTTON_PIN GPIO_Pin_0 108 | #define USER_BUTTON_GPIO_PORT GPIOA 109 | #define USER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA 110 | #define USER_BUTTON_EXTI_LINE EXTI_Line0 111 | #define USER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA 112 | #define USER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0 113 | #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Macros 119 | * @{ 120 | */ 121 | /** 122 | * @} 123 | */ 124 | 125 | 126 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Functions 127 | * @{ 128 | */ 129 | void STM_EVAL_LEDInit(Led_TypeDef Led); 130 | void STM_EVAL_LEDOn(Led_TypeDef Led); 131 | void STM_EVAL_LEDOff(Led_TypeDef Led); 132 | void STM_EVAL_LEDToggle(Led_TypeDef Led); 133 | void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode); 134 | uint32_t STM_EVAL_PBGetState(Button_TypeDef Button); 135 | /** 136 | * @} 137 | */ 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | 143 | #endif /* __STM32F4_DISCOVERY_H */ 144 | /** 145 | * @} 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | 157 | 158 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 159 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_iwdg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_IWDG_H 25 | #define __STM32F4xx_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup IWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup IWDG_WriteAccess 50 | * @{ 51 | */ 52 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 53 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 54 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 55 | ((ACCESS) == IWDG_WriteAccess_Disable)) 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @defgroup IWDG_prescaler 61 | * @{ 62 | */ 63 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 64 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 65 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 66 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 67 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 68 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 69 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 70 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 71 | ((PRESCALER) == IWDG_Prescaler_8) || \ 72 | ((PRESCALER) == IWDG_Prescaler_16) || \ 73 | ((PRESCALER) == IWDG_Prescaler_32) || \ 74 | ((PRESCALER) == IWDG_Prescaler_64) || \ 75 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 76 | ((PRESCALER) == IWDG_Prescaler_256)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup IWDG_Flag 82 | * @{ 83 | */ 84 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 85 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 86 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 87 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /* Exported macro ------------------------------------------------------------*/ 97 | /* Exported functions --------------------------------------------------------*/ 98 | 99 | /* Prescaler and Counter configuration functions ******************************/ 100 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 101 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 102 | void IWDG_SetReload(uint16_t Reload); 103 | void IWDG_ReloadCounter(void); 104 | 105 | /* IWDG activation function ***************************************************/ 106 | void IWDG_Enable(void); 107 | 108 | /* Flag management function ***************************************************/ 109 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | #endif /* __STM32F4xx_IWDG_H */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/stm32f4_discovery.h~: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4_discovery.h 4 | * @author MCD Application Team 5 | * @version V1.1.0 6 | * @date 28-October-2011 7 | * @brief This file contains definitions for STM32F4-Discovery Kit's Leds and 8 | * push-button hardware resources. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4_DISCOVERY_H 25 | #define __STM32F4_DISCOVERY_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | #include "stm32f4xx_conf.h" 34 | 35 | /** @addtogroup Utilities 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup STM32F4_DISCOVERY 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL 44 | * @{ 45 | */ 46 | 47 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Types 48 | * @{ 49 | */ 50 | typedef enum 51 | { 52 | LED4 = 0, 53 | LED3 = 1, 54 | LED5 = 2, 55 | LED6 = 3 56 | } Led_TypeDef; 57 | 58 | typedef enum 59 | { 60 | BUTTON_USER = 0, 61 | } Button_TypeDef; 62 | 63 | typedef enum 64 | { 65 | BUTTON_MODE_GPIO = 0, 66 | BUTTON_MODE_EXTI = 1 67 | } ButtonMode_TypeDef; 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Constants 73 | * @{ 74 | */ 75 | 76 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_LED 77 | * @{ 78 | */ 79 | #define LEDn 4 80 | 81 | #define LED4_PIN GPIO_Pin_12 82 | #define LED4_GPIO_PORT GPIOD 83 | #define LED4_GPIO_CLK RCC_AHB1Periph_GPIOD 84 | 85 | #define LED3_PIN GPIO_Pin_13 86 | #define LED3_GPIO_PORT GPIOD 87 | #define LED3_GPIO_CLK RCC_AHB1Periph_GPIOD 88 | 89 | #define LED5_PIN GPIO_Pin_14 90 | #define LED5_GPIO_PORT GPIOD 91 | #define LED5_GPIO_CLK RCC_AHB1Periph_GPIOD 92 | 93 | #define LED6_PIN GPIO_Pin_15 94 | #define LED6_GPIO_PORT GPIOD 95 | #define LED6_GPIO_CLK RCC_AHB1Periph_GPIOD 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_BUTTON 101 | * @{ 102 | */ 103 | #define BUTTONn 1 104 | 105 | /** 106 | * @brief Wakeup push-button 107 | */ 108 | #define USER_BUTTON_PIN GPIO_Pin_0 109 | #define USER_BUTTON_GPIO_PORT GPIOA 110 | #define USER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA 111 | #define USER_BUTTON_EXTI_LINE EXTI_Line0 112 | #define USER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA 113 | #define USER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0 114 | #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn 115 | /** 116 | * @} 117 | */ 118 | 119 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Macros 120 | * @{ 121 | */ 122 | /** 123 | * @} 124 | */ 125 | 126 | 127 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Functions 128 | * @{ 129 | */ 130 | void STM_EVAL_LEDInit(Led_TypeDef Led); 131 | void STM_EVAL_LEDOn(Led_TypeDef Led); 132 | void STM_EVAL_LEDOff(Led_TypeDef Led); 133 | void STM_EVAL_LEDToggle(Led_TypeDef Led); 134 | void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode); 135 | uint32_t STM_EVAL_PBGetState(Button_TypeDef Button); 136 | /** 137 | * @} 138 | */ 139 | 140 | #ifdef __cplusplus 141 | } 142 | #endif 143 | 144 | #endif /* __STM32F4_DISCOVERY_H */ 145 | /** 146 | * @} 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | 158 | 159 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 160 | -------------------------------------------------------------------------------- /stm32f4-discovery/src/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file IO_Toggle/main.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Main program body 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f4_discovery.h" 24 | #include "stm32f4xx_conf.h" // again, added because ST didn't put it here ? 25 | 26 | /** @addtogroup STM32F4_Discovery_Peripheral_Examples 27 | * @{ 28 | */ 29 | 30 | /** @addtogroup IO_Toggle 31 | * @{ 32 | */ 33 | 34 | /* Private typedef -----------------------------------------------------------*/ 35 | GPIO_InitTypeDef GPIO_InitStructure; 36 | 37 | /* Private define ------------------------------------------------------------*/ 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | /* Private function prototypes -----------------------------------------------*/ 41 | void Delay(__IO uint32_t nCount); 42 | /* Private functions ---------------------------------------------------------*/ 43 | 44 | /** 45 | * @brief Main program 46 | * @param None 47 | * @retval None 48 | */ 49 | int main(void) 50 | { 51 | /*!< At this stage the microcontroller clock setting is already configured, 52 | this is done through SystemInit() function which is called from startup 53 | file (startup_stm32f4xx.s) before to branch to application main. 54 | To reconfigure the default setting of SystemInit() function, refer to 55 | system_stm32f4xx.c file 56 | */ 57 | 58 | /* GPIOD Periph clock enable */ 59 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); 60 | 61 | /* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */ 62 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15; 63 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; 64 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 65 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 66 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 67 | GPIO_Init(GPIOD, &GPIO_InitStructure); 68 | 69 | while (1) 70 | { 71 | /* PD12 to be toggled */ 72 | GPIO_SetBits(GPIOD, GPIO_Pin_12); 73 | 74 | /* Insert delay */ 75 | Delay(0x3FFFFF); 76 | 77 | /* PD13 to be toggled */ 78 | GPIO_SetBits(GPIOD, GPIO_Pin_13); 79 | 80 | /* Insert delay */ 81 | Delay(0x3FFFFF); 82 | 83 | /* PD14 to be toggled */ 84 | GPIO_SetBits(GPIOD, GPIO_Pin_14); 85 | 86 | /* Insert delay */ 87 | Delay(0x3FFFFF); 88 | 89 | /* PD15 to be toggled */ 90 | GPIO_SetBits(GPIOD, GPIO_Pin_15); 91 | 92 | /* Insert delay */ 93 | Delay(0x7FFFFF); 94 | 95 | GPIO_ResetBits(GPIOD, GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15); 96 | 97 | /* Insert delay */ 98 | Delay(0xFFFFFF); 99 | } 100 | } 101 | 102 | /** 103 | * @brief Delay Function. 104 | * @param nCount:specifies the Delay time length. 105 | * @retval None 106 | */ 107 | void Delay(__IO uint32_t nCount) 108 | { 109 | while(nCount--) 110 | { 111 | } 112 | } 113 | 114 | #ifdef USE_FULL_ASSERT 115 | 116 | /** 117 | * @brief Reports the name of the source file and the source line number 118 | * where the assert_param error has occurred. 119 | * @param file: pointer to the source file name 120 | * @param line: assert_param error line source number 121 | * @retval None 122 | */ 123 | void assert_failed(uint8_t* file, uint32_t line) 124 | { 125 | /* User can add his own implementation to report the file name and line number, 126 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 127 | 128 | /* Infinite loop */ 129 | while (1) 130 | { 131 | } 132 | } 133 | #endif 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 144 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_PWR_H 24 | #define __STM32F10x_PWR_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup PWR 38 | * @{ 39 | */ 40 | 41 | /** @defgroup PWR_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup PWR_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** @defgroup PVD_detection_level 54 | * @{ 55 | */ 56 | 57 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 58 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 59 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 60 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 61 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 62 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 63 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 64 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 65 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 66 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 67 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 68 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup Regulator_state_is_STOP_mode 74 | * @{ 75 | */ 76 | 77 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 78 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 79 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 80 | ((REGULATOR) == PWR_Regulator_LowPower)) 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @defgroup STOP_mode_entry 86 | * @{ 87 | */ 88 | 89 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 90 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 91 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** @defgroup PWR_Flag 98 | * @{ 99 | */ 100 | 101 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 102 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 103 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 104 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 105 | ((FLAG) == PWR_FLAG_PVDO)) 106 | 107 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** @defgroup PWR_Exported_Macros 117 | * @{ 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /** @defgroup PWR_Exported_Functions 125 | * @{ 126 | */ 127 | 128 | void PWR_DeInit(void); 129 | void PWR_BackupAccessCmd(FunctionalState NewState); 130 | void PWR_PVDCmd(FunctionalState NewState); 131 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 132 | void PWR_WakeUpPinCmd(FunctionalState NewState); 133 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 134 | void PWR_EnterSTANDBYMode(void); 135 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 136 | void PWR_ClearFlag(uint32_t PWR_FLAG); 137 | 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | 142 | #endif /* __STM32F10x_PWR_H */ 143 | /** 144 | * @} 145 | */ 146 | 147 | /** 148 | * @} 149 | */ 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 156 | -------------------------------------------------------------------------------- /stm32vl-discovery/src/stm32f10x_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Demo/src/stm32f10x_it.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief Main Interrupt Service Routines. 8 | * This file provides template for all exceptions handler and peripherals 9 | * interrupt service routine. 10 | ****************************************************************************** 11 | * @copy 12 | * 13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 19 | * 20 | *

© COPYRIGHT 2010 STMicroelectronics

21 | */ 22 | 23 | /* Includes ------------------------------------------------------------------*/ 24 | #include "stm32f10x_it.h" 25 | void TimingDelay_Decrement(void); 26 | /** @addtogroup Demo 27 | * @{ 28 | */ 29 | 30 | /* Private typedef -----------------------------------------------------------*/ 31 | /* Private define ------------------------------------------------------------*/ 32 | /* Private macro -------------------------------------------------------------*/ 33 | /* Private variables ---------------------------------------------------------*/ 34 | /* Private function prototypes -----------------------------------------------*/ 35 | /* Private functions ---------------------------------------------------------*/ 36 | 37 | /******************************************************************************/ 38 | /* Cortex-M3 Processor Exceptions Handlers */ 39 | /******************************************************************************/ 40 | 41 | /** 42 | * @brief This function handles NMI exception. 43 | * @param None 44 | * @retval None 45 | */ 46 | void NMI_Handler(void) 47 | { 48 | } 49 | 50 | /** 51 | * @brief This function handles Hard Fault exception. 52 | * @param None 53 | * @retval None 54 | */ 55 | void HardFault_Handler(void) 56 | { 57 | /* Go to infinite loop when Hard Fault exception occurs */ 58 | while (1) 59 | { 60 | } 61 | } 62 | 63 | /** 64 | * @brief This function handles Memory Manage exception. 65 | * @param None 66 | * @retval None 67 | */ 68 | void MemManage_Handler(void) 69 | { 70 | /* Go to infinite loop when Memory Manage exception occurs */ 71 | while (1) 72 | { 73 | } 74 | } 75 | 76 | /** 77 | * @brief This function handles Bus Fault exception. 78 | * @param None 79 | * @retval None 80 | */ 81 | void BusFault_Handler(void) 82 | { 83 | /* Go to infinite loop when Bus Fault exception occurs */ 84 | while (1) 85 | { 86 | } 87 | } 88 | 89 | /** 90 | * @brief This function handles Usage Fault exception. 91 | * @param None 92 | * @retval None 93 | */ 94 | void UsageFault_Handler(void) 95 | { 96 | /* Go to infinite loop when Usage Fault exception occurs */ 97 | while (1) 98 | { 99 | } 100 | } 101 | 102 | /** 103 | * @brief This function handles SVCall exception. 104 | * @param None 105 | * @retval None 106 | */ 107 | void SVC_Handler(void) 108 | { 109 | } 110 | 111 | /** 112 | * @brief This function handles Debug Monitor exception. 113 | * @param None 114 | * @retval None 115 | */ 116 | void DebugMon_Handler(void) 117 | { 118 | } 119 | 120 | /** 121 | * @brief This function handles PendSV_Handler exception. 122 | * @param None 123 | * @retval None 124 | */ 125 | void PendSV_Handler(void) 126 | { 127 | } 128 | 129 | /** 130 | * @brief This function handles SysTick Handler. 131 | * @param None 132 | * @retval None 133 | */ 134 | void SysTick_Handler(void) 135 | { 136 | TimingDelay_Decrement(); 137 | } 138 | 139 | /******************************************************************************/ 140 | /* STM32F10x Peripherals Interrupt Handlers */ 141 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 142 | /* available peripheral interrupt handler's name please refer to the startup */ 143 | /* file (startup_stm32f10x_xx.s). */ 144 | /******************************************************************************/ 145 | 146 | /** 147 | * @brief This function handles PPP interrupt request. 148 | * @param None 149 | * @retval None 150 | */ 151 | /*void PPP_IRQHandler(void) 152 | { 153 | }*/ 154 | 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /stm32f4-discovery/src/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file IO_Toggle/stm32f4xx_it.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 19-September-2011 7 | * @brief Main Interrupt Service Routines. 8 | * This file provides template for all exceptions handler and 9 | * peripherals interrupt service routine. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 19 | * 20 | *

© COPYRIGHT 2011 STMicroelectronics

21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes ------------------------------------------------------------------*/ 25 | #include "stm32f4xx_it.h" 26 | 27 | /** @addtogroup STM32F4_Discovery_Peripheral_Examples 28 | * @{ 29 | */ 30 | 31 | /** @addtogroup IO_Toggle 32 | * @{ 33 | */ 34 | 35 | /* Private typedef -----------------------------------------------------------*/ 36 | /* Private define ------------------------------------------------------------*/ 37 | /* Private macro -------------------------------------------------------------*/ 38 | /* Private variables ---------------------------------------------------------*/ 39 | /* Private function prototypes -----------------------------------------------*/ 40 | /* Private functions ---------------------------------------------------------*/ 41 | 42 | /******************************************************************************/ 43 | /* Cortex-M4 Processor Exceptions Handlers */ 44 | /******************************************************************************/ 45 | 46 | /** 47 | * @brief This function handles NMI exception. 48 | * @param None 49 | * @retval None 50 | */ 51 | void NMI_Handler(void) 52 | { 53 | } 54 | 55 | /** 56 | * @brief This function handles Hard Fault exception. 57 | * @param None 58 | * @retval None 59 | */ 60 | void HardFault_Handler(void) 61 | { 62 | /* Go to infinite loop when Hard Fault exception occurs */ 63 | while (1) 64 | { 65 | } 66 | } 67 | 68 | /** 69 | * @brief This function handles Memory Manage exception. 70 | * @param None 71 | * @retval None 72 | */ 73 | void MemManage_Handler(void) 74 | { 75 | /* Go to infinite loop when Memory Manage exception occurs */ 76 | while (1) 77 | { 78 | } 79 | } 80 | 81 | /** 82 | * @brief This function handles Bus Fault exception. 83 | * @param None 84 | * @retval None 85 | */ 86 | void BusFault_Handler(void) 87 | { 88 | /* Go to infinite loop when Bus Fault exception occurs */ 89 | while (1) 90 | { 91 | } 92 | } 93 | 94 | /** 95 | * @brief This function handles Usage Fault exception. 96 | * @param None 97 | * @retval None 98 | */ 99 | void UsageFault_Handler(void) 100 | { 101 | /* Go to infinite loop when Usage Fault exception occurs */ 102 | while (1) 103 | { 104 | } 105 | } 106 | 107 | /** 108 | * @brief This function handles SVCall exception. 109 | * @param None 110 | * @retval None 111 | */ 112 | void SVC_Handler(void) 113 | { 114 | } 115 | 116 | /** 117 | * @brief This function handles Debug Monitor exception. 118 | * @param None 119 | * @retval None 120 | */ 121 | void DebugMon_Handler(void) 122 | { 123 | } 124 | 125 | /** 126 | * @brief This function handles PendSVC exception. 127 | * @param None 128 | * @retval None 129 | */ 130 | void PendSV_Handler(void) 131 | { 132 | } 133 | 134 | /** 135 | * @brief This function handles SysTick Handler. 136 | * @param None 137 | * @retval None 138 | */ 139 | void SysTick_Handler(void) 140 | { 141 | } 142 | 143 | /******************************************************************************/ 144 | /* STM32F4xx Peripherals Interrupt Handlers */ 145 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 146 | /* available peripheral interrupt handler's name please refer to the startup */ 147 | /* file (startup_stm32f4xx.s). */ 148 | /******************************************************************************/ 149 | 150 | /** 151 | * @brief This function handles PPP interrupt request. 152 | * @param None 153 | * @retval None 154 | */ 155 | /*void PPP_IRQHandler(void) 156 | { 157 | }*/ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 168 | -------------------------------------------------------------------------------- /stm32vl-discovery/stm32f100.ld: -------------------------------------------------------------------------------- 1 | /* 2 | Linker script for STM32F10x_128K_8K 3 | 4 | modified from 5 | 6 | http://www.codesourcery.com/archives/arm-gnu/msg02972.html 7 | */ 8 | 9 | /* 10 | There will be a link error if there is not this amount of RAM free at the 11 | end. 12 | */ 13 | _Minimum_Stack_Size = 256; 14 | 15 | ENTRY(Reset_Handler) 16 | 17 | 18 | /* Memory Spaces Definitions */ 19 | 20 | MEMORY 21 | { 22 | RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 8K 23 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K 24 | } 25 | 26 | /* highest address of the user mode stack */ 27 | 28 | _estack = 0x20002000; 29 | 30 | PROVIDE ( _Stack_Limit = _estack - _Minimum_Stack_Size ); 31 | 32 | /* Sections Definitions */ 33 | 34 | SECTIONS 35 | { 36 | .text : 37 | { 38 | KEEP(*(.isr_vector)) /* Startup code */ 39 | *(.text) /* code */ 40 | *(.text.*) /* remaining code */ 41 | *(.rodata) /* read-only data (constants) */ 42 | *(.rodata.*) 43 | *(.glue_7) 44 | *(.glue_7t) 45 | *(.vfp11_veneer) 46 | *(.v4_bx) 47 | *(.ARM.extab* .gnu.linkonce.armextab.*) 48 | } >FLASH 49 | 50 | /* for exception handling/unwind - some Newlib functions (in 51 | common with C++ and STDC++) use this. */ 52 | .ARM.extab : 53 | { 54 | *(.ARM.extab* .gnu.linkonce.armextab.*) 55 | 56 | } > FLASH 57 | 58 | __exidx_start = .; 59 | .ARM.exidx : 60 | { 61 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) 62 | } > FLASH 63 | __exidx_end = .; 64 | 65 | . = ALIGN(4); 66 | _etext = .; 67 | /* This is used by the startup in order to initialize the .data secion 68 | */ 69 | _sidata = _etext; 70 | 71 | /* This is the initialized data section 72 | The program executes knowing that the data is in the RAM 73 | but the loader puts the initial values in the FLASH (inidata). 74 | It is one task of the startup to copy the initial values from FLASH to 75 | RAM. */ 76 | .data : AT ( _sidata ) 77 | { 78 | . = ALIGN(4); 79 | /* This is used by the startup in order to initialize the .data 80 | secion */ 81 | _sdata = . ; 82 | 83 | *(.data) 84 | *(.data.*) 85 | 86 | . = ALIGN(4); 87 | /* This is used by the startup in order to initialize the .data 88 | secion */ 89 | _edata = . ; 90 | } >RAM 91 | 92 | 93 | /* This is the uninitialized data section */ 94 | .bss : 95 | { 96 | . = ALIGN(4); 97 | /* This is used by the startup in order to initialize the .bss 98 | secion */ 99 | _sbss = .; 100 | __bss_start__ = _sbss; 101 | *(.bss) 102 | *(.bss.*) 103 | *(COMMON) 104 | 105 | . = ALIGN(4); 106 | /* This is used by the startup in order to initialize the .bss 107 | secion */ 108 | _ebss = . ; 109 | __bss_end__ = _ebss; 110 | } >RAM 111 | 112 | PROVIDE ( end = _ebss ); 113 | PROVIDE ( _end = _ebss ); 114 | PROVIDE ( _exit = _ebss ); 115 | /* This is the user stack section 116 | This is just to check that there is enough RAM left for the User mode 117 | stack 118 | It should generate an error if it's full. 119 | */ 120 | ._usrstack : 121 | { 122 | . = ALIGN(4); 123 | _susrstack = . ; 124 | 125 | . = . + _Minimum_Stack_Size ; 126 | 127 | . = ALIGN(4); 128 | _eusrstack = . ; 129 | } >RAM 130 | 131 | 132 | 133 | /* after that it's only debugging information. */ 134 | 135 | /* remove the debugging information from the standard libraries */ 136 | /* 137 | DISCARD : 138 | { 139 | libc.a ( * ) 140 | libm.a ( * ) 141 | libgcc.a ( * ) 142 | } 143 | */ 144 | 145 | /* Stabs debugging sections. */ 146 | .stab 0 : { *(.stab) } 147 | .stabstr 0 : { *(.stabstr) } 148 | .stab.excl 0 : { *(.stab.excl) } 149 | .stab.exclstr 0 : { *(.stab.exclstr) } 150 | .stab.index 0 : { *(.stab.index) } 151 | .stab.indexstr 0 : { *(.stab.indexstr) } 152 | .comment 0 : { *(.comment) } 153 | /* DWARF debug sections. 154 | Symbols in the DWARF debugging sections are relative to the beginning 155 | of the section so we begin them at 0. */ 156 | /* DWARF 1 */ 157 | .debug 0 : { *(.debug) } 158 | .line 0 : { *(.line) } 159 | /* GNU DWARF 1 extensions */ 160 | .debug_srcinfo 0 : { *(.debug_srcinfo) } 161 | .debug_sfnames 0 : { *(.debug_sfnames) } 162 | /* DWARF 1.1 and DWARF 2 */ 163 | .debug_aranges 0 : { *(.debug_aranges) } 164 | .debug_pubnames 0 : { *(.debug_pubnames) } 165 | /* DWARF 2 */ 166 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 167 | .debug_abbrev 0 : { *(.debug_abbrev) } 168 | .debug_line 0 : { *(.debug_line) } 169 | .debug_frame 0 : { *(.debug_frame) } 170 | .debug_str 0 : { *(.debug_str) } 171 | .debug_loc 0 : { *(.debug_loc) } 172 | .debug_macinfo 0 : { *(.debug_macinfo) } 173 | /* SGI/MIPS DWARF 2 extensions */ 174 | .debug_weaknames 0 : { *(.debug_weaknames) } 175 | .debug_funcnames 0 : { *(.debug_funcnames) } 176 | .debug_typenames 0 : { *(.debug_typenames) } 177 | .debug_varnames 0 : { *(.debug_varnames) } 178 | } 179 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_iwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.c 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file provides all the IWDG firmware functions. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f10x_iwdg.h" 23 | 24 | /** @addtogroup STM32F10x_StdPeriph_Driver 25 | * @{ 26 | */ 27 | 28 | /** @defgroup IWDG 29 | * @brief IWDG driver modules 30 | * @{ 31 | */ 32 | 33 | /** @defgroup IWDG_Private_TypesDefinitions 34 | * @{ 35 | */ 36 | 37 | /** 38 | * @} 39 | */ 40 | 41 | /** @defgroup IWDG_Private_Defines 42 | * @{ 43 | */ 44 | 45 | /* ---------------------- IWDG registers bit mask ----------------------------*/ 46 | 47 | /* KR register bit mask */ 48 | #define KR_KEY_Reload ((uint16_t)0xAAAA) 49 | #define KR_KEY_Enable ((uint16_t)0xCCCC) 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup IWDG_Private_Macros 56 | * @{ 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup IWDG_Private_Variables 64 | * @{ 65 | */ 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup IWDG_Private_FunctionPrototypes 72 | * @{ 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup IWDG_Private_Functions 80 | * @{ 81 | */ 82 | 83 | /** 84 | * @brief Enables or disables write access to IWDG_PR and IWDG_RLR registers. 85 | * @param IWDG_WriteAccess: new state of write access to IWDG_PR and IWDG_RLR registers. 86 | * This parameter can be one of the following values: 87 | * @arg IWDG_WriteAccess_Enable: Enable write access to IWDG_PR and IWDG_RLR registers 88 | * @arg IWDG_WriteAccess_Disable: Disable write access to IWDG_PR and IWDG_RLR registers 89 | * @retval None 90 | */ 91 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess) 92 | { 93 | /* Check the parameters */ 94 | assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); 95 | IWDG->KR = IWDG_WriteAccess; 96 | } 97 | 98 | /** 99 | * @brief Sets IWDG Prescaler value. 100 | * @param IWDG_Prescaler: specifies the IWDG Prescaler value. 101 | * This parameter can be one of the following values: 102 | * @arg IWDG_Prescaler_4: IWDG prescaler set to 4 103 | * @arg IWDG_Prescaler_8: IWDG prescaler set to 8 104 | * @arg IWDG_Prescaler_16: IWDG prescaler set to 16 105 | * @arg IWDG_Prescaler_32: IWDG prescaler set to 32 106 | * @arg IWDG_Prescaler_64: IWDG prescaler set to 64 107 | * @arg IWDG_Prescaler_128: IWDG prescaler set to 128 108 | * @arg IWDG_Prescaler_256: IWDG prescaler set to 256 109 | * @retval None 110 | */ 111 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler) 112 | { 113 | /* Check the parameters */ 114 | assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler)); 115 | IWDG->PR = IWDG_Prescaler; 116 | } 117 | 118 | /** 119 | * @brief Sets IWDG Reload value. 120 | * @param Reload: specifies the IWDG Reload value. 121 | * This parameter must be a number between 0 and 0x0FFF. 122 | * @retval None 123 | */ 124 | void IWDG_SetReload(uint16_t Reload) 125 | { 126 | /* Check the parameters */ 127 | assert_param(IS_IWDG_RELOAD(Reload)); 128 | IWDG->RLR = Reload; 129 | } 130 | 131 | /** 132 | * @brief Reloads IWDG counter with value defined in the reload register 133 | * (write access to IWDG_PR and IWDG_RLR registers disabled). 134 | * @param None 135 | * @retval None 136 | */ 137 | void IWDG_ReloadCounter(void) 138 | { 139 | IWDG->KR = KR_KEY_Reload; 140 | } 141 | 142 | /** 143 | * @brief Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). 144 | * @param None 145 | * @retval None 146 | */ 147 | void IWDG_Enable(void) 148 | { 149 | IWDG->KR = KR_KEY_Enable; 150 | } 151 | 152 | /** 153 | * @brief Checks whether the specified IWDG flag is set or not. 154 | * @param IWDG_FLAG: specifies the flag to check. 155 | * This parameter can be one of the following values: 156 | * @arg IWDG_FLAG_PVU: Prescaler Value Update on going 157 | * @arg IWDG_FLAG_RVU: Reload Value Update on going 158 | * @retval The new state of IWDG_FLAG (SET or RESET). 159 | */ 160 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG) 161 | { 162 | FlagStatus bitstatus = RESET; 163 | /* Check the parameters */ 164 | assert_param(IS_IWDG_FLAG(IWDG_FLAG)); 165 | if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET) 166 | { 167 | bitstatus = SET; 168 | } 169 | else 170 | { 171 | bitstatus = RESET; 172 | } 173 | /* Return the flag status */ 174 | return bitstatus; 175 | } 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 190 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_dbgmcu.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.c 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file provides all the DBGMCU firmware functions. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f10x_dbgmcu.h" 23 | 24 | /** @addtogroup STM32F10x_StdPeriph_Driver 25 | * @{ 26 | */ 27 | 28 | /** @defgroup DBGMCU 29 | * @brief DBGMCU driver modules 30 | * @{ 31 | */ 32 | 33 | /** @defgroup DBGMCU_Private_TypesDefinitions 34 | * @{ 35 | */ 36 | 37 | /** 38 | * @} 39 | */ 40 | 41 | /** @defgroup DBGMCU_Private_Defines 42 | * @{ 43 | */ 44 | 45 | #define IDCODE_DEVID_Mask ((uint32_t)0x00000FFF) 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup DBGMCU_Private_Macros 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup DBGMCU_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup DBGMCU_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup DBGMCU_Private_Functions 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Returns the device revision identifier. 80 | * @param None 81 | * @retval Device revision identifier 82 | */ 83 | uint32_t DBGMCU_GetREVID(void) 84 | { 85 | return(DBGMCU->IDCODE >> 16); 86 | } 87 | 88 | /** 89 | * @brief Returns the device identifier. 90 | * @param None 91 | * @retval Device identifier 92 | */ 93 | uint32_t DBGMCU_GetDEVID(void) 94 | { 95 | return(DBGMCU->IDCODE & IDCODE_DEVID_Mask); 96 | } 97 | 98 | /** 99 | * @brief Configures the specified peripheral and low power mode behavior 100 | * when the MCU under Debug mode. 101 | * @param DBGMCU_Periph: specifies the peripheral and low power mode. 102 | * This parameter can be any combination of the following values: 103 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode 104 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode 105 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode 106 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted 107 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted 108 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted 109 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted 110 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted 111 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted 112 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted 113 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted 114 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted 115 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted 116 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted 117 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted 118 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted 119 | * @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted 120 | * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted 121 | * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted 122 | * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted 123 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted 124 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted 125 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted 126 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted 127 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted 128 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted 129 | * @param NewState: new state of the specified peripheral in Debug mode. 130 | * This parameter can be: ENABLE or DISABLE. 131 | * @retval None 132 | */ 133 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) 134 | { 135 | /* Check the parameters */ 136 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); 137 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 138 | 139 | if (NewState != DISABLE) 140 | { 141 | DBGMCU->CR |= DBGMCU_Periph; 142 | } 143 | else 144 | { 145 | DBGMCU->CR &= ~DBGMCU_Periph; 146 | } 147 | } 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | /** 158 | * @} 159 | */ 160 | 161 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 162 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/stm32f10x_wwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.c 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file provides all the WWDG firmware functions. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f10x_wwdg.h" 23 | #include "stm32f10x_rcc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup WWDG 30 | * @brief WWDG driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup WWDG_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup WWDG_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /* ----------- WWDG registers bit address in the alias region ----------- */ 47 | #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE) 48 | 49 | /* Alias word address of EWI bit */ 50 | #define CFR_OFFSET (WWDG_OFFSET + 0x04) 51 | #define EWI_BitNumber 0x09 52 | #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4)) 53 | 54 | /* --------------------- WWDG registers bit mask ------------------------ */ 55 | 56 | /* CR register bit mask */ 57 | #define CR_WDGA_Set ((uint32_t)0x00000080) 58 | 59 | /* CFR register bit mask */ 60 | #define CFR_WDGTB_Mask ((uint32_t)0xFFFFFE7F) 61 | #define CFR_W_Mask ((uint32_t)0xFFFFFF80) 62 | #define BIT_Mask ((uint8_t)0x7F) 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup WWDG_Private_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup WWDG_Private_Variables 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Private_FunctionPrototypes 85 | * @{ 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup WWDG_Private_Functions 93 | * @{ 94 | */ 95 | 96 | /** 97 | * @brief Deinitializes the WWDG peripheral registers to their default reset values. 98 | * @param None 99 | * @retval None 100 | */ 101 | void WWDG_DeInit(void) 102 | { 103 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE); 104 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE); 105 | } 106 | 107 | /** 108 | * @brief Sets the WWDG Prescaler. 109 | * @param WWDG_Prescaler: specifies the WWDG Prescaler. 110 | * This parameter can be one of the following values: 111 | * @arg WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1 112 | * @arg WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2 113 | * @arg WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4 114 | * @arg WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8 115 | * @retval None 116 | */ 117 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler) 118 | { 119 | uint32_t tmpreg = 0; 120 | /* Check the parameters */ 121 | assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler)); 122 | /* Clear WDGTB[1:0] bits */ 123 | tmpreg = WWDG->CFR & CFR_WDGTB_Mask; 124 | /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */ 125 | tmpreg |= WWDG_Prescaler; 126 | /* Store the new value */ 127 | WWDG->CFR = tmpreg; 128 | } 129 | 130 | /** 131 | * @brief Sets the WWDG window value. 132 | * @param WindowValue: specifies the window value to be compared to the downcounter. 133 | * This parameter value must be lower than 0x80. 134 | * @retval None 135 | */ 136 | void WWDG_SetWindowValue(uint8_t WindowValue) 137 | { 138 | __IO uint32_t tmpreg = 0; 139 | 140 | /* Check the parameters */ 141 | assert_param(IS_WWDG_WINDOW_VALUE(WindowValue)); 142 | /* Clear W[6:0] bits */ 143 | 144 | tmpreg = WWDG->CFR & CFR_W_Mask; 145 | 146 | /* Set W[6:0] bits according to WindowValue value */ 147 | tmpreg |= WindowValue & (uint32_t) BIT_Mask; 148 | 149 | /* Store the new value */ 150 | WWDG->CFR = tmpreg; 151 | } 152 | 153 | /** 154 | * @brief Enables the WWDG Early Wakeup interrupt(EWI). 155 | * @param None 156 | * @retval None 157 | */ 158 | void WWDG_EnableIT(void) 159 | { 160 | *(__IO uint32_t *) CFR_EWI_BB = (uint32_t)ENABLE; 161 | } 162 | 163 | /** 164 | * @brief Sets the WWDG counter value. 165 | * @param Counter: specifies the watchdog counter value. 166 | * This parameter must be a number between 0x40 and 0x7F. 167 | * @retval None 168 | */ 169 | void WWDG_SetCounter(uint8_t Counter) 170 | { 171 | /* Check the parameters */ 172 | assert_param(IS_WWDG_COUNTER(Counter)); 173 | /* Write to T[6:0] bits to configure the counter value, no need to do 174 | a read-modify-write; writing a 0 to WDGA bit does nothing */ 175 | WWDG->CR = Counter & BIT_Mask; 176 | } 177 | 178 | /** 179 | * @brief Enables WWDG and load the counter value. 180 | * @param Counter: specifies the watchdog counter value. 181 | * This parameter must be a number between 0x40 and 0x7F. 182 | * @retval None 183 | */ 184 | void WWDG_Enable(uint8_t Counter) 185 | { 186 | /* Check the parameters */ 187 | assert_param(IS_WWDG_COUNTER(Counter)); 188 | WWDG->CR = CR_WDGA_Set | Counter; 189 | } 190 | 191 | /** 192 | * @brief Checks whether the Early Wakeup interrupt flag is set or not. 193 | * @param None 194 | * @retval The new state of the Early Wakeup interrupt flag (SET or RESET) 195 | */ 196 | FlagStatus WWDG_GetFlagStatus(void) 197 | { 198 | return (FlagStatus)(WWDG->SR); 199 | } 200 | 201 | /** 202 | * @brief Clears Early Wakeup interrupt flag. 203 | * @param None 204 | * @retval None 205 | */ 206 | void WWDG_ClearFlag(void) 207 | { 208 | WWDG->SR = (uint32_t)RESET; 209 | } 210 | 211 | /** 212 | * @} 213 | */ 214 | 215 | /** 216 | * @} 217 | */ 218 | 219 | /** 220 | * @} 221 | */ 222 | 223 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 224 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_pwr.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_PWR_H 25 | #define __STM32F4xx_PWR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup PWR 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup PWR_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup PWR_PVD_detection_level 50 | * @{ 51 | */ 52 | 53 | #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0 54 | #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1 55 | #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2 56 | #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3 57 | #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4 58 | #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5 59 | #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6 60 | #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7 61 | 62 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \ 63 | ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \ 64 | ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \ 65 | ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7)) 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | /** @defgroup PWR_Regulator_state_in_STOP_mode 72 | * @{ 73 | */ 74 | 75 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 76 | #define PWR_Regulator_LowPower PWR_CR_LPDS 77 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 78 | ((REGULATOR) == PWR_Regulator_LowPower)) 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup PWR_STOP_mode_entry 84 | * @{ 85 | */ 86 | 87 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 88 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 89 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 90 | 91 | /** @defgroup PWR_Regulator_Voltage_Scale 92 | * @{ 93 | */ 94 | 95 | #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000) 96 | #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000) 97 | #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2)) 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup PWR_Flag 104 | * @{ 105 | */ 106 | 107 | #define PWR_FLAG_WU PWR_CSR_WUF 108 | #define PWR_FLAG_SB PWR_CSR_SBF 109 | #define PWR_FLAG_PVDO PWR_CSR_PVDO 110 | #define PWR_FLAG_BRR PWR_CSR_BRR 111 | #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY 112 | 113 | /** @defgroup PWR_Flag_Legacy 114 | * @{ 115 | */ 116 | #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY 117 | /** 118 | * @} 119 | */ 120 | 121 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 122 | ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \ 123 | ((FLAG) == PWR_FLAG_VOSRDY)) 124 | 125 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 126 | /** 127 | * @} 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /* Exported macro ------------------------------------------------------------*/ 135 | /* Exported functions --------------------------------------------------------*/ 136 | 137 | /* Function used to set the PWR configuration to the default reset state ******/ 138 | void PWR_DeInit(void); 139 | 140 | /* Backup Domain Access function **********************************************/ 141 | void PWR_BackupAccessCmd(FunctionalState NewState); 142 | 143 | /* PVD configuration functions ************************************************/ 144 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 145 | void PWR_PVDCmd(FunctionalState NewState); 146 | 147 | /* WakeUp pins configuration functions ****************************************/ 148 | void PWR_WakeUpPinCmd(FunctionalState NewState); 149 | 150 | /* Main and Backup Regulators configuration functions *************************/ 151 | void PWR_BackupRegulatorCmd(FunctionalState NewState); 152 | void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage); 153 | 154 | /* FLASH Power Down configuration functions ***********************************/ 155 | void PWR_FlashPowerDownCmd(FunctionalState NewState); 156 | 157 | /* Low Power modes configuration functions ************************************/ 158 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 159 | void PWR_EnterSTANDBYMode(void); 160 | 161 | /* Flags management functions *************************************************/ 162 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 163 | void PWR_ClearFlag(uint32_t PWR_FLAG); 164 | 165 | #ifdef __cplusplus 166 | } 167 | #endif 168 | 169 | #endif /* __STM32F4xx_PWR_H */ 170 | 171 | /** 172 | * @} 173 | */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 180 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/src/peripherals/stm32f4xx_dbgmcu.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_dbgmcu.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file provides all the DBGMCU firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f4xx_dbgmcu.h" 24 | 25 | /** @addtogroup STM32F4xx_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup DBGMCU 30 | * @brief DBGMCU driver modules 31 | * @{ 32 | */ 33 | 34 | /* Private typedef -----------------------------------------------------------*/ 35 | /* Private define ------------------------------------------------------------*/ 36 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF) 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | /* Private function prototypes -----------------------------------------------*/ 41 | /* Private functions ---------------------------------------------------------*/ 42 | 43 | /** @defgroup DBGMCU_Private_Functions 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief Returns the device revision identifier. 49 | * @param None 50 | * @retval Device revision identifier 51 | */ 52 | uint32_t DBGMCU_GetREVID(void) 53 | { 54 | return(DBGMCU->IDCODE >> 16); 55 | } 56 | 57 | /** 58 | * @brief Returns the device identifier. 59 | * @param None 60 | * @retval Device identifier 61 | */ 62 | uint32_t DBGMCU_GetDEVID(void) 63 | { 64 | return(DBGMCU->IDCODE & IDCODE_DEVID_MASK); 65 | } 66 | 67 | /** 68 | * @brief Configures low power mode behavior when the MCU is in Debug mode. 69 | * @param DBGMCU_Periph: specifies the low power mode. 70 | * This parameter can be any combination of the following values: 71 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode 72 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode 73 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode 74 | * @param NewState: new state of the specified low power mode in Debug mode. 75 | * This parameter can be: ENABLE or DISABLE. 76 | * @retval None 77 | */ 78 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) 79 | { 80 | /* Check the parameters */ 81 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); 82 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 83 | if (NewState != DISABLE) 84 | { 85 | DBGMCU->CR |= DBGMCU_Periph; 86 | } 87 | else 88 | { 89 | DBGMCU->CR &= ~DBGMCU_Periph; 90 | } 91 | } 92 | 93 | /** 94 | * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode. 95 | * @param DBGMCU_Periph: specifies the APB1 peripheral. 96 | * This parameter can be any combination of the following values: 97 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted 98 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted 99 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted 100 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted 101 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted 102 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted 103 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted 104 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted 105 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted 106 | * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter stopped when Core is halted. 107 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted 108 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted 109 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted 110 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted 111 | * @arg DBGMCU_I2C3_SMBUS_TIMEOUT: I2C3 SMBUS timeout mode stopped when Core is halted 112 | * @arg DBGMCU_CAN2_STOP: Debug CAN1 stopped when Core is halted 113 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted 114 | * This parameter can be: ENABLE or DISABLE. 115 | * @retval None 116 | */ 117 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState) 118 | { 119 | /* Check the parameters */ 120 | assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph)); 121 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 122 | 123 | if (NewState != DISABLE) 124 | { 125 | DBGMCU->APB1FZ |= DBGMCU_Periph; 126 | } 127 | else 128 | { 129 | DBGMCU->APB1FZ &= ~DBGMCU_Periph; 130 | } 131 | } 132 | 133 | /** 134 | * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode. 135 | * @param DBGMCU_Periph: specifies the APB2 peripheral. 136 | * This parameter can be any combination of the following values: 137 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted 138 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted 139 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted 140 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted 141 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted 142 | * @param NewState: new state of the specified peripheral in Debug mode. 143 | * This parameter can be: ENABLE or DISABLE. 144 | * @retval None 145 | */ 146 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState) 147 | { 148 | /* Check the parameters */ 149 | assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph)); 150 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 151 | 152 | if (NewState != DISABLE) 153 | { 154 | DBGMCU->APB2FZ |= DBGMCU_Periph; 155 | } 156 | else 157 | { 158 | DBGMCU->APB2FZ &= ~DBGMCU_Periph; 159 | } 160 | } 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | /** 171 | * @} 172 | */ 173 | 174 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 175 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_cec.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_cec.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the CEC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CEC_H 24 | #define __STM32F10x_CEC_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup CEC 38 | * @{ 39 | */ 40 | 41 | 42 | /** @defgroup CEC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief CEC Init structure definition 48 | */ 49 | typedef struct 50 | { 51 | uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode. 52 | This parameter can be a value of @ref CEC_BitTiming_Mode */ 53 | uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode. 54 | This parameter can be a value of @ref CEC_BitPeriod_Mode */ 55 | }CEC_InitTypeDef; 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup CEC_Exported_Constants 62 | * @{ 63 | */ 64 | 65 | /** @defgroup CEC_BitTiming_Mode 66 | * @{ 67 | */ 68 | #define CEC_BitTimingStdMode ((uint16_t)0x00) /*!< Bit timing error Standard Mode */ 69 | #define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM /*!< Bit timing error Free Mode */ 70 | 71 | #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \ 72 | ((MODE) == CEC_BitTimingErrFreeMode)) 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup CEC_BitPeriod_Mode 78 | * @{ 79 | */ 80 | #define CEC_BitPeriodStdMode ((uint16_t)0x00) /*!< Bit period error Standard Mode */ 81 | #define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */ 82 | 83 | #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \ 84 | ((MODE) == CEC_BitPeriodFlexibleMode)) 85 | /** 86 | * @} 87 | */ 88 | 89 | 90 | /** @defgroup CEC_interrupts_definition 91 | * @{ 92 | */ 93 | #define CEC_IT_TERR CEC_CSR_TERR 94 | #define CEC_IT_TBTRF CEC_CSR_TBTRF 95 | #define CEC_IT_RERR CEC_CSR_RERR 96 | #define CEC_IT_RBTF CEC_CSR_RBTF 97 | #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \ 98 | ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF)) 99 | /** 100 | * @} 101 | */ 102 | 103 | 104 | /** @defgroup CEC_Own_Addres 105 | * @{ 106 | */ 107 | #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10) 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup CEC_Prescaler 113 | * @{ 114 | */ 115 | #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF) 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** @defgroup CEC_flags_definition 122 | * @{ 123 | */ 124 | 125 | /** 126 | * @brief ESR register flags 127 | */ 128 | #define CEC_FLAG_BTE ((uint32_t)0x10010000) 129 | #define CEC_FLAG_BPE ((uint32_t)0x10020000) 130 | #define CEC_FLAG_RBTFE ((uint32_t)0x10040000) 131 | #define CEC_FLAG_SBE ((uint32_t)0x10080000) 132 | #define CEC_FLAG_ACKE ((uint32_t)0x10100000) 133 | #define CEC_FLAG_LINE ((uint32_t)0x10200000) 134 | #define CEC_FLAG_TBTFE ((uint32_t)0x10400000) 135 | 136 | /** 137 | * @brief CSR register flags 138 | */ 139 | #define CEC_FLAG_TEOM ((uint32_t)0x00000002) 140 | #define CEC_FLAG_TERR ((uint32_t)0x00000004) 141 | #define CEC_FLAG_TBTRF ((uint32_t)0x00000008) 142 | #define CEC_FLAG_RSOM ((uint32_t)0x00000010) 143 | #define CEC_FLAG_REOM ((uint32_t)0x00000020) 144 | #define CEC_FLAG_RERR ((uint32_t)0x00000040) 145 | #define CEC_FLAG_RBTF ((uint32_t)0x00000080) 146 | 147 | #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00)) 148 | 149 | #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \ 150 | ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \ 151 | ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \ 152 | ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \ 153 | ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \ 154 | ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \ 155 | ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF)) 156 | 157 | /** 158 | * @} 159 | */ 160 | 161 | /** 162 | * @} 163 | */ 164 | 165 | /** @defgroup CEC_Exported_Macros 166 | * @{ 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /** @defgroup CEC_Exported_Functions 174 | * @{ 175 | */ 176 | void CEC_DeInit(void); 177 | void CEC_Init(CEC_InitTypeDef* CEC_InitStruct); 178 | void CEC_Cmd(FunctionalState NewState); 179 | void CEC_ITConfig(FunctionalState NewState); 180 | void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress); 181 | void CEC_SetPrescaler(uint16_t CEC_Prescaler); 182 | void CEC_SendDataByte(uint8_t Data); 183 | uint8_t CEC_ReceiveDataByte(void); 184 | void CEC_StartOfMessage(void); 185 | void CEC_EndOfMessageCmd(FunctionalState NewState); 186 | FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG); 187 | void CEC_ClearFlag(uint32_t CEC_FLAG); 188 | ITStatus CEC_GetITStatus(uint8_t CEC_IT); 189 | void CEC_ClearITPendingBit(uint16_t CEC_IT); 190 | 191 | #ifdef __cplusplus 192 | } 193 | #endif 194 | 195 | #endif /* __STM32F10x_CEC_H */ 196 | 197 | /** 198 | * @} 199 | */ 200 | 201 | /** 202 | * @} 203 | */ 204 | 205 | /** 206 | * @} 207 | */ 208 | 209 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 210 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/misc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file misc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the miscellaneous 8 | * firmware library functions (add-on to CMSIS functions). 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __MISC_H 25 | #define __MISC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup MISC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | 44 | /** 45 | * @brief NVIC Init Structure definition 46 | */ 47 | 48 | typedef struct 49 | { 50 | uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled. 51 | This parameter can be an enumerator of @ref IRQn_Type 52 | enumeration (For the complete STM32 Devices IRQ Channels 53 | list, please refer to stm32f4xx.h file) */ 54 | 55 | uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel 56 | specified in NVIC_IRQChannel. This parameter can be a value 57 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table 58 | A lower priority value indicates a higher priority */ 59 | 60 | uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified 61 | in NVIC_IRQChannel. This parameter can be a value 62 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table 63 | A lower priority value indicates a higher priority */ 64 | 65 | FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel 66 | will be enabled or disabled. 67 | This parameter can be set either to ENABLE or DISABLE */ 68 | } NVIC_InitTypeDef; 69 | 70 | /* Exported constants --------------------------------------------------------*/ 71 | 72 | /** @defgroup MISC_Exported_Constants 73 | * @{ 74 | */ 75 | 76 | /** @defgroup MISC_Vector_Table_Base 77 | * @{ 78 | */ 79 | 80 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000) 81 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000) 82 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \ 83 | ((VECTTAB) == NVIC_VectTab_FLASH)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup MISC_System_Low_Power 89 | * @{ 90 | */ 91 | 92 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10) 93 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04) 94 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02) 95 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \ 96 | ((LP) == NVIC_LP_SLEEPDEEP) || \ 97 | ((LP) == NVIC_LP_SLEEPONEXIT)) 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @defgroup MISC_Preemption_Priority_Group 103 | * @{ 104 | */ 105 | 106 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority 107 | 4 bits for subpriority */ 108 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority 109 | 3 bits for subpriority */ 110 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority 111 | 2 bits for subpriority */ 112 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority 113 | 1 bits for subpriority */ 114 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority 115 | 0 bits for subpriority */ 116 | 117 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \ 118 | ((GROUP) == NVIC_PriorityGroup_1) || \ 119 | ((GROUP) == NVIC_PriorityGroup_2) || \ 120 | ((GROUP) == NVIC_PriorityGroup_3) || \ 121 | ((GROUP) == NVIC_PriorityGroup_4)) 122 | 123 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 124 | 125 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 126 | 127 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF) 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /** @defgroup MISC_SysTick_clock_source 134 | * @{ 135 | */ 136 | 137 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB) 138 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004) 139 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \ 140 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8)) 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Exported macro ------------------------------------------------------------*/ 150 | /* Exported functions --------------------------------------------------------*/ 151 | 152 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup); 153 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); 154 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset); 155 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState); 156 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource); 157 | 158 | #ifdef __cplusplus 159 | } 160 | #endif 161 | 162 | #endif /* __MISC_H */ 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | /** 169 | * @} 170 | */ 171 | 172 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 173 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_exti.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_exti.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the EXTI firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_EXTI_H 24 | #define __STM32F10x_EXTI_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup EXTI 38 | * @{ 39 | */ 40 | 41 | /** @defgroup EXTI_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief EXTI mode enumeration 47 | */ 48 | 49 | typedef enum 50 | { 51 | EXTI_Mode_Interrupt = 0x00, 52 | EXTI_Mode_Event = 0x04 53 | }EXTIMode_TypeDef; 54 | 55 | #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event)) 56 | 57 | /** 58 | * @brief EXTI Trigger enumeration 59 | */ 60 | 61 | typedef enum 62 | { 63 | EXTI_Trigger_Rising = 0x08, 64 | EXTI_Trigger_Falling = 0x0C, 65 | EXTI_Trigger_Rising_Falling = 0x10 66 | }EXTITrigger_TypeDef; 67 | 68 | #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \ 69 | ((TRIGGER) == EXTI_Trigger_Falling) || \ 70 | ((TRIGGER) == EXTI_Trigger_Rising_Falling)) 71 | /** 72 | * @brief EXTI Init Structure definition 73 | */ 74 | 75 | typedef struct 76 | { 77 | uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled. 78 | This parameter can be any combination of @ref EXTI_Lines */ 79 | 80 | EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines. 81 | This parameter can be a value of @ref EXTIMode_TypeDef */ 82 | 83 | EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines. 84 | This parameter can be a value of @ref EXTIMode_TypeDef */ 85 | 86 | FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines. 87 | This parameter can be set either to ENABLE or DISABLE */ 88 | }EXTI_InitTypeDef; 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup EXTI_Exported_Constants 95 | * @{ 96 | */ 97 | 98 | /** @defgroup EXTI_Lines 99 | * @{ 100 | */ 101 | 102 | #define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 */ 103 | #define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 */ 104 | #define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */ 105 | #define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */ 106 | #define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */ 107 | #define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */ 108 | #define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */ 109 | #define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */ 110 | #define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */ 111 | #define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */ 112 | #define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */ 113 | #define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */ 114 | #define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */ 115 | #define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */ 116 | #define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */ 117 | #define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */ 118 | #define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output */ 119 | #define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */ 120 | #define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB Device/USB OTG FS 121 | Wakeup from suspend event */ 122 | #define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ 123 | 124 | #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF00000) == 0x00) && ((LINE) != (uint16_t)0x00)) 125 | #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \ 126 | ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \ 127 | ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \ 128 | ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \ 129 | ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \ 130 | ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \ 131 | ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \ 132 | ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \ 133 | ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \ 134 | ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19)) 135 | 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | /** @defgroup EXTI_Exported_Macros 146 | * @{ 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** @defgroup EXTI_Exported_Functions 154 | * @{ 155 | */ 156 | 157 | void EXTI_DeInit(void); 158 | void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct); 159 | void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); 160 | void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); 161 | FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line); 162 | void EXTI_ClearFlag(uint32_t EXTI_Line); 163 | ITStatus EXTI_GetITStatus(uint32_t EXTI_Line); 164 | void EXTI_ClearITPendingBit(uint32_t EXTI_Line); 165 | 166 | #ifdef __cplusplus 167 | } 168 | #endif 169 | 170 | #endif /* __STM32F10x_EXTI_H */ 171 | /** 172 | * @} 173 | */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | /** 180 | * @} 181 | */ 182 | 183 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 184 | -------------------------------------------------------------------------------- /stm32vl-discovery/src/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Demo/src/main.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief Main program body 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2010 STMicroelectronics

19 | */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f10x.h" 23 | #include "STM32vldiscovery.h" 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | #define LSE_FAIL_FLAG 0x80 28 | #define LSE_PASS_FLAG 0x100 29 | /* Private macro -------------------------------------------------------------*/ 30 | /* Private consts ------------------------------------------------------------*/ 31 | 32 | /* Private variables ---------------------------------------------------------*/ 33 | u32 LSE_Delay = 0; 34 | u32 count = 0; 35 | u32 BlinkSpeed = 0; 36 | u32 KeyState = 0; 37 | static __IO uint32_t TimingDelay; 38 | /* Private function prototypes -----------------------------------------------*/ 39 | void Delay(uint32_t nTime); 40 | void TimingDelay_Decrement(void); 41 | 42 | /* Private functions ---------------------------------------------------------*/ 43 | 44 | /** 45 | * @brief Main program. 46 | * @param None 47 | * @retval None 48 | */ 49 | 50 | int main(void) 51 | { 52 | /* Enable GPIOx Clock */ 53 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); 54 | 55 | /* Initialise LEDs LD3&LD4, both off */ 56 | STM32vldiscovery_LEDInit(LED3); 57 | STM32vldiscovery_LEDInit(LED4); 58 | 59 | STM32vldiscovery_LEDOff(LED3); 60 | STM32vldiscovery_LEDOff(LED4); 61 | 62 | /* Initialise USER Button */ 63 | STM32vldiscovery_PBInit(BUTTON_USER, BUTTON_MODE_GPIO); 64 | 65 | /* Setup SysTick Timer for 1 msec interrupts */ 66 | if (SysTick_Config(SystemCoreClock / 1000)) 67 | { 68 | /* Capture error */ 69 | while (1); 70 | } 71 | 72 | /* Enable access to the backup register => LSE can be enabled */ 73 | PWR_BackupAccessCmd(ENABLE); 74 | 75 | /* Enable LSE (Low Speed External Oscillation) */ 76 | RCC_LSEConfig(RCC_LSE_ON); 77 | 78 | /* Check the LSE Status */ 79 | while(1) 80 | { 81 | if(LSE_Delay < LSE_FAIL_FLAG) 82 | { 83 | /* check whether LSE is ready, with 4 seconds timeout */ 84 | Delay (500); 85 | LSE_Delay += 0x10; 86 | if(RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET) 87 | { 88 | /* Set flag: LSE PASS */ 89 | LSE_Delay |= LSE_PASS_FLAG; 90 | /* Turn Off Led4 */ 91 | STM32vldiscovery_LEDOff(LED4); 92 | /* Disable LSE */ 93 | RCC_LSEConfig(RCC_LSE_OFF); 94 | break; 95 | } 96 | } 97 | 98 | /* LSE_FAIL_FLAG = 0x80 */ 99 | else if(LSE_Delay >= LSE_FAIL_FLAG) 100 | { 101 | if(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) 102 | { 103 | /* Set flag: LSE FAIL */ 104 | LSE_Delay |= LSE_FAIL_FLAG; 105 | /* Turn On Led4 */ 106 | STM32vldiscovery_LEDOn(LED4); 107 | } 108 | /* Disable LSE */ 109 | RCC_LSEConfig(RCC_LSE_OFF); 110 | break; 111 | } 112 | } 113 | 114 | /* main while */ 115 | while(1) 116 | { 117 | if(0 == STM32vldiscovery_PBGetState(BUTTON_USER)) 118 | { 119 | if(KeyState == 1) 120 | { 121 | if(0 == STM32vldiscovery_PBGetState(BUTTON_USER)) 122 | { 123 | /* USER Button released */ 124 | KeyState = 0; 125 | /* Turn Off LED4 */ 126 | STM32vldiscovery_LEDOff(LED4); 127 | } 128 | } 129 | } 130 | else if(STM32vldiscovery_PBGetState(BUTTON_USER)) 131 | { 132 | if(KeyState == 0) 133 | { 134 | if(STM32vldiscovery_PBGetState(BUTTON_USER)) 135 | { 136 | /* USER Button released */ 137 | KeyState = 1; 138 | /* Turn ON LED4 */ 139 | STM32vldiscovery_LEDOn(LED4); 140 | Delay(1000); 141 | /* Turn OFF LED4 */ 142 | STM32vldiscovery_LEDOff(LED4); 143 | /* BlinkSpeed: 0 -> 1 -> 2, then re-cycle */ 144 | BlinkSpeed ++ ; 145 | } 146 | } 147 | } 148 | count++; 149 | Delay(100); 150 | /* BlinkSpeed: 0 */ 151 | if(BlinkSpeed == 0) 152 | { 153 | if(4 == (count % 8)) 154 | STM32vldiscovery_LEDOn(LED3); 155 | if(0 == (count % 8)) 156 | STM32vldiscovery_LEDOff(LED3); 157 | } 158 | /* BlinkSpeed: 1 */ 159 | if(BlinkSpeed == 1) 160 | { 161 | if(2 == (count % 4)) 162 | STM32vldiscovery_LEDOn(LED3); 163 | if(0 == (count % 4)) 164 | STM32vldiscovery_LEDOff(LED3); 165 | } 166 | /* BlinkSpeed: 2 */ 167 | if(BlinkSpeed == 2) 168 | { 169 | if(0 == (count % 2)) 170 | STM32vldiscovery_LEDOn(LED3); 171 | else 172 | STM32vldiscovery_LEDOff(LED3); 173 | } 174 | /* BlinkSpeed: 3 */ 175 | else if(BlinkSpeed == 3) 176 | BlinkSpeed = 0; 177 | } 178 | } 179 | 180 | /** 181 | * @brief Inserts a delay time. 182 | * @param nTime: specifies the delay time length, in milliseconds. 183 | * @retval None 184 | */ 185 | void Delay(uint32_t nTime) 186 | { 187 | TimingDelay = nTime; 188 | 189 | while(TimingDelay != 0); 190 | } 191 | 192 | /** 193 | * @brief Decrements the TimingDelay variable. 194 | * @param None 195 | * @retval None 196 | */ 197 | void TimingDelay_Decrement(void) 198 | { 199 | if (TimingDelay != 0x00) 200 | { 201 | TimingDelay--; 202 | } 203 | } 204 | 205 | #ifdef USE_FULL_ASSERT 206 | /** 207 | * @brief Reports the name of the source file and the source line number 208 | * where the assert_param error has occurred. 209 | * @param file: pointer to the source file name 210 | * @param line: assert_param error line source number 211 | * @retval None 212 | */ 213 | void assert_failed(uint8_t* file, uint32_t line) 214 | { 215 | /* User can add his own implementation to report the file name and line number, 216 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 217 | 218 | /* Infinite loop */ 219 | while (1) 220 | { 221 | } 222 | } 223 | #endif 224 | 225 | /** 226 | * @} 227 | */ 228 | 229 | /** 230 | * @} 231 | */ 232 | 233 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 234 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/STM32vldiscovery.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32vldiscovery.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 09/13/2010 7 | * @brief STM32VLDISCOVERY abstraction layer. 8 | * This file should be added to the main application to use the provided 9 | * functions that manage the Leds LD3 and LD4 and the USER push-button. 10 | ****************************************************************************** 11 | * @copy 12 | * 13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 19 | * 20 | *

© COPYRIGHT 2010 STMicroelectronics

21 | */ 22 | 23 | /* Includes ------------------------------------------------------------------*/ 24 | #include "STM32vldiscovery.h" 25 | 26 | /** @defgroup STM32vldiscovery_Private_TypesDefinitions 27 | * @{ 28 | */ 29 | /** 30 | * @} 31 | */ 32 | 33 | 34 | /** @defgroup STM32vldiscovery_Private_Defines 35 | * @{ 36 | */ 37 | /** 38 | * @} 39 | */ 40 | 41 | 42 | /** @defgroup STM32vldiscovery_Private_Macros 43 | * @{ 44 | */ 45 | /** 46 | * @} 47 | */ 48 | 49 | 50 | /** @defgroup STM32vldiscovery_Private_Variables 51 | * @{ 52 | */ 53 | GPIO_TypeDef* GPIO_PORT[LEDn] = {LED3_GPIO_PORT, LED4_GPIO_PORT}; 54 | 55 | const uint16_t GPIO_PIN[LEDn] = {LED3_PIN, LED4_PIN}; 56 | 57 | const uint32_t GPIO_CLK[LEDn] = {LED3_GPIO_CLK, LED4_GPIO_CLK}; 58 | 59 | const uint16_t BUTTON_PIN_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PIN_SOURCE}; 60 | 61 | const uint16_t BUTTON_PORT_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PORT_SOURCE}; 62 | 63 | GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT}; 64 | 65 | const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN}; 66 | 67 | const uint32_t BUTTON_CLK[BUTTONn] = {USER_BUTTON_GPIO_CLK}; 68 | 69 | const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {USER_BUTTON_EXTI_LINE}; 70 | 71 | const uint16_t BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn}; 72 | 73 | /** @defgroup STM32vldiscovery_Private_FunctionPrototypes 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | 80 | 81 | /** @defgroup STM32vldiscovery_Private_Functions 82 | * @{ 83 | */ 84 | 85 | /** 86 | * @brief Configures LED GPIO. 87 | * @param Led: Specifies the Led to be configured. 88 | * This parameter can be one of following parameters: 89 | * @arg LED3 90 | * @arg LED4 91 | * @retval None 92 | */ 93 | void STM32vldiscovery_LEDInit(Led_TypeDef Led) 94 | { 95 | GPIO_InitTypeDef GPIO_InitStructure; 96 | 97 | /* Enable the GPIO_LED Clock */ 98 | RCC_APB2PeriphClockCmd(GPIO_CLK[Led], ENABLE); 99 | 100 | /* Configure the GPIO_LED pin */ 101 | GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led]; 102 | 103 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 104 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 105 | GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure); 106 | } 107 | 108 | /** 109 | * @brief Turns selected LED On. 110 | * @param Led: Specifies the Led to be set on. 111 | * This parameter can be one of following parameters: 112 | * @arg LED3 113 | * @arg LED4 114 | * @retval None 115 | */ 116 | void STM32vldiscovery_LEDOn(Led_TypeDef Led) 117 | { 118 | GPIO_PORT[Led]->BSRR = GPIO_PIN[Led]; 119 | } 120 | 121 | /** 122 | * @brief Turns selected LED Off. 123 | * @param Led: Specifies the Led to be set off. 124 | * This parameter can be one of following parameters: 125 | * @arg LED3 126 | * @arg LED4 127 | * @retval None 128 | */ 129 | void STM32vldiscovery_LEDOff(Led_TypeDef Led) 130 | { 131 | GPIO_PORT[Led]->BRR = GPIO_PIN[Led]; 132 | } 133 | 134 | /** 135 | * @brief Toggles the selected LED. 136 | * @param Led: Specifies the Led to be toggled. 137 | * This parameter can be one of following parameters: 138 | * @arg LED3 139 | * @arg LED4 140 | * @retval None 141 | */ 142 | void STM32vldiscovery_LEDToggle(Led_TypeDef Led) 143 | { 144 | GPIO_PORT[Led]->ODR ^= GPIO_PIN[Led]; 145 | } 146 | 147 | /** 148 | * @brief Configures Button GPIO and EXTI Line. 149 | * @param Button: Specifies the Button to be configured. 150 | * This parameter can be one of following parameters: 151 | * @arg BUTTON_USER: USER Push Button 152 | * @param Button_Mode: Specifies Button mode. 153 | * This parameter can be one of following parameters: 154 | * @arg BUTTON_MODE_GPIO: Button will be used as simple IO 155 | * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line with interrupt 156 | * generation capability 157 | * @retval None 158 | */ 159 | void STM32vldiscovery_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode) 160 | { 161 | GPIO_InitTypeDef GPIO_InitStructure; 162 | EXTI_InitTypeDef EXTI_InitStructure; 163 | NVIC_InitTypeDef NVIC_InitStructure; 164 | 165 | /* Enable the BUTTON Clock */ 166 | RCC_APB2PeriphClockCmd(BUTTON_CLK[Button] | RCC_APB2Periph_AFIO, ENABLE); 167 | 168 | /* Configure Button pin as input floating */ 169 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 170 | GPIO_InitStructure.GPIO_Pin = BUTTON_PIN[Button]; 171 | GPIO_Init(BUTTON_PORT[Button], &GPIO_InitStructure); 172 | 173 | if (Button_Mode == BUTTON_MODE_EXTI) 174 | { 175 | /* Connect Button EXTI Line to Button GPIO Pin */ 176 | GPIO_EXTILineConfig(BUTTON_PORT_SOURCE[Button], BUTTON_PIN_SOURCE[Button]); 177 | 178 | /* Configure Button EXTI line */ 179 | EXTI_InitStructure.EXTI_Line = BUTTON_EXTI_LINE[Button]; 180 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; 181 | 182 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; 183 | 184 | EXTI_InitStructure.EXTI_LineCmd = ENABLE; 185 | EXTI_Init(&EXTI_InitStructure); 186 | 187 | /* Enable and set Button EXTI Interrupt to the lowest priority */ 188 | NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button]; 189 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F; 190 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F; 191 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 192 | 193 | NVIC_Init(&NVIC_InitStructure); 194 | } 195 | } 196 | 197 | /** 198 | * @brief Returns the selected Button state. 199 | * @param Button: Specifies the Button to be checked. 200 | * This parameter can be one of following parameters: 201 | * @arg BUTTON_USER: USER Push Button 202 | * @retval The Button GPIO pin value. 203 | */ 204 | uint32_t STM32vldiscovery_PBGetState(Button_TypeDef Button) 205 | { 206 | return GPIO_ReadInputDataBit(BUTTON_PORT[Button], BUTTON_PIN[Button]); 207 | } 208 | 209 | /** 210 | * @} 211 | */ 212 | 213 | /** 214 | * @} 215 | */ 216 | 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | /** 227 | * @} 228 | */ 229 | 230 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 231 | -------------------------------------------------------------------------------- /stm32f4-discovery/lib/inc/peripherals/stm32f4xx_syscfg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_syscfg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the SYSCFG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_SYSCFG_H 25 | #define __STM32F4xx_SYSCFG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup SYSCFG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup SYSCFG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup SYSCFG_EXTI_Port_Sources 50 | * @{ 51 | */ 52 | #define EXTI_PortSourceGPIOA ((uint8_t)0x00) 53 | #define EXTI_PortSourceGPIOB ((uint8_t)0x01) 54 | #define EXTI_PortSourceGPIOC ((uint8_t)0x02) 55 | #define EXTI_PortSourceGPIOD ((uint8_t)0x03) 56 | #define EXTI_PortSourceGPIOE ((uint8_t)0x04) 57 | #define EXTI_PortSourceGPIOF ((uint8_t)0x05) 58 | #define EXTI_PortSourceGPIOG ((uint8_t)0x06) 59 | #define EXTI_PortSourceGPIOH ((uint8_t)0x07) 60 | #define EXTI_PortSourceGPIOI ((uint8_t)0x08) 61 | 62 | #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \ 63 | ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \ 64 | ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \ 65 | ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \ 66 | ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \ 67 | ((PORTSOURCE) == EXTI_PortSourceGPIOF) || \ 68 | ((PORTSOURCE) == EXTI_PortSourceGPIOG) || \ 69 | ((PORTSOURCE) == EXTI_PortSourceGPIOH) || \ 70 | ((PORTSOURCE) == EXTI_PortSourceGPIOI)) 71 | /** 72 | * @} 73 | */ 74 | 75 | 76 | /** @defgroup SYSCFG_EXTI_Pin_Sources 77 | * @{ 78 | */ 79 | #define EXTI_PinSource0 ((uint8_t)0x00) 80 | #define EXTI_PinSource1 ((uint8_t)0x01) 81 | #define EXTI_PinSource2 ((uint8_t)0x02) 82 | #define EXTI_PinSource3 ((uint8_t)0x03) 83 | #define EXTI_PinSource4 ((uint8_t)0x04) 84 | #define EXTI_PinSource5 ((uint8_t)0x05) 85 | #define EXTI_PinSource6 ((uint8_t)0x06) 86 | #define EXTI_PinSource7 ((uint8_t)0x07) 87 | #define EXTI_PinSource8 ((uint8_t)0x08) 88 | #define EXTI_PinSource9 ((uint8_t)0x09) 89 | #define EXTI_PinSource10 ((uint8_t)0x0A) 90 | #define EXTI_PinSource11 ((uint8_t)0x0B) 91 | #define EXTI_PinSource12 ((uint8_t)0x0C) 92 | #define EXTI_PinSource13 ((uint8_t)0x0D) 93 | #define EXTI_PinSource14 ((uint8_t)0x0E) 94 | #define EXTI_PinSource15 ((uint8_t)0x0F) 95 | #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \ 96 | ((PINSOURCE) == EXTI_PinSource1) || \ 97 | ((PINSOURCE) == EXTI_PinSource2) || \ 98 | ((PINSOURCE) == EXTI_PinSource3) || \ 99 | ((PINSOURCE) == EXTI_PinSource4) || \ 100 | ((PINSOURCE) == EXTI_PinSource5) || \ 101 | ((PINSOURCE) == EXTI_PinSource6) || \ 102 | ((PINSOURCE) == EXTI_PinSource7) || \ 103 | ((PINSOURCE) == EXTI_PinSource8) || \ 104 | ((PINSOURCE) == EXTI_PinSource9) || \ 105 | ((PINSOURCE) == EXTI_PinSource10) || \ 106 | ((PINSOURCE) == EXTI_PinSource11) || \ 107 | ((PINSOURCE) == EXTI_PinSource12) || \ 108 | ((PINSOURCE) == EXTI_PinSource13) || \ 109 | ((PINSOURCE) == EXTI_PinSource14) || \ 110 | ((PINSOURCE) == EXTI_PinSource15)) 111 | /** 112 | * @} 113 | */ 114 | 115 | 116 | /** @defgroup SYSCFG_Memory_Remap_Config 117 | * @{ 118 | */ 119 | #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00) 120 | #define SYSCFG_MemoryRemap_SystemFlash ((uint8_t)0x01) 121 | #define SYSCFG_MemoryRemap_FSMC ((uint8_t)0x02) 122 | #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03) 123 | 124 | #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \ 125 | ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \ 126 | ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \ 127 | ((REMAP) == SYSCFG_MemoryRemap_FSMC)) 128 | /** 129 | * @} 130 | */ 131 | 132 | 133 | /** @defgroup SYSCFG_ETHERNET_Media_Interface 134 | * @{ 135 | */ 136 | #define SYSCFG_ETH_MediaInterface_MII ((uint32_t)0x00000000) 137 | #define SYSCFG_ETH_MediaInterface_RMII ((uint32_t)0x00000001) 138 | 139 | #define IS_SYSCFG_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == SYSCFG_ETH_MediaInterface_MII) || \ 140 | ((INTERFACE) == SYSCFG_ETH_MediaInterface_RMII)) 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Exported macro ------------------------------------------------------------*/ 150 | /* Exported functions --------------------------------------------------------*/ 151 | 152 | void SYSCFG_DeInit(void); 153 | void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap); 154 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex); 155 | void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface); 156 | void SYSCFG_CompensationCellCmd(FunctionalState NewState); 157 | FlagStatus SYSCFG_GetCompensationCellStatus(void); 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif /*__STM32F4xx_SYSCFG_H */ 164 | 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 174 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/src/peripherals/misc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file misc.c 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file provides all the miscellaneous firmware functions (add-on 8 | * to CMSIS functions). 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "misc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup MISC 30 | * @brief MISC driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup MISC_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup MISC_Private_Defines 43 | * @{ 44 | */ 45 | 46 | #define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000) 47 | /** 48 | * @} 49 | */ 50 | 51 | /** @defgroup MISC_Private_Macros 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @defgroup MISC_Private_Variables 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup MISC_Private_FunctionPrototypes 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup MISC_Private_Functions 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @brief Configures the priority grouping: pre-emption priority and subpriority. 81 | * @param NVIC_PriorityGroup: specifies the priority grouping bits length. 82 | * This parameter can be one of the following values: 83 | * @arg NVIC_PriorityGroup_0: 0 bits for pre-emption priority 84 | * 4 bits for subpriority 85 | * @arg NVIC_PriorityGroup_1: 1 bits for pre-emption priority 86 | * 3 bits for subpriority 87 | * @arg NVIC_PriorityGroup_2: 2 bits for pre-emption priority 88 | * 2 bits for subpriority 89 | * @arg NVIC_PriorityGroup_3: 3 bits for pre-emption priority 90 | * 1 bits for subpriority 91 | * @arg NVIC_PriorityGroup_4: 4 bits for pre-emption priority 92 | * 0 bits for subpriority 93 | * @retval None 94 | */ 95 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup) 96 | { 97 | /* Check the parameters */ 98 | assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup)); 99 | 100 | /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */ 101 | SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup; 102 | } 103 | 104 | /** 105 | * @brief Initializes the NVIC peripheral according to the specified 106 | * parameters in the NVIC_InitStruct. 107 | * @param NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure that contains 108 | * the configuration information for the specified NVIC peripheral. 109 | * @retval None 110 | */ 111 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct) 112 | { 113 | uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F; 114 | 115 | /* Check the parameters */ 116 | assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd)); 117 | assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority)); 118 | assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority)); 119 | 120 | if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE) 121 | { 122 | /* Compute the Corresponding IRQ Priority --------------------------------*/ 123 | tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08; 124 | tmppre = (0x4 - tmppriority); 125 | tmpsub = tmpsub >> tmppriority; 126 | 127 | tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre; 128 | tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub; 129 | tmppriority = tmppriority << 0x04; 130 | 131 | NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority; 132 | 133 | /* Enable the Selected IRQ Channels --------------------------------------*/ 134 | NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = 135 | (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); 136 | } 137 | else 138 | { 139 | /* Disable the Selected IRQ Channels -------------------------------------*/ 140 | NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = 141 | (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); 142 | } 143 | } 144 | 145 | /** 146 | * @brief Sets the vector table location and Offset. 147 | * @param NVIC_VectTab: specifies if the vector table is in RAM or FLASH memory. 148 | * This parameter can be one of the following values: 149 | * @arg NVIC_VectTab_RAM 150 | * @arg NVIC_VectTab_FLASH 151 | * @param Offset: Vector Table base offset field. This value must be a multiple of 0x100. 152 | * @retval None 153 | */ 154 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset) 155 | { 156 | /* Check the parameters */ 157 | assert_param(IS_NVIC_VECTTAB(NVIC_VectTab)); 158 | assert_param(IS_NVIC_OFFSET(Offset)); 159 | 160 | SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80); 161 | } 162 | 163 | /** 164 | * @brief Selects the condition for the system to enter low power mode. 165 | * @param LowPowerMode: Specifies the new mode for the system to enter low power mode. 166 | * This parameter can be one of the following values: 167 | * @arg NVIC_LP_SEVONPEND 168 | * @arg NVIC_LP_SLEEPDEEP 169 | * @arg NVIC_LP_SLEEPONEXIT 170 | * @param NewState: new state of LP condition. This parameter can be: ENABLE or DISABLE. 171 | * @retval None 172 | */ 173 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState) 174 | { 175 | /* Check the parameters */ 176 | assert_param(IS_NVIC_LP(LowPowerMode)); 177 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 178 | 179 | if (NewState != DISABLE) 180 | { 181 | SCB->SCR |= LowPowerMode; 182 | } 183 | else 184 | { 185 | SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode); 186 | } 187 | } 188 | 189 | /** 190 | * @brief Configures the SysTick clock source. 191 | * @param SysTick_CLKSource: specifies the SysTick clock source. 192 | * This parameter can be one of the following values: 193 | * @arg SysTick_CLKSource_HCLK_Div8: AHB clock divided by 8 selected as SysTick clock source. 194 | * @arg SysTick_CLKSource_HCLK: AHB clock selected as SysTick clock source. 195 | * @retval None 196 | */ 197 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource) 198 | { 199 | /* Check the parameters */ 200 | assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource)); 201 | if (SysTick_CLKSource == SysTick_CLKSource_HCLK) 202 | { 203 | SysTick->CTRL |= SysTick_CLKSource_HCLK; 204 | } 205 | else 206 | { 207 | SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8; 208 | } 209 | } 210 | 211 | /** 212 | * @} 213 | */ 214 | 215 | /** 216 | * @} 217 | */ 218 | 219 | /** 220 | * @} 221 | */ 222 | 223 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 224 | -------------------------------------------------------------------------------- /stm32vl-discovery/lib/inc/peripherals/stm32f10x_bkp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_bkp.h 4 | * @author MCD Application Team 5 | * @version V3.3.0 6 | * @date 04/16/2010 7 | * @brief This file contains all the functions prototypes for the BKP firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2010 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_BKP_H 24 | #define __STM32F10x_BKP_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /** @addtogroup STM32F10x_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup BKP 38 | * @{ 39 | */ 40 | 41 | /** @defgroup BKP_Exported_Types 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | /** @defgroup BKP_Exported_Constants 50 | * @{ 51 | */ 52 | 53 | /** @defgroup Tamper_Pin_active_level 54 | * @{ 55 | */ 56 | 57 | #define BKP_TamperPinLevel_High ((uint16_t)0x0000) 58 | #define BKP_TamperPinLevel_Low ((uint16_t)0x0001) 59 | #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \ 60 | ((LEVEL) == BKP_TamperPinLevel_Low)) 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin 66 | * @{ 67 | */ 68 | 69 | #define BKP_RTCOutputSource_None ((uint16_t)0x0000) 70 | #define BKP_RTCOutputSource_CalibClock ((uint16_t)0x0080) 71 | #define BKP_RTCOutputSource_Alarm ((uint16_t)0x0100) 72 | #define BKP_RTCOutputSource_Second ((uint16_t)0x0300) 73 | #define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \ 74 | ((SOURCE) == BKP_RTCOutputSource_CalibClock) || \ 75 | ((SOURCE) == BKP_RTCOutputSource_Alarm) || \ 76 | ((SOURCE) == BKP_RTCOutputSource_Second)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup Data_Backup_Register 82 | * @{ 83 | */ 84 | 85 | #define BKP_DR1 ((uint16_t)0x0004) 86 | #define BKP_DR2 ((uint16_t)0x0008) 87 | #define BKP_DR3 ((uint16_t)0x000C) 88 | #define BKP_DR4 ((uint16_t)0x0010) 89 | #define BKP_DR5 ((uint16_t)0x0014) 90 | #define BKP_DR6 ((uint16_t)0x0018) 91 | #define BKP_DR7 ((uint16_t)0x001C) 92 | #define BKP_DR8 ((uint16_t)0x0020) 93 | #define BKP_DR9 ((uint16_t)0x0024) 94 | #define BKP_DR10 ((uint16_t)0x0028) 95 | #define BKP_DR11 ((uint16_t)0x0040) 96 | #define BKP_DR12 ((uint16_t)0x0044) 97 | #define BKP_DR13 ((uint16_t)0x0048) 98 | #define BKP_DR14 ((uint16_t)0x004C) 99 | #define BKP_DR15 ((uint16_t)0x0050) 100 | #define BKP_DR16 ((uint16_t)0x0054) 101 | #define BKP_DR17 ((uint16_t)0x0058) 102 | #define BKP_DR18 ((uint16_t)0x005C) 103 | #define BKP_DR19 ((uint16_t)0x0060) 104 | #define BKP_DR20 ((uint16_t)0x0064) 105 | #define BKP_DR21 ((uint16_t)0x0068) 106 | #define BKP_DR22 ((uint16_t)0x006C) 107 | #define BKP_DR23 ((uint16_t)0x0070) 108 | #define BKP_DR24 ((uint16_t)0x0074) 109 | #define BKP_DR25 ((uint16_t)0x0078) 110 | #define BKP_DR26 ((uint16_t)0x007C) 111 | #define BKP_DR27 ((uint16_t)0x0080) 112 | #define BKP_DR28 ((uint16_t)0x0084) 113 | #define BKP_DR29 ((uint16_t)0x0088) 114 | #define BKP_DR30 ((uint16_t)0x008C) 115 | #define BKP_DR31 ((uint16_t)0x0090) 116 | #define BKP_DR32 ((uint16_t)0x0094) 117 | #define BKP_DR33 ((uint16_t)0x0098) 118 | #define BKP_DR34 ((uint16_t)0x009C) 119 | #define BKP_DR35 ((uint16_t)0x00A0) 120 | #define BKP_DR36 ((uint16_t)0x00A4) 121 | #define BKP_DR37 ((uint16_t)0x00A8) 122 | #define BKP_DR38 ((uint16_t)0x00AC) 123 | #define BKP_DR39 ((uint16_t)0x00B0) 124 | #define BKP_DR40 ((uint16_t)0x00B4) 125 | #define BKP_DR41 ((uint16_t)0x00B8) 126 | #define BKP_DR42 ((uint16_t)0x00BC) 127 | 128 | #define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \ 129 | ((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \ 130 | ((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \ 131 | ((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \ 132 | ((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \ 133 | ((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \ 134 | ((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \ 135 | ((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \ 136 | ((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \ 137 | ((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \ 138 | ((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \ 139 | ((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \ 140 | ((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \ 141 | ((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42)) 142 | 143 | #define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F) 144 | /** 145 | * @} 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** @defgroup BKP_Exported_Macros 153 | * @{ 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** @defgroup BKP_Exported_Functions 161 | * @{ 162 | */ 163 | 164 | void BKP_DeInit(void); 165 | void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel); 166 | void BKP_TamperPinCmd(FunctionalState NewState); 167 | void BKP_ITConfig(FunctionalState NewState); 168 | void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource); 169 | void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue); 170 | void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data); 171 | uint16_t BKP_ReadBackupRegister(uint16_t BKP_DR); 172 | FlagStatus BKP_GetFlagStatus(void); 173 | void BKP_ClearFlag(void); 174 | ITStatus BKP_GetITStatus(void); 175 | void BKP_ClearITPendingBit(void); 176 | 177 | #ifdef __cplusplus 178 | } 179 | #endif 180 | 181 | #endif /* __STM32F10x_BKP_H */ 182 | /** 183 | * @} 184 | */ 185 | 186 | /** 187 | * @} 188 | */ 189 | 190 | /** 191 | * @} 192 | */ 193 | 194 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 195 | --------------------------------------------------------------------------------