Changeset - 4e72955028d8
[Not reviewed]
default
0 2 0
Ethan Zonca - 10 years ago 2014-07-10 19:47:46
ez@ethanzonca.com
Added LED defs
2 files changed with 11 insertions and 16 deletions:
0 comments (0 inline, 0 general)
libraries/oleddrv/bsp.h
Show inline comments
 
@@ -35,28 +35,25 @@ D1/Data 3  4  D0/Clk
 
#define   SSD_Clk_High()    GPIOA->ODR |= GPIO_Pin_5
 
#define   SSD_Data_Low()    GPIOA->BRR = GPIO_Pin_7
 
#define   SSD_Data_High()   GPIOA->ODR |= GPIO_Pin_7
 
#define   SSD_Reset_Low()   GPIOB->BRR = GPIO_Pin_2
 
#define   SSD_Reset_High()  GPIOB->ODR |= GPIO_Pin_2
 
#define   SSD_A0_Low()      GPIOB->BRR = GPIO_Pin_10
 
#define   SSD_A0_High()     GPIOB->ODR |= GPIO_Pin_10
 
#define   SSD_CS_Low()      GPIOB->BRR = GPIO_Pin_1
 
#define   SSD_CS_High()     GPIOB->ODR |= GPIO_Pin_1
 
 
// 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
 
#define   ToggleLED()     if(GPIOA->ODR & GPIO_Pin_8){GPIOA->BRR = GPIO_Pin_8;}\
 
                          else{GPIOA->BSRR = GPIO_Pin_8;}
 
#define   GSel1_High()    GPIOB->BSRR = GPIO_Pin_9
 
#define   GSel1_Low()     GPIOB->BRR = GPIO_Pin_9
 
 
#define   MMA_SLEEP()     GPIOB->BRR = GPIO_Pin_11
 
#define   MMA_WAKEUP()    GPIOB->BSRR = GPIO_Pin_11
 
#define   Is_MMA_WAKEUP() (GPIOB->ODR & GPIO_Pin_11)
 
main.c
Show inline comments
 
#include "main.h"
 
#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;
 
 
void init_gpio();
 
void init_spi();
 
 
/* Main */
 
int main(void)
 
{
 
 
   // Hopefully init clocks
 
   SystemInit();
 
   RCC_ClocksTypeDef RCC_Clocks;
 
  
 
  /* Configure LED3 and LED4 on STM32L100C-Discovery */
 
  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);
 
 
 /* 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)
 
  {  
 
      /* Turn on LD4 Blue LED during 1s each time User button is pressed */
 
      STM_EVAL_LEDOn(LED4);
 
      //STM_EVAL_LEDOn(LED3);
 
      
 
      /* wait for 1s */
 
      Delay(300);
 
      
 
      /* Turn off LD4 Blue LED after 1s each time User button is pressed */
0 comments (0 inline, 0 general)