Merge branch 'master' of https://github.com/Tencent/TencentOS-tiny
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "tos.h"
|
||||
#include <tos_compiler.h>
|
||||
#include <tos_ktypes.h>
|
||||
|
||||
#define ECLIC_ADDR_BASE 0xD2000000
|
||||
#define CLIC_INT_TMR 0x07
|
||||
@@ -18,18 +19,18 @@
|
||||
#define ECLIC_CFG_NLBITS_LSB 1
|
||||
|
||||
|
||||
static uint8_t elci_get_clic_int_ctl_bits() {
|
||||
static uint8_t eclic_get_clic_int_ctl_bits() {
|
||||
uint32_t bits = *(volatile uint32_t*)(ECLIC_ADDR_BASE+ECLIC_INFO_OFFSET);
|
||||
bits >>= 21;
|
||||
return (uint8_t) bits;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t elci_get_nlbits() {
|
||||
static uint8_t eclic_get_nlbits() {
|
||||
uint8_t nlbits = *(volatile uint8_t*)(ECLIC_ADDR_BASE+ECLIC_CFG_OFFSET);
|
||||
nlbits = (nlbits & ECLIC_CFG_NLBITS_MASK) >> ECLIC_CFG_NLBITS_LSB;
|
||||
|
||||
uint8_t cicbits = elci_get_clic_int_ctl_bits();
|
||||
uint8_t cicbits = eclic_get_clic_int_ctl_bits();
|
||||
if(nlbits > cicbits) {
|
||||
nlbits = cicbits;
|
||||
}
|
||||
@@ -51,7 +52,7 @@ static void eclic_enable_interrupt(uint32_t source) {
|
||||
}
|
||||
|
||||
static void eclic_set_irq_level(uint32_t source, uint8_t level) {
|
||||
uint8_t nlbits = elci_get_nlbits();
|
||||
uint8_t nlbits = eclic_get_nlbits();
|
||||
|
||||
if (nlbits == 0) {
|
||||
return ;
|
||||
@@ -67,8 +68,8 @@ static void eclic_set_irq_level(uint32_t source, uint8_t level) {
|
||||
}
|
||||
|
||||
static void eclic_set_irq_priority(uint32_t source, uint8_t priority) {
|
||||
uint8_t nlbits = elci_get_nlbits();
|
||||
uint8_t cicbits= elci_get_clic_int_ctl_bits();
|
||||
uint8_t nlbits = eclic_get_nlbits();
|
||||
uint8_t cicbits= eclic_get_clic_int_ctl_bits();
|
||||
|
||||
if (nlbits >= cicbits) {
|
||||
return ;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#include <tos.h>
|
||||
#include <riscv_encoding.h>
|
||||
#include <riscv_port.h>
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
@@ -107,7 +106,7 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
regs->gp = (cpu_data_t)gp; // gp: global pointer
|
||||
regs->a0 = (cpu_data_t)arg; // a0: argument
|
||||
regs->ra = (cpu_data_t)0xACE00ACE; // ra: return address
|
||||
regs->mstatus = (cpu_data_t)(MSTATUS_MPP | MSTATUS_MPIE); // return to machine mode and enable interrupt
|
||||
regs->mstatus = (cpu_data_t)0x00001880; // return to machine mode and enable interrupt
|
||||
regs->epc = (cpu_data_t)entry;
|
||||
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
#include <tos.h>
|
||||
#include "riscv_encoding.h"
|
||||
#include "riscv_port.h"
|
||||
|
||||
__PORT__ void port_systick_config(uint32_t cycle_per_tick)
|
||||
|
@@ -15,8 +15,14 @@
|
||||
.extern k_curr_task
|
||||
.extern k_next_task
|
||||
|
||||
#define MSTATUS_MIE 0x00000008
|
||||
#define MSTATUS_MPP 0x00001800
|
||||
|
||||
#include "riscv_encoding.h"
|
||||
#define MIE_MTIE (1 << 7)
|
||||
|
||||
#define MIP_MTIP (1 << 7)
|
||||
|
||||
#define REGBYTES 4
|
||||
|
||||
.text
|
||||
.align 2
|
||||
@@ -59,7 +65,6 @@ port_systick_pending_reset:
|
||||
csrc mip, t0
|
||||
ret
|
||||
|
||||
#define REGBYTES 4
|
||||
|
||||
.macro SAVE_CONTEXT
|
||||
addi sp, sp, -32*REGBYTES
|
||||
|
9
board/GD32VF103C_START/BSP/Inc/mcu_init.h
Normal file
9
board/GD32VF103C_START/BSP/Inc/mcu_init.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef __MCU_INIT_H
|
||||
#define __MCU_INIT_H
|
||||
|
||||
#include "gd32vf103.h"
|
||||
#include "usart.h"
|
||||
|
||||
void board_init();
|
||||
|
||||
#endif //__MCU_INIT_H
|
10
board/GD32VF103C_START/BSP/Inc/usart.h
Normal file
10
board/GD32VF103C_START/BSP/Inc/usart.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __USART_H
|
||||
#define __USART_H
|
||||
|
||||
#define USART0_GPIO_TX_PIN GPIO_PIN_9
|
||||
#define USART0_GPIO_RX_PIN GPIO_PIN_10
|
||||
#define USART0_GPIO_PORT GPIOA
|
||||
|
||||
void usart0_init(int baud);
|
||||
|
||||
#endif // __USART_H
|
12
board/GD32VF103C_START/BSP/Src/mcu_init.c
Normal file
12
board/GD32VF103C_START/BSP/Src/mcu_init.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "mcu_init.h"
|
||||
|
||||
void board_init() {
|
||||
|
||||
SystemInit();
|
||||
|
||||
rcu_periph_clock_enable(RCU_GPIOA);
|
||||
|
||||
gpio_init(GPIOA, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_7);
|
||||
|
||||
gpio_bit_reset(GPIOA, GPIO_PIN_7);
|
||||
}
|
28
board/GD32VF103C_START/BSP/Src/usart.c
Normal file
28
board/GD32VF103C_START/BSP/Src/usart.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "gd32vf103.h"
|
||||
#include "usart.h"
|
||||
void usart0_init(int baud)
|
||||
{
|
||||
/* enable GPIO clock */
|
||||
rcu_periph_clock_enable(RCU_GPIOA);
|
||||
|
||||
/* enable USART0 clock */
|
||||
rcu_periph_clock_enable(RCU_USART0);
|
||||
|
||||
/* connect port to USART0_Tx */
|
||||
gpio_init(USART0_GPIO_PORT, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, USART0_GPIO_TX_PIN);
|
||||
|
||||
/* connect port to USART0_Rx */
|
||||
gpio_init(USART0_GPIO_PORT, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, USART0_GPIO_RX_PIN);
|
||||
|
||||
/* USART0 configure */
|
||||
usart_deinit(USART0);
|
||||
usart_baudrate_set(USART0, baud);
|
||||
usart_word_length_set(USART0, USART_WL_8BIT);
|
||||
usart_stop_bit_set(USART0, USART_STB_1BIT);
|
||||
usart_parity_config(USART0, USART_PM_NONE);
|
||||
usart_hardware_flow_rts_config(USART0, USART_RTS_DISABLE);
|
||||
usart_hardware_flow_cts_config(USART0, USART_CTS_DISABLE);
|
||||
usart_receive_config(USART0, USART_RECEIVE_ENABLE);
|
||||
usart_transmit_config(USART0, USART_TRANSMIT_ENABLE);
|
||||
usart_enable(USART0);
|
||||
}
|
@@ -1,27 +1,38 @@
|
||||
#ifndef INC_TOS_CONFIG_H_
|
||||
#define INC_TOS_CONFIG_H_
|
||||
|
||||
#include "gd32vf103.h"
|
||||
#include "stddef.h"
|
||||
|
||||
#define TOS_CFG_TASK_PRIO_MAX 10u // 配置TencentOS tiny默认支持的最大优先级数量
|
||||
// 配置TencentOS tiny默认支持的最大优先级数量
|
||||
#define TOS_CFG_TASK_PRIO_MAX 10u
|
||||
|
||||
#define TOS_CFG_ROUND_ROBIN_EN 0u // 配置TencentOS tiny的内核是否开启时间片轮转
|
||||
// 配置TencentOS tiny的内核是否开启时间片轮转
|
||||
#define TOS_CFG_ROUND_ROBIN_EN 0u
|
||||
|
||||
#define TOS_CFG_OBJECT_VERIFY 0u // 配置TencentOS tiny是否校验指针合法
|
||||
// 配置TencentOS tiny是否校验指针合法
|
||||
#define TOS_CFG_OBJECT_VERIFY 0u
|
||||
|
||||
#define TOS_CFG_EVENT_EN 1u // TencentOS tiny 事件模块功能宏
|
||||
// TencentOS tiny 事件模块功能宏
|
||||
#define TOS_CFG_EVENT_EN 1u
|
||||
|
||||
#define TOS_CFG_MMHEAP_EN 1u // 配置TencentOS tiny是否开启动态内存模块
|
||||
// 配置TencentOS tiny是否开启动态内存模块
|
||||
#define TOS_CFG_MMHEAP_EN 1u
|
||||
|
||||
#define TOS_CFG_MMHEAP_POOL_SIZE 8192 // 配置TencentOS tiny动态内存池大小
|
||||
// 配置TencentOS tiny动态内存池大小
|
||||
#define TOS_CFG_MMHEAP_POOL_SIZE 8192
|
||||
|
||||
#define TOS_CFG_MUTEX_EN 1u // 配置TencentOS tiny是否开启互斥锁模块
|
||||
// 配置TencentOS tiny是否开启互斥锁模块
|
||||
#define TOS_CFG_MUTEX_EN 1u
|
||||
|
||||
#define TOS_CFG_QUEUE_EN 1u // 配置TencentOS tiny是否开启队列模块
|
||||
// 配置TencentOS tiny是否开启队列模块
|
||||
#define TOS_CFG_QUEUE_EN 1u
|
||||
|
||||
#define TOS_CFG_TIMER_EN 0u // 配置TencentOS tiny是否开启软件定时器模块
|
||||
// 配置TencentOS tiny是否开启软件定时器模块
|
||||
#define TOS_CFG_TIMER_EN 0u
|
||||
|
||||
#define TOS_CFG_SEM_EN 1u // 配置TencentOS tiny是否开启信号量模块
|
||||
// 配置TencentOS tiny是否开启信号量模块
|
||||
#define TOS_CFG_SEM_EN 1u
|
||||
|
||||
#define TOS_CFG_CPU_SYSTICK_PRIO 0xF
|
||||
|
||||
@@ -31,15 +42,22 @@
|
||||
#define TOS_CFG_MSG_EN 0u
|
||||
#endif
|
||||
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u // 配置TencentOS tiny消息队列大小
|
||||
// 配置TencentOS tiny消息队列大小
|
||||
#define TOS_CFG_MSG_POOL_SIZE 10u
|
||||
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u // 配置TencentOS tiny空闲任务栈大小
|
||||
// 配置TencentOS tiny空闲任务栈大小
|
||||
#define TOS_CFG_IDLE_TASK_STK_SIZE 512u
|
||||
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u // 配置TencentOS tiny的tick频率
|
||||
// 配置TencentOS tiny的tick频率
|
||||
#define TOS_CFG_CPU_TICK_PER_SECOND 1000u
|
||||
|
||||
#define TOS_CFG_CPU_CLOCK (108000000/4) // 配置TencentOS tiny CPU频率
|
||||
// 配置TencentOS tiny CPU频率
|
||||
// 除4的原因是,Bumblebee内核通过core_clk_aon四分频来更新mtime寄存器
|
||||
// 具体信息参见《Bumblebee内核简明数据手册》
|
||||
#define TOS_CFG_CPU_CLOCK (SystemCoreClock/4)
|
||||
|
||||
#define TOS_CFG_TIMER_AS_PROC 1u // 配置是否将TIMER配置成函数模式
|
||||
// 配置是否将TIMER配置成函数模式
|
||||
#define TOS_CFG_TIMER_AS_PROC 1u
|
||||
|
||||
#define TOS_CFG_VFS_EN 1u
|
||||
|
||||
|
@@ -144,6 +144,8 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/hello_world/TencentOS_tiny/arch/risc-v/bumblebee}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/hello_world/TencentOS_tiny/kernel/evtdrv/include}""/>
|
||||
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/hello_world/Application/Inc}""/>
|
||||
|
||||
</option>
|
||||
|
||||
|
@@ -39,6 +39,16 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Application/Inc</name>
|
||||
<type>2</type>
|
||||
<locationURI>TOP_DIR/board/GD32VF103C_START/BSP/Inc</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Application/Src</name>
|
||||
<type>2</type>
|
||||
<locationURI>TOP_DIR/board/GD32VF103C_START/BSP/Src</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Application/tos_config.h</name>
|
||||
<type>1</type>
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1367083006174630109" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1310167466484573552" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
|
@@ -1,58 +1,68 @@
|
||||
#include "gd32vf103.h"
|
||||
#include "tos.h"
|
||||
|
||||
#define TASK_SIZE 512
|
||||
k_task_t k_task_task1;
|
||||
k_task_t k_task_task2;
|
||||
uint8_t k_task1_stk[TASK_SIZE];
|
||||
uint8_t k_task2_stk[TASK_SIZE];
|
||||
|
||||
int share = 0xCBA7F9;
|
||||
k_sem_t sem;
|
||||
|
||||
void task1(void *pdata)
|
||||
{
|
||||
int task_cnt1 = 0;
|
||||
while (1) {
|
||||
task_cnt1++;
|
||||
tos_sem_pend(&sem, ~0U);
|
||||
gpio_bit_write(GPIOA, GPIO_PIN_7, share % 2);
|
||||
}
|
||||
}
|
||||
|
||||
void task2(void *pdata)
|
||||
{
|
||||
int task_cnt2 = 0;
|
||||
while (1) {
|
||||
task_cnt2--;
|
||||
share++;
|
||||
tos_task_delay(1000);
|
||||
tos_sem_post(&sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main(void) {
|
||||
rcu_periph_clock_enable(RCU_GPIOA);
|
||||
|
||||
gpio_init(GPIOA, GPIO_MODE_OUT_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_7);
|
||||
|
||||
gpio_bit_reset(GPIOA, GPIO_PIN_7);
|
||||
|
||||
tos_knl_init();
|
||||
|
||||
tos_task_create(&k_task_task1, "task1", task1, NULL, 3, k_task1_stk, TASK_SIZE, 0);
|
||||
tos_task_create(&k_task_task2, "task2", task2, NULL, 3, k_task2_stk, TASK_SIZE, 0);
|
||||
|
||||
k_err_t err = tos_sem_create(&sem, 1);
|
||||
if (err != K_ERR_NONE) {
|
||||
goto die;
|
||||
}
|
||||
|
||||
tos_knl_start();
|
||||
|
||||
die:
|
||||
while (1) {
|
||||
asm("wfi;");
|
||||
}
|
||||
}
|
||||
#include "mcu_init.h"
|
||||
#include "tos.h"
|
||||
|
||||
#define TASK_SIZE 1024
|
||||
k_task_t k_task_task1;
|
||||
k_task_t k_task_task2;
|
||||
uint8_t k_task1_stk[TASK_SIZE];
|
||||
uint8_t k_task2_stk[TASK_SIZE];
|
||||
|
||||
int share = 0xCBA7F9;
|
||||
k_sem_t sem;
|
||||
|
||||
void task1(void *pdata)
|
||||
{
|
||||
int task_cnt1 = 0;
|
||||
while (1) {
|
||||
printf("hello world from %s cnt: %d\n", __func__, task_cnt1++);
|
||||
tos_sem_pend(&sem, ~0U);
|
||||
gpio_bit_write(GPIOA, GPIO_PIN_7, share % 2);
|
||||
}
|
||||
}
|
||||
|
||||
void task2(void *pdata)
|
||||
{
|
||||
int task_cnt2 = 0;
|
||||
while (1) {
|
||||
share++;
|
||||
for(int i=0; i<5; i++) {
|
||||
printf("hello world from %s cnt: %08x\n", __func__, task_cnt2--);
|
||||
tos_task_delay(200);
|
||||
}
|
||||
tos_sem_post(&sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void main(void) {
|
||||
board_init();
|
||||
|
||||
usart0_init(115200);
|
||||
|
||||
tos_knl_init();
|
||||
|
||||
tos_task_create(&k_task_task1, "task1", task1, NULL, 3, k_task1_stk, TASK_SIZE, 0);
|
||||
tos_task_create(&k_task_task2, "task2", task2, NULL, 3, k_task2_stk, TASK_SIZE, 0);
|
||||
|
||||
k_err_t err = tos_sem_create(&sem, 1);
|
||||
if (err != K_ERR_NONE) {
|
||||
goto die;
|
||||
}
|
||||
|
||||
tos_knl_start();
|
||||
|
||||
die:
|
||||
while (1) {
|
||||
asm("wfi;");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int _put_char(int ch)
|
||||
{
|
||||
usart_data_transmit(USART0, (uint8_t) ch );
|
||||
while (usart_flag_get(USART0, USART_FLAG_TBE)== RESET){
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
@@ -209,14 +209,14 @@ void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr)
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: OLED_ShowCHinese
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: OLED_ShowChinese
|
||||
* ˵ <20><>: <20><>ָ<EFBFBD><D6B8>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
||||
* <20><> <20><>: x<><78><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>x<EFBFBD><78><EFBFBD><EFBFBD>
|
||||
y<><79><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>y<EFBFBD><79><EFBFBD><EFBFBD>
|
||||
no<6E><6F>Ҫ<EFBFBD><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><D6BF>еı<D0B5><C4B1>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>Ŵ<EFBFBD>0<EFBFBD><30>ʼ
|
||||
* <20><> <20><> ֵ: <20><>
|
||||
***************************************************************/
|
||||
void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no)
|
||||
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no)
|
||||
{
|
||||
uint8_t t,adder=0;
|
||||
OLED_Set_Pos(x,y);
|
||||
|
@@ -37,7 +37,7 @@ void OLED_Fill(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2,uint8_t dot);
|
||||
void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr);
|
||||
void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size);
|
||||
void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p);
|
||||
void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no);
|
||||
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no);
|
||||
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
|
||||
/**************************************************************/
|
||||
/************** OLED<45><44><EFBFBD>ýӿ<C3BD> ************************/
|
||||
|
@@ -41,17 +41,17 @@ void board_init(void)
|
||||
OLED_Init();
|
||||
Init_BH1750();
|
||||
DHT11_Init();
|
||||
//OLED_ShowCHinese(0,0,0);
|
||||
//OLED_ShowCHinese(18,0,1);
|
||||
//OLED_ShowCHinese(38,0,2);
|
||||
//OLED_ShowCHinese(56,0,3);
|
||||
//OLED_ShowCHinese(74,0,4);
|
||||
//OLED_ShowChinese(0,0,0);
|
||||
//OLED_ShowChinese(18,0,1);
|
||||
//OLED_ShowChinese(38,0,2);
|
||||
//OLED_ShowChinese(56,0,3);
|
||||
//OLED_ShowChinese(74,0,4);
|
||||
OLED_ShowString(10,0,(uint8_t*)"TencentOS tiny");
|
||||
// OLED_ShowCHinese(1,3,5);
|
||||
// OLED_ShowCHinese(21,3,6);
|
||||
// OLED_ShowChinese(1,3,5);
|
||||
// OLED_ShowChinese(21,3,6);
|
||||
// OLED_ShowString(39,3,(uint8_t*)":25 C");
|
||||
// OLED_ShowCHinese(1,6,7);
|
||||
// OLED_ShowCHinese(21,6,8);
|
||||
// OLED_ShowChinese(1,6,7);
|
||||
// OLED_ShowChinese(21,6,8);
|
||||
// OLED_ShowString(39,6,(uint8_t*)":88 RH%");
|
||||
}
|
||||
|
||||
|
@@ -91,7 +91,7 @@ uint8_t SHT3x_CheckCrc(char data[], char nbrOfBytes, char checksum)
|
||||
|
||||
char crc = 0xFF;
|
||||
char bit = 0;
|
||||
char byteCtr ;
|
||||
unsigned char byteCtr;
|
||||
|
||||
//calculates 8-Bit checksum with given polynomial
|
||||
for(byteCtr = 0; byteCtr < nbrOfBytes; ++byteCtr)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//<EFBFBD>洢ͼƬ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ͼƬ<EFBFBD><EFBFBD>СΪ64*32<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//存储图片数据,图片大小为64*32像素
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -71,7 +71,7 @@ unsigned char BMP1[] =
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,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,0x20,0x40,0x40,
|
||||
0x40,0x50,0x20,0x5F,0x80,0x00,0x1F,0x20,0x40,0x40,0x40,0x50,0x20,0x5F,0x80,0x00,/*"C:\Users\evk\Desktop\??2014.bmp",0*/
|
||||
0x40,0x50,0x20,0x5F,0x80,0x00,0x1F,0x20,0x40,0x40,0x40,0x50,0x20,0x5F,0x80,0x00,
|
||||
|
||||
};
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#include "oled.h"
|
||||
#include "stdlib.h"
|
||||
#include "oledfont.h"
|
||||
//OLED<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>
|
||||
//<EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
#include "oledfont.h"
|
||||
//OLED的显存
|
||||
//存放格式如下.
|
||||
//-----------------------------------
|
||||
//|x<EFBFBD><EFBFBD>[0,127] |
|
||||
//| OLED<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
||||
//|y <EFBFBD><EFBFBD>Χ |
|
||||
//|<EFBFBD><EFBFBD> |
|
||||
//|x→[0,127] |
|
||||
//| OLED显示坐标 |
|
||||
//|y 范围 |
|
||||
//|↓ |
|
||||
//|[0,31] |
|
||||
//-----------------------------------
|
||||
//-----------------------------------
|
||||
/**********************************************
|
||||
//IIC Start
|
||||
**********************************************/
|
||||
@@ -46,7 +46,7 @@ void Write_IIC_Byte(unsigned char IIC_Byte)
|
||||
unsigned char m,da;
|
||||
da=IIC_Byte;
|
||||
OLED_SCLK_Clr();
|
||||
for(i=0;i<8;i++)
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
m=da;
|
||||
m=m&0x80;
|
||||
@@ -54,7 +54,7 @@ void Write_IIC_Byte(unsigned char IIC_Byte)
|
||||
{
|
||||
OLED_SDIN_Set();
|
||||
}
|
||||
else
|
||||
else
|
||||
OLED_SDIN_Clr();
|
||||
da=da<<1;
|
||||
OLED_SCLK_Set();
|
||||
@@ -68,11 +68,11 @@ void Write_IIC_Command(unsigned char IIC_Command)
|
||||
{
|
||||
IIC_Start();
|
||||
Write_IIC_Byte(0x78); //Slave address,SA0=0
|
||||
IIC_Wait_Ack();
|
||||
IIC_Wait_Ack();
|
||||
Write_IIC_Byte(0x00); //write command
|
||||
IIC_Wait_Ack();
|
||||
Write_IIC_Byte(IIC_Command);
|
||||
IIC_Wait_Ack();
|
||||
IIC_Wait_Ack();
|
||||
Write_IIC_Byte(IIC_Command);
|
||||
IIC_Wait_Ack();
|
||||
IIC_Stop();
|
||||
}
|
||||
/**********************************************
|
||||
@@ -82,11 +82,11 @@ void Write_IIC_Data(unsigned char IIC_Data)
|
||||
{
|
||||
IIC_Start();
|
||||
Write_IIC_Byte(0x78); //D/C#=0; R/W#=0
|
||||
IIC_Wait_Ack();
|
||||
IIC_Wait_Ack();
|
||||
Write_IIC_Byte(0x40); //write data
|
||||
IIC_Wait_Ack();
|
||||
IIC_Wait_Ack();
|
||||
Write_IIC_Byte(IIC_Data);
|
||||
IIC_Wait_Ack();
|
||||
IIC_Wait_Ack();
|
||||
IIC_Stop();
|
||||
}
|
||||
void OLED_WR_Byte(unsigned dat,unsigned cmd)
|
||||
@@ -95,9 +95,9 @@ void OLED_WR_Byte(unsigned dat,unsigned cmd)
|
||||
{
|
||||
Write_IIC_Data(dat);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Write_IIC_Command(dat);
|
||||
Write_IIC_Command(dat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,94 +120,97 @@ void fill_picture(unsigned char fill_Data)
|
||||
}
|
||||
}
|
||||
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void OLED_Set_Pos(unsigned char x, unsigned char y)
|
||||
{
|
||||
//坐标设置
|
||||
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),OLED_CMD);
|
||||
}
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OLED<EFBFBD><EFBFBD>ʾ
|
||||
OLED_WR_Byte((x&0x0f),OLED_CMD);
|
||||
}
|
||||
//开启OLED显示
|
||||
void OLED_Display_On(void)
|
||||
{
|
||||
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
|
||||
OLED_WR_Byte(0X14,OLED_CMD); //DCDC ON
|
||||
OLED_WR_Byte(0XAF,OLED_CMD); //DISPLAY ON
|
||||
}
|
||||
//<EFBFBD>ر<EFBFBD>OLED<EFBFBD><EFBFBD>ʾ
|
||||
//关闭OLED显示
|
||||
void OLED_Display_Off(void)
|
||||
{
|
||||
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte(0X8D,OLED_CMD); //SET DCDC命令
|
||||
OLED_WR_Byte(0X10,OLED_CMD); //DCDC OFF
|
||||
OLED_WR_Byte(0XAE,OLED_CMD); //DISPLAY OFF
|
||||
}
|
||||
//ע<EFBFBD>⣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ǻ<EFBFBD>ɫ<EFBFBD><C9AB>!<21><>û<EFBFBD><C3BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>!!!
|
||||
void OLED_Clear(void)
|
||||
{
|
||||
uint8_t i,n;
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
OLED_WR_Byte (0xb0+i,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>0~7<EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte (0x00,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<EFBFBD>á<EFBFBD><EFBFBD>е͵<EFBFBD>ַ
|
||||
OLED_WR_Byte (0x10,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<EFBFBD>á<EFBFBD><EFBFBD>иߵ<EFBFBD>ַ
|
||||
}
|
||||
//注意:清屏函数,清完屏,整个屏幕是黑色的!和没点亮一样!!!
|
||||
void OLED_Clear(void)
|
||||
{
|
||||
uint8_t 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);
|
||||
} //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
OLED_WR_Byte(0,OLED_DATA);
|
||||
} //更新显示
|
||||
}
|
||||
void OLED_On(void)
|
||||
{
|
||||
uint8_t i,n;
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
OLED_WR_Byte (0xb0+i,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>0~7<EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte (0x00,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<EFBFBD>á<EFBFBD><EFBFBD>е͵<EFBFBD>ַ
|
||||
OLED_WR_Byte (0x10,OLED_CMD); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾλ<EFBFBD>á<EFBFBD><EFBFBD>иߵ<EFBFBD>ַ
|
||||
for(n=0;n<128;n++)OLED_WR_Byte(1,OLED_DATA);
|
||||
} //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
void OLED_On(void)
|
||||
{
|
||||
uint8_t 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(1,OLED_DATA);
|
||||
} //更新显示
|
||||
}
|
||||
//<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
|
||||
//在指定位置显示一个字符,包括部分字符
|
||||
//x:0~127
|
||||
//y:0~63
|
||||
//
|
||||
//size:ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16/12
|
||||
//
|
||||
//size:选择字体 16/12
|
||||
void OLED_ShowChar(uint8_t x,uint8_t y,uint8_t chr,uint8_t Char_Size)
|
||||
{
|
||||
unsigned char c=0,i=0;
|
||||
c=chr-' ';//<EFBFBD>õ<EFBFBD>ƫ<EFBFBD>ƺ<EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
{
|
||||
unsigned char c=0,i=0;
|
||||
c=chr-' ';//得到偏移后的值
|
||||
if(x>Max_Column-1){x=0;y=y+2;}
|
||||
if(Char_Size ==16)
|
||||
{
|
||||
OLED_Set_Pos(x,y);
|
||||
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_Set_Pos(x,y+1);
|
||||
for(i=0;i<8;i++){
|
||||
OLED_WR_Byte(F8X16[c*16+i+8],OLED_DATA);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
OLED_Set_Pos(x,y);
|
||||
for(i=0;i<6;i++)
|
||||
OLED_WR_Byte(F6x8[c][i],OLED_DATA);
|
||||
}
|
||||
}
|
||||
//m^n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//m^n函数
|
||||
uint32_t oled_pow(uint8_t m,uint8_t n)
|
||||
{
|
||||
uint32_t result=1;
|
||||
while(n--)result*=m;
|
||||
uint32_t result=1;
|
||||
while(n--)result*=m;
|
||||
return result;
|
||||
}
|
||||
//<EFBFBD><EFBFBD>ʾ2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//x,y :<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//len :<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>λ<EFBFBD><EFBFBD>
|
||||
//size:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
}
|
||||
//显示2个数字
|
||||
//x,y :起点坐标
|
||||
//len :数字的位数
|
||||
//size:字体大小
|
||||
//
|
||||
//num:<EFBFBD><EFBFBD>ֵ(0~4294967295);
|
||||
//num:数值(0~4294967295);
|
||||
void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size2)
|
||||
{
|
||||
{
|
||||
uint8_t t,temp;
|
||||
uint8_t enshow=0;
|
||||
uint8_t enshow=0;
|
||||
for(t=0;t<len;t++)
|
||||
{
|
||||
temp=(num/oled_pow(10,len-t-1))%10;
|
||||
@@ -217,18 +220,18 @@ void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size2)
|
||||
{
|
||||
OLED_ShowChar(x+(size2/2)*t,y,' ',size2);
|
||||
continue;
|
||||
}else
|
||||
enshow=1;
|
||||
}else
|
||||
enshow=1;
|
||||
}
|
||||
OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2);
|
||||
OLED_ShowChar(x+(size2/2)*t,y,temp+'0',size2);
|
||||
}
|
||||
}
|
||||
//<EFBFBD><EFBFBD>ʾһ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>Ŵ<EFBFBD>
|
||||
}
|
||||
//显示一个字符号串
|
||||
void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size)
|
||||
{
|
||||
unsigned char j=0;
|
||||
while (chr[j]!='\0')
|
||||
{
|
||||
{
|
||||
OLED_ShowChar(x,y,chr[j],Char_Size);
|
||||
x+=8;
|
||||
if(x>120)
|
||||
@@ -238,60 +241,60 @@ void OLED_ShowString(uint8_t x,uint8_t y,uint8_t *chr,uint8_t Char_Size)
|
||||
j++;
|
||||
}
|
||||
}
|
||||
//<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no)
|
||||
//显示汉字
|
||||
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no)
|
||||
{
|
||||
uint8_t t,adder=0;
|
||||
OLED_Set_Pos(x,y);
|
||||
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);
|
||||
}
|
||||
OLED_Set_Pos(x,y+1);
|
||||
for(t=0;t<16;t++)
|
||||
{
|
||||
{
|
||||
OLED_WR_Byte(Hzk[2*no+1][t],OLED_DATA);
|
||||
adder+=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/***********<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ʾBMPͼƬ128<EFBFBD><EFBFBD>64<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(x,y),x<>ķ<EFBFBD>Χ0<CEA7><30>127<32><37>yΪҳ<CEAA>ķ<EFBFBD>Χ0<CEA7><30>7*****************/
|
||||
/***********功能描述:显示显示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;
|
||||
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);
|
||||
{
|
||||
OLED_WR_Byte(BMP[j++],OLED_DATA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>OLED
|
||||
//初始化OLED
|
||||
void OLED_Init(void)
|
||||
{
|
||||
{
|
||||
HAL_Delay(200);
|
||||
OLED_WR_Byte(0xAE,OLED_CMD);//<EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
OLED_WR_Byte(0xAE,OLED_CMD);//关闭显示
|
||||
|
||||
OLED_WR_Byte(0x40,OLED_CMD);//---set low column address
|
||||
OLED_WR_Byte(0xB0,OLED_CMD);//---set high column address
|
||||
|
||||
OLED_WR_Byte(0xC8,OLED_CMD);//-not offset
|
||||
|
||||
OLED_WR_Byte(0x81,OLED_CMD);//<EFBFBD><EFBFBD><EFBFBD>öԱȶ<EFBFBD>
|
||||
OLED_WR_Byte(0x81,OLED_CMD);//设置对比度
|
||||
OLED_WR_Byte(0xff,OLED_CMD);
|
||||
|
||||
OLED_WR_Byte(0xa1,OLED_CMD);//<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte(0xa1,OLED_CMD);//段重定向设置
|
||||
|
||||
OLED_WR_Byte(0xa6,OLED_CMD);//
|
||||
|
||||
OLED_WR_Byte(0xa8,OLED_CMD);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>
|
||||
OLED_WR_Byte(0xa8,OLED_CMD);//设置驱动路数
|
||||
OLED_WR_Byte(0x1f,OLED_CMD);
|
||||
|
||||
OLED_WR_Byte(0xd3,OLED_CMD);
|
||||
@@ -314,4 +317,4 @@ void OLED_Init(void)
|
||||
|
||||
OLED_WR_Byte(0xaf,OLED_CMD);
|
||||
OLED_Clear();
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,41 @@
|
||||
#ifndef __OLED_H
|
||||
#define __OLED_H
|
||||
#define __OLED_H
|
||||
#include "stm32l4xx_hal.h"
|
||||
#include "stdlib.h"
|
||||
#include "stdlib.h"
|
||||
#define OLED_MODE 0
|
||||
#define OLED_SIZE 8
|
||||
#define XLevelL 0x00
|
||||
#define XLevelH 0x10
|
||||
#define Max_Column 128
|
||||
#define Max_Row 64
|
||||
#define Brightness 0xFF
|
||||
#define Brightness 0xFF
|
||||
#define X_WIDTH 128
|
||||
#define Y_WIDTH 64
|
||||
//-----------------OLED IIC<EFBFBD>˿ڶ<EFBFBD><EFBFBD><EFBFBD>----------------
|
||||
#define Y_WIDTH 64
|
||||
//-----------------OLED IIC端口定义----------------
|
||||
//HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState);
|
||||
#define OLED_SCLK_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_10, GPIO_PIN_RESET);//SDA IIC<EFBFBD>ӿڵ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
|
||||
#define OLED_SCLK_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_10, GPIO_PIN_RESET);//SDA IIC接口的时钟信号
|
||||
#define OLED_SCLK_Set() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_10, GPIO_PIN_SET);
|
||||
|
||||
#define OLED_SDIN_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_3, GPIO_PIN_RESET);//SCL IIC<EFBFBD>ӿڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
|
||||
#define OLED_SDIN_Clr() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_3, GPIO_PIN_RESET);//SCL IIC接口的数据信号
|
||||
#define OLED_SDIN_Set() HAL_GPIO_WritePin(GPIOB,GPIO_PIN_3, GPIO_PIN_SET);
|
||||
|
||||
|
||||
#define OLED_CMD 0 //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define OLED_DATA 1 //д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#define OLED_CMD 0 //写命令
|
||||
#define OLED_DATA 1 //写数据
|
||||
|
||||
|
||||
//OLED<EFBFBD>ӿڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>
|
||||
//OLED接口控制用函数
|
||||
void OLED_ShowNum(uint8_t x,uint8_t y,uint32_t num,uint8_t len,uint8_t size);
|
||||
void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p,uint8_t Char_Size);
|
||||
void OLED_ShowCHinese(uint8_t x,uint8_t y,uint8_t no);
|
||||
void OLED_ShowString(uint8_t x,uint8_t y, uint8_t *p,uint8_t Char_Size);
|
||||
void OLED_ShowChinese(uint8_t x,uint8_t y,uint8_t no);
|
||||
void OLED_DrawBMP(unsigned char x0, unsigned char y0,unsigned char x1, unsigned char y1,unsigned char BMP[]);
|
||||
|
||||
|
||||
|
||||
//OLED<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//OLED基础函数
|
||||
void OLED_Init(void);
|
||||
void OLED_Clear(void);
|
||||
void OLED_Display_On(void);
|
||||
void OLED_Display_Off(void);
|
||||
void OLED_Display_Off(void);
|
||||
void OLED_Set_Pos(unsigned char x, unsigned char y);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1,108 +1,108 @@
|
||||
#ifndef __OLEDFONT_H
|
||||
#define __OLEDFONT_H
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII<EFBFBD><EFBFBD>
|
||||
//ƫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>32
|
||||
//ASCII<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
||||
//ƫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>32
|
||||
//<EFBFBD><EFBFBD>С:12*6
|
||||
/************************************6*8<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>************************************/
|
||||
const unsigned char F6x8[][6] =
|
||||
#define __OLEDFONT_H
|
||||
//常用ASCII表
|
||||
//偏移量32
|
||||
//ASCII字符集
|
||||
//偏移量32
|
||||
//大小:12*6
|
||||
/************************************6*8的点阵************************************/
|
||||
const unsigned char 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
|
||||
{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
|
||||
};
|
||||
/****************************************8*16<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>************************************/
|
||||
const unsigned char F8X16[]=
|
||||
/****************************************8*16的点阵************************************/
|
||||
const unsigned char 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
|
||||
@@ -203,30 +203,28 @@ const unsigned char F8X16[]=
|
||||
char Hzk[][32]={
|
||||
|
||||
{0x40,0x3C,0x10,0xFF,0x10,0x10,0x20,0x10,0x8F,0x78,0x08,0xF8,0x08,0xF8,0x00,0x00},
|
||||
{0x02,0x06,0x02,0xFF,0x01,0x01,0x04,0x42,0x21,0x18,0x46,0x81,0x40,0x3F,0x00,0x00},/*"<EFBFBD><EFBFBD>",0*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x02,0x06,0x02,0xFF,0x01,0x01,0x04,0x42,0x21,0x18,0x46,0x81,0x40,0x3F,0x00,0x00},/*"物",0*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
|
||||
{0x02,0xFE,0x92,0x92,0xFE,0x02,0x00,0x10,0x11,0x16,0xF0,0x14,0x13,0x10,0x00,0x00},
|
||||
{0x10,0x1F,0x08,0x08,0xFF,0x04,0x81,0x41,0x31,0x0D,0x03,0x0D,0x31,0x41,0x81,0x00},/*"<EFBFBD><EFBFBD>",1*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x10,0x1F,0x08,0x08,0xFF,0x04,0x81,0x41,0x31,0x0D,0x03,0x0D,0x31,0x41,0x81,0x00},/*"联",1*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
|
||||
{0x00,0xFE,0x02,0x22,0x42,0x82,0x72,0x02,0x22,0x42,0x82,0x72,0x02,0xFE,0x00,0x00},
|
||||
{0x00,0xFF,0x10,0x08,0x06,0x01,0x0E,0x10,0x08,0x06,0x01,0x4E,0x80,0x7F,0x00,0x00},/*"<EFBFBD><EFBFBD>",2*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x00,0xFF,0x10,0x08,0x06,0x01,0x0E,0x10,0x08,0x06,0x01,0x4E,0x80,0x7F,0x00,0x00},/*"网",2*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
|
||||
{0x00,0x80,0x60,0xF8,0x07,0x00,0xFE,0x52,0x52,0x52,0x52,0x52,0xFE,0x00,0x00,0x00},
|
||||
{0x01,0x00,0x00,0xFF,0x08,0x88,0x4F,0x29,0x09,0x09,0x09,0x29,0x4F,0x88,0x08,0x00},/*"<EFBFBD><EFBFBD>",3*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x01,0x00,0x00,0xFF,0x08,0x88,0x4F,0x29,0x09,0x09,0x09,0x29,0x4F,0x88,0x08,0x00},/*"俱",3*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
|
||||
{0x00,0x00,0xE0,0x9C,0x84,0x84,0x84,0xF4,0x82,0x82,0x83,0x82,0x80,0x80,0x00,0x00},
|
||||
{0x00,0x20,0x10,0x08,0x06,0x40,0x80,0x7F,0x00,0x00,0x02,0x04,0x08,0x30,0x00,0x00},/*"<EFBFBD><EFBFBD>",4*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x00,0x20,0x10,0x08,0x06,0x40,0x80,0x7F,0x00,0x00,0x02,0x04,0x08,0x30,0x00,0x00},/*"乐",4*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
|
||||
{0x40,0x44,0x54,0x65,0x46,0x44,0x64,0x54,0x44,0x40,0xFE,0x02,0x22,0xDA,0x06,0x00},
|
||||
{0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0xFF,0x08,0x10,0x08,0x07,0x00},/*"<EFBFBD><EFBFBD>",5*/
|
||||
/* (16 X 16 , <EFBFBD><EFBFBD><EFBFBD><EFBFBD> )*/
|
||||
{0x00,0x00,0x7E,0x22,0x22,0x22,0x22,0x7E,0x00,0x00,0xFF,0x08,0x10,0x08,0x07,0x00},/*"部",5*/
|
||||
/* (16 X 16 , 宋体 )*/
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -53,12 +53,12 @@ void board_init(void)
|
||||
DHT11_Init();
|
||||
OLED_Init();
|
||||
OLED_Clear();
|
||||
OLED_ShowCHinese(0,0,0);
|
||||
OLED_ShowCHinese(18,0,1);
|
||||
OLED_ShowCHinese(36,0,2);
|
||||
OLED_ShowCHinese(54,0,3);
|
||||
OLED_ShowCHinese(72,0,4);
|
||||
OLED_ShowCHinese(90,0,5);
|
||||
OLED_ShowChinese(0,0,0);
|
||||
OLED_ShowChinese(18,0,1);
|
||||
OLED_ShowChinese(36,0,2);
|
||||
OLED_ShowChinese(54,0,3);
|
||||
OLED_ShowChinese(72,0,4);
|
||||
OLED_ShowChinese(90,0,5);
|
||||
OLED_ShowString(0,2,(uint8_t*)str,16);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user