diff --git a/.cproject b/.cproject index 1925130..f57cf50 100644 --- a/.cproject +++ b/.cproject @@ -1,251 +1,251 @@ - + - + - - - - - - + + + + + + - - - - - - + + + + + - + - + - - - - - - + + + + + + - - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/.mxproject b/.mxproject index 09bb787..647e52b 100644 --- a/.mxproject +++ b/.mxproject @@ -8,7 +8,7 @@ SourceFiles=gpio.c;stm32f1xx_it.c;main.c;spi.c;stm32f1xx_hal_msp.c;dma.c; LibFiles=Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_spi.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h; [PreviousUsedSW4STM32Files] -SourceFiles=../Src/main.c;../Src/gpio.c;../Src/dma.c;../Src/spi.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..//Src/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;/home/abody/work/private/NeoPixelF103MVP//startup/startup_stm32f103xb.s; +SourceFiles=../Src/main.c;../Src/gpio.c;../Src/dma.c;../Src/spi.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;..//Src/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;null; HeaderPath=../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include;../Inc; CDefines=__weak:"__attribute__((weak))";__packed:"__attribute__((__packed__))"; diff --git a/.project b/.project index 5861cb8..ea72b56 100644 --- a/.project +++ b/.project @@ -1,7 +1,7 @@ NeoPixelF103MVP - + diff --git a/App/App.cpp b/App/App.cpp index fa4a738..2c03ac8 100644 --- a/App/App.cpp +++ b/App/App.cpp @@ -13,11 +13,11 @@ #include #include +#include "Config.h" #include "Pixel.h" #include "LedBuffers.h" #include "Sparkle.h" -#define NUMSPARKLES 10 Sparkle g_s[NUMSPARKLES]; void convert(uint8_t *src, uint8_t *dst, uint16_t size) @@ -75,7 +75,10 @@ extern "C" void App() } convert((uint8_t*)g_pixels, g_ledBits, sizeof(g_pixels)); + g_done = false; + GPIOC->BSRR = 1 << (13+16); HAL_SPI_Transmit_DMA(&hspi1, g_ledBits, sizeof(g_ledBits)); + GPIOC->BSRR = 1 << 13; while(!g_done); HAL_Delay(5); } diff --git a/App/Config.h b/App/Config.h new file mode 100644 index 0000000..692a66d --- /dev/null +++ b/App/Config.h @@ -0,0 +1,14 @@ +/* + * Config.h + * + * Created on: Dec 17, 2018 + * Author: abody + */ + +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#define NUMPIXELS 300 +#define NUMSPARKLES 25 + +#endif /* CONFIG_H_ */ diff --git a/App/LedBuffers.h b/App/LedBuffers.h index fff08a8..73c9893 100644 --- a/App/LedBuffers.h +++ b/App/LedBuffers.h @@ -8,9 +8,9 @@ #ifndef LEDBUFFERS_H_ #define LEDBUFFERS_H_ +#include "Config.h" #include "Pixel.h" -#define NUMPIXELS 144 #ifdef __cplusplus extern "C" { diff --git a/Inc/main.h b/Inc/main.h index 18a4596..0c431f1 100644 --- a/Inc/main.h +++ b/Inc/main.h @@ -66,7 +66,7 @@ extern volatile uint8_t g_done; } #endif - /* USER CODE END Private defines */ +/* USER CODE END Private defines */ #ifdef __cplusplus extern "C" { diff --git a/NeoPixelF103MVP.ioc b/NeoPixelF103MVP.ioc index 1ffab48..520d6f5 100644 --- a/NeoPixelF103MVP.ioc +++ b/NeoPixelF103MVP.ioc @@ -23,17 +23,15 @@ Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC13-TAMPER-RTC Mcu.Pin1=PC14-OSC32_IN -Mcu.Pin10=PA14 -Mcu.Pin11=VP_SYS_VS_Systick Mcu.Pin2=PC15-OSC32_OUT Mcu.Pin3=PD0-OSC_IN Mcu.Pin4=PD1-OSC_OUT Mcu.Pin5=PA5 -Mcu.Pin6=PA6 -Mcu.Pin7=PA7 -Mcu.Pin8=PB11 -Mcu.Pin9=PA13 -Mcu.PinsNb=12 +Mcu.Pin6=PA7 +Mcu.Pin7=PA13 +Mcu.Pin8=PA14 +Mcu.Pin9=VP_SYS_VS_Systick +Mcu.PinsNb=10 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F103C8Tx @@ -56,15 +54,8 @@ PA14.Mode=Serial_Wire PA14.Signal=SYS_JTCK-SWCLK PA5.Mode=TX_Only_Simplex_Unidirect_Master PA5.Signal=SPI1_SCK -PA6.Locked=true -PA6.Signal=GPIO_Output PA7.Mode=TX_Only_Simplex_Unidirect_Master PA7.Signal=SPI1_MOSI -PB11.GPIOParameters=GPIO_Speed,PinState -PB11.GPIO_Speed=GPIO_SPEED_FREQ_HIGH -PB11.Locked=true -PB11.PinState=GPIO_PIN_RESET -PB11.Signal=GPIO_Output PC13-TAMPER-RTC.Locked=true PC13-TAMPER-RTC.Signal=GPIO_Output PC14-OSC32_IN.Mode=LSE-External-Oscillator diff --git a/Src/gpio.c b/Src/gpio.c index c35a51b..a48f792 100644 --- a/Src/gpio.c +++ b/Src/gpio.c @@ -66,17 +66,10 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); - __HAL_RCC_GPIOB_CLK_ENABLE(); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); - /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); - - /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_11, GPIO_PIN_RESET); - /*Configure GPIO pin : PC13 */ GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; @@ -84,20 +77,6 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); - /*Configure GPIO pin : PA6 */ - GPIO_InitStruct.Pin = GPIO_PIN_6; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - - /*Configure GPIO pin : PB11 */ - GPIO_InitStruct.Pin = GPIO_PIN_11; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - } /* USER CODE BEGIN 2 */