removing old files as eclipse builds now

Added #define organisation over mfg logo (no actual build effect though just for neatness)
Creating a CubeMX project to match settings for future use
More comments and cleaning up
This commit is contained in:
Ben V. Brown
2016-09-11 21:54:52 +10:00
parent 871e8e35c9
commit 0b4068976c
153 changed files with 2549 additions and 79493 deletions

View File

@@ -1,12 +1,12 @@
/********************* (C) COPYRIGHT 2015 e-Design Co.,Ltd. **********************
File Name : Oled.c
Version : S100 APP Ver 2.11
Description:
Author : Celery
Data: 2015/07/07
History:
2015/07/07 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
File Name : Oled.c
Version : S100 APP Ver 2.11
Description:
Author : Celery
Data: 2015/07/07
History:
2015/07/07 ͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*******************************************************************************/
#include <stdio.h>
#include <string.h>
@@ -18,301 +18,298 @@ History:
#include "Disk.h"
#include "UI.h"
const u8 Mini[] = {/*12*16*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFE,
0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFE,0xFE,0xFC,0x78,
0x30,0x80,0xC0,0xC0,0x00,0x18,0x9C,0xCE,0xE6,0xF0,0xF8,0xFC,0xFE,0xFE,0xFC,0xF8,
0xF0,0xE0,0xC0,0xE0,0xF0,0xF8,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x0F,0x07,0x03,0x01,0x03,0x07,0x0F,0x1F,
0x3F,0x7F,0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x03,0x07,0x07,0x03,0x19,0x1C,0x0E,
0x67,0x73,0x39,0x1C,0x0E,0x07,0x03,0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0x7F,0x3F,
0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"D:\yinyongqin\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\LOGOIN.BMP.bmp",0*/
//Choose startup logo by manufacturer
#ifdef MFTSEEED
//V -- Seeed startup logo
const u8 Seeed[] = {/*12*16*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
0x80, 0x00, 0x00, 0xC0, 0xF8, 0x38, 0x04, 0x00, 0x04, 0x38, 0xF8, 0xC0,
0x00, 0x00, 0x80, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x30,
0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30,
0x10, 0x10, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0, 0x60,
0x30, 0x10, 0x10, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x60,
0x30, 0x10, 0x10, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0,
0x40, 0x20, 0x20, 0x20, 0x20, 0x40, 0xC0, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x0F, 0x1C, 0x38, 0x23, 0x6F, 0x5C, 0x00, 0x00, 0x00, 0x5C, 0x6F, 0x23,
0x38, 0x1C, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x23,
0x42, 0x42, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x07, 0x1E, 0x32, 0x22,
0x42, 0x42, 0x42, 0x42, 0x62, 0x32, 0x03, 0x00, 0x00, 0x07, 0x1E, 0x32,
0x22, 0x42, 0x42, 0x42, 0x42, 0x22, 0x32, 0x03, 0x00, 0x07, 0x1E, 0x32,
0x22, 0x42, 0x42, 0x42, 0x42, 0x62, 0x32, 0x03, 0x00, 0x00, 0x0F, 0x18,
0x10, 0x20, 0x20, 0x20, 0x20, 0x10, 0x18, 0x7F, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, /*"D:\yinyongqin\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\LOGOIN.ddMP.bmp",0*/
};
const u8 Seeed[] = {/*12*16*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x80,0x00,0x00,0xC0,0xF8,0x38,0x04,0x00,
0x04,0x38,0xF8,0xC0,0x00,0x00,0x80,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x30,
0x10,0x10,0x10,0x10,0x10,0x20,0x00,0x00,0x80,0xC0,0x60,0x30,0x10,0x10,0x10,0x30,
0x60,0xC0,0x80,0x00,0x00,0x80,0xC0,0x60,0x30,0x10,0x10,0x10,0x30,0x60,0xC0,0x80,
0x00,0x80,0xC0,0x60,0x30,0x10,0x10,0x10,0x30,0x60,0xC0,0x80,0x00,0x00,0x80,0xC0,
0x40,0x20,0x20,0x20,0x20,0x40,0xC0,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1C,0x38,0x23,0x6F,0x5C,0x00,0x00,
0x00,0x5C,0x6F,0x23,0x38,0x1C,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x31,0x23,
0x42,0x42,0x42,0x42,0x42,0x22,0x1C,0x00,0x07,0x1E,0x32,0x22,0x42,0x42,0x42,0x42,
0x62,0x32,0x03,0x00,0x00,0x07,0x1E,0x32,0x22,0x42,0x42,0x42,0x42,0x22,0x32,0x03,
0x00,0x07,0x1E,0x32,0x22,0x42,0x42,0x42,0x42,0x62,0x32,0x03,0x00,0x00,0x0F,0x18,
0x10,0x20,0x20,0x20,0x20,0x10,0x18,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"D:\yinyongqin\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\LOGOIN.ddMP.bmp",0*/
};
#ifdef SSD1316
u8 gOled_param[50] = { 0x80,0xAE,0x80,0x00,0x80,0x10,0x80,0x40,0x80,0xB0,0x80,
0x81,0x80,0xFF,0x80,0xA0,0x80,0xA6,0x80,0xA8,0x80,0x1F,
0x80,0xC8,0x80,0xD3,0x80,0x00,0x80,0xD5,0x80,0x80,0x80,
0xD9,0x80,0x22,0x80,0xDA,0x80,0x12,0x80,0xDB,0x80,0x40,
0x80,0x8D,0x80,0x14,0x80,0xAF,
};
#else
u8 gOled_param[46] = { 0x80,0xAE,0x80,0xD5,0x80,0x52,0x80,0xA8,0x80,0x0f,0x80,
0xC0,0x80,0xD3,0x80,0x00,0x80,0x40,0x80,0xA0,0x80,0x8D,
0x80,0x14,0x80,0xDA,0x80,0x02,0x80,0x81,0x80,0x33,0x80,
0xD9,0x80,0xF1,0x80,0xDB,0x80,0x30,0x80,0xA4,0x80,0XA6,
0x80,0xAF
};
//MiniDSO startup logo
const u8 Mini[] = {/*12*16*/0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE,
0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE,
0xFE, 0xFE, 0xFC, 0x78, 0x30, 0x80, 0xC0, 0xC0, 0x00, 0x18, 0x9C, 0xCE,
0xE6, 0xF0, 0xF8, 0xFC, 0xFE, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0xE0,
0xF0, 0xF8, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x03, 0x07, 0x0F, 0x1F,
0x3F, 0x7F, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x03, 0x07, 0x07,
0x03, 0x19, 0x1C, 0x0E, 0x67, 0x73, 0x39, 0x1C, 0x0E, 0x07, 0x03, 0x01,
0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, /*"D:\yinyongqin\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\LOGOIN.BMP.bmp",0*/
};
#endif
//Setup params depending on oled model
#ifdef SSD1316
u8 gOled_param[50] = {0x80,0xAE,0x80,0x00,0x80,0x10,0x80,0x40,0x80,0xB0,0x80,
0x81,0x80,0xFF,0x80,0xA0,0x80,0xA6,0x80,0xA8,0x80,0x1F,
0x80,0xC8,0x80,0xD3,0x80,0x00,0x80,0xD5,0x80,0x80,0x80,
0xD9,0x80,0x22,0x80,0xDA,0x80,0x12,0x80,0xDB,0x80,0x40,
0x80,0x8D,0x80,0x14,0x80,0xAF,
};
#else
u8 gOled_param[46] = { 0x80, 0xAE, 0x80, 0xD5, 0x80, 0x52, 0x80, 0xA8, 0x80,
0x0f, 0x80, 0xC0, 0x80, 0xD3, 0x80, 0x00, 0x80, 0x40, 0x80, 0xA0, 0x80,
0x8D, 0x80, 0x14, 0x80, 0xDA, 0x80, 0x02, 0x80, 0x81, 0x80, 0x33, 0x80,
0xD9, 0x80, 0xF1, 0x80, 0xDB, 0x80, 0x30, 0x80, 0xA4, 0x80, 0XA6, 0x80,
0xAF };
#endif
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Sc_Pt
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ļ<EFBFBD>Աȶ<D4B1>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:Co<43><6F>Ļ<EFBFBD>ԱȶȲ<C8B6><C8B2><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Sc_Pt
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>Ļ<EFBFBD>Աȶ<D4B1>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:Co<43><6F>Ļ<EFBFBD>ԱȶȲ<C8B6><C8B2><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Sc_Pt(u8 Co) //<2F><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
{
u8 pt[4] = {0x80,0x81,0x80,Co};
u8 pt[4] = { 0x80, 0x81, 0x80, Co };
I2C_PageWrite(pt,4,DEVICEADDR_OLED);
I2C_PageWrite(pt, 4, DEVICEADDR_OLED);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Oled_DisplayOn
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>OLED<45><44>ʾ
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Oled_DisplayOn(void)
{
u8 data[6] = {0x80,0X8D,0x80,0X14,0x80,0XAF};
Function: Oled_DisplayOn
Description:Turn on the Oled display
*******************************************************************************/
void Oled_DisplayOn(void) {
u8 data[6] = { 0x80, 0X8D, 0x80, 0X14, 0x80, 0XAF };
I2C_PageWrite(data,6,DEVICEADDR_OLED);
I2C_PageWrite(data, 6, DEVICEADDR_OLED);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Oled_DisplayOff
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>ر<EFBFBD>OLED<45><44>ʾ
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Oled_DisplayOff(void)
{
u8 data[6] = {0x80,0X8D,0x80,0X10,0x80,0XAE};
Function: Oled_DisplayOff
Description:Turn off the Oled display
*******************************************************************************/
void Oled_DisplayOff(void) {
u8 data[6] = { 0x80, 0X8D, 0x80, 0X10, 0x80, 0XAE };
I2C_PageWrite(data,6,DEVICEADDR_OLED);
I2C_PageWrite(data, 6, DEVICEADDR_OLED);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Data_Command
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>ʾ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB4AB>OLED
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:wide <20><>,ptr <20><>ָ<EFBFBD><D6B8>
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:<3A><>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8>
*******************************************************************************/
u8* Data_Command(u8 wide,u8* ptr)
{
int i;
u8 tx_data[128];
tx_data[0] = 0x40;
wide += 1;
for(i = 1; i < wide; i++) tx_data[i] = *ptr++;
I2C_PageWrite(tx_data,wide,DEVICEADDR_OLED);
return ptr;
Function: Data_Command
Description: write a command to the Oled display
Input: number of bytes to write, array to write
Output:
*******************************************************************************/
u8* Data_Command(u8 wide, u8* ptr) {
int i;
u8 tx_data[128];
//here are are inserting the data write command at the beginning
tx_data[0] = 0x40;
wide += 1;
for (i = 1; i < wide; i++) //Loop through the array of data
tx_data[i] = *ptr++;
I2C_PageWrite(tx_data, wide, DEVICEADDR_OLED); //write out the buffer
return ptr;
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Set_ShowPos
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D2AA>ʾ<EFBFBD><CABE><EFBFBD>ݵ<EFBFBD>λ<EFBFBD><CEBB>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:x:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,y:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0,8,16,24)
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Set_ShowPos(u8 x,u8 y)
{
u8 pos_param[8] = { 0x80,0xB0,0x80,0x21,0x80,0x20,0x80,0x7F };
Function:Set_ShowPos
Description:Set the current position in GRAM that we are drawing to
Input:x,y co-ordinates
*******************************************************************************/
void Set_ShowPos(u8 x, u8 y) {
u8 pos_param[8] = { 0x80, 0xB0, 0x80, 0x21, 0x80, 0x20, 0x80, 0x7F };
pos_param[5] = x + 32;
pos_param[1] += y;
pos_param[5] = x + 32;
pos_param[1] += y;
I2C_PageWrite(pos_param,8,DEVICEADDR_OLED);
I2C_PageWrite(pos_param, 8, DEVICEADDR_OLED);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Oled_DrawArea
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʾһ<CABE><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: x0:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
y0:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0,8,16,24)
wide:<3A><>ʾ<EFBFBD><CABE><EFBFBD>ݿ<EFBFBD><DDBF>
high:<3A><>ʾ<EFBFBD><CABE><EFBFBD>ݸ߶<DDB8>
ptr:<3A><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>ָ<EFBFBD><D6B8>
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:<3A><>һ<EFBFBD><D2BB>ָ<EFBFBD><D6B8>
*******************************************************************************/
u8* Oled_DrawArea(u8 x0,u8 y0,u8 wide, u8 high,u8* ptr)
{
u8 m,n,y;
Function:Oled_DrawArea
Description:
Inputs:(x,y) start point, (width,height) of enclosing rect, pointer to data
Output: last byte written out
*******************************************************************************/
u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high, u8* ptr) {
u8 m, n, y;
n = y0 + high;
if(y0 % 8 == 0) m = y0 / 8;
else m = y0 / 8 + 1;
n = y0 + high;
if (y0 % 8 == 0)
m = y0 / 8;
else
m = y0 / 8 + 1;
if(n % 8 == 0) y = n / 8;
else y = n / 8 + 1;
if (n % 8 == 0)
y = n / 8;
else
y = n / 8 + 1;
for(; m < y; m++) {
Set_ShowPos(x0,m);
ptr = Data_Command(wide,ptr);
}
return ptr;
for (; m < y; m++) {
Set_ShowPos(x0, m);
ptr = Data_Command(wide, ptr);
}
return ptr;
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Clean_Char
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wideλ<65><CEBB>Ϊk<CEAA><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>λ<EFBFBD><CEBB>wideΪ<65><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Clean_Char(int k,u8 wide)
{
int i;
u8 tx_data[128];
Function:Clean_Char
Description:Overwries a square to off, used to overwrite a char
Inputs:(k) input X position char starts at, (wide) how many pixels wide the char is
*******************************************************************************/
void Clean_Char(int k, u8 wide) {
int i;
u8 tx_data[128];
memset(&tx_data[0],0,wide);
for(i = 0; i < 2; i++) {
Oled_DrawArea(k,i * 8,wide,8,tx_data);
}
memset(&tx_data[0], 0, wide);
for (i = 0; i < 2; i++) {
Oled_DrawArea(k, i * 8, wide, 8, tx_data);
}
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: GPIO_Init_OLED
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʼ<EFBFBD><CABC>LED<45>˿<EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void GPIO_Init_OLED(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
Function:GPIO_Init_OLED
Description:Init the outputs as needed for the OLED (in this case the RST line)
*******************************************************************************/
void GPIO_Init_OLED(void) {
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = OLED_RST_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = OLED_RST_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Init_Oled
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʼ<EFBFBD><CABC>LED<45><44><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Init_Oled(void)
{
u8 param_len;
Function: Init_Oled
Description: Initalizes the Oled screen
*******************************************************************************/
void Init_Oled(void) {
u8 param_len;
OLED_RST();
Delay_Ms(2);
OLED_ACT();
Delay_Ms(2);
OLED_RST();
Delay_Ms(2);
OLED_ACT();
Delay_Ms(2);
#ifdef SSD1316
param_len = 50;
param_len = 50;
#else
param_len = 46;
param_len = 46;
#endif
I2C_PageWrite((u8 *)gOled_param,param_len,DEVICEADDR_OLED);
I2C_PageWrite((u8 *) gOled_param, param_len, DEVICEADDR_OLED);
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Clear_Screen
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Clear_Screen(void)
{
u8 tx_data[128];
u8 i,wd;
Function:Clear_Screen
Description:Clear the entire screen to off (black)
*******************************************************************************/
void Clear_Screen(void) {
u8 tx_data[128];
u8 i, wd;
#ifdef SSD1316
wd = 32;
wd = 32;
#else
wd = 16;
wd = 16;
#endif
memset(&tx_data[0],0,128);
for(i = 0; i < wd / 8; i++) {
Oled_DrawArea(0,i * 8,128,8,tx_data);
}
memset(&tx_data[0], 0, 128);
for (i = 0; i < wd / 8; i++) {
Oled_DrawArea(0, i * 8, 128, 8, tx_data);
}
}
/*******************************************************************************
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: Display_BG
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ΪLOGOIN.BMP<4D><50>ͼƬ
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:NULL
<EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>:NULL
*******************************************************************************/
void Display_BG(void)
{
u8 i,j,k,m,n,p,ch,Palette = 1;
u8* bmpfile;
u16 filelen;
u16* Root_addr = 0;
u8 *ptr = 0;
u8 g_au8TxData[128];
Function:Display_BG
Description:Display the bootup graphics (the logo)
* Reads the file if present in the filesystem otherwise uses hard coded ones
*******************************************************************************/
void Display_BG(void) {
u8 i, j, k, m, n, p, ch, Palette = 1;
u8* bmpfile;
u16 filelen;
u16* Root_addr = 0;
u8 *ptr = 0;
u8 g_au8TxData[128];
if((bmpfile = SearchFile("LOGOIN BMP",&filelen,Root_addr))) {
if(bmpfile[0] == 'B' && bmpfile[1] == 'M' ) {
if((bmpfile[0x36] == 0xFF) && (bmpfile[0x37] == 0xFF) && (bmpfile[0x38] == 0xFF)) {
Palette = 0;
}
memset(&g_au8TxData[1],0,127);
p = 0x1;
for(i = 15; i >= 8; i--) {
m = 0;
for(j = 0; j < 12; j++) {
ch = bmpfile[0x3E + i * 12 + j];
n = 0x80;
for(k = 0; k < 8; k++) {
if(Palette) {
if(!(ch & n)) g_au8TxData[m + 1] |= p;
} else {
if((ch & n)) g_au8TxData[m + 1] |= p;
}
m++;
n >>= 1;
}
}
p <<= 1;
}
Oled_DrawArea(0,0,96,8,g_au8TxData);
Clear_Watchdog();
if ((bmpfile = SearchFile("LOGOIN BMP", &filelen, Root_addr))) {
if (bmpfile[0] == 'B' && bmpfile[1] == 'M') {
if ((bmpfile[0x36] == 0xFF) && (bmpfile[0x37] == 0xFF)
&& (bmpfile[0x38] == 0xFF)) {
Palette = 0;
}
memset(&g_au8TxData[1], 0, 127);
p = 0x1;
for (i = 15; i >= 8; i--) {
m = 0;
for (j = 0; j < 12; j++) {
ch = bmpfile[0x3E + i * 12 + j];
n = 0x80;
for (k = 0; k < 8; k++) {
if (Palette) {
if (!(ch & n))
g_au8TxData[m + 1] |= p;
} else {
if ((ch & n))
g_au8TxData[m + 1] |= p;
}
m++;
n >>= 1;
}
}
p <<= 1;
}
Oled_DrawArea(0, 0, 96, 8, g_au8TxData);
Clear_Watchdog();
memset(&g_au8TxData[1],0,127);
p = 0x1;
for(i = 0; i < 8; i++) {
m = 0;
for(j = 0; j < 12; j++) {
ch = bmpfile[0x3E + (7 - i) * 12 + j];
n = 0x80;
for(k = 0; k < 8; k++) {
if(Palette) {
if(!(ch & n)) g_au8TxData[m + 1] |= p;
} else {
if((ch & n)) g_au8TxData[m + 1] |= p;
}
m++;
n >>= 1;
}
}
p <<= 1;
}
Oled_DrawArea(0,8,96,8,g_au8TxData);
Delay_Ms(1000);
Clear_Watchdog();
return;
}
} else {
memset(&g_au8TxData[1], 0, 127);
p = 0x1;
for (i = 0; i < 8; i++) {
m = 0;
for (j = 0; j < 12; j++) {
ch = bmpfile[0x3E + (7 - i) * 12 + j];
n = 0x80;
for (k = 0; k < 8; k++) {
if (Palette) {
if (!(ch & n))
g_au8TxData[m + 1] |= p;
} else {
if ((ch & n))
g_au8TxData[m + 1] |= p;
}
m++;
n >>= 1;
}
}
p <<= 1;
}
Oled_DrawArea(0, 8, 96, 8, g_au8TxData);
Delay_Ms(1000);
Clear_Watchdog();
return;
}
} else {
//Check the #defines for which one to use
#ifdef MFTSEEED
ptr = (u8*)Seeed;
ptr = (u8*)Seeed;
#else
ptr = (u8*)Mini;
ptr = (u8*) Mini;
#endif
Oled_DrawArea(0,0,96,16,ptr);
Delay_Ms(1000);
Clear_Watchdog();
}
Oled_DrawArea(0, 0, 96, 16, ptr);
Delay_Ms(1000);
Clear_Watchdog();
}
}
/******************************** END OF FILE *********************************/