diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -10,15 +10,14 @@ static __IO uint32_t TimingDelay; void init_gpio(); void init_spi(); -/* Main */ int main(void) { - // Hopefully init clocks + // Init clocks SystemInit(); RCC_ClocksTypeDef RCC_Clocks; - //SysTick end of count event each 1ms + // SysTick end of count event each 1ms RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000); @@ -28,7 +27,7 @@ int main(void) init_gpio(); init_spi(); - //SSD1302_Init(); + //ssd1306_Init(); //SSD1303_DrawPoint(3,3,1); //SSD1303_DrawPoint(5,5,0); @@ -38,16 +37,8 @@ int main(void) while(1) { - /* Turn on LD0 Blue LED during 1s each time User button is pressed */ - //STM_EVAL_LEDOn(LED4); GPIO_SetBits(LED_POWER); - //STM_EVAL_LEDOn(LED3); - - /* wait for 1s */ Delay(150); - - /* Turn off LD4 Blue LED after 1s each time User button is pressed */ - //STM_EVAL_LEDOff(LED4); GPIO_ResetBits(LED_POWER); Delay(150); } @@ -61,7 +52,6 @@ int main(void) void Delay(__IO uint32_t nTime) { TimingDelay = nTime; - while(TimingDelay != 0); } @@ -80,7 +70,8 @@ void TimingDelay_Decrement(void) -void init_spi(void) { +void init_spi(void) +{ SPI_InitTypeDef SPI_InitStructure; // OLED IC @@ -114,17 +105,6 @@ void init_gpio(void) { GPIO_InitTypeDef GPIO_InitStruct; - /** Configure pins as - * Analog - * Input - * Output - * EVENT_OUT - * EXTI - */ - - /*Enable or disable the APB peripheral clock */ - - // Enable SPI clocks RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); @@ -132,6 +112,7 @@ void init_gpio(void) { // Enable GPIO clocks RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC|RCC_AHBPeriph_GPIOB|RCC_AHBPeriph_GPIOA, ENABLE); + // Enable DMA clocks (Is AHB even the right thing???) RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); // EMZ TODO get the right ones /*Configure GPIO pin : PC */