#include <math.h>
#include <string.h>
#include "oled.h"
#include "memory.h"
/* GPIOS ºê¶¨Òå */
#define CS_PORT GPIOA
#define CS_PIN GPIO_Pin_8
#define DC_PORT GPIOB
#define DC_PIN GPIO_Pin_15
#define SDA_PORT GPIOB
#define SDA_PIN GPIO_Pin_13
#define SCL_PORT GPIOB
#define SCL_PIN GPIO_Pin_12
#define RES_PORT GPIOB
#define RES_PIN GPIO_Pin_14
/* дÈ뷽ʽ */
typedef enum {
OLED_CMD = 0,//OLEDµÄÖ¸Áî²Ù×÷
OLED_DAT = 1,//OLEDµÄÊý¾Ý²Ù×÷
}OLED_WriteType;
static OLED _oled;
static unsigned char _init_status = 0;
/* º¯ÊýÉùÃ÷ */
static void _oledCls(void);
static void _oledReset(void);
static void _oledGpioInit(void);
static void _oledUpDisBuffToDevice(void);
static void _oledRegisterConfiguration(void);
static void _oledSetPoint(unsigned char x,unsigned char y);
static void _oledWriteByte(OLED_WriteType type,unsigned char data);
static void _oledWriteBmpToDispalyMemory(unsigned int x,unsigned int y,BMP *bmp);
static void _oledWriteCharacterToDispalyMemory(unsigned int x,unsigned int y,char ch,WordStock wordStock);
static void _oledWriteStringToDispalyMemoryEx(unsigned int line,char *str,WordStock wordStock,ALIGN align);
static void _oledWriteStringToDispalyMemory(unsigned int x,unsigned int y,char *str,WordStock wordStock,FunctionalState wordWrap);
//ÆÁÄ»³ß´çÐÅÏ¢
#if OLED_SIZE == OLED_128_64
static unsigned int _screen_hight=64;
static unsigned int _screen_width=128;
static unsigned char _oled_dis_buff[128][8];
#endif
/**
*³õʼ»¯MCUÓëOLEDÆÁĻͨѶµÄÒý½Å
*@param void
*@return void
*/
static void _oledGpioInit(void)
{
GPIO_InitTypeDef oledInitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB,ENABLE);//¿ªÆôGPIOʱÖÓ
oledInitStruct.GPIO_Mode = GPIO_Mode_Out_PP;//Ñ¡ÔñÍÆÍìÊä³öģʽ
oledInitStruct.GPIO_Speed = GPIO_Speed_50MHz;//Ñ¡ÔñÊä³öËÙÂÊ
//CS
oledInitStruct.GPIO_Pin = CS_PIN;
GPIO_Init(CS_PORT,&oledInitStruct);
//DC
oledInitStruct.GPIO_Pin = DC_PIN;
GPIO_Init(DC_PORT,&oledInitStruct);
//SDA
oledInitStruct.GPIO_Pin = SDA_PIN;
GPIO_Init(SDA_PORT,&oledInitStruct);
//SCL
oledInitStruct.GPIO_Pin = SCL_PIN;
GPIO_Init(SCL_PORT,&oledInitStruct);
//RES
oledInitStruct.GPIO_Pin = RES_PIN;
GPIO_Init(RES_PORT,&oledInitStruct);
}
/**
*ÏòOLEDдÈëÒ»¸ö×Ö½Ú£¬ÃüÁî»òÕßÊý¾Ý
*@param OLED_WriteType type дÈ뷽ʽö¾Ù
* unsigned char data Êý¾ÝÖµ
*@return void
*/
static void _oledWriteByte(OLED_WriteType type,unsigned char data)
{
if(type == OLED_CMD)//дÈ뷽ʽ
GPIO_ResetBits(DC_PORT,DC_PIN);
else
GPIO_SetBits(DC_PORT,DC_PIN);
GPIO_ResetBits(CS_PORT,CS_PIN);//ʹÄÜÉ豸
for(int index=0;index<8;index++)//Ñ»··¢ËÍÊý¾Ý ¸ßλÏÈÐÐ
{
GPIO_ResetBits(SCL_PORT,SCL_PIN);//ÀµÍʱÖÓÏß
if((data&0x80) == 0x80)//·¢ËÍ×î¸ßλ
GPIO_SetBits(SDA_PORT,SDA_PIN);
else
GPIO_ResetBits(SDA_PORT,SDA_PIN);
GPIO_SetBits(SCL_PORT,SCL_PIN);//À¸ßʱÖÓÏß Íê³ÉһλµÄ·¢ËÍ
data <<= 1;//Êý¾Ý×óÒÆÒ»Î»
}GPIO_SetBits(CS_PORT,CS_PIN);//ÊÍ·ÅÉ豸
}
/**
*OLEDÆÁÄ»µÄÓ²¼þ¸´Î»
*@param void
*@return void
*/
static void _oledReset(void)
{
//ÉϵçÖØÖÃ(µÍµçƽÂö³å)
GPIO_WriteBit(RES_PORT,RES_PIN,Bit_SET);
GPIO_WriteBit(RES_PORT,RES_PIN,Bit_RESET);
GPIO_WriteBit(RES_PORT,RES_PIN,Bit_SET);
}
/**
*OLEDĬÈϼĴæÆ÷ÅäÖÃ
*@param void
*@return ĬÈÏΨһµÄ¿ØÖƽṹÌå
*/
static void _oledRegisterConfiguration(void)
{
//»ù±¾ÃüÁî
_oledWriteByte(OLED_CMD,0xAE);//¹ØÏÔʾ
_oledWriteByte(OLED_CMD,0x81);//ÉèÖöԱȶȣ¨Ë«×Ö½Ú£ºÅäºÏÏÂÒ»×Ö½Ú£©
_oledWriteByte(OLED_CMD,0xFF);//ÅäÖöԱȶÈΪ0x7F
_oledWriteByte(OLED_CMD,0xA4);//»Ö¸´RAMÄÚÈݵÄÏÔʾ
_oledWriteByte(OLED_CMD,0xA6);//Õý³£ÏÔʾ£¨0¹Ø 1¿ª£©
//¹öÆÁÃüÁî
_oledWriteByte(OLED_CMD,0x2E);//¹Ø±Õ¹öÆÁ¹¦ÄÜ
//µØÖ·É趨ÃüÁî
_oledWriteByte(OLED_CMD,0x00);//ÉèÖõÍËÄλҳµØÖ·
_oledWriteByte(OLED_CMD,0x10);//ÉèÖøßËÄλҳµØÖ·
_oledWriteByte(OLED_CMD,0x20);//ÉèÖÃÄÚ´æµØÖ·Ä£Ê½£¨Ë«×Ö½Ú£ºÅäºÏÏÂÒ»×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x00);//00£ºË®Æ½Ñ°Ö· 01£º´¹Ö±Ñ°Ö·
_oledWriteByte(OLED_CMD,0x21);//ÉèÖÃÁеØÖ· ÉèÖÃÁеĿªÊ¼ºÍ½áÊøµØÖ·£¨Èý×Ö½Ú£ºÅäºÏÏÂÁ½×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x00);//ÉèÖÿªÊ¼µØÖ· 0x00
_oledWriteByte(OLED_CMD,0x7f);//ÉèÖýáÊøµØÖ· 0x7f
_oledWriteByte(OLED_CMD,0x22);//ÉèÖÃÒ³µØÖ· ÉèÖÃÒ³µÄ¿ªÊ¼ºÍ½áÊøµØÖ· (Èý×Ö½Ú£ºÅäºÏÏÂÁ½×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x00);//ÉèÖÿªÊ¼µØÖ· 0x00
_oledWriteByte(OLED_CMD,0x07);//ÉèÖýáÊøµØÖ· 0x07
_oledWriteByte(OLED_CMD,0xB0);//ÉèÖÃÒ³¿ªÊ¼µØÖ·
//Ó²¼þÅäÖÃÃüÁî
_oledWriteByte(OLED_CMD,0x40);//ÉèÖÃÏÔʾRAMÏÔʾÆðʼÐмĴæÆ÷ RAM0 -> COM0
_oledWriteByte(OLED_CMD,0xA1);//ÉèÖöÎÔÙÏÖ ÓÃÓÚ×óÓÒ·´Ïò£¨0£º1£© ˮƽ·×ª
_oledWriteByte(OLED_CMD,0xA8);//ÉèÖöàÓø´ÓÃÂÊ£¨Ë«×Ö½Ú£ºÅäºÏÏÂÒ»×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x3f);//--1/64 duty
_oledWriteByte(OLED_CMD,0xC8);//ÉèÖÃCOMɨÃèÊä³ö·½Ïò ´ÓCOM0 µ½ COM[N¨C1] ´¹Ö±·×ª
_oledWriteByte(OLED_CMD,0xD3);//ÉèÖÃÏÔʾµÖÏû(Ë«×Ö½Ú£ºÅäºÏÏÂÒ»×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x00);//Æ«ÒÆ0
_oledWriteByte(OLED_CMD,0xDA);//ÉèÖÃCOMÒý½Å£¨Ë«×Ö½Ú£ºÅäºÏÏÂÒ»×Ö½Ú£©
_oledWriteByte(OLED_CMD,0x12);
//ÉèÖÃʱ¼äºÍÇý¶¯·½°¸ÃüÁî
_oledWriteByte(OLED_CMD,0xD5);//--set display clock divide ratio/oscillator frequency
_oledWriteByte(OLED_CMD,0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
_oledWriteByte(OLED_CMD,0xD9);//--set pre-charge period
_oledWriteByte(OLED_CMD,0xF1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
_oledWriteByte(OLED_CMD,0xDB);//--set vcomh
_oledWriteByte(OLED_CMD,0x40);//
_oledWriteByte(OLED_CMD,0x8D);//ÉèÖóäµç±ÃÆôÓÃ/½ûÓÃ
_oledSetPoint(0,7);
for(int row=0;row<_screen_hight/8;row++)
for(int col=0;col<_screen_width;col++)
_oledWriteByte(OLED_DAT,0x00);
_oledWriteByte(OLED_CMD,0xAF);//¿ªÏÔʾ
}
/**
*ÉèÖÃÏÔʾλÖÃ
*@param unsigned char x
unsigned char y
*@return void
*/
static void _oledSetPoint(unsigned char x,unsigned char y)
{
if((x>=_screen_width) || y>=(_screen_hight/8))return;//·Ç·¨µØÖ·
_oledWriteByte(OLED_CMD,0xB0+y%8);//ÉèÖÃÒ³(¼´YÖá×ø±ê)
_oledWriteByte(OLED_CMD,0x00+(x&0x0f));//ÉèÖÃÁеÍ4bit
_oledWriteByte(OLED_CMD,0x10+(x>>4));//ÉèÖÃÁиß4bit
}
/**
*ͬ²½ÏÔ´æµ½ÆÁÄ»
*@param void
*@return void
*/
static void _oledUpDisBuffToDevice(void)
{
unsigned int colMax=_screen_width;
unsigned int rowMax=_screen_hight/8;
_oledSetPoint(0x00,0x00);//Ö¸Õë¹éλ
//½«ÏÔ´æÊý¾Ýͬ²½µ½ÆÁÄ»
for(int row=0;row<rowMax;row++)
for(int col=0;col<colMax;col++)
_oledWriteByte(OLED_DAT,_oled_dis_buff[col][row]);
}
/**
*OLEDÇåÆÁ²Ù×÷
*@param void
*@return void
*/
static void _oledCls(void)
{
memInit(_oled_dis_buff,_screen_hight*_screen_width/8,0x00);
}
/**
*OLEDÇå³ý²Ù×÷
*@param unsigned int line ÐÐ0->127
* unsigned int column ÁÐ0->7
*@return void
*/
static void _oledClear(unsigned int line,unsigned int column)
{
//µØÖ·ÅжÏ
if((line>=(_screen_hight/8)) || (column>=_screen_width))return;
if((line==All_LINE) && (column==All_COLUMN))
_oledCls();
else if(line == All_LINE){
for(int i=0;i<line;i++)
_oled_dis_buff[column][i] = 0x00;
}else if(column == All_COLUMN){
for(int i=0;i<column;i++)
_oled_dis_buff[i][line] = 0x00;
}else
_oled_dis_buff[column][line] = 0x00;
}
/**
*ÔÚÏÔ´æÖÐдÈë×Ö·ûÊý¾Ý
*@param unsigned int x ºá×ø±êÖµ0->(_screen_width-1)
* unsigned int y ×Ý×ø±êÖµ0->(_screen_hight/8-1)
* char ch ×Ö·ûÂë
* WordStock wordStock ×Ö¿âÀàÐÍ
*@return void
*/
static void _oledWriteCharacterToDispalyMemory(unsigned int x,unsigned int y,char ch,WordStock wordStock)
{
if((x>=_screen_width) || (y>=_screen_hight))return;//·Ç·¨µØÖ·
FONT *font = getFontOnWordStock(wordStock,ch);///»ñµÃ×ÖÌå
if(font == NULL)return;//ÅжÏ×ÖÌåÊÇ·ñÓÐЧ
//Èç¹ûдÈëλÖÃyÊÇXµÄÕûÊýʱ£¬²ÉÓÃÖ±½ÓдÈëЧÂʸü¸ß£¬ÓÃBMP»æÖƵÄÐÎʽ¸ü¼ÓͨÓÃ
if((y%0x08) == 0x00)
{
_oled.showBmp(x,y,(BMP*)font);
}else _oled.showBmp(x,y,(BMP*)font);
}
/**
*ÔÚÏÔ´æÖÐдÈë×Ö·û´®Êý¾Ý
*@param unsigned int x ºá×ø±êÖµ0->(_screen_width-1)
* unsigned int y ×Ý×ø±êÖµ0->(_screen_hight/8-1)
* char str ×Ö·û´®
* WordStock wordStock ×Ö¿âÀàÐÍ
* FunctionalState wordWrap ×Ô¶¯»Ø³µÊ¹ÄÜ
*@return void
*/
static void _oledWriteStringToDispalyMemory(unsigned int x,unsigned int y,char *str,WordStock wordStock,FunctionalState wordWrap)
{
if(str == NULL)return;//Ö¸Õë´æÔÚÒì³£
if((x>=_screen_width) || (y>=_screen_hight))return;//·Ç·¨µØÖ·
FONT *font = getFontOnWordStock(wordStock,str[0]);//»ñÈ¡×ÖÌå
if(font == NULL)return;//ÅжÏ×ÖÌåÊÇ·ñÓÐЧ
while(*str != '\0')//Ñ»··¢ËÍ×Ö·û´®Êý¾Ý
{
_oledWriteCharacterToDispalyMemory(x,y,*str++,wordStock);//»æÖÆ×Ö·û
x += font->width;//×Ö·ûx×ø±êµÝÔö
if((x + font->width) >= _screen_width)//Èç¹ûÊ£Óà¿í¶È²»×ãÒÔÏÔʾһ¸ö×Ö·ûÔò»Ø³µ»òÕßÍ˳ö
{
if(wordWrap == ENABLE){
if(y > 7)return;//ÒѾµ½µ×
x = 0;y++;
_oledSetPoint(x,y);//ÖØÐÂÉèÖÃÏÔʾµØÖ·
}else
return;
}
}
}
/**
*ÔÚÏÔ´æÖÐдÈë×Ö·û´®Êý¾Ý
*@param unsigned int line ÐÐÊý
* char str ×Ö·û´®
* WordStock wordStock ×Ö¿âÀàÐÍ
* ALIGN allign ¶ÔÆë·½Ê½£¬¿ÉÒÔʹÓøÃö¾Ù±äÁ¿
*@return void
*/
static void _oledWriteStringToDispalyMemoryEx(unsigned int line,char *str,WordStock wordStock,ALIGN align)
{
unsigned int x=0;
int strLength = strlen((char*)str);//»ñµÃ×Ö·û´®³¤¶È
FONT *font = getFontOnWordStock(wordStock,str[0]);//»ñµÃ×ÖÌ广¸ñ
switch(align)
{
case Align_Left:break;//×ó¶ÔÆë
case Align_Center:x = (_screen_width-(strLength*font->width))/2;break;//¾ÓÖÐ¶ÔÆë
case Align_Right:x = _screen_width-(strLength*font->width+1);break;//ÓÒ¶ÔÆë
default:return;
}_oledWriteStringToDispalyMemory(x,line,str,wordStock,DISABLE);//ÏÔʾ×Ö·û´®
}
/**
*ÔÚÏÔ´æÖÐдÈëλͼ£¬×¢ÒâȡģӦ²ÉÓà ÖðÁС¢ÄæÏòÒõÂëµÄÐÎʽ
*@param unsigned int x ºá×ø±êÖµ0->_screen_width-1
* unsigned int y ×Ý×ø±êÖµ0->_screen_hight-1
* BMP *bmp λͼ½á¹¹Ìå
*@return void
*/
static void _oledWriteBmpToDispalyMemory(unsigned int x,unsigned int y,BMP *bmp)
{
long long cache = 0x00;
unsigned int bytes = bmp->heiht/0x08;
//²ÉÓÃÖðÁÐɨÃèдÈëµÄ·½Ê½
for(int i=0;i<bmp->width;i++)
{
unsigned int add = (unsigned int)bmp->bmp+i*bytes;//»ñÈ¡Êý¾ÝµØÖ·
if(bytes > 0x04){
unsigned int add_2 = (unsigned int)bmp->bmp+i*bytes+4;//»ñÈ¡Êý¾ÝµØÖ·2
cache = (((long long)(*(unsigned int*)add_2))<<32)|(*(unsigned int*)add);//×°ÔØÊý¾Ý
}else
cache = *(unsigned int*)add;//×°ÔØÊý¾Ý
cache &= ((long long)1<<bmp->heiht)-1;//ÑÚÂë²Ù×÷
cache <<= y; //ÒÆÎ»²Ù×÷
*(long long*)(&_oled_dis_buff[x+i][0]) |= cache;//дÈëÏÔ´æ
}
}
/**
*ÔÚÏÔ´æÖÐдÈëµã
*@param unsigned int x ºá×ø±êÖµ0->_screen_width-1
* unsigned int y ×Ý×ø±êÖµ0->_screen_hight-1
*@return void
*/
static void _oledWriteDotToDispalyMemory(unsigned int x,unsigned int y)
{
if((x > _screen_width) || (y > _screen_hight))return;//ÎÞЧλÖÃ
_oled_dis_buff[x][y/8] |= 0x01<<(y%8);
}
/**
*ÔÚÏÔ´æÖÐдÈëÏß
*@param unsigned int s_x ¿ªÊ¼ºá×ø±êÖµ0->_screen_width-1
* unsigned int s_y ¿ªÊ¼×Ý×ø±êÖµ0->_screen_hight-1
* unsigned int e_x ½áÊøºá×ø±êÖµ0->_screen_width-1
* unsigned int e_y ½áÊø×Ý×ø±êÖµ0->_screen_hight-1
*@return void
*/
static void _oledWriteLineToDispalyMemory(unsigned int s_x,unsigned int s_y,unsigned int e_x,unsigned int e_y)
{
float stepValue;
//ÅжÏÁ½ÖáÖ®²îµÄ´óС£¬¾ö¶¨Ë×÷ΪÖ÷Öá»æÖÆ
if(fabs((int)s_x-(int)e_x) > fabs((int)s_y-(int)e_y))
{
//Èç¹û½áÊøx×ø±êСÓÚÆðʼx×ø±êÔòµ÷»»
if(e_x < s_x)
{
unsigned int temp = e_x;
e_x = s_x;s_x = temp;
temp = e_y;
e_y = s_y;s_y = e_y;
}
//´Ós_x¿ªÊ¼±éÀú
stepValue = (int)(e_y - s_y)/(float)((int)(e_x - s_x));//²½½øÖµ
for(int i=s_x;i<e_x;i++)
_oledWriteDotToDispalyMemory(i,s_y + (i-s_x)*stepValue);
}else{
//Èç¹û½áÊøy×ø±êСÓÚÆðʼy×ø±êÔòµ÷»»
if(e_y < s_y)
{
unsigned int temp = e_y;
e_y = s_y;s_y = temp;
temp = e_x;
e_x = s_x;s_x = e_x;
}
//´Ós_x¿ªÊ¼±éÀú
stepValue = (int)(e_x - s_x)/(float)((int)(e_y - s_y));//²½½øÖµ
for(int i=s_y;i<e_y;i++)
_oledWriteDotToDispalyMemory(s_x + (i-s_y)*stepValue,i);
}
}
/**
*ÔÚÏÔ´æÖÐдÈë¾ØÐÎ
*@param unsigned int x ¿ªÊ¼ºá×ø±êÖµ0->_screen_width-1
* unsigned int y ¿ªÊ¼×Ý×ø±êÖµ0->_screen_hight-1
* unsigned int length ³¤¶È0->_screen_width-1
* unsigned int width ¿í¶È0->_screen_hight-1
*@return void
*/
static void _oledWriteRectangleToDispalyMemory(unsigned int x,unsigned int y,unsigned int length,unsigned int width)
{
//¾ØÐβ»¹ýËÄÌõÏß
_oledWriteLineToDispalyMemory(x,y,x,y+width);
_oledWriteLineToDispalyMemory(x,y,x+length,y);
_oledWriteLineToDispalyMemory(x,y+width,x+length,y+width);
_oledWriteLineToDispalyMemory(x+length,y+width,x+length,y);
}
/**
*ÔÚÏÔ´æÖÐдÈëÔ²
*@param unsigned int x Ô²Ðĺá×ø±êÖµ0->_screen_width-1
* unsigned int y Ô²ÐÄ×Ý×ø±êÖµ0->_screen_hight-1
* unsigned int radii °ë¾¶0->_screen_width-1
*@return void
*/
static void _oledWriteCircleToDispalyMemory(unsigned int x,unsigned int y,unsigned int radii)
{
//±éÀúx×ø±ê»µã
for(int i=(0-radii);i<(int)radii;i++)
{
//ÀûÓù´¹É¶¨ÀíÇóµÚÈý±é
float temp = sqrt((radii*radii)-(i*i));
_oledWriteDotToDispalyMemory(x+i,y-temp);
_oledWriteDotToDispalyMemory(x+i,y+temp);
}
//±éÀúy×ø±ê»µã
for(int i=(0-radii);i<(int)radii;i++)
{
//ÀûÓù´¹É¶¨ÀíÇóµÚÈý±é
float temp = sqrt((radii*radii)-(i*i));
_oledWriteDotToDispalyMemory(x-temp,y+i);
_oledWriteDotToDispalyMemory(x+temp,y+i);
}
}
/**
*»æÖƲ¨Ðε½ÏÔ´æµ±ÖÐ
*@param unsigned char *data Êý¾ÝÖ¸Õë
* unsigned int length »º´æÇø³¤¶È
*@return ÎÞ
*/
static void _oledWriteWaveformToDispalyMemory(unsigned char *data,unsigned int length)
{
for(int i=0;i<length;i++)
_oledWriteLineToDispalyMemory(i,63-data[i],i+1,63-data[i+1]);
}
/**
*»ñȡĬÈÏ¿ØÖƽṹÌå,ÕâÊDZ¾ÎļþΨһµÄ¶ÔÍâ½Ó¿Ú,»ñÈ¡½á¹¹ÌåÖ¸Õëºó£¬
*½ø¶ø¿ÉÒÔ²Ù×÷Õû¸öOLEDÆÁÄ»¡£
*@param void
*@return ĬÈÏΨһµÄ¿ØÖƽṹÌå
*/
OLED* getOledHandle(void)
{
//Èç¹û¸ÃÖ¸ÕëÒѾ±»»ñÈ¡¹ýÁËÔòÍ˳ö
if(_init_status != 0x00)
{
return &_oled;
}else _init_status = 0x01;
//Ö´ÐÐÆ÷¼þ³õʼ»¯
_oledGpioInit();
_oledReset();
_oledRegisterConfiguration();
//Ϊº¯ÊýÖ¸Õ븳ֵ
_oled.cls =_oledCls;
_oled.clear = _oledClear;
_oled.memorySynchronous = _oledUpDisBuffToDevice;
_oled.showString = _oledWriteStringToDispalyMemory;
_oled.showStringEx = _oledWriteStringToDispalyMemoryEx;
_oled.showCharacter = _oledWriteCharacterToDispalyMemory;
_oled.showBmp = _oledWriteBmpToDispalyMemory;
_oled.showDot = _oledWriteDotToDispalyMemory;
_oled.showLine = _oledWriteLineToDispalyMemory;
_oled.showCircle = _oledWriteCircleToDispalyMemory;
_oled.showRectangle = _oledWriteRectangleToDispalyMemory;
_oled.showWaveform = _oledWriteWaveformToDispalyMemory;
return &_oled;
}
这个代码属于标准还是模拟(虽然可能是SPI)