├── .gitignore
├── README.md
├── Task-1-Leds
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-10-DHT
├── .cproject
├── .project
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ ├── dht21.h
│ ├── main.h
│ └── time.h
├── src
│ ├── dht21.c
│ ├── main.c
│ └── time.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-11-StepperMotor
├── .cproject
├── .project
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-12-ADC
├── .cproject
├── .project
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-2-Buttons
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-3-SystemClocks
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ └── stm32f4xx_conf.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ ├── main.h
│ └── startup.h
├── src
│ ├── main.c
│ └── startup.c
├── startup_stm32f4xx.S
└── stm32_flash.ld
├── Task-4-PWM
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-5-SPI
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ ├── org.eclipse.core.resources.prefs
│ ├── org.eclipse.core.runtime.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ ├── main.h
│ └── stm32f4_discovery_lis302dl.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-6-Interrupt
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-7-USB
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ ├── STM32_USB_Device_Library
│ │ ├── Class
│ │ │ └── cdc
│ │ │ │ ├── inc
│ │ │ │ └── usbd_cdc_core.h
│ │ │ │ └── src
│ │ │ │ └── usbd_cdc_core.c
│ │ └── Core
│ │ │ ├── inc
│ │ │ ├── usbd_conf_template.h
│ │ │ ├── usbd_core.h
│ │ │ ├── usbd_def.h
│ │ │ ├── usbd_ioreq.h
│ │ │ ├── usbd_req.h
│ │ │ └── usbd_usr.h
│ │ │ └── src
│ │ │ ├── usbd_core.c
│ │ │ ├── usbd_ioreq.c
│ │ │ └── usbd_req.c
│ ├── STM32_USB_OTG_Driver
│ │ ├── inc
│ │ │ ├── usb_bsp.h
│ │ │ ├── usb_conf_template.h
│ │ │ ├── usb_core.h
│ │ │ ├── usb_dcd.h
│ │ │ ├── usb_dcd_int.h
│ │ │ ├── usb_defines.h
│ │ │ ├── usb_hcd.h_D
│ │ │ ├── usb_hcd_int.h_D
│ │ │ ├── usb_otg.h_D
│ │ │ └── usb_regs.h
│ │ └── src
│ │ │ ├── usb_bsp_template.c_D
│ │ │ ├── usb_core.c
│ │ │ ├── usb_dcd.c
│ │ │ ├── usb_dcd_int.c
│ │ │ ├── usb_hcd.c_D
│ │ │ ├── usb_hcd_int.c_D
│ │ │ └── usb_otg.c_D
│ ├── main.h
│ ├── stm32f4_discovery.h
│ ├── stm32f4xx_conf.h
│ ├── stm32f4xx_it.h
│ ├── usb_conf.h
│ ├── usbd_cdc.h
│ ├── usbd_cdc_vcp.h
│ ├── usbd_conf.h
│ └── usbd_desc.h
├── src
│ ├── main.c
│ ├── stm32f4_discovery.c
│ ├── stm32f4xx_it.c
│ ├── system_stm32f4xx.c
│ ├── usb_bsp.c
│ ├── usbd_cdc.c
│ ├── usbd_cdc_vcp.c
│ ├── usbd_desc.c
│ └── usbd_usr.c
├── startup_stm32f4xx.S
└── stm32_flash.ld
├── Task-8-US
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
├── Task-9-RTC
├── .cproject
├── .project
├── .settings
│ ├── org.eclipse.cdt.codan.core.prefs
│ ├── org.eclipse.cdt.core.prefs
│ ├── org.eclipse.cdt.ui.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── Makefile
├── inc
│ ├── CMSIS
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ ├── STM32F4xx
│ │ ├── stm32f4xx.h
│ │ ├── stm32f4xx_conf.h
│ │ └── system_stm32f4xx.h
│ ├── STM32F4xx_StdPeriph_Driver
│ │ ├── inc
│ │ │ ├── misc.h
│ │ │ ├── stm32f4xx_adc.h
│ │ │ ├── stm32f4xx_can.h
│ │ │ ├── stm32f4xx_crc.h
│ │ │ ├── stm32f4xx_cryp.h
│ │ │ ├── stm32f4xx_dac.h
│ │ │ ├── stm32f4xx_dbgmcu.h
│ │ │ ├── stm32f4xx_dcmi.h
│ │ │ ├── stm32f4xx_dma.h
│ │ │ ├── stm32f4xx_exti.h
│ │ │ ├── stm32f4xx_flash.h
│ │ │ ├── stm32f4xx_fsmc.h
│ │ │ ├── stm32f4xx_gpio.h
│ │ │ ├── stm32f4xx_hash.h
│ │ │ ├── stm32f4xx_i2c.h
│ │ │ ├── stm32f4xx_iwdg.h
│ │ │ ├── stm32f4xx_pwr.h
│ │ │ ├── stm32f4xx_rcc.h
│ │ │ ├── stm32f4xx_rng.h
│ │ │ ├── stm32f4xx_rtc.h
│ │ │ ├── stm32f4xx_sdio.h
│ │ │ ├── stm32f4xx_spi.h
│ │ │ ├── stm32f4xx_syscfg.h
│ │ │ ├── stm32f4xx_tim.h
│ │ │ ├── stm32f4xx_usart.h
│ │ │ └── stm32f4xx_wwdg.h
│ │ └── src
│ │ │ ├── misc.c
│ │ │ ├── stm32f4xx_adc.c
│ │ │ ├── stm32f4xx_can.c
│ │ │ ├── stm32f4xx_crc.c
│ │ │ ├── stm32f4xx_cryp.c
│ │ │ ├── stm32f4xx_cryp_aes.c
│ │ │ ├── stm32f4xx_cryp_des.c
│ │ │ ├── stm32f4xx_cryp_tdes.c
│ │ │ ├── stm32f4xx_dac.c
│ │ │ ├── stm32f4xx_dbgmcu.c
│ │ │ ├── stm32f4xx_dcmi.c
│ │ │ ├── stm32f4xx_dma.c
│ │ │ ├── stm32f4xx_exti.c
│ │ │ ├── stm32f4xx_flash.c
│ │ │ ├── stm32f4xx_fsmc.c
│ │ │ ├── stm32f4xx_gpio.c
│ │ │ ├── stm32f4xx_hash.c
│ │ │ ├── stm32f4xx_hash_md5.c
│ │ │ ├── stm32f4xx_hash_sha1.c
│ │ │ ├── stm32f4xx_i2c.c
│ │ │ ├── stm32f4xx_iwdg.c
│ │ │ ├── stm32f4xx_pwr.c
│ │ │ ├── stm32f4xx_rcc.c
│ │ │ ├── stm32f4xx_rng.c
│ │ │ ├── stm32f4xx_rtc.c
│ │ │ ├── stm32f4xx_sdio.c
│ │ │ ├── stm32f4xx_spi.c
│ │ │ ├── stm32f4xx_syscfg.c
│ │ │ ├── stm32f4xx_tim.c
│ │ │ ├── stm32f4xx_usart.c
│ │ │ └── stm32f4xx_wwdg.c
│ └── main.h
├── src
│ └── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
└── stm32f4d_template
├── .cproject
├── .project
├── inc
├── CMSIS
│ ├── arm_common_tables.h
│ ├── arm_math.h
│ ├── core_cm0.h
│ ├── core_cm3.h
│ ├── core_cm4.h
│ ├── core_cm4_simd.h
│ ├── core_cmFunc.h
│ └── core_cmInstr.h
├── STM32F4xx
│ ├── stm32f4xx.h
│ ├── stm32f4xx_conf.h
│ └── system_stm32f4xx.h
├── STM32F4xx_StdPeriph_Driver
│ ├── inc
│ │ ├── misc.h
│ │ ├── stm32f4xx_adc.h
│ │ ├── stm32f4xx_can.h
│ │ ├── stm32f4xx_crc.h
│ │ ├── stm32f4xx_cryp.h
│ │ ├── stm32f4xx_dac.h
│ │ ├── stm32f4xx_dbgmcu.h
│ │ ├── stm32f4xx_dcmi.h
│ │ ├── stm32f4xx_dma.h
│ │ ├── stm32f4xx_exti.h
│ │ ├── stm32f4xx_flash.h
│ │ ├── stm32f4xx_fsmc.h
│ │ ├── stm32f4xx_gpio.h
│ │ ├── stm32f4xx_hash.h
│ │ ├── stm32f4xx_i2c.h
│ │ ├── stm32f4xx_iwdg.h
│ │ ├── stm32f4xx_pwr.h
│ │ ├── stm32f4xx_rcc.h
│ │ ├── stm32f4xx_rng.h
│ │ ├── stm32f4xx_rtc.h
│ │ ├── stm32f4xx_sdio.h
│ │ ├── stm32f4xx_spi.h
│ │ ├── stm32f4xx_syscfg.h
│ │ ├── stm32f4xx_tim.h
│ │ ├── stm32f4xx_usart.h
│ │ └── stm32f4xx_wwdg.h
│ └── src
│ │ ├── misc.c
│ │ ├── stm32f4xx_adc.c
│ │ ├── stm32f4xx_can.c
│ │ ├── stm32f4xx_crc.c
│ │ ├── stm32f4xx_cryp.c
│ │ ├── stm32f4xx_cryp_aes.c
│ │ ├── stm32f4xx_cryp_des.c
│ │ ├── stm32f4xx_cryp_tdes.c
│ │ ├── stm32f4xx_dac.c
│ │ ├── stm32f4xx_dbgmcu.c
│ │ ├── stm32f4xx_dcmi.c
│ │ ├── stm32f4xx_dma.c
│ │ ├── stm32f4xx_exti.c
│ │ ├── stm32f4xx_flash.c
│ │ ├── stm32f4xx_fsmc.c
│ │ ├── stm32f4xx_gpio.c
│ │ ├── stm32f4xx_hash.c
│ │ ├── stm32f4xx_hash_md5.c
│ │ ├── stm32f4xx_hash_sha1.c
│ │ ├── stm32f4xx_i2c.c
│ │ ├── stm32f4xx_iwdg.c
│ │ ├── stm32f4xx_pwr.c
│ │ ├── stm32f4xx_rcc.c
│ │ ├── stm32f4xx_rng.c
│ │ ├── stm32f4xx_rtc.c
│ │ ├── stm32f4xx_sdio.c
│ │ ├── stm32f4xx_spi.c
│ │ ├── stm32f4xx_syscfg.c
│ │ ├── stm32f4xx_tim.c
│ │ ├── stm32f4xx_usart.c
│ │ └── stm32f4xx_wwdg.c
└── main.h
├── src
└── main.c
├── startup_stm32f4xx.S
├── stm32_flash.ld
└── system_stm32f4xx.c
/.gitignore:
--------------------------------------------------------------------------------
1 | */Debug/
2 | .metadata/
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | stm32f4-examples
2 | ================
3 |
4 | Examples programs for STM32F4Discovery board. These examples were written while I was exploring STM32F407VGT microcontroller. I think this is may be helpful somebody.
5 |
6 | stm32f4d_template
7 | -----------------
8 |
9 | This is Eclipse project template for STM32F4Discovery board
10 |
11 | Task-1-Leds
12 | -----------
13 |
14 | This is "Hello world" project. Simple blinking LEDs on board.
15 |
16 | Task-2-Buttons
17 | --------------
18 |
19 | This is "Hello world" project, but this also used buttons for switch LEDs.
20 |
21 | Task-3-SystemClocks
22 | -------------------
23 |
24 | Setup and runtime change system clocks settings.
25 |
26 | Task-4-PWM
27 | ----------
28 |
29 | Example how to use PWM to change LEDs brightness.
30 |
31 | Task-5-SPI
32 | ----------
33 |
34 | Use onboard accelerometer by SPI bus.
35 |
36 | Task-6-Interrupt
37 | ----------------
38 |
39 | Expamle external and system timer interrupt
40 |
41 | Task-7-USB
42 | ----------
43 |
44 | Simple exampe CDC USB device. Press 'a' and 's' for toggle LEDs, press user button for send 'HELLO' to PC.
45 |
46 | Task-8-US
47 | ---------
48 |
49 | Simple example shows how to use Ultrasonic sensor
50 |
51 | Task-9-RTC
52 | ----------
53 |
54 | Real time clock example
55 |
56 | Task-10-DHT
57 | -----------
58 |
59 | Simple exemple for DHT21/AM2301 sensor
60 |
61 | Task-11-SepperMotor
62 | -------------------
63 |
64 | Simple example about how to work with sepper motor
65 |
66 | Task-12-ADC
67 | -----------
68 |
69 | Simple ADC example
--------------------------------------------------------------------------------
/Task-1-Leds/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-1-Leds
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/Task-1-Leds/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 | org.eclipse.cdt.core.ccnature
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Task-1-Leds/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-1-Leds/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-1-Leds/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-1-Leds/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-1-Leds/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-1-Leds/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-1-Leds/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-1-Leds/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 | const uint16_t LED[4] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
7 |
8 | void init();
9 | void loop();
10 |
11 | void delay();
12 |
--------------------------------------------------------------------------------
/Task-1-Leds/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | int main() {
4 | init();
5 |
6 | do {
7 | loop();
8 | } while (1);
9 | }
10 |
11 | void init() {
12 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
13 | GPIO_InitTypeDef gpio;
14 | GPIO_StructInit(&gpio);
15 | gpio.GPIO_Mode = GPIO_Mode_OUT;
16 | gpio.GPIO_Pin = LEDS;
17 | GPIO_Init(GPIOD, &gpio);
18 |
19 | GPIO_SetBits(GPIOD, LEDS);
20 | }
21 |
22 | void loop() {
23 | static uint32_t counter = 0;
24 |
25 | ++counter;
26 |
27 | GPIO_ResetBits(GPIOD, LEDS);
28 | GPIO_SetBits(GPIOD, LED[counter % 4]);
29 |
30 | delay(250);
31 | }
32 |
33 | void delay(uint32_t ms) {
34 | ms *= 3360;
35 | while(ms--) {
36 | __NOP();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Task-1-Leds/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-1-Leds/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-10-DHT/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-10-DHT
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d-template}/Debug
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-10-DHT/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-10-DHT/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-10-DHT/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-10-DHT/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-10-DHT/inc/dht21.h:
--------------------------------------------------------------------------------
1 | /*
2 | * dht.h
3 | *
4 | * Created on: Jan 3, 2014
5 | * Author: kvv
6 | */
7 |
8 | #ifndef DHT21_H_
9 | #define DHT21_H_
10 |
11 | #include "stm32f4xx.h"
12 |
13 | #define DHT_OK 0 // OK
14 | #define DHT_ERR_CON 1 // DHT is not connected
15 | #define DHT_ERR_DEL 2 // DHT time out
16 | #define DHT_ERR_SUM 3 // error control sum
17 |
18 | #define DHT_C 0
19 | #define DHT_F 1
20 |
21 | #define DHT21_PIN GPIO_Pin_5
22 | #define DHT21_GPIO GPIOA
23 | #define DHT21_BUS RCC_AHB1Periph_GPIOA
24 |
25 | void DHT21_init();
26 | uint8_t DHT21_read(uint8_t s, int16_t *t, uint16_t *h); // TODO : the first byte is whole number the second byte is fractional part
27 |
28 | #endif /* DHT21_H_ */
29 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 | const uint16_t LED[] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
7 |
8 | void init();
9 | void loop();
10 |
11 |
--------------------------------------------------------------------------------
/Task-10-DHT/inc/time.h:
--------------------------------------------------------------------------------
1 | /*
2 | * time.h
3 | *
4 | * Created on: Apr 21, 2013
5 | * Author: kvv
6 | */
7 |
8 | #ifndef TIME_H_
9 | #define TIME_H_
10 |
11 | #include "stm32f4xx.h"
12 |
13 | uint32_t TIME_nano;
14 |
15 | void TIME_init();
16 | void TIME_delay(uint32_t ms);
17 | void TIME_delayNano(uint32_t nano);
18 | void SysTick_Handler(void);
19 |
20 | #endif /* TIME_H_ */
21 |
--------------------------------------------------------------------------------
/Task-10-DHT/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 | #include "dht21.h"
3 | #include "time.h"
4 |
5 | void delay(uint32_t ms) {
6 | ms *= 8000;
7 | while(ms--) {
8 | __NOP();
9 | }
10 | }
11 |
12 | int main() {
13 | init();
14 | DHT21_init();
15 | TIME_init();
16 |
17 | do {
18 | loop();
19 | } while (1);
20 | }
21 |
22 | void init() {
23 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
24 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
25 |
26 | GPIO_InitTypeDef gpio;
27 | GPIO_StructInit(&gpio);
28 | gpio.GPIO_Mode = GPIO_Mode_OUT;
29 | gpio.GPIO_Pin = LEDS;
30 | GPIO_Init(GPIOD, &gpio);
31 | }
32 |
33 | void loop() {
34 | TIME_delay(2000);
35 | GPIO_ResetBits(GPIOD, LEDS);
36 |
37 | int16_t temp = 0;
38 | uint16_t hum = 0;
39 | uint8_t err = DHT21_read(DHT_C, &temp, &hum), i = 0, j = 0;
40 | temp = temp / 10;
41 | hum = hum / 10;
42 |
43 | if (err != DHT_OK) {
44 | if (err == DHT_ERR_CON) {
45 | j = 2;
46 | } else if (err == DHT_ERR_DEL) {
47 | j = 3;
48 | } else if (err == DHT_ERR_SUM) {
49 | j = 4;
50 | }
51 | for (i = 0; i < j; i++) {
52 | GPIO_SetBits(GPIOD, LED[0]);
53 | delay(250);
54 | GPIO_ResetBits(GPIOD, LED[0]);
55 | delay(200);
56 | }
57 | }
58 | else {
59 | /* temp = (buf[2] * 256 + buf[3]) / 10;*/
60 | if (temp == 0) {
61 | GPIO_SetBits(GPIOD, LED[0]);
62 | } else {
63 | GPIO_ResetBits(GPIOD, LED[0]);
64 | }
65 | if (temp > 10) {
66 | GPIO_SetBits(GPIOD, LED[1]);
67 | }
68 | if (temp > 20) {
69 | GPIO_SetBits(GPIOD, LED[2]);
70 | }
71 | if (temp > 30) {
72 | GPIO_SetBits(GPIOD, LED[3]);
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Task-10-DHT/src/time.c:
--------------------------------------------------------------------------------
1 | /*
2 | * time.c
3 | *
4 | * Created on: Apr 21, 2013
5 | * Author: kvv
6 | */
7 |
8 | #include "time.h"
9 | #include "stm32f4xx_rcc.h"
10 |
11 | void TIME_init() {
12 | TIME_nano = 0;
13 |
14 | RCC_ClocksTypeDef RCC_Clocks;
15 | /* SysTick end of count event each 1ms */
16 | RCC_GetClocksFreq(&RCC_Clocks);
17 | SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000000);
18 | NVIC_SetPriority(SysTick_IRQn, 1);
19 | }
20 |
21 | void TIME_delay(uint32_t ms) {
22 | TIME_delayNano(ms*1000);
23 | }
24 |
25 | void TIME_delayNano(uint32_t nano) {
26 | uint32_t deadLine = TIME_nano + nano;
27 | while (deadLine > TIME_nano) {
28 | __NOP();
29 | }
30 | }
31 |
32 | void SysTick_Handler(void) {
33 | TIME_nano++;
34 | }
35 |
--------------------------------------------------------------------------------
/Task-10-DHT/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-10-DHT/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-11-StepperMotor/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-11-StepperMotor
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d-template}/Debug
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-11-StepperMotor/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-11-StepperMotor/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-11-StepperMotor/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-11-StepperMotor/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS[] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
6 | const uint16_t LED = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
7 |
8 | void init();
9 | void loop();
10 |
11 | void delay();
12 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | const uint8_t steps[4][4] = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}};
4 | uint32_t i = 0;
5 |
6 | int main() {
7 | init();
8 |
9 | do {
10 | loop();
11 | } while (1);
12 | }
13 |
14 | void init() {
15 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
16 |
17 | GPIO_InitTypeDef gpio;
18 | GPIO_StructInit(&gpio);
19 | gpio.GPIO_Mode = GPIO_Mode_OUT;
20 | gpio.GPIO_Pin = LED;
21 | GPIO_Init(GPIOD, &gpio);
22 | }
23 |
24 | void loop() {
25 | uint8_t j;
26 | for (j = 0; j < 4; j++) {
27 | if (steps[i % 4][j] == 0) {
28 | GPIO_ResetBits(GPIOD, LEDS[j]);
29 | } else {
30 | GPIO_SetBits(GPIOD, LEDS[j]);
31 | }
32 | }
33 | delay(10);
34 | i++;
35 | }
36 |
37 | void delay(uint32_t ms) {
38 | ms *= 3360;
39 | while(ms--) {
40 | __NOP();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Task-11-StepperMotor/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-11-StepperMotor/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-12-ADC/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-12-ADC
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d-template}/Debug
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-12-ADC/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-12-ADC/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-12-ADC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-12-ADC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-12-ADC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-12-ADC/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 |
7 | void init();
8 | void loop();
9 |
10 | void delay();
11 |
--------------------------------------------------------------------------------
/Task-12-ADC/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 | #include "stm32f4xx_adc.h"
3 |
4 | void leds_init() {
5 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
6 |
7 | GPIO_InitTypeDef gpio;
8 | GPIO_StructInit(&gpio);
9 | gpio.GPIO_OType = GPIO_OType_PP;
10 | gpio.GPIO_Mode = GPIO_Mode_OUT;
11 | gpio.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
12 |
13 | GPIO_Init(GPIOD, &gpio);
14 | }
15 |
16 | void adc_init() {
17 |
18 | ADC_InitTypeDef ADC_init_structure; //Structure for adc confguration
19 | GPIO_InitTypeDef GPIO_initStructre; //Structure for analog input pin
20 | //Clock configuration
21 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); //The ADC1 is connected the APB2 peripheral bus thus we will use its clock source
22 | RCC_AHB1PeriphClockCmd(RCC_AHB1ENR_GPIOCEN, ENABLE); //Clock for the ADC port!! Do not forget about this one ;)
23 | //Analog pin configuration
24 | GPIO_StructInit(&GPIO_initStructre);
25 | GPIO_initStructre.GPIO_Pin = GPIO_Pin_0; //The channel 10 is connected to PC0
26 | GPIO_initStructre.GPIO_Mode = GPIO_Mode_AN; //The PC0 pin is configured in analog mode
27 | GPIO_initStructre.GPIO_PuPd = GPIO_PuPd_NOPULL; //We don't need any pull up or pull down
28 | GPIO_Init(GPIOC, &GPIO_initStructre); //Affecting the port with the initialization structure configuration
29 | //ADC structure configuration
30 | ADC_DeInit();
31 | ADC_init_structure.ADC_DataAlign = ADC_DataAlign_Right; //data converted will be shifted to right
32 | ADC_init_structure.ADC_Resolution = ADC_Resolution_12b; //Input voltage is converted into a 12bit number giving a maximum value of 4096
33 | ADC_init_structure.ADC_ContinuousConvMode = ENABLE; //the conversion is continuous, the input data is converted more than once
34 | ADC_init_structure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_T1_CC1; // conversion is synchronous with TIM1 and CC1 (actually I'm not sure about this one :/)
35 | ADC_init_structure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; //no trigger for conversion
36 | ADC_init_structure.ADC_NbrOfConversion = 1; //I think this one is clear :p
37 | ADC_init_structure.ADC_ScanConvMode = DISABLE; //The scan is configured in one channel
38 | ADC_Init(ADC1, &ADC_init_structure); //Initialize ADC with the previous configuration
39 | //Enable ADC conversion
40 | ADC_Cmd(ADC1, ENABLE);
41 | //Select the channel to be read from
42 | ADC_RegularChannelConfig(ADC1, ADC_Channel_10, 1, ADC_SampleTime_144Cycles);
43 | }
44 |
45 | void Delay(unsigned int Val) {
46 | for (; Val != 0; Val--)
47 | __NOP();
48 | }
49 |
50 | u16 readADC1(u8 channel) {
51 | ADC_SoftwareStartConv(ADC1);//Start the conversion
52 | while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC));//Processing the conversion
53 | return ADC_GetConversionValue(ADC1); //Return the converted data
54 | }
55 | int main() {
56 | leds_init();
57 | // инициализируем диоды
58 | adc_init();
59 | // ацп
60 |
61 | //ADC_TempSensorVrefintCmd(ENABLE);
62 | // разрешаем преобразование
63 | do {
64 | unsigned int Temperature = readADC1(16);
65 | // читаем данные с датчика АЦП1
66 | if (Temperature > 1000) {
67 | // если больше 20 зажигаем первый диод
68 | GPIO_SetBits(GPIOD, GPIO_Pin_12);
69 | }
70 |
71 | if (Temperature > 2000) { // если больше 30 - второй. и т.д.
72 | GPIO_SetBits(GPIOD, GPIO_Pin_13);
73 | }
74 |
75 | if (Temperature > 3000) {
76 | GPIO_SetBits(GPIOD, GPIO_Pin_14);
77 | }
78 |
79 | if (Temperature > 4000) {
80 | GPIO_SetBits(GPIOD, GPIO_Pin_15);
81 | }
82 |
83 | Delay(5000000);
84 | GPIO_ResetBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
85 | Delay(5000000);
86 | // задержка
87 | } while (1);
88 | }
89 |
--------------------------------------------------------------------------------
/Task-12-ADC/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-12-ADC/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-2-Buttons/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-2-Buttons
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-2-Buttons/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-2-Buttons/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-2-Buttons/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=button
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/usb
10 |
11 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
12 |
13 | SOURCES += \
14 | $(PERIPH)/src/stm32f4xx_gpio.c \
15 | $(PERIPH)/src/stm32f4xx_i2c.c \
16 | $(PERIPH)/src/stm32f4xx_rcc.c \
17 | $(PERIPH)/src/stm32f4xx_spi.c \
18 | $(PERIPH)/src/stm32f4xx_exti.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(PERIPH)/src/misc.c
21 |
22 | SOURCES += startup_stm32f4xx.S
23 | #SOURCES += stm32f4xx_it.c
24 | SOURCES += system_stm32f4xx.c
25 |
26 | SOURCES += \
27 | src/main.c
28 |
29 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
30 |
31 | INCLUDES += -I$(DEVICE) \
32 | -I$(CORE) \
33 | -I$(PERIPH)/inc \
34 | -I$(DISCOVERY) \
35 | -I$(USB)/inc \
36 | -I.
37 |
38 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
39 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
40 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
41 |
42 | CC = arm-none-eabi-gcc
43 | LD = arm-none-eabi-gcc
44 | AR = arm-none-eabi-ar
45 | OBJCOPY = arm-none-eabi-objcopy
46 | GDB = arm-none-eabi-gdb
47 |
48 | CFLAGS = -O0 -g -Wall -I.\
49 | -mcpu=cortex-m4 -mthumb \
50 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
51 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER
52 |
53 | LDSCRIPT = stm32_flash.ld
54 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
55 |
56 | $(BIN): $(ELF)
57 | $(OBJCOPY) -O binary $< $@
58 |
59 | $(HEX): $(ELF)
60 | $(OBJCOPY) -O ihex $< $@
61 |
62 | $(ELF): $(OBJECTS)
63 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
64 |
65 | $(BUILDDIR)/%.o: %.c
66 | mkdir -p $(dir $@)
67 | $(CC) -c $(CFLAGS) $< -o $@
68 |
69 | $(BUILDDIR)/%.o: %.S
70 | mkdir -p $(dir $@)
71 | $(CC) -c $(CFLAGS) $< -o $@
72 |
73 | flash: $(BIN)
74 | st-flash write $(BIN) 0x8000000
75 |
76 | debug: $(ELF)
77 | $(GDB) -tui $(ELF)
78 |
79 | all: $(HEX) $(BIN)
80 |
81 | .PHONY: clean
82 | clean:
83 | rm -rf build
84 |
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-2-Buttons/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-2-Buttons/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-2-Buttons/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-2-Buttons/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 | const uint16_t LED[4] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
7 | const uint16_t USER_BUTTON = GPIO_Pin_0;
8 |
9 | void init();
10 | void loop();
11 |
12 | void delay();
13 |
14 | void initLeds();
15 | void initButton();
16 |
17 |
--------------------------------------------------------------------------------
/Task-2-Buttons/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | static uint8_t lastButtonStatus = RESET;
4 |
5 | int main() {
6 | init();
7 |
8 | do {
9 | loop();
10 | } while (1);
11 | }
12 |
13 | void init() {
14 | initLeds();
15 | initButton();
16 | }
17 |
18 | void loop() {
19 | static uint32_t counter = 0;
20 |
21 | uint8_t currentButtonStatus = GPIO_ReadInputDataBit(GPIOA, USER_BUTTON);
22 |
23 | if (lastButtonStatus != currentButtonStatus && currentButtonStatus != RESET) {
24 | ++counter;
25 | GPIO_ResetBits(GPIOD, LEDS);
26 | GPIO_SetBits(GPIOD, LED[counter % 4]);
27 | }
28 | lastButtonStatus = currentButtonStatus;
29 | }
30 |
31 | void initLeds() {
32 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
33 |
34 | GPIO_InitTypeDef gpio;
35 | GPIO_StructInit(&gpio);
36 | gpio.GPIO_Mode = GPIO_Mode_OUT;
37 | gpio.GPIO_Pin = LEDS;
38 | GPIO_Init(GPIOD, &gpio);
39 | }
40 |
41 | void initButton() {
42 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
43 |
44 | GPIO_InitTypeDef gpio;
45 | GPIO_StructInit(&gpio);
46 | gpio.GPIO_Mode = GPIO_Mode_IN;
47 | gpio.GPIO_Pin = USER_BUTTON;
48 | GPIO_Init(GPIOA, &gpio);
49 | }
50 |
51 | void delay(uint32_t ms) {
52 | ms *= 3360;
53 | while(ms--) {
54 | __NOP();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Task-2-Buttons/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-2-Buttons/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-3-SystemClocks/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-3-SystemClocks
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=systemclocks
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/usb
10 |
11 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
12 |
13 | SOURCES += \
14 | $(PERIPH)/src/stm32f4xx_gpio.c \
15 | $(PERIPH)/src/stm32f4xx_i2c.c \
16 | $(PERIPH)/src/stm32f4xx_rcc.c \
17 | $(PERIPH)/src/stm32f4xx_spi.c \
18 | $(PERIPH)/src/stm32f4xx_exti.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(PERIPH)/src/misc.c
21 |
22 | SOURCES += startup_stm32f4xx.S
23 | #SOURCES += stm32f4xx_it.c
24 | #SOURCES += system_stm32f4xx.c
25 |
26 | SOURCES += \
27 | src/main.c \
28 | src/startup.c
29 |
30 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
31 |
32 | INCLUDES += -I$(DEVICE) \
33 | -I$(CORE) \
34 | -I$(PERIPH)/inc \
35 | -I$(DISCOVERY) \
36 | -I$(USB)/inc \
37 | -I.
38 |
39 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
40 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
41 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
42 |
43 | CC = arm-none-eabi-gcc
44 | LD = arm-none-eabi-gcc
45 | AR = arm-none-eabi-ar
46 | OBJCOPY = arm-none-eabi-objcopy
47 | GDB = arm-none-eabi-gdb
48 |
49 | CFLAGS = -O0 -g -Wall -I.\
50 | -mcpu=cortex-m4 -mthumb \
51 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
52 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER
53 |
54 | LDSCRIPT = stm32_flash.ld
55 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
56 |
57 | $(BIN): $(ELF)
58 | $(OBJCOPY) -O binary $< $@
59 |
60 | $(HEX): $(ELF)
61 | $(OBJCOPY) -O ihex $< $@
62 |
63 | $(ELF): $(OBJECTS)
64 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
65 |
66 | $(BUILDDIR)/%.o: %.c
67 | mkdir -p $(dir $@)
68 | $(CC) -c $(CFLAGS) $< -o $@
69 |
70 | $(BUILDDIR)/%.o: %.S
71 | mkdir -p $(dir $@)
72 | $(CC) -c $(CFLAGS) $< -o $@
73 |
74 | flash: $(BIN)
75 | st-flash write $(BIN) 0x8000000
76 |
77 | debug: $(ELF)
78 | $(GDB) -tui $(ELF)
79 |
80 | all: $(HEX) $(BIN)
81 |
82 | .PHONY: clean
83 | clean:
84 | rm -rf build
85 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-3-SystemClocks/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-3-SystemClocks/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "startup.h"
3 | #include "stm32f4xx_gpio.h"
4 | #include "stm32f4xx_rcc.h"
5 |
6 | #define u8 uint8_t
7 | #define u16 uint16_t
8 | #define u32 uint32_t
9 |
10 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
11 | uint32_t i = 1;
12 |
13 | void init();
14 | void loop();
15 |
16 | void delay();
17 |
18 | void slowMode();
19 | void defaultMode();
20 | void fastMode();
21 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/inc/startup.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_rcc.h"
3 |
4 | uint32_t SystemInit(void);
5 | void RCC_WaitForPLLStartUp(void);
6 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | int main() {
4 | init();
5 |
6 | do {
7 | loop();
8 | } while (1);
9 | }
10 |
11 | void init() {
12 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
13 |
14 | GPIO_InitTypeDef gpio;
15 | GPIO_StructInit(&gpio);
16 | gpio.GPIO_Mode = GPIO_Mode_OUT;
17 | gpio.GPIO_Pin = LEDS;
18 | GPIO_Init(GPIOD, &gpio);
19 | }
20 |
21 | void loop() {
22 | i++;
23 | switch(i) {
24 | case 10: slowMode(); break;
25 | case 15: defaultMode(); break;
26 | case 25: fastMode(); break;
27 | case 40: i=0; break;
28 | }
29 |
30 | GPIO_ToggleBits(GPIOD, LEDS);
31 |
32 | delay(300);
33 | }
34 |
35 | void delay(u32 ms) {
36 | ms *= 1000;
37 | while(ms--) {
38 | __NOP();
39 | }
40 | }
41 |
42 | void slowMode() {
43 | RCC_DeInit();
44 |
45 | RCC_HSEConfig(RCC_HSE_ON);
46 | if (RCC_WaitForHSEStartUp() == ERROR) {
47 | return;
48 | }
49 |
50 | RCC_PLLConfig(RCC_PLLSource_HSE, 8, 192, 8, 15);
51 | RCC_PLLCmd(ENABLE);
52 |
53 | RCC_WaitForPLLStartUp();
54 |
55 | RCC_HCLKConfig(RCC_SYSCLK_Div16);
56 | RCC_PCLK1Config(RCC_HCLK_Div16);
57 | RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
58 | }
59 |
60 | void defaultMode() {
61 | RCC_DeInit();
62 | }
63 |
64 | void fastMode() {
65 | RCC_DeInit();
66 |
67 | RCC_HSEConfig(RCC_HSE_ON);
68 | if (RCC_WaitForHSEStartUp() == ERROR) {
69 | return;
70 | }
71 | RCC_PLLConfig(RCC_PLLSource_HSE, 8, 336, 2, 15);
72 | RCC_PLLCmd(ENABLE);
73 |
74 | RCC_WaitForPLLStartUp();
75 |
76 | RCC_HCLKConfig(RCC_SYSCLK_Div4);
77 | RCC_PCLK1Config(RCC_HCLK_Div1);
78 | RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
79 | }
80 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/src/startup.c:
--------------------------------------------------------------------------------
1 | #include "startup.h"
2 |
3 | uint32_t SystemInit(void) {
4 | RCC_DeInit();
5 | RCC_HSEConfig(RCC_HSE_ON);
6 |
7 | RCC_WaitForHSEStartUp();
8 |
9 | RCC_PLLConfig(RCC_PLLSource_HSE, 8, 336, 4, 7);
10 | RCC_PLLCmd(ENABLE);
11 |
12 | RCC_WaitForPLLStartUp();
13 |
14 | RCC_HCLKConfig(RCC_SYSCLK_Div4);
15 | RCC_PCLK1Config(RCC_HCLK_Div1);
16 | RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
17 |
18 | return ENABLE;
19 | }
20 |
21 | void RCC_WaitForPLLStartUp(void) {
22 | while ( (RCC->CR & RCC_CR_PLLRDY) == 0 ) {
23 | __NOP();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Task-3-SystemClocks/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-3-SystemClocks/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-4-PWM/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-4-PWM
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-4-PWM/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-4-PWM/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-4-PWM/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=pwm
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/usb
10 |
11 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
12 |
13 | SOURCES += \
14 | $(PERIPH)/src/stm32f4xx_gpio.c \
15 | $(PERIPH)/src/stm32f4xx_i2c.c \
16 | $(PERIPH)/src/stm32f4xx_rcc.c \
17 | $(PERIPH)/src/stm32f4xx_spi.c \
18 | $(PERIPH)/src/stm32f4xx_exti.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(PERIPH)/src/stm32f4xx_tim.c \
21 | $(PERIPH)/src/misc.c
22 |
23 | SOURCES += startup_stm32f4xx.S
24 | #SOURCES += stm32f4xx_it.c
25 | SOURCES += system_stm32f4xx.c
26 |
27 | SOURCES += \
28 | src/main.c \
29 |
30 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
31 |
32 | INCLUDES += -I$(DEVICE) \
33 | -I$(CORE) \
34 | -I$(PERIPH)/inc \
35 | -I$(DISCOVERY) \
36 | -I$(USB)/inc \
37 | -I.
38 |
39 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
40 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
41 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
42 |
43 | CC = arm-none-eabi-gcc
44 | LD = arm-none-eabi-gcc
45 | AR = arm-none-eabi-ar
46 | OBJCOPY = arm-none-eabi-objcopy
47 | GDB = arm-none-eabi-gdb
48 |
49 | CFLAGS = -O0 -g -Wall -I.\
50 | -mcpu=cortex-m4 -mthumb \
51 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
52 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER
53 |
54 | LDSCRIPT = stm32_flash.ld
55 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
56 |
57 | $(BIN): $(ELF)
58 | $(OBJCOPY) -O binary $< $@
59 |
60 | $(HEX): $(ELF)
61 | $(OBJCOPY) -O ihex $< $@
62 |
63 | $(ELF): $(OBJECTS)
64 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
65 |
66 | $(BUILDDIR)/%.o: %.c
67 | mkdir -p $(dir $@)
68 | $(CC) -c $(CFLAGS) $< -o $@
69 |
70 | $(BUILDDIR)/%.o: %.S
71 | mkdir -p $(dir $@)
72 | $(CC) -c $(CFLAGS) $< -o $@
73 |
74 | flash: $(BIN)
75 | st-flash write $(BIN) 0x8000000
76 |
77 | debug: $(ELF)
78 | $(GDB) -tui $(ELF)
79 |
80 | all: $(HEX) $(BIN)
81 |
82 | .PHONY: clean
83 | clean:
84 | rm -rf build
85 |
--------------------------------------------------------------------------------
/Task-4-PWM/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-4-PWM/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-4-PWM/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-4-PWM/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-4-PWM/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-4-PWM/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_rcc.h"
3 | #include "stm32f4xx_gpio.h"
4 | #include "stm32f4xx_tim.h"
5 |
6 | const uint16_t LEDS = GPIO_Pin_13 | GPIO_Pin_15;;
7 | const uint16_t USER_BUTTON = GPIO_Pin_0;
8 |
9 | int brightLed1 = 0;
10 | int brigthLed2 = 5;
11 | int delta = 1;
12 | int lastButtonStatus = RESET;
13 |
14 | void init();
15 | void loop();
16 |
17 | void delay();
18 |
19 | void initButton();
20 | void initLeds();
21 | void initTimer();
22 | void initPWM();
23 |
--------------------------------------------------------------------------------
/Task-4-PWM/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 |
4 | /* leds in the board will fade */
5 |
6 | int main(void) {
7 | init();
8 |
9 | do {
10 | loop();
11 | } while (1);
12 | }
13 |
14 | void init() {
15 | initButton();
16 | initLeds();
17 | initTimer();
18 | initPWM();
19 | }
20 |
21 | void loop() {
22 | switch(brightLed1) {
23 | case 299: delta=-1; break;
24 | case 1: delta=1; break;
25 | }
26 |
27 | brightLed1 += delta;
28 |
29 | TIM_SetCompare4(TIM4, 300 - brightLed1 % 300); // set brightness
30 |
31 | uint8_t currentButtonStatus = GPIO_ReadInputDataBit(GPIOA, USER_BUTTON);
32 | if (lastButtonStatus != currentButtonStatus && currentButtonStatus != RESET) {
33 | brigthLed2 *= 2;
34 | if (brigthLed2 >= 500 ) {
35 | brigthLed2 = 5;
36 | }
37 | TIM_SetCompare2(TIM4, brigthLed2);
38 | }
39 | lastButtonStatus = currentButtonStatus;
40 |
41 | delay(4);
42 | }
43 |
44 | void delay(uint32_t ms) {
45 | ms *= 3360;
46 | while(ms--) {
47 | __NOP();
48 | }
49 | }
50 |
51 | void initButton() {
52 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
53 | GPIO_InitTypeDef gpio;
54 | GPIO_StructInit(&gpio);
55 | gpio.GPIO_Mode = GPIO_Mode_IN;
56 | gpio.GPIO_Pin = USER_BUTTON;
57 | GPIO_Init(GPIOA, &gpio);
58 | }
59 |
60 | void initLeds() {
61 | GPIO_InitTypeDef GPIO_InitStructure;
62 |
63 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
64 |
65 | GPIO_InitStructure.GPIO_Pin = LEDS;
66 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
67 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
68 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
69 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
70 | GPIO_Init(GPIOD, &GPIO_InitStructure);
71 |
72 | GPIO_PinAFConfig(GPIOD, GPIO_PinSource13, GPIO_AF_TIM4);
73 | GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_TIM4);
74 | }
75 |
76 | void initTimer() {
77 | /* TIM4 clock enable */
78 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
79 |
80 | /* Compute the prescaler value */
81 | u32 PrescalerValue = (uint16_t) ((SystemCoreClock / 2) / 21000000) - 1;
82 |
83 | TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
84 | /* Time base configuration */
85 | TIM_TimeBaseStructure.TIM_Period = 1000;
86 | TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
87 | TIM_TimeBaseStructure.TIM_ClockDivision = 0;
88 | TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
89 |
90 | TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);
91 | }
92 |
93 | void initPWM() {
94 | TIM_OCInitTypeDef TIM_OCInitStructure;
95 |
96 | TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
97 | TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
98 | TIM_OCInitStructure.TIM_Pulse = 0;
99 | TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
100 |
101 | /* PWM1 Mode configuration: Channel2 (GPIOD Pin 13)*/
102 | TIM_OC2Init(TIM4, &TIM_OCInitStructure);
103 | TIM_OC2PreloadConfig(TIM4, TIM_OCPreload_Enable);
104 |
105 | /* PWM1 Mode configuration: Channel4 (GPIOD Pin 15)*/
106 | TIM_OC4Init(TIM4, &TIM_OCInitStructure);
107 | TIM_OC4PreloadConfig(TIM4, TIM_OCPreload_Enable);
108 |
109 | TIM_Cmd(TIM4, ENABLE);
110 | }
111 |
--------------------------------------------------------------------------------
/Task-4-PWM/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-4-PWM/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-5-SPI/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-5-SPI
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-5-SPI/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-5-SPI/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/Task-5-SPI/.settings/org.eclipse.core.runtime.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | line.separator=\n
3 |
--------------------------------------------------------------------------------
/Task-5-SPI/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-5-SPI/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=spi
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/usb
10 |
11 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
12 |
13 | SOURCES += \
14 | $(PERIPH)/src/stm32f4xx_gpio.c \
15 | $(PERIPH)/src/stm32f4xx_i2c.c \
16 | $(PERIPH)/src/stm32f4xx_rcc.c \
17 | $(PERIPH)/src/stm32f4xx_spi.c \
18 | $(PERIPH)/src/stm32f4xx_exti.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(PERIPH)/src/stm32f4xx_tim.c
21 |
22 | SOURCES += startup_stm32f4xx.S
23 | #SOURCES += stm32f4xx_it.c
24 | SOURCES += system_stm32f4xx.c
25 |
26 | SOURCES += \
27 | src/main.c \
28 |
29 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
30 |
31 | INCLUDES += -I$(DEVICE) \
32 | -I$(CORE) \
33 | -I$(PERIPH)/inc \
34 | -I$(DISCOVERY) \
35 | -I$(USB)/inc \
36 | -I.
37 |
38 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
39 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
40 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
41 |
42 | CC = arm-none-eabi-gcc
43 | LD = arm-none-eabi-gcc
44 | AR = arm-none-eabi-ar
45 | OBJCOPY = arm-none-eabi-objcopy
46 | GDB = arm-none-eabi-gdb
47 |
48 | CFLAGS = -O0 -g -Wall -I.\
49 | -mcpu=cortex-m4 -mthumb \
50 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
51 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER
52 |
53 | LDSCRIPT = stm32_flash.ld
54 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
55 |
56 | $(BIN): $(ELF)
57 | $(OBJCOPY) -O binary $< $@
58 |
59 | $(HEX): $(ELF)
60 | $(OBJCOPY) -O ihex $< $@
61 |
62 | $(ELF): $(OBJECTS)
63 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
64 |
65 | $(BUILDDIR)/%.o: %.c
66 | mkdir -p $(dir $@)
67 | $(CC) -c $(CFLAGS) $< -o $@
68 |
69 | $(BUILDDIR)/%.o: %.S
70 | mkdir -p $(dir $@)
71 | $(CC) -c $(CFLAGS) $< -o $@
72 |
73 | flash: $(BIN)
74 | st-flash write $(BIN) 0x8000000
75 |
76 | debug: $(ELF)
77 | $(GDB) -tui $(ELF)
78 |
79 | all: $(HEX) $(BIN)
80 |
81 | .PHONY: clean
82 | clean:
83 | rm -rf build
84 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-5-SPI/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-5-SPI/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-5-SPI/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-5-SPI/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-5-SPI/inc/main.h:
--------------------------------------------------------------------------------
1 | /* Define to prevent recursive inclusion -------------------------------------*/
2 | #ifndef __MAIN_H
3 | #define __MAIN_H
4 |
5 | /* Includes ------------------------------------------------------------------*/
6 | #include "stm32f4xx.h"
7 | #include "stm32f4xx_rcc.h"
8 | #include "stm32f4xx_gpio.h"
9 | #include "stm32f4xx_spi.h"
10 | #include "stm32f4xx_tim.h"
11 | #include "math.h"
12 |
13 | const u16 LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
14 | const u16 LED1 = GPIO_Pin_12;
15 | const u16 LED2 = GPIO_Pin_13;
16 | const u16 LED3 = GPIO_Pin_14;
17 | const u16 LED4 = GPIO_Pin_15;
18 | const u32 LIS302DL_FLAG_TIMEOUT = 0x1000;
19 | const u32 PWM_PERIOD = 4000;
20 |
21 | int main(void);
22 | void init(void);
23 | void loop(void);
24 | void delay(u32 ms);
25 |
26 | void initLeds(void);
27 | void initSpi(void);
28 | void LIS302DL_Init(void);
29 | void initTimer(void);
30 | void initPWM(void);
31 |
32 | u8 LIS302DL_SendByte(u8 byte);
33 | u8 LIS302DL_GetByte(void);
34 | void LIS302DL_Write(u8 REG, u8 *DATA, u8 count);
35 | void LIS302DL_Read(u8 REG, u8 *DATA, u8 count);
36 | void LIS302DL_ReadACC(int32_t* out);
37 | void LIS302DL_ReadACCY(int32_t* out);
38 |
39 | u32 abs(int32_t n);
40 | int32_t cround(int32_t x, int32_t y);
41 |
42 | #endif /* __MAIN_H */
43 |
--------------------------------------------------------------------------------
/Task-5-SPI/inc/stm32f4_discovery_lis302dl.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __STM32F4_DISCOVERY_LIS302DL_H
3 | #define __STM32F4_DISCOVERY_LIS302DL_H
4 |
5 | /* Includes ------------------------------------------------------------------*/
6 | #include "stm32f4xx.h"
7 | #include "stm32f4xx_gpio.h"
8 | #include "stm32f4xx_spi.h"
9 | #include "stm32f4xx_rcc.h"
10 |
11 | typedef struct {
12 | u16 CLK_Pin;
13 | u16 MISO_Pin;
14 | u16 MOSI_Pin;
15 | u16 CS_Pin;
16 | } SPIPIN_struct;
17 |
18 | #endif //__STM32F4_DISCOVERY_LIS302DL_H
19 |
--------------------------------------------------------------------------------
/Task-5-SPI/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-5-SPI/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-6-Interrupt/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-6-Interrupt
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=interrupt
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/usb
10 |
11 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
12 |
13 | SOURCES += \
14 | $(PERIPH)/src/stm32f4xx_gpio.c \
15 | $(PERIPH)/src/stm32f4xx_i2c.c \
16 | $(PERIPH)/src/stm32f4xx_rcc.c \
17 | $(PERIPH)/src/stm32f4xx_spi.c \
18 | $(PERIPH)/src/stm32f4xx_exti.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(PERIPH)/src/misc.c \
21 |
22 | SOURCES += startup_stm32f4xx.S
23 | #SOURCES += stm32f4xx_it.c
24 | SOURCES += system_stm32f4xx.c
25 |
26 | SOURCES += \
27 | src/main.c \
28 |
29 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
30 |
31 | INCLUDES += -I$(DEVICE) \
32 | -I$(CORE) \
33 | -I$(PERIPH)/inc \
34 | -I$(DISCOVERY) \
35 | -I$(USB)/inc \
36 | -I.
37 |
38 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
39 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
40 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
41 |
42 | CC = arm-none-eabi-gcc
43 | LD = arm-none-eabi-gcc
44 | AR = arm-none-eabi-ar
45 | OBJCOPY = arm-none-eabi-objcopy
46 | GDB = arm-none-eabi-gdb
47 |
48 | CFLAGS = -O0 -g -Wall -I.\
49 | -mcpu=cortex-m4 -mthumb \
50 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
51 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER
52 |
53 | LDSCRIPT = stm32_flash.ld
54 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
55 |
56 | $(BIN): $(ELF)
57 | $(OBJCOPY) -O binary $< $@
58 |
59 | $(HEX): $(ELF)
60 | $(OBJCOPY) -O ihex $< $@
61 |
62 | $(ELF): $(OBJECTS)
63 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
64 |
65 | $(BUILDDIR)/%.o: %.c
66 | mkdir -p $(dir $@)
67 | $(CC) -c $(CFLAGS) $< -o $@
68 |
69 | $(BUILDDIR)/%.o: %.S
70 | mkdir -p $(dir $@)
71 | $(CC) -c $(CFLAGS) $< -o $@
72 |
73 | flash: $(BIN)
74 | st-flash write $(BIN) 0x8000000
75 |
76 | debug: $(ELF)
77 | $(GDB) -tui $(ELF)
78 |
79 | all: $(HEX) $(BIN)
80 |
81 | .PHONY: clean
82 | clean:
83 | rm -rf build
84 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-6-Interrupt/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-6-Interrupt/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-6-Interrupt/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-6-Interrupt/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 | #include "stm32f4xx_tim.h"
5 | #include "stm32f4xx_syscfg.h"
6 | #include "stm32f4xx_exti.h"
7 | #include "misc.h"
8 |
9 | const u16 LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
10 | const u16 LED[4] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
11 | const u16 USER_BUTTON = GPIO_Pin_0;
12 |
13 | int main(void);
14 | void init(void);
15 | void loop(void);
16 | void delay(u32);
17 |
18 | void initLeds(void);
19 | void initButton(void);
20 | void initExtInterrupt(void);
21 | void initClkInterrupt();
22 | void toggleLed(void);
23 | void switchLed(void);
24 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | static u16 currentLed = 0;
4 | static u32 currentTime = 0;
5 |
6 | int main() {
7 | init();
8 |
9 | do {
10 | loop();
11 | } while (1);
12 | }
13 |
14 | void init() {
15 | initLeds();
16 | initButton();
17 | initExtInterrupt();
18 | initClkInterrupt();
19 | }
20 |
21 | void loop() {
22 | __NOP();
23 | }
24 |
25 | void delay(u32 ms) {
26 | ms *= 3360;
27 | while(ms--) {
28 | __NOP();
29 | }
30 | }
31 |
32 | void initLeds() {
33 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
34 |
35 | GPIO_InitTypeDef gpio;
36 | GPIO_StructInit(&gpio);
37 | gpio.GPIO_Mode = GPIO_Mode_OUT;
38 | gpio.GPIO_Pin = LEDS;
39 | GPIO_Init(GPIOD, &gpio);
40 | }
41 |
42 | void initButton() {
43 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
44 |
45 | GPIO_InitTypeDef gpio;
46 | GPIO_StructInit(&gpio);
47 | gpio.GPIO_Mode = GPIO_Mode_IN;
48 | gpio.GPIO_PuPd = GPIO_PuPd_NOPULL;
49 | gpio.GPIO_Pin = USER_BUTTON;
50 | GPIO_Init(GPIOD, &gpio);
51 | }
52 |
53 | void initExtInterrupt() {
54 | EXTI_InitTypeDef EXTI_InitStructure;
55 |
56 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
57 | SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA,EXTI_PinSource0);
58 | EXTI_InitStructure.EXTI_Line = EXTI_Line0;
59 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
60 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
61 | EXTI_InitStructure.EXTI_LineCmd = ENABLE;
62 | EXTI_Init(&EXTI_InitStructure);
63 |
64 | NVIC_InitTypeDef NVIC_InitStructure;
65 |
66 | NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
67 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
68 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
69 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
70 | NVIC_Init(&NVIC_InitStructure);
71 | }
72 |
73 | void initClkInterrupt() {
74 | SysTick_Config(SystemCoreClock / 1000);
75 | NVIC_SetPriority(SysTick_IRQn, 1);
76 | }
77 |
78 | void EXTI0_IRQHandler() {
79 | if (EXTI_GetITStatus(EXTI_Line0) != RESET) {
80 | switchLed();
81 | EXTI_ClearITPendingBit(EXTI_Line0);
82 | }
83 | }
84 |
85 | void SysTick_Handler(void) {
86 | currentTime++;
87 | toggleLed();
88 | }
89 |
90 | void toggleLed(void) {
91 | if (currentTime % 200 == 0) {
92 | GPIO_ToggleBits(GPIOD, LED[currentLed]);
93 | }
94 | }
95 |
96 | void switchLed(void) {
97 | GPIO_ResetBits(GPIOD, LED[currentLed]);
98 |
99 | currentLed++;
100 | if (currentLed > 3) {
101 | currentLed = 0;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Task-6-Interrupt/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-6-Interrupt/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-7-USB/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-6-USB
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-7-USB/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-7-USB/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-7-USB/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=usb
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/STM32_USB_Device_Library
10 | USB_OTG = inc/STM32_USB_OTG_Driver
11 |
12 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
13 |
14 | SOURCES += \
15 | $(PERIPH)/src/misc.c \
16 | $(PERIPH)/src/stm32f4xx_exti.c \
17 | $(PERIPH)/src/stm32f4xx_gpio.c \
18 | $(PERIPH)/src/stm32f4xx_rcc.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 | $(USB)/Class/cdc/src/usbd_cdc_core.c \
21 | $(USB)/Core/src/usbd_core.c \
22 | $(USB)/Core/src/usbd_ioreq.c \
23 | $(USB)/Core/src/usbd_req.c \
24 | $(USB_OTG)/src/usb_core.c \
25 | $(USB_OTG)/src/usb_dcd.c \
26 | $(USB_OTG)/src/usb_dcd_int.c \
27 |
28 | SOURCES += startup_stm32f4xx.S
29 |
30 | SOURCES += \
31 | src/main.c \
32 | src/stm32f4xx_it.c \
33 | src/stm32f4_discovery.c \
34 | src/system_stm32f4xx.c \
35 | src/usb_bsp.c \
36 | src/usbd_cdc.c \
37 | src/usbd_cdc_vcp.c \
38 | src/usbd_desc.c \
39 | src/usbd_usr.c
40 |
41 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
42 |
43 | INCLUDES += -I$(DEVICE) \
44 | -I$(CORE) \
45 | -I$(PERIPH)/inc \
46 | -I$(DISCOVERY) \
47 | -I$(USB)/Class/cdc/inc \
48 | -I$(USB)/Core/inc \
49 | -I$(USB_OTG)/inc \
50 | -I.
51 |
52 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
53 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
54 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
55 |
56 | CC = arm-none-eabi-gcc
57 | LD = arm-none-eabi-gcc
58 | AR = arm-none-eabi-ar
59 | OBJCOPY = arm-none-eabi-objcopy
60 | GDB = arm-none-eabi-gdb
61 |
62 | CFLAGS = -O0 -g -Wall -I.\
63 | -mcpu=cortex-m4 -mthumb \
64 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
65 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER \
66 | -DSTM32F4XX -DUSE_STM32F4_DISCOVERY \
67 | -DHSE_VALUE=8000000 \
68 | -DUSE_USB_OTG_FS
69 |
70 | LDSCRIPT = stm32_flash.ld
71 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
72 |
73 | $(BIN): $(ELF)
74 | $(OBJCOPY) -O binary $< $@
75 |
76 | $(HEX): $(ELF)
77 | $(OBJCOPY) -O ihex $< $@
78 |
79 | $(ELF): $(OBJECTS)
80 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
81 |
82 | $(BUILDDIR)/%.o: %.c
83 | mkdir -p $(dir $@)
84 | $(CC) -c $(CFLAGS) $< -o $@
85 |
86 | $(BUILDDIR)/%.o: %.S
87 | mkdir -p $(dir $@)
88 | $(CC) -c $(CFLAGS) $< -o $@
89 |
90 | flash: $(BIN)
91 | st-flash write $(BIN) 0x8000000
92 |
93 | debug: $(ELF)
94 | $(GDB) -tui $(ELF)
95 |
96 | all: $(HEX) $(BIN)
97 |
98 | .PHONY: clean
99 | clean:
100 | rm -rf build
101 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-7-USB/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-7-USB/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_Device_Library/Core/inc/usbd_conf_template.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_conf_template.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief usb device configuration template 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 __USBD_CONF__H__
24 | #define __USBD_CONF__H__
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f2xx.h"
28 |
29 |
30 |
31 | /** @defgroup USB_CONF_Exported_Defines
32 | * @{
33 | */
34 | #define USE_USB_OTG_HS
35 |
36 | #define USBD_CFG_MAX_NUM 1
37 | #define USB_MAX_STR_DESC_SIZ 64
38 | #define USBD_EP0_MAX_PACKET_SIZE 64
39 |
40 | /**
41 | * @}
42 | */
43 |
44 |
45 | /** @defgroup USB_CONF_Exported_Types
46 | * @{
47 | */
48 | /**
49 | * @}
50 | */
51 |
52 |
53 | /** @defgroup USB_CONF_Exported_Macros
54 | * @{
55 | */
56 | /**
57 | * @}
58 | */
59 |
60 | /** @defgroup USB_CONF_Exported_Variables
61 | * @{
62 | */
63 | /**
64 | * @}
65 | */
66 |
67 | /** @defgroup USB_CONF_Exported_FunctionsPrototype
68 | * @{
69 | */
70 | /**
71 | * @}
72 | */
73 |
74 |
75 | #endif //__USBD_CONF__H__
76 |
77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
78 |
79 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_Device_Library/Core/inc/usbd_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_core.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief Header file for usbd_core.c
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 __USBD_CORE_H
24 | #define __USBD_CORE_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "usb_dcd.h"
28 | #include "usbd_def.h"
29 | #include "usbd_conf.h"
30 |
31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 | /** @defgroup USBD_CORE
36 | * @brief This file is the Header file for usbd_core.c file
37 | * @{
38 | */
39 |
40 |
41 | /** @defgroup USBD_CORE_Exported_Defines
42 | * @{
43 | */
44 |
45 | typedef enum {
46 | USBD_OK = 0,
47 | USBD_BUSY,
48 | USBD_FAIL,
49 | }USBD_Status;
50 | /**
51 | * @}
52 | */
53 |
54 |
55 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
56 | * @{
57 | */
58 |
59 |
60 | /**
61 | * @}
62 | */
63 |
64 |
65 |
66 | /** @defgroup USBD_CORE_Exported_Macros
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @defgroup USBD_CORE_Exported_Variables
75 | * @{
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype
83 | * @{
84 | */
85 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
86 | USB_OTG_CORE_ID_TypeDef coreID,
87 | USBD_DEVICE *pDevice,
88 | USBD_Class_cb_TypeDef *class_cb,
89 | USBD_Usr_cb_TypeDef *usr_cb);
90 |
91 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev);
92 |
93 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
94 |
95 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | #endif /* __USBD_CORE_H */
102 |
103 | /**
104 | * @}
105 | */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief header file for the usbd_ioreq.c 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 |
24 | #ifndef __USBD_IOREQ_H_
25 | #define __USBD_IOREQ_H_
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "usbd_def.h"
29 | #include "usbd_core.h"
30 |
31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 | /** @defgroup USBD_IOREQ
36 | * @brief header file for the usbd_ioreq.c file
37 | * @{
38 | */
39 |
40 | /** @defgroup USBD_IOREQ_Exported_Defines
41 | * @{
42 | */
43 | /**
44 | * @}
45 | */
46 |
47 |
48 | /** @defgroup USBD_IOREQ_Exported_Types
49 | * @{
50 | */
51 |
52 |
53 | /**
54 | * @}
55 | */
56 |
57 |
58 |
59 | /** @defgroup USBD_IOREQ_Exported_Macros
60 | * @{
61 | */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /** @defgroup USBD_IOREQ_Exported_Variables
68 | * @{
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
76 | * @{
77 | */
78 |
79 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev,
80 | uint8_t *buf,
81 | uint16_t len);
82 |
83 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev,
84 | uint8_t *pbuf,
85 | uint16_t len);
86 |
87 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev,
88 | uint8_t *pbuf,
89 | uint16_t len);
90 |
91 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev,
92 | uint8_t *pbuf,
93 | uint16_t len);
94 |
95 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev);
96 |
97 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev);
98 |
99 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev ,
100 | uint8_t epnum);
101 |
102 | /**
103 | * @}
104 | */
105 |
106 | #endif /* __USBD_IOREQ_H_ */
107 |
108 | /**
109 | * @}
110 | */
111 |
112 | /**
113 | * @}
114 | */
115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
116 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_Device_Library/Core/inc/usbd_req.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_req.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief header file for the usbd_req.c 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 |
24 | #ifndef __USB_REQUEST_H_
25 | #define __USB_REQUEST_H_
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "usbd_def.h"
29 | #include "usbd_core.h"
30 | #include "usbd_conf.h"
31 |
32 |
33 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
34 | * @{
35 | */
36 |
37 | /** @defgroup USBD_REQ
38 | * @brief header file for the usbd_ioreq.c file
39 | * @{
40 | */
41 |
42 | /** @defgroup USBD_REQ_Exported_Defines
43 | * @{
44 | */
45 | /**
46 | * @}
47 | */
48 |
49 |
50 | /** @defgroup USBD_REQ_Exported_Types
51 | * @{
52 | */
53 | /**
54 | * @}
55 | */
56 |
57 |
58 |
59 | /** @defgroup USBD_REQ_Exported_Macros
60 | * @{
61 | */
62 | /**
63 | * @}
64 | */
65 |
66 | /** @defgroup USBD_REQ_Exported_Variables
67 | * @{
68 | */
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype
74 | * @{
75 | */
76 |
77 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
78 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
79 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
80 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev,
81 | USB_SETUP_REQ *req);
82 |
83 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev,
84 | USB_SETUP_REQ *req);
85 |
86 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len);
87 | /**
88 | * @}
89 | */
90 |
91 | #endif /* __USB_REQUEST_H_ */
92 |
93 | /**
94 | * @}
95 | */
96 |
97 | /**
98 | * @}
99 | */
100 |
101 |
102 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
103 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_OTG_Driver/inc/usb_bsp.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_bsp.h
4 | * @author MCD Application Team
5 | * @version V2.0.0
6 | * @date 22-July-2011
7 | * @brief Specific api's relative to the used hardware platform
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 __USB_BSP__H__
24 | #define __USB_BSP__H__
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "usb_core.h"
28 | #include "stm32f4_discovery.h"
29 |
30 | /** @addtogroup USB_OTG_DRIVER
31 | * @{
32 | */
33 |
34 | /** @defgroup USB_BSP
35 | * @brief This file is the
36 | * @{
37 | */
38 |
39 |
40 | /** @defgroup USB_BSP_Exported_Defines
41 | * @{
42 | */
43 | /**
44 | * @}
45 | */
46 |
47 |
48 | /** @defgroup USB_BSP_Exported_Types
49 | * @{
50 | */
51 | /**
52 | * @}
53 | */
54 |
55 |
56 | /** @defgroup USB_BSP_Exported_Macros
57 | * @{
58 | */
59 | /**
60 | * @}
61 | */
62 |
63 | /** @defgroup USB_BSP_Exported_Variables
64 | * @{
65 | */
66 | /**
67 | * @}
68 | */
69 |
70 | /** @defgroup USB_BSP_Exported_FunctionsPrototype
71 | * @{
72 | */
73 | void BSP_Init(void);
74 |
75 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev);
76 | void USB_OTG_BSP_uDelay (const uint32_t usec);
77 | void USB_OTG_BSP_mDelay (const uint32_t msec);
78 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev);
79 | #ifdef USE_HOST_MODE
80 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev);
81 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state);
82 | #endif
83 | /**
84 | * @}
85 | */
86 |
87 | #endif //__USB_BSP__H__
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /**
94 | * @}
95 | */
96 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
97 |
98 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_OTG_Driver/inc/usb_hcd.h_D:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_hcd.h
4 | * @author MCD Application Team
5 | * @version V2.0.0
6 | * @date 22-July-2011
7 | * @brief Host layer Header 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 __USB_HCD_H__
24 | #define __USB_HCD_H__
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "usb_regs.h"
28 | #include "usb_core.h"
29 |
30 |
31 | /** @addtogroup USB_OTG_DRIVER
32 | * @{
33 | */
34 |
35 | /** @defgroup USB_HCD
36 | * @brief This file is the
37 | * @{
38 | */
39 |
40 |
41 | /** @defgroup USB_HCD_Exported_Defines
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USB_HCD_Exported_Types
50 | * @{
51 | */
52 | /**
53 | * @}
54 | */
55 |
56 |
57 | /** @defgroup USB_HCD_Exported_Macros
58 | * @{
59 | */
60 | /**
61 | * @}
62 | */
63 |
64 | /** @defgroup USB_HCD_Exported_Variables
65 | * @{
66 | */
67 | /**
68 | * @}
69 | */
70 |
71 | /** @defgroup USB_HCD_Exported_FunctionsPrototype
72 | * @{
73 | */
74 | uint32_t HCD_Init (USB_OTG_CORE_HANDLE *pdev ,
75 | USB_OTG_CORE_ID_TypeDef coreID);
76 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev ,
77 | uint8_t hc_num);
78 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev ,
79 | uint8_t hc_num) ;
80 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev);
81 | uint32_t HCD_ResetPort (USB_OTG_CORE_HANDLE *pdev);
82 | uint32_t HCD_IsDeviceConnected (USB_OTG_CORE_HANDLE *pdev);
83 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) ;
84 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num);
85 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num);
86 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) ;
87 | /**
88 | * @}
89 | */
90 |
91 | #endif //__USB_HCD_H__
92 |
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
102 |
103 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/STM32_USB_OTG_Driver/inc/usb_otg.h_D:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_otg.h
4 | * @author MCD Application Team
5 | * @version V2.0.0
6 | * @date 22-July-2011
7 | * @brief OTG Core Header
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 __USB_OTG__
24 | #define __USB_OTG__
25 |
26 |
27 | /** @addtogroup USB_OTG_DRIVER
28 | * @{
29 | */
30 |
31 | /** @defgroup USB_OTG
32 | * @brief This file is the
33 | * @{
34 | */
35 |
36 |
37 | /** @defgroup USB_OTG_Exported_Defines
38 | * @{
39 | */
40 |
41 |
42 | void USB_OTG_InitiateSRP(void);
43 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode);
44 | void USB_OTG_Switchback (USB_OTG_CORE_HANDLE *pdev);
45 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_HANDLE *pdev);
46 |
47 | uint32_t STM32_USBO_OTG_ISR_Handler(USB_OTG_CORE_HANDLE *pdev);
48 | /**
49 | * @}
50 | */
51 |
52 |
53 | /** @defgroup USB_OTG_Exported_Types
54 | * @{
55 | */
56 | /**
57 | * @}
58 | */
59 |
60 |
61 | /** @defgroup USB_OTG_Exported_Macros
62 | * @{
63 | */
64 | /**
65 | * @}
66 | */
67 |
68 | /** @defgroup USB_OTG_Exported_Variables
69 | * @{
70 | */
71 | /**
72 | * @}
73 | */
74 |
75 | /** @defgroup USB_OTG_Exported_FunctionsPrototype
76 | * @{
77 | */
78 | /**
79 | * @}
80 | */
81 |
82 |
83 | #endif //__USB_OTG__
84 |
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
94 |
95 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Header for main.c module
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 __STM32F4_DISCOVERY_DEMO_H
24 | #define __STM32F4_DISCOVERY_DEMO_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4_discovery.h"
28 | #include
29 |
30 | /* Exported types ------------------------------------------------------------*/
31 | /* Exported constants --------------------------------------------------------*/
32 | /* TIM2 Autoreload and Capture Compare register values */
33 | #define TIM_ARR (uint16_t)1999
34 | #define TIM_CCR (uint16_t)1000
35 |
36 | /* MEMS Microphone SPI Interface */
37 | #define SPI_SCK_PIN GPIO_Pin_10
38 | #define SPI_SCK_GPIO_PORT GPIOB
39 | #define SPI_SCK_GPIO_CLK RCC_AHB1Periph_GPIOB
40 | #define SPI_SCK_SOURCE GPIO_PinSource10
41 | #define SPI_SCK_AF GPIO_AF_SPI2
42 |
43 | #define SPI_MOSI_PIN GPIO_Pin_3
44 | #define SPI_MOSI_GPIO_PORT GPIOC
45 | #define SPI_MOSI_GPIO_CLK RCC_AHB1Periph_GPIOC
46 | #define SPI_MOSI_SOURCE GPIO_PinSource3
47 | #define SPI_MOSI_AF GPIO_AF_SPI2
48 |
49 | /* Exported macro ------------------------------------------------------------*/
50 | #define ABS(x) (x < 0) ? (-x) : x
51 | #define MAX(a,b) (a < b) ? (b) : a
52 | /* Exported functions ------------------------------------------------------- */
53 | void TimingDelay_Decrement(void);
54 | void Delay(__IO uint32_t nTime);
55 | void Fail_Handler(void);
56 | #endif /* __STM32F4_DISCOVERY_DEMO_H */
57 |
58 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
59 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file 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 "usb_conf.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 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/usbd_cdc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_cdc_vcp.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief Header for usbd_cdc_vcp.c 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 __USBD_CDC_H
24 | #define __USBD_CDC_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4xx.h"
28 |
29 | #include "usbd_cdc_core.h"
30 | #include "usbd_conf.h"
31 |
32 |
33 | #define DEFAULT_CONFIG 0
34 | #define OTHER_CONFIG 1
35 |
36 | /* Exported macro ------------------------------------------------------------*/
37 | /* Exported functions ------------------------------------------------------- */
38 |
39 | #endif /* __USBD_CDC_VCP_H */
40 |
41 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
42 |
--------------------------------------------------------------------------------
/Task-7-USB/inc/usbd_cdc_vcp.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_cdc_vcp.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief Header for usbd_cdc_vcp.c 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 __USBD_CDC_VCP_H
24 | #define __USBD_CDC_VCP_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4xx.h"
28 |
29 | #include "usbd_cdc_core.h"
30 | #include "usbd_conf.h"
31 |
32 |
33 | /* Exported typef ------------------------------------------------------------*/
34 | /* The following structures groups all needed parameters to be configured for the
35 | ComPort. These parameters can modified on the fly by the host through CDC class
36 | command class requests. */
37 | typedef struct
38 | {
39 | uint32_t bitrate;
40 | uint8_t format;
41 | uint8_t paritytype;
42 | uint8_t datatype;
43 | }LINE_CODING;
44 |
45 | /* Exported constants --------------------------------------------------------*/
46 |
47 | #define DEFAULT_CONFIG 0
48 | #define OTHER_CONFIG 1
49 |
50 | /* Exported macro ------------------------------------------------------------*/
51 | /* Exported functions ------------------------------------------------------- */
52 | void DISCOVERY_COM_IRQHandler(void);
53 | static uint16_t VCP_Init (void);
54 | static uint16_t VCP_DeInit (void);
55 | static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
56 | uint16_t VCP_DataTx (uint8_t* Buf, uint32_t Len);
57 | static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len);
58 |
59 | #endif /* __USBD_CDC_VCP_H */
60 |
61 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
62 |
--------------------------------------------------------------------------------
/Task-7-USB/src/main.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-7-USB/src/main.c
--------------------------------------------------------------------------------
/Task-7-USB/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-7-USB/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-8-US/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-8-US
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-8-US/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-8-US/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-8-US/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=us
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/STM32_USB_Device_Library
10 | USB_OTG = inc/STM32_USB_OTG_Driver
11 |
12 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
13 |
14 | SOURCES += \
15 | $(PERIPH)/src/misc.c \
16 | $(PERIPH)/src/stm32f4xx_exti.c \
17 | $(PERIPH)/src/stm32f4xx_gpio.c \
18 | $(PERIPH)/src/stm32f4xx_rcc.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 |
21 | SOURCES += startup_stm32f4xx.S
22 |
23 | SOURCES += \
24 | src/main.c \
25 | system_stm32f4xx.c
26 |
27 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
28 |
29 | INCLUDES += -I$(DEVICE) \
30 | -I$(CORE) \
31 | -I$(PERIPH)/inc \
32 | -I$(DISCOVERY) \
33 | -I$(USB)/Class/cdc/inc \
34 | -I$(USB)/Core/inc \
35 | -I$(USB_OTG)/inc \
36 | -I.
37 |
38 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
39 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
40 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
41 |
42 | CC = arm-none-eabi-gcc
43 | LD = arm-none-eabi-gcc
44 | AR = arm-none-eabi-ar
45 | OBJCOPY = arm-none-eabi-objcopy
46 | GDB = arm-none-eabi-gdb
47 |
48 | CFLAGS = -O0 -g -Wall -I.\
49 | -mcpu=cortex-m4 -mthumb \
50 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
51 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER \
52 | -DSTM32F4XX -DUSE_STM32F4_DISCOVERY \
53 | -DHSE_VALUE=8000000 \
54 | -DUSE_USB_OTG_FS
55 |
56 | LDSCRIPT = stm32_flash.ld
57 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
58 |
59 | $(BIN): $(ELF)
60 | $(OBJCOPY) -O binary $< $@
61 |
62 | $(HEX): $(ELF)
63 | $(OBJCOPY) -O ihex $< $@
64 |
65 | $(ELF): $(OBJECTS)
66 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
67 |
68 | $(BUILDDIR)/%.o: %.c
69 | mkdir -p $(dir $@)
70 | $(CC) -c $(CFLAGS) $< -o $@
71 |
72 | $(BUILDDIR)/%.o: %.S
73 | mkdir -p $(dir $@)
74 | $(CC) -c $(CFLAGS) $< -o $@
75 |
76 | flash: $(BIN)
77 | st-flash write $(BIN) 0x8000000
78 |
79 | debug: $(ELF)
80 | $(GDB) -tui $(ELF)
81 |
82 | all: $(HEX) $(BIN)
83 |
84 | .PHONY: clean
85 | clean:
86 | rm -rf build
87 |
--------------------------------------------------------------------------------
/Task-8-US/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-8-US/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-8-US/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-8-US/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-8-US/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-8-US/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | void init();
6 | void loop();
7 |
8 | void delay();
9 |
--------------------------------------------------------------------------------
/Task-8-US/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | int main() {
4 | init();
5 |
6 | do {
7 | loop();
8 | } while (1);
9 | }
10 |
11 | void init() {
12 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
13 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
14 |
15 | GPIO_InitTypeDef gpio;
16 | GPIO_StructInit(&gpio);
17 | gpio.GPIO_Mode = GPIO_Mode_OUT;
18 | gpio.GPIO_Pin = GPIO_Pin_2;
19 | GPIO_Init(GPIOA, &gpio);
20 |
21 | gpio.GPIO_Pin = GPIO_Pin_13;
22 | GPIO_Init(GPIOD, &gpio);
23 |
24 | gpio.GPIO_Mode = GPIO_Mode_IN;
25 | gpio.GPIO_Pin = GPIO_Pin_3;
26 | GPIO_Init(GPIOA, &gpio);
27 | }
28 |
29 | void delay_us(uint32_t us) {
30 | us *= 3;
31 | while(us--) {
32 | __NOP();
33 | }
34 | }
35 |
36 | uint32_t timing_1() {
37 | GPIO_ResetBits(GPIOA, GPIO_Pin_2);
38 | delay_us(2);
39 | GPIO_SetBits(GPIOA, GPIO_Pin_2);
40 | delay_us(10);
41 | GPIO_ResetBits(GPIOA, GPIO_Pin_2);
42 |
43 | uint32_t duration = 0;
44 | while ( GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_3) == RESET && duration < 200) {
45 | duration++;
46 | delay_us(1);
47 | };
48 | duration = 0;
49 | while ( GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_3) == SET ) {
50 | delay_us(1);
51 | duration++;
52 | }
53 | return duration;
54 | }
55 |
56 | void loop() {
57 | uint32_t duration = timing_1();
58 | if (duration > 30000) {
59 | return;
60 | }
61 | uint32_t distacne_cm = duration /29 / 2 ;
62 |
63 | GPIO_SetBits(GPIOD, GPIO_Pin_13);
64 | delay(distacne_cm * 20);
65 | GPIO_ResetBits(GPIOD, GPIO_Pin_13);
66 | delay(distacne_cm * 20);
67 | }
68 |
69 |
70 | void delay(uint32_t ms) {
71 | ms *= 3360;
72 | while(ms--) {
73 | __NOP();
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Task-8-US/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-8-US/stm32_flash.ld
--------------------------------------------------------------------------------
/Task-9-RTC/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Task-9-RTC
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | cs-make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d_template/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Task-9-RTC/.settings/org.eclipse.cdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_kcode
3 | formatter_settings_version=1
4 |
--------------------------------------------------------------------------------
/Task-9-RTC/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/Task-9-RTC/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT_NAME=rtc
2 |
3 | BUILDDIR = build
4 |
5 | DEVICE = inc/STM32F4xx
6 | CORE = inc/CMSIS
7 | PERIPH = inc/STM32F4xx_StdPeriph_Driver
8 | DISCOVERY = inc
9 | USB = inc/STM32_USB_Device_Library
10 | USB_OTG = inc/STM32_USB_OTG_Driver
11 |
12 | #SOURCES += $(DISCOVERY)/src/stm32f4_discovery.c
13 |
14 | SOURCES += \
15 | $(PERIPH)/src/misc.c \
16 | $(PERIPH)/src/stm32f4xx_exti.c \
17 | $(PERIPH)/src/stm32f4xx_gpio.c \
18 | $(PERIPH)/src/stm32f4xx_rcc.c \
19 | $(PERIPH)/src/stm32f4xx_syscfg.c \
20 |
21 | SOURCES += startup_stm32f4xx.S
22 |
23 | SOURCES += \
24 | src/main.c \
25 | system_stm32f4xx.c
26 |
27 | OBJECTS = $(addprefix $(BUILDDIR)/, $(addsuffix .o, $(basename $(SOURCES))))
28 |
29 | INCLUDES += -I$(DEVICE) \
30 | -I$(CORE) \
31 | -I$(PERIPH)/inc \
32 | -I$(DISCOVERY) \
33 | -I$(USB)/Class/cdc/inc \
34 | -I$(USB)/Core/inc \
35 | -I$(USB_OTG)/inc \
36 | -I.
37 |
38 | ELF = $(BUILDDIR)/$(PROJECT_NAME).elf
39 | HEX = $(BUILDDIR)/$(PROJECT_NAME).hex
40 | BIN = $(BUILDDIR)/$(PROJECT_NAME).bin
41 |
42 | CC = arm-none-eabi-gcc
43 | LD = arm-none-eabi-gcc
44 | AR = arm-none-eabi-ar
45 | OBJCOPY = arm-none-eabi-objcopy
46 | GDB = arm-none-eabi-gdb
47 |
48 | CFLAGS = -O0 -g -Wall -I.\
49 | -mcpu=cortex-m4 -mthumb \
50 | -mfpu=fpv4-sp-d16 -mfloat-abi=hard \
51 | $(INCLUDES) -DUSE_STDPERIPH_DRIVER \
52 | -DSTM32F4XX -DUSE_STM32F4_DISCOVERY \
53 | -DHSE_VALUE=8000000 \
54 | -DUSE_USB_OTG_FS
55 |
56 | LDSCRIPT = stm32_flash.ld
57 | LDFLAGS += -T$(LDSCRIPT) -mthumb -mcpu=cortex-m4 -nostdlib
58 |
59 | $(BIN): $(ELF)
60 | $(OBJCOPY) -O binary $< $@
61 |
62 | $(HEX): $(ELF)
63 | $(OBJCOPY) -O ihex $< $@
64 |
65 | $(ELF): $(OBJECTS)
66 | $(LD) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
67 |
68 | $(BUILDDIR)/%.o: %.c
69 | mkdir -p $(dir $@)
70 | $(CC) -c $(CFLAGS) $< -o $@
71 |
72 | $(BUILDDIR)/%.o: %.S
73 | mkdir -p $(dir $@)
74 | $(CC) -c $(CFLAGS) $< -o $@
75 |
76 | flash: $(BIN)
77 | st-flash write $(BIN) 0x8000000
78 |
79 | debug: $(ELF)
80 | $(GDB) -tui $(ELF)
81 |
82 | all: $(HEX) $(BIN)
83 |
84 | .PHONY: clean
85 | clean:
86 | rm -rf build
87 |
--------------------------------------------------------------------------------
/Task-9-RTC/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-9-RTC/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-9-RTC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Task-9-RTC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-9-RTC/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Task-9-RTC/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 |
7 | void init();
8 | void loop();
9 |
10 | void delay();
11 |
--------------------------------------------------------------------------------
/Task-9-RTC/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | int main() {
4 | init();
5 |
6 | do {
7 | loop();
8 | } while (1);
9 | }
10 |
11 | void init() {
12 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
13 |
14 | GPIO_InitTypeDef gpio;
15 | GPIO_StructInit(&gpio);
16 | gpio.GPIO_Mode = GPIO_Mode_OUT;
17 | gpio.GPIO_Pin = LEDS;
18 | GPIO_Init(GPIOD, &gpio);
19 | }
20 |
21 | void loop() {
22 | GPIO_ToggleBits(GPIOD, LEDS);
23 |
24 | delay(500);
25 | }
26 |
27 | void delay(uint32_t ms) {
28 | ms *= 3360;
29 | while(ms--) {
30 | __NOP();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Task-9-RTC/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/Task-9-RTC/stm32_flash.ld
--------------------------------------------------------------------------------
/stm32f4d_template/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | stm32f4d-template
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.autoBuildTarget
22 | all
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/stm32f4d-template}/Debug
35 |
36 |
37 | org.eclipse.cdt.make.core.cleanBuildTarget
38 | clean
39 |
40 |
41 | org.eclipse.cdt.make.core.contents
42 | org.eclipse.cdt.make.core.activeConfigSettings
43 |
44 |
45 | org.eclipse.cdt.make.core.enableAutoBuild
46 | false
47 |
48 |
49 | org.eclipse.cdt.make.core.enableCleanBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.enableFullBuild
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.fullBuildTarget
58 | all
59 |
60 |
61 | org.eclipse.cdt.make.core.stopOnError
62 | true
63 |
64 |
65 | org.eclipse.cdt.make.core.useDefaultBuildCmd
66 | true
67 |
68 |
69 |
70 |
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
72 | full,incremental,
73 |
74 |
75 |
76 |
77 |
78 | org.eclipse.cdt.core.cnature
79 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
80 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
81 |
82 |
83 |
--------------------------------------------------------------------------------
/stm32f4d_template/inc/CMSIS/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 |
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/stm32f4d_template/inc/STM32F4xx/stm32f4xx.h
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | #ifndef STM32F4XX_CONF_H_
2 | #define STM32F4XX_CONF_H_
3 |
4 | #ifndef assert_param
5 | #define assert_param(x)
6 | #endif
7 |
8 | #endif /* STM32F4XX_CONF_H_ */
9 |
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx/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 |
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx_StdPeriph_Driver/inc/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 |
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/stm32f4d_template/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/stm32f4d_template/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/stm32f4d_template/inc/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/stm32f4d_template/inc/main.h:
--------------------------------------------------------------------------------
1 | #include "stm32f4xx.h"
2 | #include "stm32f4xx_gpio.h"
3 | #include "stm32f4xx_rcc.h"
4 |
5 | const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
6 |
7 | void init();
8 | void loop();
9 |
10 | void delay();
11 |
--------------------------------------------------------------------------------
/stm32f4d_template/src/main.c:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 |
3 | int main() {
4 | init();
5 |
6 | do {
7 | loop();
8 | } while (1);
9 | }
10 |
11 | void init() {
12 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
13 |
14 | GPIO_InitTypeDef gpio;
15 | GPIO_StructInit(&gpio);
16 | gpio.GPIO_Mode = GPIO_Mode_OUT;
17 | gpio.GPIO_Pin = LEDS;
18 | GPIO_Init(GPIOD, &gpio);
19 | }
20 |
21 | void loop() {
22 | GPIO_ToggleBits(GPIOD, LEDS);
23 |
24 | delay(500);
25 | }
26 |
27 | void delay(uint32_t ms) {
28 | ms *= 3360;
29 | while(ms--) {
30 | __NOP();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/stm32f4d_template/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k-code/stm32f4-examples/5865785c18fa25895ed7f86e889d37dd509c0d70/stm32f4d_template/stm32_flash.ld
--------------------------------------------------------------------------------