资源简介
基于CC2530的OLED开发,包含了相应的源文件,移植只需要修改少许地方即可。。。。。。。。。。。。。。。

代码片段和文件信息
#include “XMF_OLED1306.h“
#include “XMF_OLED_Font.h“
#include “XMF_OLED_BMP.h“
/*==========================延时函数==========================*/
void Delay_oled(unsigned char time)
{
while(time--);
}
/*==========================写单字节==========================*/
void OLED_Write_Byte(unsigned char dat unsigned char cmd)
{
unsigned char i;
if(cmd)
OLED_DC = 1;
else
OLED_DC = 0;
for(i = 0; i < 8; i++)
{
OLED_SCK = 0;
if(dat & 0x80)
OLED_DD = 1;
else
OLED_DD = 0;
OLED_SCK = 1;
dat<<=1;
}
OLED_DC = 1;
}
/*==========================设置坐标==========================*/
void OLED_Set_Pos(unsigned char x unsigned char y)
{
OLED_Write_Byte(0xb0+y OLED_CMD);
OLED_Write_Byte(((x&0xf0)>>4)|0x10 OLED_CMD);
OLED_Write_Byte((x&0x0f)|0x01 OLED_CMD);
}
/*==========================显示字符===========================
* 在指定位置显示一个字符包括部分字符
* x: 0~127
* y: 0~63
* mode: 0--反白显示; 1--正常显示
* size: 选择字体 16/12
=============================================================*/
void OLED_Show_Char(unsigned char x unsigned char y unsigned char chr)
{
unsigned char c=0i=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_Write_Byte(F8X16[c*16+i] OLED_DATA);
OLED_Set_Pos(x y+1);
for(i = 0; i < 8; i++)
OLED_Write_Byte(F8X16[c*16+i+8]OLED_DATA);
}
else {
OLED_Set_Pos(x y+1);
for(i = 0; i < 6; i++)
OLED_Write_Byte(F6x8[c][i] OLED_DATA);
}
}
/*========================显示字符串==========================*/
void OLED_Show_Str(unsigned char x unsigned char y unsigned char *chr)
{
unsigned char j = 0;
while (chr[j]!=‘\0‘)
{
OLED_Show_Char(x y chr[j]);
x += 8;
if(x > 120)
{
x=0;
y+=2;
}
j++;
}
}
/*==========================计算m^n===========================*/
unsigned int OLED_pow(unsigned char m unsigned char n)
{
unsigned int result = 1;
while(n--)
result *= m;
return result;
}
//显示2个数字
//xy :起点坐标
//len :数字的位数
//size:字体大小
//mode:模式 0填充模式;1叠加模式
//num:数值(0~4294967295);
/*========================显示多位整数========================
* 显示多位数字
* 起始点坐标(xy)
* num: 显示的整数
* len :数字的位数
* size2: 字体大小,建议用16
=============================================================*/
void OLED_Show_Int(unsigned char x unsigned char y unsigned int num unsigned char len unsigned char size2)
{
unsigned char itemp;
unsigned char enshow=0;
for(i = 0; i < len; i++)
{
temp=(num/OLED_pow(10len-i-1))%10;
if(enshow==0&&i<(len-1))
{
if(temp==0)
{
OLED_Show_Char(x+(size2/2)*iy‘ ‘);
continue;
}
else
enshow=1;
}
OLED_Show_Char(x+(size2/2)*i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1793 2018-02-01 12:50 XMF_OLED1306.h
文件 10718 2018-01-31 15:29 XMF_OLED_BMP.h
文件 15207 2018-01-31 13:40 XMF_OLED_Font.h
文件 7768 2018-01-31 15:57 XMF_OLED1306.c
相关资源
- cc2530寄存器手册
- IEEE 802.15.4的CC2530无线数据收发设计
- IEEE 802.15.4的CC2530无线数据收发设计
- ZStack-CC2530-2.5.1a
- 基于ZigBee温室环境监测系统电路设计
- 智能分户供暖监控系统的无线温控器
- CC2530的分布式无线数据采集系统设计
- CC2530 BasicRFTI源文件
- cc2530-contiki读取DHT11并发送数据例程
- CC2530中文数据手册完全版.pdf
- CC2530 (zigbee) 中文数据手册完全版
- SampleApp_dht11.zip
- zigbee基于cc2530指导
- 基于cc2530的温湿度检测点对点无线传
- 基于CC2530的温湿度数据采集系统
- 基于cc2530的zigbee的无线led灯控制程序
- TI公司推出的CCS3.3开发环境中文入门指
- 基于Zigbee的室内自定位
- Zigbee CC2530 振动传感器开发源码 项目
- Zigbee CC2530 酒精传感器开发源码
- Zigbee CC2530 火焰传感器开发源码
- CC2530+DHT11温湿度传感器+HC-SR04超声波传
- cc2530中文数据手册完全版
- Zigbee CC2530模块电路图和原理图
- STM32和CC2530串口通信
- cc2530无线点灯实验
- CC2530无线点灯
- TIMAC-CC2530-1.4.0
- ZStack-CC2530-2.3.0-1.4.0 完整文档,多个
- 光照低功耗.rar
评论
共有 条评论