Changeset - 7f452f677255
[Not reviewed]
default
1 1 0
Ethan Zonca - 10 years ago 2014-08-24 00:48:43
ez@ethanzonca.com
Remove BSP
2 files changed with 0 insertions and 5 deletions:
0 comments (0 inline, 0 general)
bsp.h
Show inline comments
 
deleted file
ssd1306.c
Show inline comments
 
#include "stm32l100c_discovery.h"
 
#include "bsp.h"
 
#include "ssd1306.h"
 
 
// Write command to OLED
 
void WriteCommand(unsigned char command)
 
{
 
  SSD_A0_Low();
 
  SPI_SendByte(command);
 
  SPI_Wait();
 
}
 
 
// Write data to OLED
 
void WriteData(unsigned char data)
 
{
 
  SSD_A0_High();
 
  SPI_SendByte(data);
 
  SPI_Wait();
 
}
 
 
// Initialize OLED
 
void ssd1306_Init(void)
 
{
 
 
  /* Generate a reset */
 
  SSD_Reset_Low();
 
  uint32_t i;
 
  for(i=5000; i>1; i--) 
 
  SSD_Reset_High();
 
 
  WriteCommand(0xAE);
 
  WriteCommand(0xD5);
 
  WriteCommand(0x80);
 
  WriteCommand(0xA8);
 
  WriteCommand(0x1F);
 
  WriteCommand(0xD3);
 
  WriteCommand(0x00);
 
  WriteCommand(0x40 | 0x00); // line #0
 
  WriteCommand(0x8D);
 
  WriteCommand(0x14); //10 or 14 if not externalvcc
 
  WriteCommand(0x20);
 
  WriteCommand(0x00);
 
  WriteCommand(0xA0 | 0x1); // segremap
 
  WriteCommand(0xC8); // comscandep
 
  WriteCommand(0xDA); // setcompins 
 
  WriteCommand(0x02);
 
  WriteCommand(0x81); // contrast
 
  WriteCommand(0x0F); // contrast value. 8f is a good one.
 
  WriteCommand(0xD9);
 
  WriteCommand(0xF1); //22 or F1 if not externalvcc
0 comments (0 inline, 0 general)