# HG changeset patch # User Ethan Zonca # Date 2014-07-10 19:47:46 # Node ID 4e72955028d82132392b849d5b6f08945e538153 # Parent efdd8ce536bda1365168b74409804abf0f1ac51c Added LED defs diff --git a/libraries/oleddrv/bsp.h b/libraries/oleddrv/bsp.h --- a/libraries/oleddrv/bsp.h +++ b/libraries/oleddrv/bsp.h @@ -44,10 +44,7 @@ D1/Data 3 4 D0/Clk // Use stdperiph #define SPI_SendByte(data) SPI_I2S_SendData(SPI1, data); //SPI1->DR = (data) -#define SPI_Wait() while(!(SPI1->SR&SPI_I2S_FLAG_TXE));while(SPI1->SR&SPI_I2S_FLAG_BSY); - -#define SSD1303_FPS 50 - +#define SPI_Wait() while(!(SPI1->SR&SPI_I2S_FLAG_TXE));while(SPI1->SR&SPI_I2S_FLAG_BSY); #define SSD1303_FPS 50 #define IsLedOn() (!(GPIOA->ODR & GPIO_Pin_8)) #define LED_ON() GPIOA->BRR = GPIO_Pin_8 #define LED_OFF() GPIOA->BSRR = GPIO_Pin_8 diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -2,6 +2,9 @@ #include "stm32l100c_discovery.h" #include "ssd1306.h" +#define LED_POWER GPIOB, GPIO_Pin_9 +#define LED_STAT GPIOA, GPIO_Pin_15 + static __IO uint32_t TimingDelay; uint8_t BlinkSpeed = 0; @@ -11,6 +14,8 @@ void init_spi(); /* Main */ int main(void) { + + // Hopefully init clocks SystemInit(); RCC_ClocksTypeDef RCC_Clocks; @@ -18,11 +23,6 @@ int main(void) STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); - -// RCC_Configuration(); - /* Initialize User_Button on STM32L100C-Discovery */ - //STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO); - /* SysTick end of count event each 1ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 1000); @@ -30,21 +30,19 @@ int main(void) /* Initiate Blink Speed variable */ BlinkSpeed = 1; -// while(1) { -// ITM_SendChar('!'); -// } - - init_spi(); //SPI_I2S_SendData(SPI1, 0x1); /* Init lcd driver */ // SSD1303_Init(); // SSD1303_DrawPoint(3,3,1); // SSD1303_DrawPoint(5,5,0); - + +//testme +// GPIO_SetBits(LED_PWR); STM_EVAL_LEDOn(LED4); Delay(1000); - STM_EVAL_LEDOff(LED4); +// GPIO_ResetBits(LED_PWR); +STM_EVAL_LEDOff(LED4); Delay(1000); while(1)