首页 > 其他分享 >机器人武术擂台---无差别组(四)底层配置

机器人武术擂台---无差别组(四)底层配置

时间:2022-12-28 19:01:17浏览次数:39  
标签:无差别 0X00 0x20 0x00 --- OLED 擂台 GPIO 0x80


机器人武术擂台---无差别组(四)底层配置

做一份笔记,大佬勿喷。

作者:sumjess

注意:本博客是以《2018年华北五省(市、自治区)大学生机器人大赛竞赛规则》为基础而写的

@@@@@@@@@一共写2个版本的底层配置-----STM32、K60@@@@@@@@

特别提醒:K60是基于山外库书写!

@@@@@@@@@STM32的底层配置@@@@@@@@

一、光电开关底层配置:

optoelectronic_switch.c中的代码:

#include "optoelectronic_switch.h"

//光电开关初始化
void optoelect_switch()
{

GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC, ENABLE); //使能A端口时钟

GPIO_InitStructure.GPIO_Pin =GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; //浮空输入
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO口速度为50MHz
GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6;
GPIO_Init(GPIOC, &GPIO_InitStructure); //浮空输入 ,IO口速度为50MHz


}

optoelectronic_switch.h中的代码:

#ifndef __OPTOELECTRONIC_SWITCH_H
#define __OPTOELECTRONIC_SWITCH_H
#include "optoelectronic_switch.h"
#include "sys.h"


#define up_for_lift GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_1)
#define up_for_right GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_2)
#define up_back_left GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_4)
#define up_back_right GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_5)
#define for_1 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_6)
#define for_2 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_7)
#define for_3 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_9)
#define back_1 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_10)
#define back_2 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_11)
#define left_1 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_12)
#define left_2 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_13)
#define right_1 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_14)
#define right_2 GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_15)
#define for_lift GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_0)
#define for_right GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_1)
#define back_lift GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2)
#define back_right GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_3)
#define down_1 GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_4)
#define down_2 GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_5)
#define down_3 GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_6)

void optoelect_switch(void);//GPIO初始化



#endif

二、光电开关——oled显示底层配置:

oled.c.中的代码:

//              说明: 
// ----------------------------------------------------------------
// GND 电源地
// VCC 接5V或3.3v电源
// D0 接PD6(SCL)
// D1 接PD7(SDA)
// RES 接PD4
// DC 接PD5
// CS 接PD3
// ----------------------------------------------------------------


#include "oled.h"
#include "stdlib.h"
#include "oledfont.h"
#include "delay.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

#if OLED_MODE==1
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
DATAOUT(dat);
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
OLED_WR_Clr();
OLED_WR_Set();
OLED_CS_Set();
OLED_DC_Set();
}
#else
//向SSD1106写入一个字节。
//dat:要写入的数据/命令
//cmd:数据/命令标志 0,表示命令;1,表示数据;
void OLED_WR_Byte(u8 dat,u8 cmd)
{
u8 i;
if(cmd)
OLED_DC_Set();
else
OLED_DC_Clr();
OLED_CS_Clr();
for(i=0;i<8;i++)
{
OLED_SCLK_Clr();
if(dat&0x80)
OLED_SDIN_Set();
else
OLED_SDIN_Clr();
OLED_SCLK_Set();
dat<<=1;
}
OLED_CS_Set();
OLED_DC_Set();
}
#endif
void OLED_Set_Pos(unsigned char x, unsigned char y)
{
OLED_WR_Byte(0xb0+y,OLED_CMD);
OLED_WR_Byte(((x&0xf0)>>4)|0x10,OLED_CMD);
OLED_WR_Byte((x&0x0f)|0x01,OLED_CMD);
}
//开启OLED显示
void OLED_Display_On(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
}
//关闭OLED显示
void OLED_Display_Off(void)
{
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
}
//清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
void OLED_Clear(void)
{
u8 i,n;
for(i=0;i<8;i++)
{
OLED_WR_Byte (0xb0+i,OLED_CMD); //设置页地址(0~7)
OLED_WR_Byte (0x00,OLED_CMD); //设置显示位置—列低地址
OLED_WR_Byte (0x10,OLED_CMD); //设置显示位置—列高地址
for(n=0;n<128;n++)OLED_WR_Byte(0,OLED_DATA);
} //更新显示
}


//在指定位置显示一个字符,包括部分字符
//x:0~127
//y:0~63
//mode:0,反白显示;1,正常显示
//size:选择字体 16/12
void OLED_ShowChar(u8 x,u8 y,u8 chr)
{
unsigned char c=0,i=0;
c=chr-' ';//得到偏移后的值
if(x>Max_Column-1){x=0;y=y+2;}
if(SIZE ==16)
{
OLED_Set_Pos(x,y);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i],OLED_DATA);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)
OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
}
else {
OLED_Set_Pos(x,y+1);
for(i=0;i<6;i++)
OLED_WR_Byte(F6x8[c][i],OLED_DATA);

}
}
//m^n函数
u32 oled_pow(u8 m,u8 n)
{
u32 result=1;
while(n--)result*=m;
return result;
}
//显示2个数字
//x,y :起点坐标
//len :数字的位数
//size:字体大小
//mode:模式 0,填充模式;1,叠加模式
//num:数值(0~4294967295);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size)
{
u8 t,temp;
u8 enshow=0;
for(t=0;t<len;t++)
{
temp=(num/oled_pow(10,len-t-1))%10;
if(enshow==0&&t<(len-1))
{
if(temp==0)
{
OLED_ShowChar(x+(size/2)*t,y,' ');
continue;
}else enshow=1;

}
OLED_ShowChar(x+(size/2)*t,y,temp+'0');
}
}
//显示一个字符号串
void OLED_ShowString(u8 x,u8 y,u8 *chr)
{
unsigned char j=0;
while (chr[j]!='\0')
{ OLED_ShowChar(x,y,chr[j]);
x+=8;
if(x>120){x=0;y+=2;}
j++;
}
}
//显示汉字
void OLED_ShowCHinese(u8 x,u8 y,u8 no)
{
u8 t,adder=0;
OLED_Set_Pos(x,y);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no][t],OLED_DATA);
adder+=1;
}
OLED_Set_Pos(x,y+1);
for(t=0;t<16;t++)
{
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
adder+=1;
}
}
/***********功能描述:显示显示BMP图片128×64起始点坐标(x,y),x的范围0~127,y为页的范围0~7*****************/
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[])
{
unsigned int j=0;
unsigned char x,y;

if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<y1;y++)
{
OLED_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WR_Byte(BMP[j++],OLED_DATA);
}
}
}


//初始化SSD1306
void OLED_Init(void)
{


GPIO_InitTypeDef GPIO_InitStructure;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOD|RCC_APB2Periph_GPIOG, ENABLE); //使能PC,D,G端口时钟

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_3|GPIO_Pin_8; //PD3,PD6推挽输出
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//速度50MHz
GPIO_Init(GPIOD, &GPIO_InitStructure); //初始化GPIOD3,6
GPIO_SetBits(GPIOD,GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_3|GPIO_Pin_8); //PD3,PD6 输出高

#if OLED_MODE==1

GPIO_InitStructure.GPIO_Pin =0xFF; //PC0~7 OUT推挽输出
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_SetBits(GPIOC,0xFF); //PC0~7输出高

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15; //PG13,14,15 OUT推挽输出
GPIO_Init(GPIOG, &GPIO_InitStructure);
GPIO_SetBits(GPIOG,GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15); //PG13,14,15 OUT 输出高

#else
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1; //PC0,1 OUT推挽输出
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_SetBits(GPIOC,GPIO_Pin_0|GPIO_Pin_1); //PC0,1 OUT 输出高

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG15 OUT推挽输出 RST
GPIO_Init(GPIOG, &GPIO_InitStructure);
GPIO_SetBits(GPIOG,GPIO_Pin_15); //PG15 OUT 输出高


#endif



OLED_RST_Set();
delay_ms(100);
OLED_RST_Clr();
delay_ms(100);
OLED_RST_Set();

OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
OLED_WR_Byte(0x00,OLED_CMD);//---set low column address
OLED_WR_Byte(0x10,OLED_CMD);//---set high column address
OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WR_Byte(0x00,OLED_CMD);//-not offset
OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WR_Byte(0x02,OLED_CMD);//
OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel

OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
OLED_Clear();
OLED_Set_Pos(0,0);
}

oled.h中的代码:

#ifndef __OLED_H
#define __OLED_H
#include "sys.h"
#include "stdlib.h"
//OLED模式设置
//0:4线串行模式
//1:并行8080模式
#define OLED_MODE 0
#define SIZE 16
#define XLevelL 0x00
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64
//-----------------OLED端口定义----------------
#define OLED_CS_Clr() GPIO_ResetBits(GPIOD,GPIO_Pin_3)//CS
#define OLED_CS_Set() GPIO_SetBits(GPIOD,GPIO_Pin_3)

#define OLED_RST_Clr() GPIO_ResetBits(GPIOD,GPIO_Pin_4)//RES
#define OLED_RST_Set() GPIO_SetBits(GPIOD,GPIO_Pin_4)

#define OLED_DC_Clr() GPIO_ResetBits(GPIOD,GPIO_Pin_5)//DC
#define OLED_DC_Set() GPIO_SetBits(GPIOD,GPIO_Pin_5)

#define OLED_WR_Clr() GPIO_ResetBits(GPIOG,GPIO_Pin_14)
#define OLED_WR_Set() GPIO_SetBits(GPIOG,GPIO_Pin_14)

#define OLED_RD_Clr() GPIO_ResetBits(GPIOG,GPIO_Pin_13)
#define OLED_RD_Set() GPIO_SetBits(GPIOG,GPIO_Pin_13)



//PC0~7,作为数据线
#define DATAOUT(x) GPIO_Write(GPIOC,x);//输出
//使用4线串行接口时使用

#define OLED_SCLK_Clr() GPIO_ResetBits(GPIOD,GPIO_Pin_6)//CLK
#define OLED_SCLK_Set() GPIO_SetBits(GPIOD,GPIO_Pin_6)

#define OLED_SDIN_Clr() GPIO_ResetBits(GPIOD,GPIO_Pin_7)//DIN
#define OLED_SDIN_Set() GPIO_SetBits(GPIOD,GPIO_Pin_7)


#define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据


//OLED控制用函数
void OLED_WR_Byte(u8 dat,u8 cmd);
void OLED_Display_On(void);
void OLED_Display_Off(void);
void OLED_Init(void);
void OLED_Clear(void);
void OLED_DrawPoint(u8 x,u8 y,u8 t);
void OLED_Fill(u8 x1,u8 y1,u8 x2,u8 y2,u8 dot);
void OLED_ShowChar(u8 x,u8 y,u8 chr);
void OLED_ShowNum(u8 x,u8 y,u32 num,u8 len,u8 size);
void OLED_ShowString(u8 x,u8 y, u8 *p);
void OLED_Set_Pos(unsigned char x, unsigned char y);
void OLED_ShowCHinese(u8 x,u8 y,u8 no);
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
#endif

myoled.c中的代码(显示各个光电开关的状态):

#include "myoled.h"
#include "oled.h"

void GD_oled(void)
{
int a;
//铲子
a=gdqianchanzuo;
OLED_ShowNum(0,0,a,1,12);
a=gdqianchanyou;
OLED_ShowNum(18,0,a,1,12);
a=gdhouchanzuo;
OLED_ShowNum(36,0,a,1,12);
a=gdhouchanyou;
OLED_ShowNum(54,0,a,1,12);

//前
a=gdzuoqian;
OLED_ShowNum(0,2,a,1,12);
a=gdqian1;
OLED_ShowNum(18,2,a,1,12);
a=gdqian2;
OLED_ShowNum(36,2,a,1,12);
a=gdyouqian;
OLED_ShowNum(54,2,a,1,12);

//中
a=gdzuo1;
OLED_ShowNum(0,4,a,1,12);
a=gdzuo2;
OLED_ShowNum(18,4,a,1,12);
a=gdyou1;
OLED_ShowNum(36,4,a,1,12);
a=gdyou2;
OLED_ShowNum(54,4,a,1,12);

//后
a=gdzuohou;
OLED_ShowNum(0,6,a,1,12);
a=gdhou1;
OLED_ShowNum(18,6,a,1,12);
a=gdhou2;
OLED_ShowNum(36,6,a,1,12);
a=gdyouhou;
OLED_ShowNum(54,6,a,1,12);

delay_ms(800);//刷新时间
OLED_Clear();//清屏

}

myoled.h中的代码(显示各个光电开关的状态):

#ifndef __MYOLED_H
#define __MYOLED_H
#include "myoled.h"
#include "oled.h"
#include "optoelectronic_switch.h"
#include "delay.h"

void GD_oled(void);

三、PWM底层配置:

sumjess_pwm.c中的代码:

#include "sumjess_pwm.h"

/*******************************************************************************
================================================================================
【平 台】stm32f103zet6_sumjess平台
【编 写】sumjess
【E-mail 】[email protected]
【软件版本】V2.0
【最后更新】2018年09月06日
【相关信息参考下列地址】
【网 站】

http://www.openedv.com/
http://www.stmcu.org/
http://www.firebbs.cn/forum.php
---------------------------------------------------------------------------------
【dev.env.】MDK5.14及以上版本
【Target 】stm32f103zet6
第一次修订:2017/11/09
第二次修订:2018/01/21
第三次修订:2018/09/06
【problem 】
(1)库内补充的不全面;
(2)库内解释部分不全面;
(3)库内还存在一定的bug;
【direction】
下一步的目标就是把库继续集成!
【explain 】
本库是根据正点原子、中景园电子、优信电子等商家改编而成,
同时为了方便使用,我也自己写了很多的库,和优化了算法和表示方式!
【warning】
目前程序中暂无警告 !
---------------------------------------------------------------------------------
没有完美的代码,只有不断的奉献,大家一起努力;
赠人玫瑰手留余香,欢迎大家反馈bug!
================================================================================
********************************************************************************/
//PWM 驱动代码
void speed_Init(void) //TIM3_CH1->PC6 CH2->PC7 CH3->PC8 CH4->PC9
{
//**********电机驱动设置************//
TIM_OCInitTypeDef TIM_OCInitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure ;
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //使能GPIO外设和AFIO复用功能模块时钟
TIM_DeInit(TIM3);//初始化TIM3寄存器

GPIO_PinRemapConfig(GPIO_FullRemap_TIM3, ENABLE); //Timer3完全重映射 TIM3_CH1->PC6 CH2->PC7 CH3->PC8 CH4->PC9
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9; //TIM1_CH1 //设置该引脚为复用输出功能,输出TIM3 CH1的PWM脉冲波形 GPIOC.6
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //复用推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);//初始化GPIO
//**************************************************************************
// 定时器1设置: 72分频,频率10KHz,向上计数,105是为了速度为100时,PWM占空比不会到100,方便电机驱动自举生压。一般PWM频率大于1K,4-10K比较好。
//**************************************************************************
TIM_TimeBaseStructure.TIM_Period = 105-1;
TIM_TimeBaseStructure.TIM_Prescaler = 71;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);

// 主定时器T3为 PWM3 模式
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);//使能的预装载寄存器

TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OC2Init(TIM3, &TIM_OCInitStructure);
TIM_OC2PreloadConfig(TIM3, TIM_OCPreload_Enable);//使能的预装载寄存器

TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OC3Init(TIM3, &TIM_OCInitStructure);
TIM_OC3PreloadConfig(TIM3, TIM_OCPreload_Enable);//使能的预装载寄存器

TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OC4Init(TIM3, &TIM_OCInitStructure);
TIM_OC4PreloadConfig(TIM3, TIM_OCPreload_Enable);//使能的预装载寄存器

TIM_ARRPreloadConfig(TIM3, ENABLE); //使能定时器3
TIM_Cmd(TIM3, ENABLE);
}

sumjess_pwm.h中的代码:

#ifndef __SUMJESS_PWM_H
#define __SUMJESS_PWM_H
/*******************************************************************************
================================================================================
【平 台】stm32f103zet6_sumjess平台
【编 写】sumjess

【软件版本】V2.0
【最后更新】2018年09月06日
【相关信息参考下列地址】
【网 站】

http://www.openedv.com/
http://www.stmcu.org/
http://www.firebbs.cn/forum.php
---------------------------------------------------------------------------------
【dev.env.】MDK5.14及以上版本
【Target 】stm32f103zet6
第一次修订:2017/11/09
第二次修订:2018/01/21
第三次修订:2018/09/06
【problem 】
(1)库内补充的不全面;
(2)库内解释部分不全面;
(3)库内还存在一定的bug;
【direction】
下一步的目标就是把库继续集成!
【explain 】
本库是根据正点原子、中景园电子、优信电子等商家改编而成,
同时为了方便使用,我也自己写了很多的库,和优化了算法和表示方式!
【warning】
目前程序中暂无警告 !
---------------------------------------------------------------------------------
没有完美的代码,只有不断的奉献,大家一起努力;
赠人玫瑰手留余香,欢迎大家反馈bug!
================================================================================
********************************************************************************/
//PWM 驱动代码



#include "sys.h"

void speed_Init(void); //TIM3_CH1->PC6 CH2->PC7 CH3->PC8 CH4->PC9

#endif

 

 

@@@@@@@@@K60的底层配置@@@@@@@@

一、光电开关底层配置:

optoelectronic_switch.c中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
*
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file optoelectronic_switch.c
* @brief 光电开关底层配置
* @author sumjess
* @version v2.1
* @date 2018-01-17
*/

#include "common.h"
#include "MK60_port.h"
#include "MK60_gpio.h"
#include "optoelectronic_switch.h"

//
//


void optoelectronic_switch_init(void)//光电开关初始化
{
gpio_init(PTC1, GPI, 0);
gpio_init(PTC3, GPI, 0);
gpio_init(PTC4, GPI, 0);
gpio_init(PTC5, GPI, 0);
gpio_init(PTC6, GPI, 0);
gpio_init(PTC8, GPI, 0);
gpio_init(PTC10, GPI, 0);
gpio_init(PTB3, GPI, 0);
gpio_init(PTB5, GPI, 0);
gpio_init(PTB7, GPI, 0);
gpio_init(PTB9, GPI, 0);
gpio_init(PTB23, GPI, 0);
gpio_init(PTB11, GPI, 0);
gpio_init(PTB17, GPI, 0);
gpio_init(PTB19, GPI, 0);
gpio_init(PTB21, GPI, 0);
}

optoelectronic_switch.h中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
* 技术讨论:QQ 1371129880
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file optoelectronic_switch.h
* @brief 光电开关底层配置头文件
* @author sumjess
* @version v2.1
* @date 2018-01-24
*/

#ifndef __OPTOELECTRONIC_SWITCH_H__
#define __OPTOELECTRONIC_SWITCH_H__
/*
B11 B17
C1 C3 C4 C5
C6 C8
C10 B3
B5 B7 B9 B23
B19 B21
*/

#define left_forward gpio_get(PTC1) //左前
#define forward_middle_left gpio_get(PTC3) //前中左
#define forward_middle_right gpio_get(PTC4) //前中右
#define right_forward gpio_get(PTC5) //右前
#define left_1 gpio_get(PTC6) //左一
#define right_1 gpio_get(PTC8) //右一
#define left_2 gpio_get(PTC10)//左二
#define right_2 gpio_get(PTB3) //右二
#define left_back gpio_get(PTB5) //左后
#define back_middle_left gpio_get(PTB7) //后中左
#define back_middle_right gpio_get(PTB9) //后中右
#define right_back gpio_get(PTB23)//右后
#define left_forward_edge gpio_get(PTB11)//左前边缘
#define right_forward_edge gpio_get(PTB17)//右前边缘
#define left_back_edge gpio_get(PTB19)//左后边缘
#define right_back_edge gpio_get(PTB21)//右后边缘

void optoelectronic_switch_init(void);

#endif

二、光电开关——oled显示底层配置:

sumjess_OLED.c.中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
* 技术讨论:QQ 1371129880
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_oled.c
* @brief OLED配置
* @author sumjess
* @version v1.0
* @date 2018-01-19
*/
#include "common.h"
#include "include.h"
#include "sumjess_OLED.h"


/************************************************************************
OLED 一行可以显示16个字符,可以显示8行。
************************************************************************/

#define OLED_SCL PTC16_OUT
#define OLED_SDA PTC17_OUT
#define OLED_RST PTC18_OUT
#define OLED_DC PTC19_OUT
//CS接地或悬空即可

#define XLevelL 0x00
#define XLevelH 0x10
#define XLevel ((XLevelH&0x0F)*16+XLevelL)
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xCF

/*
4线SPI使用说明:
VBT 供内部DC-DC电压,3.3~4.3V,如果使用5V电压,为保险起见串一个100~500欧的电阻
VCC 供内部逻辑电压 1.8~6V
GND 地

BS0 低电平
BS1 低电平
BS2 低电平

CS 片选管脚
DC 命令数据选择管脚
RES 模块复位管脚
D0(SCLK) ,时钟脚,由MCU控制
D1(MOSI) ,主输出从输入数据脚,由MCU控制

D2 悬空
D3-D7 , 低电平 , 也可悬空,但最好设为低电平
RD 低电平 ,也可悬空,但最好设为低电平
RW 低电平 ,也可悬空,但最好设为低电平
RD 低电平 ,也可悬空,但最好设为低电平
*/

#define X_WIDTH 128
#define Y_WIDTH 64
//======================================
const uint8 F6x8[][6] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // sp
{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 }, // !
{ 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 }, // "
{ 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 }, // #
{ 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, // $
{ 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 }, // %
{ 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 }, // &
{ 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 }, // '
{ 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 }, // (
{ 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 }, // )
{ 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 }, // *
{ 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 }, // +
{ 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 }, // ,
{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 }, // -
{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 }, // .
{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 }, // /
{ 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0
{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1
{ 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2
{ 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3
{ 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4
{ 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5
{ 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6
{ 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7
{ 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8
{ 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9
{ 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 }, // :
{ 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 }, // ;
{ 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 }, // <
{ 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 }, // =
{ 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 }, // >
{ 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 }, // ?
{ 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E }, // @
{ 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C }, // A
{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B
{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C
{ 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D
{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E
{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 }, // F
{ 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A }, // G
{ 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H
{ 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I
{ 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J
{ 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K
{ 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L
{ 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F }, // M
{ 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N
{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O
{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P
{ 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q
{ 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R
{ 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 }, // S
{ 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T
{ 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U
{ 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V
{ 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F }, // W
{ 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 }, // X
{ 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 }, // Y
{ 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z
{ 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 }, // [
{ 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 }, // 55
{ 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 }, // ]
{ 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^
{ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 }, // _
{ 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 }, // '
{ 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 }, // a
{ 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 }, // c
{ 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F }, // d
{ 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 }, // e
{ 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f
{ 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C }, // g
{ 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h
{ 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i
{ 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 }, // j
{ 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 }, // k
{ 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l
{ 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m
{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 }, // o
{ 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 }, // p
{ 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC }, // q
{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r
{ 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 }, // s
{ 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t
{ 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u
{ 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v
{ 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w
{ 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 }, // x
{ 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C }, // y
{ 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z
{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 } // horiz lines
};
const uint8 F14x16_Idx[] =
{
"新电一队排位模式淘汰模式测试模式出乱码欢迎您进入退出当前"
};
//======================================================
// 128X64I液晶底层驱动[14X16]字体库
// 设计者: sumjess
// 描 述: 宋体字宽14字高16
//======================================================
const uint8 F14x16[] = {

0x00,0x08,0x58,0x6A,0xCC,0x78,0x48,0x48,0xFC,0x44,0x44,0x84,0x44,0x00,
0x00,0x22,0x3E,0x4A,0x7F,0x06,0x5A,0x32,0x0F,0x00,0x00,0x7F,0x00,0x00,//新0,

0x00,0x00,0xF0,0x90,0x90,0x90,0xFE,0x90,0x90,0x90,0xF0,0x10,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x7F,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,//电1,

0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//一2,

0x00,0x00,0xFC,0x44,0xB4,0x0C,0x00,0x00,0xFE,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x3F,0x08,0x58,0x2F,0x10,0x0E,0x01,0x03,0x0C,0x30,0x00,0x00,//队3,

0x00,0x00,0x10,0xFE,0x90,0x90,0x90,0xFE,0x00,0x6C,0x92,0x90,0x90,0x00,
0x00,0x02,0x41,0x3F,0x00,0x00,0x04,0x7F,0x00,0x3F,0x04,0x04,0x04,0x00,//排4,

0x00,0x80,0x60,0xFC,0x12,0x10,0x90,0x12,0x1C,0x10,0xD0,0x50,0x00,0x00,
0x00,0x01,0x00,0x7F,0x40,0x40,0x43,0x4C,0x40,0x3C,0x43,0x40,0x20,0x00,//位5,

0x00,0x00,0xD0,0xFE,0x90,0x18,0xE8,0xBE,0xA8,0xA8,0xBE,0xE8,0x00,0x00,
0x08,0x06,0x01,0x7F,0x88,0x88,0x4B,0x2A,0x1E,0x1A,0x2A,0x4B,0x4C,0x00,//模6,

0x00,0x00,0x90,0x90,0x10,0x90,0x90,0x10,0xFE,0x10,0x14,0x18,0x10,0x00,
0x00,0x60,0x20,0x20,0x1F,0x10,0x10,0x01,0x03,0x1C,0x20,0x40,0x70,0x00,//式7,

0x00,0x40,0xC4,0x8C,0x70,0xD8,0x6E,0x88,0x48,0x48,0x08,0x08,0xF8,0x00,
0x00,0x00,0x7C,0x03,0x03,0x1E,0x12,0x1F,0x12,0x3E,0x41,0x70,0x0F,0x00,//淘8,

0x00,0x40,0x04,0x88,0x60,0x20,0x20,0xFE,0xE2,0x20,0x20,0x20,0x20,0x00,
0x00,0x00,0x7C,0x43,0x40,0x30,0x0E,0x09,0x30,0x07,0x18,0x30,0x20,0x00,//汰9,

0x00,0x00,0xD0,0xFE,0x90,0x18,0xE8,0xBE,0xA8,0xA8,0xBE,0xE8,0x00,0x00,
0x08,0x06,0x01,0x7F,0x88,0x88,0x4B,0x2A,0x1E,0x1A,0x2A,0x4B,0x4C,0x00,//模10,

0x00,0x00,0x90,0x90,0x10,0x90,0x90,0x10,0xFE,0x10,0x14,0x18,0x10,0x00,
0x00,0x60,0x20,0x20,0x1F,0x10,0x10,0x01,0x03,0x1C,0x20,0x40,0x70,0x00,//式11

0x00,0x20,0x04,0xC0,0xFC,0x04,0xF4,0x04,0xFC,0x00,0xF0,0x00,0xFC,0x00,
0x00,0x00,0x7E,0x41,0x47,0x38,0x07,0x10,0x67,0x00,0x0F,0x40,0x3F,0x00,//测12,

0x00,0x80,0x8C,0x90,0x10,0x20,0x20,0x20,0xA0,0xFE,0x20,0x24,0x18,0x00,
0x00,0x00,0x00,0x7F,0x10,0x28,0x21,0x1F,0x10,0x09,0x0E,0x30,0x70,0x00,//试13,

0x00,0x00,0xD0,0xFE,0x90,0x18,0xE8,0xBE,0xA8,0xA8,0xBE,0xE8,0x00,0x00,
0x08,0x06,0x01,0x7F,0x88,0x88,0x4B,0x2A,0x1E,0x1A,0x2A,0x4B,0x4C,0x00,//模14,

0x00,0x00,0x90,0x90,0x10,0x90,0x90,0x10,0xFE,0x10,0x14,0x18,0x10,0x00,
0x00,0x60,0x20,0x20,0x1F,0x10,0x10,0x01,0x03,0x1C,0x20,0x40,0x70,0x00,//式15,

0x00,0x00,0x04,0xFC,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0xFC,0x02,0x00,0x00,
0x00,0x20,0x50,0x49,0x45,0x2B,0x35,0x15,0x2D,0x47,0x41,0x40,0x40,0x00,//16,

0x00,0x80,0x80,0x80,0x88,0x88,0x88,0x88,0x88,0x88,0x84,0x80,0x80,0x00,
0x00,0x00,0x20,0x30,0x28,0x26,0x21,0x20,0x20,0x24,0x18,0x20,0x00,0x00,//17,

0x00,0x00,0x10,0x10,0x90,0x70,0x10,0xFC,0x70,0x90,0x10,0x08,0x00,0x00,
0x00,0x42,0x72,0x01,0x00,0x30,0x00,0x03,0x70,0x00,0x09,0x31,0x01,0x00,//18,

0x00,0x28,0x48,0x88,0xE8,0x18,0xC0,0x38,0x16,0xD0,0x10,0x50,0x30,0x00,
0x00,0x10,0x0C,0x03,0x06,0x5C,0x20,0x10,0x0F,0x03,0x1C,0x20,0x40,0x00,//欢19,

0x00,0x40,0x44,0xC8,0x00,0xF8,0x04,0x04,0x02,0xF8,0x08,0x08,0xF8,0x00,
0x00,0x30,0x10,0x1F,0x20,0x27,0x22,0x42,0x40,0x4F,0x40,0x46,0x21,0x00,//迎20,

0x00,0x20,0x10,0xEE,0x22,0x90,0x4C,0x0A,0xF8,0x08,0x68,0x98,0x00,0x00,
0x00,0x20,0x30,0x01,0x7D,0x48,0x44,0x5A,0x43,0x40,0x60,0x09,0x30,0x00,//您21,

0x00,0x40,0x44,0xC8,0x10,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x00,
0x00,0x60,0x10,0x1F,0x21,0x51,0x4D,0x43,0x41,0x61,0x5F,0x41,0x41,0x00,//进22,

0x00,0x00,0x00,0x00,0x02,0x04,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x20,0x18,0x04,0x03,0x00,0x00,0x03,0x0C,0x18,0x30,0x20,0x00,//入23,

0x00,0x00,0x44,0xC8,0x00,0x00,0xFC,0x94,0x94,0x94,0xFC,0x04,0x00,0x00,
0x00,0x20,0x10,0x1F,0x20,0x20,0x5F,0x49,0x42,0x44,0x46,0x49,0x00,0x00,//退24,

0x00,0x00,0xF0,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0xF0,0x08,0x00,0x00,
0x00,0x00,0x7E,0x40,0x40,0x40,0x3F,0x40,0x40,0x40,0x41,0x7E,0x00,0x00,//出25,

0x00,0x00,0x04,0x48,0x50,0x40,0x7C,0x40,0x60,0x50,0x4C,0xC0,0x00,0x00,
0x00,0x00,0x40,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7F,0x00,0x00,//当26,

0x00,0x10,0xD0,0x50,0x52,0xCC,0x10,0x10,0xC8,0x16,0x10,0xF0,0x08,0x00,
0x00,0x00,0x7F,0x09,0x09,0x7F,0x00,0x00,0x1F,0x40,0x40,0x3F,0x00,0x00,//前27,



};

//======================================================
// 128X64I液晶底层驱动[8X16]字体库
// 设计者: sumjess
// 描 述: [8X16]西文字符的字模数据 (纵向取模,字节倒序)
// !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
//======================================================
const uint8 F8X16[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//!1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//"2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//#3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//%5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//&6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//'7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//(8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//)9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//*10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//,12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//-13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//.14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,///15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//016
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//117
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//218
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//319
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//420
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//521
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//622
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//723
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//824
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//925
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//:26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//;27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//<28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//=29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//>30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//?31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//]61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//`64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//|92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//}93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~94

};
//======================================================
// 128X64I液晶底层驱动logo
// 设计者: sumjess
// 描 述: logo
//======================================================
uint8 lanzhou96x64[1768] = {//768
/*
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X80,0XC0,0XC0,0XC0,0X60,0X60,0X60,0X30,0X30,0X30,0X38,0X18,0X18,
0X18,0X18,0X0C,0X0C,0X0C,0X0C,0X0C,0X0E,0X0E,0X0E,0X06,0X06,0X06,0X06,0X06,0X06,
0X06,0X06,0X06,0X06,0X06,0X06,0X06,0X0E,0X0E,0X0C,0X0C,0X0C,0X0C,0X0C,0X1C,0X18,
0X18,0X18,0X18,0X30,0X30,0X30,0X70,0X60,0X60,0XE0,0XC0,0XC0,0X80,0X80,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,0X80,0XC0,0XE0,0X70,0X30,0X38,0X1C,0X0C,0X06,
0X07,0X03,0X03,0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X80,0X80,0X80,0X00,0X00,0X00,0X00,0X00,0X80,0X80,
0XF0,0XF8,0XF8,0XF0,0X80,0X00,0X00,0X80,0XE0,0XF0,0XF8,0XFC,0X3C,0X1C,0X0C,0X0C,
0X1C,0XFC,0XF8,0XF0,0XE0,0X80,0X00,0X00,0X00,0XC0,0XC0,0XC1,0X01,0X03,0X03,0X07,
0X06,0X0E,0X0C,0X18,0X38,0X70,0X60,0XC0,0X80,0X80,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0XC0,0XF0,0X78,0X1E,0X07,0X33,0X31,0X38,0X78,0XFC,0XFE,0XF6,0XC0,0X80,
0X00,0X00,0X00,0X00,0XC0,0XC0,0X80,0X00,0XF8,0XFC,0XDE,0X0E,0X0F,0X1E,0XBE,0XFC,
0XF0,0X06,0XFF,0XFF,0XFF,0XFF,0X03,0X07,0XFF,0XFF,0XFE,0X80,0X1E,0X3F,0XFF,0XFF,
0XF9,0XF9,0XFF,0XFF,0X7F,0X1F,0X0E,0X7F,0XFF,0XFF,0XFF,0XC1,0X80,0XCE,0XCE,0XC6,
0XC0,0XFF,0XFF,0XFF,0XFF,0X3F,0X80,0XFC,0XFC,0XFD,0X7D,0X01,0XC0,0XF8,0XF8,0XF0,
0X70,0X00,0XC0,0X80,0X80,0X80,0X00,0X00,0X01,0X07,0X0E,0X3C,0XF8,0XE0,0X80,0X00,
0X00,0XFE,0XFF,0X03,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X03,0X0F,0X1F,0X7F,
0XFE,0XFC,0XF0,0XF0,0XF0,0X7F,0X7F,0X3E,0X10,0X03,0X03,0X0F,0X1F,0X1F,0X0F,0X0F,
0X03,0X04,0X07,0X07,0X07,0X07,0X06,0X00,0X07,0X07,0X07,0X0F,0X1E,0X3F,0X7F,0X7F,
0X7F,0X79,0X73,0X3F,0X3F,0X1F,0X0E,0X00,0X01,0X03,0X03,0X07,0X07,0X06,0X0E,0X0F,
0X0F,0X1F,0X3F,0X3D,0X08,0X0C,0X1F,0X1F,0X1F,0X19,0X3C,0X7F,0X7F,0X7F,0XF3,0XF0,
0XFC,0XFE,0X3F,0X1F,0X07,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XCF,0XFF,0X70,
0X00,0X03,0X1F,0X7E,0XF0,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X03,0X03,0X01,0X01,0X00,0X00,0X00,0X00,0XC0,0XC0,0X40,0X40,0X40,0X40,0XF8,0X78,
0X40,0XC0,0X40,0X58,0X58,0X40,0X40,0X40,0X00,0X00,0X00,0X00,0X00,0X80,0X80,0X80,
0X00,0X00,0X00,0X00,0X00,0X00,0X60,0XF0,0XE0,0X20,0X20,0X20,0X20,0X30,0X30,0X38,
0X18,0X10,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,
0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0XE0,0XF8,0X3F,0X0F,0X00,
0X00,0X00,0X00,0X00,0X00,0X03,0X07,0X0E,0X1C,0X38,0X30,0X60,0XE0,0XC0,0X80,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X40,0X60,0X60,0X70,0X30,0X18,0X0C,0X07,0X11,0X08,
0X3F,0X7D,0X66,0XE7,0XE3,0XC0,0XC0,0XC0,0XE0,0X60,0X00,0X00,0X00,0X03,0X03,0X03,
0X00,0X00,0X60,0X60,0X60,0X60,0X60,0X7F,0X7F,0X61,0X61,0X61,0X61,0X7F,0X7F,0X61,
0X61,0XE1,0XE0,0XE0,0XC0,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X80,0XC0,0XC0,0XE0,0X70,0X38,0X18,0X0C,0X07,0X03,0X01,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X01,0X03,
0X03,0X06,0X06,0X0C,0X0C,0X18,0X18,0X38,0X30,0X30,0X70,0X60,0X60,0XE0,0XC0,0XC0,
0XC0,0XC0,0XC0,0X80,0X80,0X80,0X81,0X80,0X80,0X80,0X80,0X80,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X80,0X80,0X80,0X80,0X80,0X80,0X80,0X80,0X80,0X80,0XC0,0XC0,
0XC0,0XC0,0XC0,0X60,0X60,0X60,0X30,0X30,0X30,0X18,0X18,0X1C,0X0C,0X0E,0X06,0X07,
0X03,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,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X03,0X03,0X03,0X03,0X03,0X03,0X03,
0X03,0X03,0X03,0X03,0X03,0X03,0X03,0X01,0X01,0X01,0X01,0X01,0X01,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,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,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,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xE0,0xE0,
0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xFC,
0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,
0xFC,0xFC,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,
0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0x80,0x80,0x80,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,0x80,0x80,0xC0,0xE0,0xF0,0xF0,0xF8,
0xF8,0xFC,0xFC,0xFE,0x7E,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x3F,0x9F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x0F,0x07,0x07,0x07,0x07,0x87,0xC7,0xF7,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x0F,0x03,0x03,0x03,0x03,0x03,
0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0F,0x1F,0x7F,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x8F,0x07,0x07,0x07,0x07,0x06,0x06,0x06,0x04,
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,0x30,0x38,0x3C,0x1E,0x1F,0x0F,0x0F,0x07,0x07,0x03,0x03,0x01,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0x0F,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x7F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x1F,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xF0,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,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFE,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xF8,0xF8,0xF8,
0xF8,0xF8,0xF8,0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,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,0x01,0x03,0x07,0x0E,0x1E,0x3C,0x3C,0x7C,0xF8,0xF8,0xF0,
0xF0,0xF0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC1,0xC7,0xDF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFC,0xF8,0xE0,0xC0,0x80,0x00,0x00,0x00,0x07,0x1F,0x3F,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFC,0xF0,0xC0,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x81,0xC1,0xE1,0xF9,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0x3F,0x1F,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,
0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF8,0xF8,
0x78,0x3C,0x3C,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x03,0x03,0x07,0x07,0x07,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x3F,0x3F,0x3F,0x3F,0x7F,
0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,
0xFC,0xFC,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFF,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x3F,0x3F,0x1F,
0x1F,0x1F,0x1F,0x0F,0x0F,0x0F,0x07,0x07,0x07,0x03,0x03,0x01,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,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,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,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,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//C:\Users\user\Desktop\sumjess\社标.BMP0,





};
const uint8 LIBLOGO60x58[480] = {
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,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0XC0,0XE0,0XF8,0XFC,0XFE,0X7F,0X3F,0X0F,0X0F,0X07,0X07,0X07,0X87,0XC7,
0XC7,0XC7,0XE7,0XEF,0XFF,0XFF,0XFF,0XEF,0XE7,0XE7,0XE7,0XE7,0XE7,0XEF,0XFF,0XFF,
0XFF,0XEF,0XE7,0XE7,0XE7,0XE7,0XE7,0XF7,0X07,0X0F,0X3F,0X7F,0XFF,0XFE,0XFC,0XF0,
0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XD8,0XDC,0XDF,0XDF,0XDF,
0XDF,0XD7,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X3E,0X7F,0XFF,0XFF,0XE3,0XE1,0XE1,
0XFF,0XFF,0XFF,0XE0,0XE0,0XE0,0XE0,0XE0,0XE0,0XE0,0XFF,0XFF,0XFF,0XE0,0XE0,0XE0,
0XE0,0XC1,0X83,0X07,0X00,0X00,0X00,0X00,0X01,0XD7,0XDF,0XDF,0XDF,0XDF,0XDC,0XD8,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X03,0X0F,0X1F,0X3F,0XFF,0XFF,0XFE,0XF8,
0XF0,0XE0,0XC0,0X80,0X00,0X00,0XF8,0XF0,0XE0,0XC0,0XC0,0XC0,0XFF,0XFF,0XFF,0XC0,
0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XFF,0XFF,0XFF,0XC0,0XE0,0XE1,0XF3,0XFF,0X7F,0X3F,
0X00,0XC0,0XE0,0XF8,0XFE,0XFF,0XFF,0XFF,0X3F,0X1F,0X07,0X01,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X07,0X0F,0X3F,0X7F,0XFF,
0XFE,0XFC,0XF9,0XF3,0XC1,0X81,0X01,0X01,0XFF,0XFF,0XFF,0X01,0X01,0X01,0X01,0X01,
0X01,0X01,0XFF,0XFF,0XFF,0X03,0X01,0X81,0XC0,0XF0,0XFC,0XFE,0XFF,0XFF,0X7F,0X3F,
0X0F,0X07,0X03,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,0X03,0X07,0X0F,0X3F,
0X7F,0XFF,0XFF,0XFF,0XFB,0XF3,0XE3,0XC3,0X03,0X03,0X03,0X03,0X03,0X83,0XC3,0XF3,
0XF3,0XFB,0XFF,0XFF,0XFF,0X7F,0X3F,0X0F,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,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0X07,
0X07,0X1F,0X3F,0X7F,0XFF,0XFE,0XFC,0XFC,0XFE,0XFF,0XFF,0X7F,0X3F,0X0F,0X07,0X03,
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,
0X00,0X03,0X07,0X0F,0X0F,0X07,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,
};
uint8 LANDZO_LOGO[300] ={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0x60,0x30,0x10,0x18,0x08,
0x04,0x14,0x10,0x1A,0x18,0x18,0x1C,0x1C,0x1C,0x1C,0x3C,0x3C,0x3C,0x3C,0x7C,0x7C,
0xFC,0xFC,0xF8,0xF8,0xF0,0xF0,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xC0,0xF0,0xF8,0x7E,0x1F,0x07,0x03,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x01,0x03,0x8F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xF8,
0xE0,0x80,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0x07,0x00,0xF8,0xF8,0xF0,0xF0,0xE0,
0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,
0xE0,0xE0,0xF0,0xF0,0xF8,0xF8,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xF8,0xC0,0x0F,0x7F,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x1F,0x0F,0x07,0x03,0x03,0x01,
0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x03,0x03,0x07,0x03,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x7F,0xFE,
0xFC,0xF1,0xE7,0xCF,0x9F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,0xF0,0xE0,0xE0,0xC0,
0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x03,0x03,0x07,0x0F,0x0F,0x1E,0x1E,0x1C,0x39,0x39,0x3B,0x73,0x73,
0x77,0x67,0x67,0x67,0x67,0x67,0x67,0x27,0x27,0x36,0x36,0x16,0x12,0x0A,0x0A,0x04,
0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
//======================================================
// 128X64I液晶底层驱动延时
// 设计者: sumjess
// 描 述:
//======================================================
void Dly_ms(uint16 ms)
{
uint16 ii,jj;
if (ms<1) ms=1;
ms = ms*12 ;
for(ii=0;ii<ms;ii++)
for(jj=0;jj<1335;jj++); //16MHz--1ms
// for(jj=0;jj<4006;jj++); //48MHz--1ms
//for(jj=0;jj<5341;jj++); //64MHz--1ms
}

void OLED_WrDat(uint8 data)
{
uint8 i=8;
//LCD_CS=0;;
OLED_DC=1;
OLED_SCL=0;
//asm("nop");
while(i--)
{
if(data&0x80){OLED_SDA=1;}
else{OLED_SDA=0;}
OLED_SCL=1;
asm("nop");;
//asm("nop");
OLED_SCL=0;;
data<<=1;
}
//LCD_CS=1;
}
void OLED_WrCmd(uint8 cmd)
{
uint8 i=8;

//LCD_CS=0;;
OLED_DC=0;;
OLED_SCL=0;;
//asm("nop");
while(i--)
{
if(cmd&0x80){OLED_SDA=1;}
else{OLED_SDA=0;;}
OLED_SCL=1;;
asm("nop");;
//asm("nop");
OLED_SCL=0;;
cmd<<=1;;
}

}
void OLED_Set_Pos(uint8 x, uint8 y)
{
OLED_WrCmd(0xb0+y);
OLED_WrCmd(((x&0xf0)>>4)|0x10);
OLED_WrCmd((x&0x0f)|0x01);
}
void OLED_Fill(uint8 bmp_data)
{
uint8 y,x;

for(y=0;y<8;y++)
{
OLED_WrCmd(0xb0+y);
OLED_WrCmd(0x01);
OLED_WrCmd(0x10);
for(x=0;x<X_WIDTH;x++)
OLED_WrDat(bmp_data);
}
}
//======================================================
// 128X64I液晶底层驱动
// 设计者: sumjess
// 描 述: 清屏
//======================================================
void OLED_CLS(void)
{
uint8 y,x;
for(y=0;y<8;y++)
{
OLED_WrCmd(0xb0+y);
OLED_WrCmd(0x01);
OLED_WrCmd(0x10);
for(x=0;x<X_WIDTH;x++)
OLED_WrDat(0);
}
}
void OLED_DLY_ms(uint16 ms)
{
uint16 a;
while(ms)
{
a=16000;
while(a--);
ms--;
}
return;
}
//======================================================
// 128X64I液晶底层驱动初始化
// 设计者: sumjess
// 描 述: OLED底层初始化
//======================================================
void OLED_Init(void)
{

gpio_init (PTC16,GPO,1);
gpio_init (PTC17,GPO,1);
gpio_init (PTC18,GPO,1);
gpio_init (PTC19,GPO,1);
//gpio_init (PTC15,GPO,0);

OLED_SCL=1;
//LCD_CS=1; //预制SLK和SS为高电平
//OLED_CS = 0 ; ///使能信号端,拉低时正常使用
OLED_RST=0;
OLED_DLY_ms(50);
OLED_RST=1;

OLED_WrCmd(0xae);//--turn off oled panel
OLED_WrCmd(0x00);//---set low column address
OLED_WrCmd(0x10);//---set high column address
OLED_WrCmd(0x40);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
OLED_WrCmd(0x81);//--set contrast control register
OLED_WrCmd(0xcf); // Set SEG Output Current Brightness
OLED_WrCmd(0xa1);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
OLED_WrCmd(0xc8);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
OLED_WrCmd(0xa6);//--set normal display
OLED_WrCmd(0xa8);//--set multiplex ratio(1 to 64)
OLED_WrCmd(0x3f);//--1/64 duty
OLED_WrCmd(0xd3);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
OLED_WrCmd(0x00);//-not offset
OLED_WrCmd(0xd5);//--set display clock divide ratio/oscillator frequency
OLED_WrCmd(0x80);//--set divide ratio, Set Clock as 100 Frames/Sec
OLED_WrCmd(0xd9);//--set pre-charge period
OLED_WrCmd(0xf1);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
OLED_WrCmd(0xda);//--set com pins hardware configuration
OLED_WrCmd(0x12);
OLED_WrCmd(0xdb);//--set vcomh
OLED_WrCmd(0x40);//Set VCOM Deselect Level
OLED_WrCmd(0x20);//-Set Page Addressing Mode (0x00/0x01/0x02)
OLED_WrCmd(0x02);//
OLED_WrCmd(0x8d);//--set Charge Pump enable/disable
OLED_WrCmd(0x14);//--set(0x10) disable
OLED_WrCmd(0xa4);// Disable Entire Display On (0xa4/0xa5)
OLED_WrCmd(0xa6);// Disable Inverse Display On (0xa6/a7)
OLED_WrCmd(0xaf);//--turn on oled panel
OLED_Fill(0x00); //初始清屏
OLED_Set_Pos(0,0);

}
//==============================================================
//函数名: void LCD_PutPixel(uint8 x,uint8 y)
//设计者: sumjess
//功能描述:绘制一个点(x,y)
//参数:真实坐标值(x,y),x的范围0~127,y的范围0~64
//返回:无
//==============================================================
void OLED_PutPixel(uint8 x,uint8 y)
{
uint8 data1; //data1当前点的数据

OLED_Set_Pos(x,y);
data1 = 0x01<<(y%8);
OLED_WrCmd(0xb0+(y>>3));
OLED_WrCmd(((x&0xf0)>>4)|0x10);
OLED_WrCmd((x&0x0f)|0x00);
OLED_WrDat(data1);
}
//==============================================================
//函数名: void LCD_Rectangle(uint8 x1,uint8 y1,
// uint8 x2,uint8 y2,uint8 color,uint8 gif)
//设计者: sumjess
//功能描述:绘制一个实心矩形
//参数:左上角坐标(x1,y1),右下角坐标(x2,y2)
// 其中x1、x2的范围0~127,y1,y2的范围0~63,即真实坐标值
//返回:无
//==============================================================
void OLED_Rectangle(uint8 x1,uint8 y1,uint8 x2,uint8 y2,uint8 gif)
{
uint8 n;

OLED_Set_Pos(x1,y1>>3);
for(n=x1;n<=x2;n++)
{
OLED_WrDat(0x01<<(y1%8));
if(gif == 1) OLED_DLY_ms(50);
}
OLED_Set_Pos(x1,y2>>3);
for(n=x1;n<=x2;n++)
{
OLED_WrDat(0x01<<(y2%8));
if(gif == 1) OLED_DLY_ms(5);
}

}
//==============================================================
//函数名:LCD_P6x8Str(uint8 x,uint8 y,uint8 *p)
//设计者: sumjess
//功能描述:写入一组标准ASCII字符串
//参数:显示的位置(x,y),y为页范围0~7,要显示的字符串
//返回:无
//==============================================================
void OLED_P6x8Str(uint8 x,uint8 y,uint8 ch[])
{
uint8 c=0,i=0,j=0;
while (ch[j]!='\0')
{
c =ch[j]-32;
if(x>126){x=0;y++;}
OLED_Set_Pos(x,y);
for(i=0;i<6;i++)
OLED_WrDat(F6x8[c][i]);
x+=6;
j++;
}
}
//==============================================================
//函数名:LCD_P8x16Str(uint8 x,uint8 y,uint8 *p)
//设计者: sumjess
//功能描述:写入一组标准ASCII字符串
//参数:显示的位置(x,y),y为页范围0~7,要显示的字符串
//返回:无
//==============================================================
void OLED_P8x16Str(uint8 x,uint8 y,uint8 ch[])
{
uint8 c=0,i=0,j=0;

while (ch[j]!='\0')
{
c =ch[j]-32;
if(x>120){x=0;y++;}
OLED_Set_Pos(x,y);
for(i=0;i<8;i++)
OLED_WrDat(F8X16[c*16+i]);
OLED_Set_Pos(x,y+1);
for(i=0;i<8;i++)
OLED_WrDat(F8X16[c*16+i+8]);
x+=8;
j++;
}
}
//输出汉字字符串
void OLED_P14x16Str(uint8 x,uint8 y,uint8 ch[])
{
uint8 wm=0,ii = 0;
uint16 adder=1;

while(ch[ii] != '\0')
{
wm = 0;
adder = 1;
while(F14x16_Idx[wm] > 127)
{
if(F14x16_Idx[wm] == ch[ii])
{
if(F14x16_Idx[wm + 1] == ch[ii + 1])
{
adder = wm * 14;
break;
}
}
wm += 2;
}
if(x>118){x=0;y++;}
OLED_Set_Pos(x , y);
if(adder != 1)// 显示汉字
{
OLED_Set_Pos(x , y);
for(wm = 0;wm < 14;wm++)
{
OLED_WrDat(F14x16[adder]);
adder += 1;
}
OLED_Set_Pos(x,y + 1);
for(wm = 0;wm < 14;wm++)
{
OLED_WrDat(F14x16[adder]);
adder += 1;
}
}
else //显示空白字符
{
ii += 1;
OLED_Set_Pos(x,y);
for(wm = 0;wm < 16;wm++)
{
OLED_WrDat(0);
}
OLED_Set_Pos(x,y + 1);
for(wm = 0;wm < 16;wm++)
{
OLED_WrDat(0);
}
}
x += 14;
ii += 2;
}
}


//=======================================//
//sumjess推荐使用该函数//
//输出汉字和字符混合字符串//
//======================================//

void OLED_Print(uint8 x, uint8 y, uint8 ch[])
{
uint8 ch2[3];
uint8 ii=0;
while(ch[ii] != '\0')
{
if(ch[ii] > 127)
{
ch2[0] = ch[ii];
ch2[1] = ch[ii + 1];
ch2[2] = '\0'; //汉字为两个字节
OLED_P14x16Str(x , y, ch2); //显示汉字
x += 14;
ii += 2;
}
else
{
ch2[0] = ch[ii];
ch2[1] = '\0'; //字母占一个字节
OLED_P8x16Str(x , y , ch2); //显示字母
x += 8;
ii+= 1;
}
}
}

//==============================================================
//函数名: void Draw_BMP(uint8 x,uint8 y)
//设计者: sumjess
//功能描述:显示BMP图片128×64
//参数:起始点坐标(x,y),x的范围0~127,y为页的范围0~7
//返回:无
//==============================================================
void Draw_BMP(uint8 x0,uint8 y0,uint8 x1,uint8 y1,uint8 bmp[])
{
uint16 ii=0;
uint8 x,y;

if(y1%8==0) y=y1/8;
else y=y1/8+1;
for(y=y0;y<=y1;y++)
{
OLED_Set_Pos(x0,y);
for(x=x0;x<x1;x++)
{
OLED_WrDat(bmp[ii++]);
}
}
}

void Draw_LibLogo(void)
{
uint16 ii=0;
uint8 x,y;

for(y=0;y<8;y++)
{
OLED_Set_Pos(34,y);
for(x=34;x<94;x++)
{
OLED_WrDat(LIBLOGO60x58[ii++]);
}
}
}

void Draw_Landzo(void)
{
uint16 ii=0;
uint8 x,y;

for(y=2;y<8;y++)
{
OLED_Set_Pos(40,y);
for(x=40;x<90;x++)
{
OLED_WrDat(LANDZO_LOGO[ii++]);
}
}
}

sumjess_OLED.h中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
*
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_oled.h 头文件
* @brief OLED配置
* @author sumjess
* @version v1.0
* @date 2018-01-19
*/
#ifndef _SUMJESS_OELD_H
#define _SUMJESS_OELD_H
#include "MK60_gpio.h"

//#define uint8 uint8 //#define uint8 unsigned char
//#define uint16 uint16 //#define uint16 unsigned short int

extern uint8 lanzhou96x64[1768];
void OLED_Init(void);
void OLED_CLS(void);
void OLED_P6x8Str(uint8 x,uint8 y,uint8 ch[]);
void OLED_P8x16Str(uint8 x,uint8 y,uint8 ch[]);
void OLED_P14x16Str(uint8 x,uint8 y,uint8 ch[]);
void OLED_Print(uint8 x, uint8 y, uint8 ch[]); //OLED_Print(5,3,"泰庆电子欢迎您"); //汉字字符串显示
void OLED_PutPixel(uint8 x,uint8 y);
void OLED_Rectangle(uint8 x1,uint8 y1,uint8 x2,uint8 y2,uint8 gif);
void OLED_Set_Pos(uint8 x, uint8 y);
void OLED_WrDat(uint8 data);
void Draw_LibLogo(void);
void Draw_Landzo(void);
void Draw_BMP(uint8 x0,uint8 y0,uint8 x1,uint8 y1,uint8 bmp[]);
void OLED_Fill(uint8 dat);
void Dly_ms(uint16 ms);



/********************************************************************/

#endif

sumjess_test.c中的代码(显示各个光电开关的状态):

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
* 技术讨论:QQ 1371129880
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_test.c
* @brief 测试模式
* @author sumjess
* @version v2.1
* @date 2018-01-24
*/
#include "common.h"
#include "sumjess_test.h"
#include "VCAN_key.h"
#include "sumjess_OLED.h"
#include "optoelectronic_switch.h"

void sumjess_test(void)
{
Strict uint8 txt[10];

//边缘 左上--右上--右下--左下
sprintf(txt,"%d",left_forward_edge);
OLED_P8x16Str(24,0,(uint8*)txt);
sprintf(txt,"%d",right_forward_edge);
OLED_P8x16Str(48,0,(uint8*)txt);
sprintf(txt,"%d",right_back_edge);
OLED_P8x16Str(72,0,(uint8*)txt);
sprintf(txt,"%d",left_back_edge);
OLED_P8x16Str(96,0,(uint8*)txt);
//左前--左前中--右前中--右前
sprintf(txt,"%d",left_forward);
OLED_P8x16Str(24,2,(uint8*)txt);
sprintf(txt,"%d",forward_middle_left);
OLED_P8x16Str(48,2,(uint8*)txt);
sprintf(txt,"%d",forward_middle_right);
OLED_P8x16Str(72,2,(uint8*)txt);
sprintf(txt,"%d",right_forward);
OLED_P8x16Str(96,2,(uint8*)txt);
//左1--左2--右1--右2
sprintf(txt,"%d",left_1);
OLED_P8x16Str(24,4,(uint8*)txt);
sprintf(txt,"%d",left_2);
OLED_P8x16Str(48,4,(uint8*)txt);
sprintf(txt,"%d",right_1);
OLED_P8x16Str(72,4,(uint8*)txt);
sprintf(txt,"%d",right_2);
OLED_P8x16Str(96,4,(uint8*)txt);
//左后--后中左--后中右--右后
sprintf(txt,"%d",left_back);
OLED_P8x16Str(24,6,(uint8*)txt);
sprintf(txt,"%d",back_middle_left);
OLED_P8x16Str(48,6,(uint8*)txt);
sprintf(txt,"%d",back_middle_right);
OLED_P8x16Str(72,6,(uint8*)txt);
sprintf(txt,"%d",right_back);
OLED_P8x16Str(96,6,(uint8*)txt);

}

sumjess_test.h中的代码(显示各个光电开关的状态):

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
*
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_test.c
* @brief 淘汰模式
* @author sumjess
* @version v2.1
* @date 2018-01-24
*/

#ifndef _SUMJESS_TEST_H
#define _SUMJESS_TEST_H


void sumjess_test(void);


/********************************************************************/

#endif

三、PWM底层配置:

sumjess_motor_drvier.c中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
*
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_motor_drvier.c
* @brief 电机驱动底层配置与速度控制函数
* @author sumjess
* @version v1.0
* @date 2018-01-17
*/

#include "common.h"
#include "MK60_port.h"
#include "MK60_gpio.h"
#include "sumjess_motor_drvier.h"
#include "MK60_FTM.h"

/
//定义有上台机构的一方为正方向///
/

// 引脚定义 轮子 PWM 正反转

// FTM0_CH1_PIN PTA4 左边 大 正
// FTM0_CH2_PIN PTA5 左边 小 转
// FTM0_CH3_PIN PTA6 右边 大 正
// FTM0_CH4_PIN PTA7 右边 小 转

//=================电机驱动PWM初始化===================//
void sumjess_motor_drvier_init(int a)//电机驱动额定频率为4000;
{
ftm_pwm_init(FTM0, FTM_CH1, a,0);//调试的时候写0,比赛时写10;电机驱动额定频率为4000;
ftm_pwm_init(FTM0, FTM_CH2, a,0);//调试的时候写0,比赛时写10;电机驱动额定频率为4000;
ftm_pwm_init(FTM0, FTM_CH3, a,0);//调试的时候写0,比赛时写10;电机驱动额定频率为4000;
ftm_pwm_init(FTM0, FTM_CH4, a,0);//调试的时候写0,比赛时写10;电机驱动额定频率为4000;
}

sumjess_motor_drvier.h中的代码:

/*!
* COPYRIGHT NOTICE
* Copyright (c) 2018,SUMJESS科技
* All rights reserved.
*
*
* 除注明出处外,以下所有内容版权均属sumjess所有,未经允许,不得用于商业用途,
* 修改内容时必须保留sumjess的版权声明。
*
* @file sumjess_motor_drvier.h
* @brief 电机驱动底层配置与速度控制函数头文件
* @author sumjess
* @version v1.0
* @date 2018-01-17
*/

#ifndef __SUMJESS_MOTOR_DRVIER_H__
#define __SUMJESS_MOTOR_DRVIER_H__

/
//定义有上台机构的一方为正方向///
/

//电机驱动PWM初始化
void sumjess_motor_drvier_init(int a);//电机驱动PWM初始化;电机驱动额定频率为4000;



#endif //__SUMJESS_MOTOR_DRVIER_H__

注:以上所有配置不一定通用,请各位读者按照自己板子的型号和原理图进行调整。

标签:无差别,0X00,0x20,0x00,---,OLED,擂台,GPIO,0x80
From: https://blog.51cto.com/u_14970037/5976191

相关文章

  • CSP-S 2021游记
    前言:半退役人员,无所畏惧。半退役人员,无所畏惧。半退役人员,无所畏惧。初赛就不记了,因为身处FJ,0分晋级。一下我的名称均用yyr(阴阳人)代替。Day-9与-8qz月考,想着......
  • csp-j 游记
    ###初赛day-7~day-1赛前集训,都很简单,什么二叉树,图论呀,轻松搞定。做了$2008$至$2015$年的普及组真题,都在$50$分以上,感觉初赛稳了(坐标$HN$)。###初赛day1......
  • Openstack-mitakaCentos7.2双节点搭建--(一)基础服务搭建
    虚拟机准备版本Centos7.21511网络配置:管理网络:192.168.100.10controller192.168.100.20compute外部网络192.168.200.10controller192.168.200.20computeVmware......
  • 亚马逊云科技 Build On 2022 - AIot 第二季物联网专场实验心得
    亚马逊云科技BuildOn2022-AIot第二季物联网专场实验心得大家好BuildOn是什么本次BuildOn主题介绍参与本场活动您能学到什么本场实验所用到的AWS服务实验部分1.线上......
  • 亚马逊云科技 Build On - Serverless助力企业降本增效
    亚马逊云科技BuildOn-Serverless开启零售新篇章​​梅开三度​​​​活动体验​​​​实验​​​​问题总结​​​​总结​​梅开三度Hi,作为一名Builder,这也是第三次接......
  • AWS使用EC2降低DeepRacer的训练成本:DeepRacer-for-cloud的实践操作
    文章目录​​前言​​​​一、技术介绍​​​​二、实现途径​​​​三、效果展示​​​​AWSDeepRacer-for-Cloud安装训练脚本如下​​​​遇到的问题​​​​四、总结​......
  • 研发思维07----嵌入式智能产品安全认证必要经过
    目录​​前言​​​​一、为什么需要进行产品认证?​​​​二、不同地区有哪类型产品认证?​​​​2.1常见标准认证​​​​2.2网络类相关标准​​​​2.3医疗类标准​​​......
  • 研发管理02----嵌入式硬件设计流程之完善
    目录​​ 一、确定功能需求&设计标准​​​​1.1确定功能需求​​​​1.2设计标准​​​​二、方案设计​​​​2.1方案查找​​​​2.1.1小家电低配类芯片方案​​​......
  • Java学习之if---elif语句
    publicclasselif1{publicstaticvoidmain(String[]args){inttestScore=50;chargrade;if(testScore>=90){grade='A';}elseif(testScore>=80){grade=......
  • Java学习之do---while语句
    do—while1/*do-while结构如下do{循环体}while(条件表达式)特点:无条件的执行一次循环体,再来判断条件表达式的值,至少循环一次*/importjava.util.*;publicclassdh1......