#include <STC8.H>
#include "SPI.h"
#include "oled.h"
#include "oledfont.h"
// OLED的显存
//存放格式如下.
//[0]0 1 2 3 ... 127
//[1]0 1 2 3 ... 127
//[2]0 1 2 3 ... 127
//[3]0 1 2 3 ... 127
//[4]0 1 2 3 ... 127
//[5]0 1 2 3 ... 127
//[6]0 1 2 3 ... 127
//[7]0 1 2 3 ... 127
uint8_t SPI_Busy = 0;
void Delay20us() //@24.000MHz
{
unsigned char i;
i = 6;
while (--i)
;
}
void delay_ms(unsigned int ms)
{
unsigned int a;
while (ms)
{
a = 1800;
while (a--)
;
ms--;
}
return;
}
//反显函数
void OLED_ColorTurn(bool i)
{
if (i == 0)
{
OLED_WR_Cmd(0xA6); //正常显示
}
else
{
OLED_WR_Cmd(0xA7); //反色显示
}
}
//屏幕旋转180度
void OLED_DisplayTurn(bool i)
{
if (i == 0)
{
OLED_WR_Cmd(0xC8); //正常显示
OLED_WR_Cmd(0xA1);
}
else
{
OLED_WR_Cmd(0xC0); //反转显示
OLED_WR_Cmd(0xA0);
}
}
#ifdef hardware
void OLED_WR_Data(uint8_t dat)
{
SPI_Busy = 0;
OLED_DC_Set(); //拉高DC管脚,写数据
OLED_Writ_Bus(dat);
}
void OLED_
|