Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67d542ddab | |||
| 62d5ffa23f | |||
| 69cc47631c | |||
| 309fca279b | |||
| bc2aa4ac9d | |||
| 4dece19fcb | |||
| f321bcba85 | |||
| a32347ff97 | |||
| dc98512a38 | |||
| 420ba224f2 | |||
| c16ebab17f | |||
| 43ca4d640c | |||
| cc2db4d0a7 | |||
| 0b3b6af977 | |||
| 2fe8e3a952 | |||
| 3cf9b1dd06 | |||
| 52f7163978 | |||
| 7999ace8d8 | |||
| 14b7ba4ecc | |||
| e789696544 | |||
| c7edd54f00 | |||
| 1dd916937d | |||
| ad529f5c53 | |||
| 47cee72ffa | |||
| f677bbecc8 | |||
| 8cf4574325 | |||
| 1407d87385 | |||
| 821c3616f8 | |||
| d7560cc5b0 | |||
| 2fd672a098 | |||
| 34a9f6d374 | |||
| 56506db572 | |||
| 4316843201 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -56,5 +56,6 @@ dkms.conf
|
|||||||
/Project/DebugConfig
|
/Project/DebugConfig
|
||||||
/Project/Listings
|
/Project/Listings
|
||||||
/Project/Objects
|
/Project/Objects
|
||||||
*.uvguix.lenovo
|
*.uvguix.*
|
||||||
*.uvoptx
|
*.uvoptx
|
||||||
|
*.scvd
|
||||||
@ -31,8 +31,8 @@
|
|||||||
; </h>
|
; </h>
|
||||||
|
|
||||||
;Stack_Size EQU 0x00000400
|
;Stack_Size EQU 0x00000400
|
||||||
;栈大小设置为 262144 Bytes
|
;栈大小设置为 131072 Bytes
|
||||||
Stack_Size EQU 0x00040000
|
Stack_Size EQU 0x00020000
|
||||||
|
|
||||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||||
Stack_Mem SPACE Stack_Size
|
Stack_Mem SPACE Stack_Size
|
||||||
@ -44,8 +44,8 @@ __initial_sp
|
|||||||
; </h>
|
; </h>
|
||||||
|
|
||||||
;Heap_Size EQU 0x00000200
|
;Heap_Size EQU 0x00000200
|
||||||
;堆大小设置为 262144 Bytes
|
;堆大小设置为 393216 Bytes
|
||||||
Heap_Size EQU 0x00040000
|
Heap_Size EQU 0x00060000
|
||||||
|
|
||||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||||
__heap_base
|
__heap_base
|
||||||
|
|||||||
@ -151,11 +151,11 @@ void PendSV_Handler(void)
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void SysTick_Handler(void)
|
// void SysTick_Handler(void)
|
||||||
{
|
// {
|
||||||
HAL_IncTick();
|
// HAL_IncTick();
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|||||||
20
Hardware/hc12/hc12.c
Normal file
20
Hardware/hc12/hc12.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//HC12 库
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "hc25.h"
|
||||||
|
|
||||||
|
/**************************************** 私有变量 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
void HC12_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
19
Hardware/hc12/hc12.h
Normal file
19
Hardware/hc12/hc12.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
//HC12 ¿â
|
||||||
|
|
||||||
|
#ifndef __HC12_H
|
||||||
|
#define __HC12_H
|
||||||
|
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
#define HC12_COM COM3
|
||||||
|
|
||||||
|
#define HC12_SendBuff(__pdata__, __data_len__) Uart_SendBuf(HC12_COM, __pdata__, __data_len__)
|
||||||
|
#define HC12_Receive(__pdata__) Uart_GetChar(HC12_COM, __pdata__)
|
||||||
|
#define HC12_ReceiveBuffUntil(__pdata__, __end_byte__, __timeout__) Uart_GetBuffUntil(HC12_COM, __pdata__, __end_byte__, __timeout__)
|
||||||
|
#define HC12_ClearSend Uart_ClearTxFifo(HC12_COM)
|
||||||
|
#define HC12_ClearReceive Uart_ClearRxFifo(HC12_COM)
|
||||||
|
#define HC12_BindReceiveHandle(__receive__) Uart_BindReceiveHandle(HC12_COM, __receive__)
|
||||||
|
|
||||||
|
void HC12_Init(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
32
Hardware/hc25/hc25.c
Normal file
32
Hardware/hc25/hc25.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
//HC25 库
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "led.h"
|
||||||
|
|
||||||
|
#include "hc25.h"
|
||||||
|
|
||||||
|
/**************************************** 私有变量 ****************************************/
|
||||||
|
|
||||||
|
uint8_t is_at_mode = 1; //开机时默认 AT 模式打开,防止出错
|
||||||
|
uint8_t at_cmd[30];
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
void HC25_Init(void)
|
||||||
|
{
|
||||||
|
HC25_ExitATMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HC25_SendATCmd(uint8_t *cmd)
|
||||||
|
{
|
||||||
|
strcpy(at_cmd, "AT+");
|
||||||
|
strcat(at_cmd, cmd);
|
||||||
|
HC25_SendBuff(at_cmd, strlen(at_cmd) + 1);
|
||||||
|
}
|
||||||
39
Hardware/hc25/hc25.h
Normal file
39
Hardware/hc25/hc25.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//HC25 ¿â
|
||||||
|
|
||||||
|
#ifndef __HC25_H
|
||||||
|
#define __HC25_H
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "uart.h"
|
||||||
|
|
||||||
|
#define HC25_COM COM2
|
||||||
|
|
||||||
|
#define HC25_SendBuff(__pdata__, __data_len__) \
|
||||||
|
Uart_SendBuf(HC25_COM, __pdata__, __data_len__); \
|
||||||
|
Delay_ms(50)
|
||||||
|
#define HC25_Receive(__pdata__) Uart_GetChar(HC25_COM, __pdata__)
|
||||||
|
#define HC25_ReceiveBuffUntil(__pdata__, __end_byte__, __timeout__) Uart_GetBuffUntil(HC25_COM, __pdata__, __end_byte__, __timeout__)
|
||||||
|
#define HC25_ClearSend Uart_ClearTxFifo(HC25_COM)
|
||||||
|
#define HC25_ClearReceive Uart_ClearRxFifo(HC25_COM)
|
||||||
|
#define HC25_EnterATMode \
|
||||||
|
if (is_at_mode == 0) \
|
||||||
|
{ \
|
||||||
|
HC25_SendBuff("+++", 4); \
|
||||||
|
Delay_ms(200); \
|
||||||
|
is_at_mode = 1; \
|
||||||
|
HC25_ClearReceive; \
|
||||||
|
}
|
||||||
|
#define HC25_ExitATMode \
|
||||||
|
if (is_at_mode == 1) \
|
||||||
|
{ \
|
||||||
|
HC25_SendATCmd("ENTM"); \
|
||||||
|
Delay_ms(200); \
|
||||||
|
is_at_mode = 0; \
|
||||||
|
HC25_ClearReceive; \
|
||||||
|
}
|
||||||
|
|
||||||
|
void HC25_Init(void);
|
||||||
|
|
||||||
|
void HC25_SendATCmd(uint8_t *cmd);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,68 +1,348 @@
|
|||||||
//按键操作
|
//按键 FIFO 库
|
||||||
|
|
||||||
#include "delay.h"
|
#include "adc.h"
|
||||||
#include "gpio.h"
|
|
||||||
|
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
|
||||||
/**
|
#define DIGITAL_KEY_NUM 3 //数字信号按键个数
|
||||||
* @brief KEY1 KEY2 初始化函数
|
#define ADC_KEY_NUM 4 //模拟信号按键个数
|
||||||
*/
|
#define KEY_COUNT (DIGITAL_KEY_NUM + ADC_KEY_NUM)
|
||||||
void KEY_Init(void)
|
|
||||||
|
//使能 GPIO 时钟
|
||||||
|
#define ALL_KEY_GPIO_CLK_ENABLE() \
|
||||||
|
{ \
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE(); \
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE(); \
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE(); \
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
GPIO_E3_C5_Init();
|
GPIO_TypeDef *gpio;
|
||||||
|
uint16_t pin;
|
||||||
|
} X_GPIO_T;
|
||||||
|
|
||||||
|
static const X_GPIO_T s_gpio_list[DIGITAL_KEY_NUM] = {
|
||||||
|
{GPIOE, GPIO_PIN_3}, //KEY1
|
||||||
|
{GPIOC, GPIO_PIN_5}, //KEY2
|
||||||
|
{GPIOD, GPIO_PIN_10} //JOY_OK
|
||||||
|
};
|
||||||
|
|
||||||
|
static volatile KEY_T s_tBtn[KEY_COUNT] = {0};
|
||||||
|
static volatile KEY_FIFO_T s_tKey; //按键 FIFO 变量
|
||||||
|
static volatile is_key_clear = 1;
|
||||||
|
|
||||||
|
static void InitKeyVar(void);
|
||||||
|
static void InitKeyDigital(void);
|
||||||
|
static void DetectKey(uint8_t i);
|
||||||
|
|
||||||
|
static uint8_t KeyPinActive(uint8_t _id)
|
||||||
|
{
|
||||||
|
if (_id < DIGITAL_KEY_NUM)
|
||||||
|
{
|
||||||
|
uint8_t level;
|
||||||
|
|
||||||
|
if ((s_gpio_list[_id].gpio->IDR & s_gpio_list[_id].pin) == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (_id < DIGITAL_KEY_NUM + ADC_KEY_NUM)
|
||||||
|
{
|
||||||
|
switch (_id)
|
||||||
|
{
|
||||||
|
case JOY_U:
|
||||||
|
{
|
||||||
|
if (ADC_Get_PC0() < 0.01)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_D:
|
||||||
|
{
|
||||||
|
if (ADC_Get_PC0() > 3.20)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_L:
|
||||||
|
{
|
||||||
|
if (ADC_Get_PC1() < 0.01)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_R:
|
||||||
|
{
|
||||||
|
if (ADC_Get_PC1() > 3.20)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t IsKeyDownFunc(uint8_t _id)
|
||||||
|
{
|
||||||
|
uint8_t count = 0;
|
||||||
|
uint8_t save = UINT8_MAX;
|
||||||
|
|
||||||
|
//判断有几个键按下
|
||||||
|
for (uint8_t i = 0; i < KEY_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (KeyPinActive(i))
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
save = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == 1 && save == _id)
|
||||||
|
return 1; //只有单个键按下时才有效
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取当前按下的键。等待按键释放后结束
|
* @brief 初始化按键
|
||||||
* @retval NO_KEY KEY1 KEY2
|
*/
|
||||||
|
void KEY_Init(void)
|
||||||
|
{
|
||||||
|
InitKeyVar(); //初始化按键变量
|
||||||
|
InitKeyDigital(); //初始化数字按键
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InitKeyDigital(void)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef gpio_init;
|
||||||
|
|
||||||
|
ALL_KEY_GPIO_CLK_ENABLE();
|
||||||
|
|
||||||
|
gpio_init.Mode = GPIO_MODE_INPUT;
|
||||||
|
gpio_init.Pull = GPIO_PULLUP;
|
||||||
|
gpio_init.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < DIGITAL_KEY_NUM; i++)
|
||||||
|
{
|
||||||
|
gpio_init.Pin = s_gpio_list[i].pin;
|
||||||
|
HAL_GPIO_Init(s_gpio_list[i].gpio, &gpio_init);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void InitKeyVar(void)
|
||||||
|
{
|
||||||
|
s_tKey.Read = 0;
|
||||||
|
s_tKey.Write = 0;
|
||||||
|
|
||||||
|
//缺省值
|
||||||
|
for (uint8_t i = 0; i < KEY_COUNT; i++)
|
||||||
|
{
|
||||||
|
s_tBtn[i].LongTime = KEY_LONG_TIME; //若设置为 0 表示不检测长按键事件
|
||||||
|
s_tBtn[i].Count = KEY_FILTER_TIME / 2; //计数器设置为滤波时间的一半
|
||||||
|
s_tBtn[i].State = 0; //按键缺省状态,0 为未按下
|
||||||
|
s_tBtn[i].RepeatSpeed = 0; //按键连发的速度,0 表示不支持连发
|
||||||
|
s_tBtn[i].RepeatCount = 0; //连发计数器
|
||||||
|
}
|
||||||
|
|
||||||
|
//摇杆上下左右,支持长按 1 秒后,自动连发
|
||||||
|
KEY_SetKeyParam(JOY_U, 50, 6);
|
||||||
|
KEY_SetKeyParam(JOY_D, 50, 6);
|
||||||
|
KEY_SetKeyParam(JOY_L, 50, 6);
|
||||||
|
KEY_SetKeyParam(JOY_R, 50, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 将键值压入按键 FIFO。可用于模拟一个按键事件
|
||||||
|
* @param _KeyCode: 键值
|
||||||
|
*/
|
||||||
|
void KEY_PutKey(uint8_t _KeyCode)
|
||||||
|
{
|
||||||
|
s_tKey.Buf[s_tKey.Write] = _KeyCode;
|
||||||
|
|
||||||
|
if (++s_tKey.Write >= KEY_FIFO_SIZE)
|
||||||
|
{
|
||||||
|
s_tKey.Write = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 从按键 FIFO 读取一个键值
|
||||||
|
* @retval 键值
|
||||||
*/
|
*/
|
||||||
uint8_t KEY_GetKey(void)
|
uint8_t KEY_GetKey(void)
|
||||||
{
|
{
|
||||||
if (KEY1_Val == 0)
|
if (s_tKey.Read == s_tKey.Write)
|
||||||
{
|
{
|
||||||
Delay_ms(10);
|
return KEY_NONE;
|
||||||
|
|
||||||
if (KEY1_Val == 0)
|
|
||||||
{
|
|
||||||
while (KEY1_Val == 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
return KEY1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (KEY2_Val == 0)
|
else
|
||||||
{
|
{
|
||||||
Delay_ms(10);
|
uint8_t ret = s_tKey.Buf[s_tKey.Read];
|
||||||
|
|
||||||
if (KEY2_Val == 0)
|
if (++s_tKey.Read >= KEY_FIFO_SIZE)
|
||||||
|
s_tKey.Read = 0;
|
||||||
|
|
||||||
|
if (
|
||||||
|
ret == KEY1_UP ||
|
||||||
|
ret == KEY2_UP ||
|
||||||
|
ret == JOY_OK_UP ||
|
||||||
|
ret == JOY_U_UP ||
|
||||||
|
ret == JOY_D_UP ||
|
||||||
|
ret == JOY_L_UP ||
|
||||||
|
ret == JOY_R_UP)
|
||||||
{
|
{
|
||||||
while (KEY2_Val == 0)
|
if (is_key_clear)
|
||||||
;
|
{
|
||||||
|
is_key_clear = 0;
|
||||||
|
return KEY_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return KEY2;
|
is_key_clear = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 从按键 FIFO 读取一个键值,空值时阻塞
|
||||||
|
* @retval 键值
|
||||||
|
*/
|
||||||
|
uint8_t KEY_GetKeyWait(void)
|
||||||
|
{
|
||||||
|
uint8_t key = KEY_NONE;
|
||||||
|
|
||||||
|
while (key == KEY_NONE)
|
||||||
|
key = KEY_GetKey();
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 读取某键状态
|
||||||
|
* @param _ucKeyID: 按键 ID
|
||||||
|
* @retval 1 表示按下,0 表示未按下
|
||||||
|
*/
|
||||||
|
uint8_t KEY_GetKeyState(KEY_ID_E _ucKeyID)
|
||||||
|
{
|
||||||
|
return s_tBtn[_ucKeyID].State;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 等待特定键按下
|
||||||
|
* @param _ucKeyID: 按键 ID
|
||||||
|
*/
|
||||||
|
void KEY_WaitKey(KEY_ID_E _ucKeyID)
|
||||||
|
{
|
||||||
|
while (KEY_GetKeyState(_ucKeyID) != 1)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设置按键参数
|
||||||
|
* @param _ucKeyID: 按键 ID
|
||||||
|
* @param _LongTime: 长按事件时间
|
||||||
|
* @param _RepeatSpeed: 连发速度
|
||||||
|
*/
|
||||||
|
void KEY_SetKeyParam(uint8_t _ucKeyID, uint16_t _LongTime, uint8_t _RepeatSpeed)
|
||||||
|
{
|
||||||
|
s_tBtn[_ucKeyID].LongTime = _LongTime; //长按时间 0 表示不检测长按键事件
|
||||||
|
s_tBtn[_ucKeyID].RepeatSpeed = _RepeatSpeed; //按键连发的速度,0 表示不支持连发
|
||||||
|
s_tBtn[_ucKeyID].RepeatCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 清空按键 FIFO
|
||||||
|
*/
|
||||||
|
void KEY_ClearKey(void)
|
||||||
|
{
|
||||||
|
s_tKey.Read = s_tKey.Write;
|
||||||
|
is_key_clear = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DetectKey(uint8_t i)
|
||||||
|
{
|
||||||
|
KEY_T *pBtn;
|
||||||
|
|
||||||
|
pBtn = &s_tBtn[i];
|
||||||
|
if (IsKeyDownFunc(i))
|
||||||
|
{
|
||||||
|
if (pBtn->Count < KEY_FILTER_TIME)
|
||||||
|
{
|
||||||
|
pBtn->Count = KEY_FILTER_TIME;
|
||||||
|
}
|
||||||
|
else if (pBtn->Count < 2 * KEY_FILTER_TIME)
|
||||||
|
{
|
||||||
|
pBtn->Count++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pBtn->State == 0)
|
||||||
|
{
|
||||||
|
pBtn->State = 1;
|
||||||
|
|
||||||
|
KEY_PutKey((uint8_t)(3 * i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pBtn->LongTime > 0)
|
||||||
|
{
|
||||||
|
if (pBtn->LongCount < pBtn->LongTime)
|
||||||
|
{
|
||||||
|
if (++pBtn->LongCount == pBtn->LongTime)
|
||||||
|
{
|
||||||
|
KEY_PutKey((uint8_t)(3 * i + 3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pBtn->RepeatSpeed > 0)
|
||||||
|
{
|
||||||
|
if (++pBtn->RepeatCount >= pBtn->RepeatSpeed)
|
||||||
|
{
|
||||||
|
pBtn->RepeatCount = 0;
|
||||||
|
KEY_PutKey((uint8_t)(3 * i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NO_KEY;
|
if (pBtn->Count > KEY_FILTER_TIME)
|
||||||
}
|
{
|
||||||
|
pBtn->Count = KEY_FILTER_TIME;
|
||||||
|
}
|
||||||
|
else if (pBtn->Count != 0)
|
||||||
|
{
|
||||||
|
pBtn->Count--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pBtn->State == 1)
|
||||||
|
{
|
||||||
|
pBtn->State = 0;
|
||||||
|
|
||||||
return NO_KEY;
|
KEY_PutKey((uint8_t)(3 * i + 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pBtn->LongCount = 0;
|
||||||
|
pBtn->RepeatCount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 等待键按下并获取键值。等待按键释放后结束
|
* @brief 扫描所有按键。非阻塞,应被 SysTick 中断周期性的调用,10ms 一次
|
||||||
* @retval KEY1 KEY2
|
|
||||||
*/
|
*/
|
||||||
uint8_t KEY_GetKeyWait(void)
|
void KEY_Scan10ms(void)
|
||||||
{
|
{
|
||||||
uint8_t key = NO_KEY;
|
for (uint8_t i = 0; i < KEY_COUNT; i++)
|
||||||
|
DetectKey(i);
|
||||||
while (key == NO_KEY)
|
|
||||||
{
|
|
||||||
key = KEY_GetKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,117 @@
|
|||||||
//°´¼ü²Ù×÷
|
//按键 FIFO 库
|
||||||
|
|
||||||
#ifndef __KEY_H
|
#ifndef __KEY_H
|
||||||
#define __KEY_H
|
#define __KEY_H
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
#define NO_KEY 0
|
//按键事件别名
|
||||||
#define KEY1 1
|
|
||||||
#define KEY2 2
|
|
||||||
#define KEY3 3
|
|
||||||
#define KEY4 4
|
|
||||||
|
|
||||||
#define KEY1_Val HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_3)
|
#define KEY1_DOWN KEY_1_DOWN
|
||||||
#define KEY2_Val HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_5)
|
#define KEY1_UP KEY_1_UP
|
||||||
|
#define KEY1_LONG KEY_1_LONG
|
||||||
|
|
||||||
|
#define KEY2_DOWN KEY_2_DOWN
|
||||||
|
#define KEY2_UP KEY_2_UP
|
||||||
|
#define KEY2_LONG KEY_2_LONG
|
||||||
|
|
||||||
|
#define JOY_OK_DOWN KEY_3_DOWN //OK
|
||||||
|
#define JOY_OK_UP KEY_3_UP
|
||||||
|
#define JOY_OK_LONG KEY_3_LONG
|
||||||
|
|
||||||
|
#define JOY_U_DOWN KEY_4_DOWN //上
|
||||||
|
#define JOY_U_UP KEY_4_UP
|
||||||
|
#define JOY_U_LONG KEY_4_LONG
|
||||||
|
|
||||||
|
#define JOY_D_DOWN KEY_5_DOWN //下
|
||||||
|
#define JOY_D_UP KEY_5_UP
|
||||||
|
#define JOY_D_LONG KEY_5_LONG
|
||||||
|
|
||||||
|
#define JOY_L_DOWN KEY_6_DOWN //左
|
||||||
|
#define JOY_L_UP KEY_6_UP
|
||||||
|
#define JOY_L_LONG KEY_6_LONG
|
||||||
|
|
||||||
|
#define JOY_R_DOWN KEY_7_DOWN //右
|
||||||
|
#define JOY_R_UP KEY_7_UP
|
||||||
|
#define JOY_R_LONG KEY_7_LONG
|
||||||
|
|
||||||
|
//按键 ID
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
KEY1 = 0,
|
||||||
|
KEY2,
|
||||||
|
JOY_OK,
|
||||||
|
JOY_U,
|
||||||
|
JOY_D,
|
||||||
|
JOY_L,
|
||||||
|
JOY_R
|
||||||
|
} KEY_ID_E;
|
||||||
|
|
||||||
|
#define KEY_FILTER_TIME 5 //按键滤波时间 50ms,单位 10ms
|
||||||
|
#define KEY_LONG_TIME 100 //持续 1 秒,长按事件
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t (*IsKeyDownFunc)(void); //按键按下的判断函数,1 表示按下
|
||||||
|
|
||||||
|
uint8_t Count; //滤波器计数器
|
||||||
|
uint16_t LongCount; //长按计数器
|
||||||
|
uint16_t LongTime; //按键按下持续时间,0 表示不检测长按
|
||||||
|
uint8_t State; //按键当前状态(按下还是弹起)
|
||||||
|
uint8_t RepeatSpeed; //连续按键周期
|
||||||
|
uint8_t RepeatCount; //连续按键计数器
|
||||||
|
} KEY_T;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
KEY_NONE = 0,
|
||||||
|
|
||||||
|
KEY_1_DOWN, //1 键按下
|
||||||
|
KEY_1_UP, //1 键弹起
|
||||||
|
KEY_1_LONG, //1 键长按
|
||||||
|
|
||||||
|
KEY_2_DOWN, //2 键按下
|
||||||
|
KEY_2_UP, //2 键弹起
|
||||||
|
KEY_2_LONG, //2 键长按
|
||||||
|
|
||||||
|
KEY_3_DOWN, //3 键按下
|
||||||
|
KEY_3_UP, //3 键弹起
|
||||||
|
KEY_3_LONG, //3 键长按
|
||||||
|
|
||||||
|
KEY_4_DOWN, //4 键按下
|
||||||
|
KEY_4_UP, //4 键弹起
|
||||||
|
KEY_4_LONG, //4 键长按
|
||||||
|
|
||||||
|
KEY_5_DOWN, //5 键按下
|
||||||
|
KEY_5_UP, //5 键弹起
|
||||||
|
KEY_5_LONG, //5 键长按
|
||||||
|
|
||||||
|
KEY_6_DOWN, //6 键按下
|
||||||
|
KEY_6_UP, //6 键弹起
|
||||||
|
KEY_6_LONG, //6 键长按
|
||||||
|
|
||||||
|
KEY_7_DOWN, //7 键按下
|
||||||
|
KEY_7_UP, //7 键弹起
|
||||||
|
KEY_7_LONG, //7 键长按
|
||||||
|
} KEY_ENUM;
|
||||||
|
|
||||||
|
//按键 FIFO 变量
|
||||||
|
#define KEY_FIFO_SIZE 10
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t Buf[KEY_FIFO_SIZE]; //键值缓冲区
|
||||||
|
uint8_t Read; //缓冲区读指针
|
||||||
|
uint8_t Write; //缓冲区写指针
|
||||||
|
} KEY_FIFO_T;
|
||||||
|
|
||||||
void KEY_Init(void);
|
void KEY_Init(void);
|
||||||
|
void KEY_Scan10ms(void);
|
||||||
|
void KEY_PutKey(uint8_t _KeyCode);
|
||||||
uint8_t KEY_GetKey(void);
|
uint8_t KEY_GetKey(void);
|
||||||
uint8_t KEY_GetKeyWait(void);
|
uint8_t KEY_GetKeyWait(void);
|
||||||
|
uint8_t KEY_GetKeyState(KEY_ID_E _ucKeyID);
|
||||||
|
void KEY_WaitKey(KEY_ID_E _ucKeyID);
|
||||||
|
void KEY_SetKeyParam(uint8_t _ucKeyID, uint16_t _LongTime, uint8_t _RepeatSpeed);
|
||||||
|
void KEY_ClearKey(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
#include "delay.h"
|
//LCD 库(ILI9431 及字库)
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
/**************************************** 私有函数 ****************************************/
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
void LCD_SetWin(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,7 +116,15 @@ void LCD_SendCmdDataBytes(uint8_t cmd, uint8_t *pData, uint32_t Count)
|
|||||||
void LCD_Init(void)
|
void LCD_Init(void)
|
||||||
{
|
{
|
||||||
//初始化 ILI9431
|
//初始化 ILI9431
|
||||||
GPIO_B0_B1_B12_Init(); //³õʼ»¯ PB0 PB1 PB12
|
//初始化 PB0 PB1 PB12
|
||||||
|
GPIO_InitTypeDef GPIO_Initure;
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE(); //开启 PB 时钟
|
||||||
|
|
||||||
|
GPIO_Initure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_12; //PB0 PB1 PB12
|
||||||
|
GPIO_Initure.Mode = GPIO_MODE_OUTPUT_PP; //推挽输出
|
||||||
|
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
||||||
|
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_Initure); //初始化 PB0 PB1 PB12
|
||||||
|
|
||||||
LCD_Stop_Send;
|
LCD_Stop_Send;
|
||||||
LCD_Data_Mode_On;
|
LCD_Data_Mode_On;
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
//LCD ¿â£¨ILI9431 ¼°×ֿ⣩
|
||||||
|
|
||||||
#ifndef __LCD_H
|
#ifndef __LCD_H
|
||||||
#define __LCD_H
|
#define __LCD_H
|
||||||
|
|
||||||
@ -155,6 +157,7 @@
|
|||||||
#define LCD_Reverse_Off LCD_SendCmd(LCD_CMD_DINVOFF) //关全局反色模式
|
#define LCD_Reverse_Off LCD_SendCmd(LCD_CMD_DINVOFF) //关全局反色模式
|
||||||
|
|
||||||
#define LCD_RAM_Wr LCD_SendCmd(LCD_CMD_RAMWR) //开始写显存
|
#define LCD_RAM_Wr LCD_SendCmd(LCD_CMD_RAMWR) //开始写显存
|
||||||
|
#define LCD_RAM_Rd LCD_SendCmd(LCD_CMD_RAMRD) //¿ªÊ¼¶ÁÏÔ´æ
|
||||||
|
|
||||||
/**************************************** 通讯函数 ****************************************/
|
/**************************************** 通讯函数 ****************************************/
|
||||||
|
|
||||||
@ -173,6 +176,7 @@ void LCD_SendCmdDataBytes(uint8_t cmd, uint8_t *pData, uint32_t Count);
|
|||||||
/**************************************** 操作函数 ****************************************/
|
/**************************************** 操作函数 ****************************************/
|
||||||
|
|
||||||
void LCD_Init(void);
|
void LCD_Init(void);
|
||||||
|
void LCD_SetWin(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
||||||
|
|
||||||
void LCD_Font_ReadAddr(uint8_t *pData, uint32_t addr, uint16_t Count);
|
void LCD_Font_ReadAddr(uint8_t *pData, uint32_t addr, uint16_t Count);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
#include "gpio.h"
|
//LED 库
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
|
||||||
@ -7,6 +9,34 @@
|
|||||||
*/
|
*/
|
||||||
void LED_Init(void)
|
void LED_Init(void)
|
||||||
{
|
{
|
||||||
GPIO_A1_Init();
|
GPIO_InitTypeDef GPIO_Initure;
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE(); //开启 PA 时钟
|
||||||
|
|
||||||
|
GPIO_Initure.Pin = GPIO_PIN_1; //PA1
|
||||||
|
GPIO_Initure.Mode = GPIO_MODE_OUTPUT_PP; //推挽输出
|
||||||
|
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
||||||
|
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_Initure); //初始化 PA1
|
||||||
|
|
||||||
LED2_Off;
|
LED2_Off;
|
||||||
|
SysTick_StartTimer(LED2_SYSTICK_TIMER_ID, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LED2 慢速翻转,无阻塞,防止因调用过快导致无法观察
|
||||||
|
* @param led_num: 序号
|
||||||
|
*/
|
||||||
|
void LED_Slow_Toggle(uint8_t led_num)
|
||||||
|
{
|
||||||
|
switch (led_num)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
if (SysTick_CheckTimer(LED2_SYSTICK_TIMER_ID))
|
||||||
|
{
|
||||||
|
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_1);
|
||||||
|
SysTick_StartTimer(LED2_SYSTICK_TIMER_ID, 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
//LED 库
|
||||||
|
|
||||||
#ifndef _LED_H
|
#ifndef _LED_H
|
||||||
#define _LED_H
|
#define _LED_H
|
||||||
|
|
||||||
@ -6,8 +8,11 @@
|
|||||||
#define LED2(n) (n ? HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET) : HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET))
|
#define LED2(n) (n ? HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET) : HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET))
|
||||||
#define LED2_On LED2(0)
|
#define LED2_On LED2(0)
|
||||||
#define LED2_Off LED2(1)
|
#define LED2_Off LED2(1)
|
||||||
#define LED2_Toggle (HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_1)) //LED2 ·×ª
|
#define LED2_Toggle HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_1) //LED2 翻转
|
||||||
|
#define LED2_SYSTICK_TIMER_ID 0
|
||||||
|
#define LED2_Slow_Toggle LED_Slow_Toggle(2) //LED2 慢速翻转,无阻塞,防止因调用过快导致无法观察
|
||||||
|
|
||||||
void LED_Init(void);
|
void LED_Init(void);
|
||||||
|
void LED_Slow_Toggle(uint8_t led_num);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -80,73 +80,18 @@
|
|||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
#include "sdio.h"
|
#include "sdio.h"
|
||||||
|
|
||||||
/** @addtogroup BSP
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32H743I_EVAL
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32H743I_EVAL_SD
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup STM32H743I_EVAL_SD_Private_TypesDefinitions SD Private TypesDefinitions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup STM32H743I_EVAL_SD_Private_Defines SD Private Defines
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* 卡插入引脚 : PG9 */
|
|
||||||
//#define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
//#define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||||
|
|
||||||
//#define SD_DETECT_GPIO_PORT GPIOG
|
//#define SD_DETECT_GPIO_PORT GPIOG
|
||||||
//#define SD_DETECT_PIN GPIO_PIN_9
|
//#define SD_DETECT_PIN GPIO_PIN_9
|
||||||
|
|
||||||
/* PG9 == 0 表示卡插入 */
|
|
||||||
//#define SD_IS_INSERTED() ((SD_DETECT_GPIO_PORT->IDR & SD_DETECT_PIN) == 0)
|
//#define SD_IS_INSERTED() ((SD_DETECT_GPIO_PORT->IDR & SD_DETECT_PIN) == 0)
|
||||||
|
|
||||||
#define SD_IS_INSERTED() 1
|
#define SD_IS_INSERTED() 1
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup STM32H743I_EVAL_SD_Private_Macros SD Private Macros
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup STM32H743I_EVAL_SD_Private_Variables SD Private Variables
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
SD_HandleTypeDef uSdHandle;
|
SD_HandleTypeDef uSdHandle;
|
||||||
//static uint8_t UseExtiModeDetection = 0;
|
//static uint8_t UseExtiModeDetection = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @defgroup STM32H743I_EVAL_SD_Private_FunctionPrototypes SD Private FunctionPrototypes
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @addtogroup STM32H743I_EVAL_SD_Exported_Functions
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the SD card device.
|
* @brief Initializes the SD card device.
|
||||||
* @retval SD status
|
* @retval SD status
|
||||||
@ -563,14 +508,6 @@ void HAL_SD_DriveTransciver_1_8V_Callback(FlagStatus status)
|
|||||||
BSP_SD_DriveTransciver_1_8V_Callback(status);
|
BSP_SD_DriveTransciver_1_8V_Callback(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*********************************************************************************************************
|
|
||||||
* 函 数 名: SDIO_IRQHandler
|
|
||||||
* 功能说明: SDIO中断
|
|
||||||
* 形 参: 无
|
|
||||||
* 返 回 值: 无
|
|
||||||
*********************************************************************************************************
|
|
||||||
*/
|
|
||||||
void SDMMC1_IRQHandler(void)
|
void SDMMC1_IRQHandler(void)
|
||||||
{
|
{
|
||||||
HAL_SD_IRQHandler(&uSdHandle);
|
HAL_SD_IRQHandler(&uSdHandle);
|
||||||
|
|||||||
@ -251,7 +251,7 @@
|
|||||||
/ buffer in the file system object (FATFS) is used for the file data transfer. */
|
/ buffer in the file system object (FATFS) is used for the file data transfer. */
|
||||||
|
|
||||||
|
|
||||||
#define _FS_EXFAT 0
|
#define _FS_EXFAT 1
|
||||||
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
|
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
|
||||||
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
|
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
|
||||||
/ Note that enabling exFAT discards C89 compatibility. */
|
/ Note that enabling exFAT discards C89 compatibility. */
|
||||||
|
|||||||
@ -339,7 +339,7 @@
|
|||||||
<MiscControls></MiscControls>
|
<MiscControls></MiscControls>
|
||||||
<Define>USE_HAL_DRIVER, STM32H743xx</Define>
|
<Define>USE_HAL_DRIVER, STM32H743xx</Define>
|
||||||
<Undefine></Undefine>
|
<Undefine></Undefine>
|
||||||
<IncludePath>..\Core;..\Hardware\led;..\Hardware\key;..\Hardware\lcd;..\Hardware\sdio;..\Libraries\HAL_Lib\Inc;..\Libraries\FatFs;..\Libraries\FatFs\drivers;..\System\delay;..\System\sys;..\System\spi;..\System\gpio;..\User\Main;..\User\GameEngine;..\User\Picture;..\User\SD;..\User\APP_Reader</IncludePath>
|
<IncludePath>..\User\Main;..\Core;..\Libraries\HAL_Lib\Inc;..\Libraries\FatFs;..\Libraries\FatFs\drivers;..\System\systick;..\System\sys;..\System\spi;..\System\gpio;..\System\tim;..\System\usart;..\System\adc;..\Hardware\led;..\Hardware\key;..\Hardware\lcd;..\Hardware\sdio;..\Hardware\hc25;..\Hardware\hc12;..\User\GameEngine;..\User\Picture;..\User\SD;..\User\WLAN;..\User\Clock;..\User\APP_Reader;..\User\APP_Video;..\User\APP_Plane;..\User\APP_Weather;..\User\APP_Setting;..\User\APP_JumpMan;..\User\APP_Ball;..\User\APP_Gobang;..\User\FxLib</IncludePath>
|
||||||
</VariousControls>
|
</VariousControls>
|
||||||
</Cads>
|
</Cads>
|
||||||
<Aads>
|
<Aads>
|
||||||
@ -425,31 +425,6 @@
|
|||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
|
||||||
<GroupName>System</GroupName>
|
|
||||||
<Files>
|
|
||||||
<File>
|
|
||||||
<FileName>delay.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\System\delay\delay.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>sys.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\System\sys\sys.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>spi.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\System\spi\spi.c</FilePath>
|
|
||||||
</File>
|
|
||||||
<File>
|
|
||||||
<FileName>gpio.c</FileName>
|
|
||||||
<FileType>1</FileType>
|
|
||||||
<FilePath>..\System\gpio\gpio.c</FilePath>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>HAL_Lib</GroupName>
|
<GroupName>HAL_Lib</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
@ -578,6 +553,61 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_spi_ex.c</FilePath>
|
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_spi_ex.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>stm32h7xx_hal_uart.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_uart.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>stm32h7xx_hal_uart_ex.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_uart_ex.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>stm32h7xx_hal_usart.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_usart.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>stm32h7xx_hal_usart_ex.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Libraries\HAL_Lib\Src\stm32h7xx_hal_usart_ex.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>System</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>sys.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\sys\sys.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>spi.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\spi\spi.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>tim.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\tim\tim.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>uart.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\usart\uart.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>systick.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\systick\systick.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>adc.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\System\adc\adc.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
@ -603,6 +633,16 @@
|
|||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\Hardware\sdio\sdio.c</FilePath>
|
<FilePath>..\Hardware\sdio\sdio.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>hc25.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Hardware\hc25\hc25.c</FilePath>
|
||||||
|
</File>
|
||||||
|
<File>
|
||||||
|
<FileName>hc12.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\Hardware\hc12\hc12.c</FilePath>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
@ -669,9 +709,9 @@
|
|||||||
<GroupName>Picture</GroupName>
|
<GroupName>Picture</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
<File>
|
<File>
|
||||||
<FileName>pic_minecraft.c</FileName>
|
<FileName>Picture.c</FileName>
|
||||||
<FileType>1</FileType>
|
<FileType>1</FileType>
|
||||||
<FilePath>..\User\Picture\pic_minecraft.c</FilePath>
|
<FilePath>..\User\Picture\Picture.c</FilePath>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
@ -685,6 +725,26 @@
|
|||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>WLAN</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>WLAN.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\WLAN\WLAN.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>Clock</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>Clock.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\Clock\Clock.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>APP_Reader</GroupName>
|
<GroupName>APP_Reader</GroupName>
|
||||||
<Files>
|
<Files>
|
||||||
@ -695,6 +755,86 @@
|
|||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Video</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Video.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Video\APP_Video.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Plane</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Plane.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Plane\APP_Plane.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Weather</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Weather.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Weather\APP_Weather.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Setting</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Setting.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Setting\APP_Setting.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_JumpMan</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_JumpMan.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_JumpMan\APP_JumpMan.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Ball</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Ball.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Ball\APP_Ball.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>APP_Gobang</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>APP_Gobang.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\APP_Gobang\APP_Gobang.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
|
<Group>
|
||||||
|
<GroupName>Fxlib</GroupName>
|
||||||
|
<Files>
|
||||||
|
<File>
|
||||||
|
<FileName>fxlib.c</FileName>
|
||||||
|
<FileType>1</FileType>
|
||||||
|
<FilePath>..\User\FxLib\fxlib.c</FilePath>
|
||||||
|
</File>
|
||||||
|
</Files>
|
||||||
|
</Group>
|
||||||
</Groups>
|
</Groups>
|
||||||
</Target>
|
</Target>
|
||||||
</Targets>
|
</Targets>
|
||||||
|
|||||||
23
README.md
23
README.md
@ -1 +1,24 @@
|
|||||||
# STM32-Player
|
# STM32-Player
|
||||||
|
|
||||||
|
基于 STM32H743 的多功能对战游戏机平台。
|
||||||
|
|
||||||
|
## 功能介绍
|
||||||
|
|
||||||
|
+ **电子书阅读器**。支持 txt 文件,支持大、小两种字号,支持自动记录上次阅读到的位置。
|
||||||
|
+ **视频播放**。可以播放使用 [Video-Generator](https://github.com/StopPointTeam/Video-Generator) 处理后的视频。带有进度条。
|
||||||
|
+ **飞机大战**。一个简易的飞机大战游戏。
|
||||||
|
+ **天气查询**。向使用 [STM32-Player-Server](https://github.com/StopPointTeam/STM32-Player-Server) 搭建的服务器请求天气信息。
|
||||||
|
+ **五子棋联机对战**。五子棋点对点联机游戏。
|
||||||
|
+ **设置**。支持夜间模式。
|
||||||
|
|
||||||
|
## 系统架构
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 参考资料
|
||||||
|
|
||||||
|
[链接](https://github.com/StopPointTeam/STM32-Player-Doc)
|
||||||
|
|
||||||
|
## 声明
|
||||||
|
|
||||||
|
StopPointTeam 版权所有 2021
|
||||||
|
|||||||
170
System/adc/adc.c
Normal file
170
System/adc/adc.c
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
//ADC 库
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
#include "adc.h"
|
||||||
|
|
||||||
|
//32 字节对齐
|
||||||
|
ALIGN_32BYTES(uint16_t __attribute__((section(".RAM_D3"))) ADCxValues[2]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC 初始化函数
|
||||||
|
*/
|
||||||
|
void ADC_Init(void)
|
||||||
|
{
|
||||||
|
ADC_HandleTypeDef AdcHandle = {0};
|
||||||
|
DMA_HandleTypeDef DMA_Handle = {0};
|
||||||
|
ADC_ChannelConfTypeDef sConfig = {0};
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
|
|
||||||
|
//配置时钟
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_ADC;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2M = 25;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2N = 504;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2P = 7;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2Q = 7;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2R = 7;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2RGE = RCC_PLL2VCIRANGE_0;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2VCOSEL = RCC_PLL2VCOWIDE;
|
||||||
|
PeriphClkInitStruct.PLL2.PLL2FRACN = 0;
|
||||||
|
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//GPIO
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
//DMA
|
||||||
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||||
|
DMA_Handle.Instance = DMA1_Stream1; //使用的DMA1 Stream1
|
||||||
|
DMA_Handle.Init.Request = DMA_REQUEST_ADC3; //请求类型采用 DMA_REQUEST_ADC3
|
||||||
|
DMA_Handle.Init.Direction = DMA_PERIPH_TO_MEMORY; //传输方向是从存储器到外设
|
||||||
|
DMA_Handle.Init.PeriphInc = DMA_PINC_DISABLE; //外设地址自增禁止
|
||||||
|
DMA_Handle.Init.MemInc = DMA_MINC_ENABLE; //存储器地址自增使能
|
||||||
|
DMA_Handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; //外设数据传输位宽选择半字,即 16bit
|
||||||
|
DMA_Handle.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; //存储器数据传输位宽选择半字,即 16bit
|
||||||
|
DMA_Handle.Init.Mode = DMA_CIRCULAR; //循环模式
|
||||||
|
DMA_Handle.Init.Priority = DMA_PRIORITY_LOW; //优先级低
|
||||||
|
DMA_Handle.Init.FIFOMode = DMA_FIFOMODE_DISABLE; //禁止 FIFO
|
||||||
|
DMA_Handle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||||
|
DMA_Handle.Init.MemBurst = DMA_MBURST_SINGLE;
|
||||||
|
DMA_Handle.Init.PeriphBurst = DMA_PBURST_SINGLE;
|
||||||
|
|
||||||
|
if (HAL_DMA_Init(&DMA_Handle) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//关联 ADC 句柄和 DMA 句柄
|
||||||
|
__HAL_LINKDMA(&AdcHandle, DMA_Handle, DMA_Handle);
|
||||||
|
|
||||||
|
//配置 ADC
|
||||||
|
__HAL_RCC_ADC3_CLK_ENABLE();
|
||||||
|
AdcHandle.Instance = ADC3;
|
||||||
|
AdcHandle.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV8; //采用PLL异步时钟,8分频,即 72MHz / 8 = 36MHz
|
||||||
|
AdcHandle.Init.Resolution = ADC_RESOLUTION_16B; //16 位分辨率
|
||||||
|
AdcHandle.Init.ScanConvMode = ADC_SCAN_ENABLE; //开启扫描
|
||||||
|
AdcHandle.Init.EOCSelection = ADC_EOC_SINGLE_CONV; //EOC 转换结束标志
|
||||||
|
AdcHandle.Init.LowPowerAutoWait = DISABLE; //禁止低功耗自动延迟特性
|
||||||
|
AdcHandle.Init.ContinuousConvMode = ENABLE; //启用自动转换
|
||||||
|
AdcHandle.Init.NbrOfConversion = 2; //使用了 2 个转换通道
|
||||||
|
AdcHandle.Init.DiscontinuousConvMode = DISABLE; //禁止不连续模式
|
||||||
|
AdcHandle.Init.NbrOfDiscConversion = 1; //禁止不连续模式后,此参数忽略,此位是用来配置不连续子组中通道数
|
||||||
|
AdcHandle.Init.ExternalTrigConv = ADC_SOFTWARE_START; //采用软件触发
|
||||||
|
AdcHandle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; //采用软件触发的话,此位忽略
|
||||||
|
AdcHandle.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DMA_CIRCULAR; //DMA 循环模式接收 ADC 转换的数据
|
||||||
|
AdcHandle.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; //ADC 转换溢出的话,覆盖 ADC 的数据寄存器
|
||||||
|
AdcHandle.Init.OversamplingMode = DISABLE; //禁止过采样
|
||||||
|
|
||||||
|
//初始化 ADC
|
||||||
|
if (HAL_ADC_Init(&AdcHandle) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//校准 ADC,采用偏移校准
|
||||||
|
if (HAL_ADCEx_Calibration_Start(&AdcHandle, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//序列 1,采样 PC0 引脚
|
||||||
|
sConfig.Channel = ADC_CHANNEL_10;
|
||||||
|
sConfig.Rank = ADC_REGULAR_RANK_1;
|
||||||
|
sConfig.SamplingTime = ADC_SAMPLETIME_810CYCLES_5; //采样周期
|
||||||
|
sConfig.SingleDiff = ADC_SINGLE_ENDED; //单端输入
|
||||||
|
sConfig.OffsetNumber = ADC_OFFSET_NONE; //无偏移
|
||||||
|
sConfig.Offset = 0;
|
||||||
|
sConfig.OffsetRightShift = DISABLE; //禁止右移
|
||||||
|
sConfig.OffsetSignedSaturation = DISABLE; //禁止有符号饱和
|
||||||
|
|
||||||
|
if (HAL_ADC_ConfigChannel(&AdcHandle, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//序列 2,采样 PC1 引脚
|
||||||
|
sConfig.Channel = ADC_CHANNEL_11;
|
||||||
|
sConfig.Rank = ADC_REGULAR_RANK_2;
|
||||||
|
sConfig.SamplingTime = ADC_SAMPLETIME_810CYCLES_5;
|
||||||
|
sConfig.SingleDiff = ADC_SINGLE_ENDED;
|
||||||
|
sConfig.OffsetNumber = ADC_OFFSET_NONE;
|
||||||
|
sConfig.Offset = 0;
|
||||||
|
sConfig.OffsetRightShift = DISABLE;
|
||||||
|
sConfig.OffsetSignedSaturation = DISABLE;
|
||||||
|
|
||||||
|
if (HAL_ADC_ConfigChannel(&AdcHandle, &sConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//启动 ADC 的 DMA 方式传输
|
||||||
|
if (HAL_ADC_Start_DMA(&AdcHandle, (uint32_t *)ADCxValues, 2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler(__FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置定时器
|
||||||
|
TIM_Set(TIM3, 1000, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取 PC0 电压
|
||||||
|
* @retval 电压,单位 V
|
||||||
|
*/
|
||||||
|
float ADC_Get_PC0(void)
|
||||||
|
{
|
||||||
|
return ADCxValues[0] * 3.3 / 65536;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取 PC1 电压
|
||||||
|
* @retval 电压,单位 V
|
||||||
|
*/
|
||||||
|
float ADC_Get_PC1(void)
|
||||||
|
{
|
||||||
|
return ADCxValues[1] * 3.3 / 65536;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM3 中断处理
|
||||||
|
*/
|
||||||
|
void TIM3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if ((TIM3->SR & TIM_FLAG_UPDATE) != RESET)
|
||||||
|
{
|
||||||
|
//清除更新标志
|
||||||
|
TIM3->SR = ~TIM_FLAG_UPDATE;
|
||||||
|
|
||||||
|
SCB_InvalidateDCache_by_Addr((uint32_t *)ADCxValues, sizeof(uint32_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
10
System/adc/adc.h
Normal file
10
System/adc/adc.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
//ADC ¿â
|
||||||
|
|
||||||
|
#ifndef __ADC_H
|
||||||
|
#define __ADC_H
|
||||||
|
|
||||||
|
void ADC_Init(void);
|
||||||
|
float ADC_Get_PC0(void);
|
||||||
|
float ADC_Get_PC1(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,55 +0,0 @@
|
|||||||
//SYSCLK 初始化及延时函数
|
|
||||||
|
|
||||||
#include "delay.h"
|
|
||||||
|
|
||||||
static uint32_t fac_us = 0; //us 延时倍乘数
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 初始化延迟函数
|
|
||||||
* @param SYSCLK: 系统时钟频率
|
|
||||||
*/
|
|
||||||
void SYSCLK_Init(uint16_t SYSCLK)
|
|
||||||
{
|
|
||||||
|
|
||||||
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
|
|
||||||
fac_us = SYSCLK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief us 延迟函数
|
|
||||||
* @param nus: us 数,不可超过 1000
|
|
||||||
*/
|
|
||||||
void Delay_us(uint32_t nus)
|
|
||||||
{
|
|
||||||
uint32_t ticks, told, tnow;
|
|
||||||
uint32_t tcnt = 0;
|
|
||||||
uint32_t reload = SysTick->LOAD; //LOAD 的值
|
|
||||||
ticks = nus * fac_us; //需要的节拍数
|
|
||||||
told = SysTick->VAL; //当前计数器值
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
tnow = SysTick->VAL;
|
|
||||||
if (tnow != told)
|
|
||||||
{
|
|
||||||
if (tnow < told)
|
|
||||||
tcnt += told - tnow;
|
|
||||||
else
|
|
||||||
tcnt += reload - tnow + told;
|
|
||||||
told = tnow;
|
|
||||||
if (tcnt >= ticks)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ms 延迟函数
|
|
||||||
* @param nms: ms 数
|
|
||||||
*/
|
|
||||||
void Delay_ms(uint16_t nms)
|
|
||||||
{
|
|
||||||
uint32_t i;
|
|
||||||
for (i = 0; i < nms; i++)
|
|
||||||
Delay_us(1000);
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
//SYSCLK 初始化及延时函数
|
|
||||||
|
|
||||||
#ifndef __DELAY_H
|
|
||||||
#define __DELAY_H
|
|
||||||
|
|
||||||
#include "sys.h"
|
|
||||||
|
|
||||||
void SYSCLK_Init(uint16_t SYSCLK);
|
|
||||||
void Delay_us(uint32_t nus);
|
|
||||||
void Delay_ms(uint16_t nms);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
//管理所有 GPIO 的初始化
|
//管理 GPIO 的初始化
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
@ -26,26 +26,33 @@ void GPIO_A1_Init(void)
|
|||||||
/************************************** GPIO E3 C5 **************************************/
|
/************************************** GPIO E3 C5 **************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PE3 PC5 初始化,用于 KEY1 KEY2
|
* @brief PE3 PC5 PD10 初始化,用于 KEY1 KEY2 KEY3
|
||||||
*/
|
*/
|
||||||
void GPIO_E3_C5_Init(void)
|
void GPIO_E3_C5_D10_Init(void)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_Initure;
|
GPIO_InitTypeDef GPIO_Initure;
|
||||||
|
|
||||||
__HAL_RCC_GPIOC_CLK_ENABLE(); //开启 PC 时钟
|
__HAL_RCC_GPIOC_CLK_ENABLE(); //开启 PC 时钟
|
||||||
__HAL_RCC_GPIOE_CLK_ENABLE(); //开启 PE 时钟
|
__HAL_RCC_GPIOE_CLK_ENABLE(); //开启 PE 时钟
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE(); //开启 PD 时钟
|
||||||
|
|
||||||
GPIO_Initure.Pin = GPIO_PIN_3; //PE3:对应 K1
|
GPIO_Initure.Pin = GPIO_PIN_3; //PE3:对应 KEY1
|
||||||
GPIO_Initure.Mode = GPIO_MODE_INPUT; //输入
|
GPIO_Initure.Mode = GPIO_MODE_INPUT; //输入
|
||||||
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
||||||
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
||||||
HAL_GPIO_Init(GPIOE, &GPIO_Initure); //初始化 PE3
|
HAL_GPIO_Init(GPIOE, &GPIO_Initure); //初始化 PE3
|
||||||
|
|
||||||
GPIO_Initure.Pin = GPIO_PIN_5; //PC5:对应 K2
|
GPIO_Initure.Pin = GPIO_PIN_5; //PC5:对应 KEY2
|
||||||
GPIO_Initure.Mode = GPIO_MODE_INPUT; //输入
|
GPIO_Initure.Mode = GPIO_MODE_INPUT; //输入
|
||||||
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
||||||
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
||||||
HAL_GPIO_Init(GPIOC, &GPIO_Initure); //初始化 PC5
|
HAL_GPIO_Init(GPIOC, &GPIO_Initure); //初始化 PC5
|
||||||
|
|
||||||
|
GPIO_Initure.Pin = GPIO_PIN_10; //PC5:对应 KEY3
|
||||||
|
GPIO_Initure.Mode = GPIO_MODE_INPUT; //输入
|
||||||
|
GPIO_Initure.Pull = GPIO_PULLUP; //上拉
|
||||||
|
GPIO_Initure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; //高速
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_Initure); //初始化 PD10
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
//管理所有 GPIO 的初始化
|
//管理 GPIO 的初始化
|
||||||
|
|
||||||
#ifndef __GPIO_H
|
#ifndef __GPIO_H
|
||||||
#define __GPIO_H
|
#define __GPIO_H
|
||||||
|
|
||||||
void GPIO_A1_Init(void);
|
void GPIO_A1_Init(void);
|
||||||
void GPIO_E3_C5_Init(void);
|
void GPIO_E3_C5_D10_Init(void);
|
||||||
void GPIO_B0_B1_B12_Init(void);
|
void GPIO_B0_B1_B12_Init(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
223
System/sys/sys.c
223
System/sys/sys.c
@ -1,4 +1,4 @@
|
|||||||
//系统初始化
|
//系统常用调用
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
@ -73,25 +73,23 @@ void Cache_Enable(void)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ³õʼ»¯ÏµÍ³Ê±ÖÓ
|
* @brief ³õʼ»¯ÏµÍ³Ê±ÖÓ
|
||||||
* @param plln: PLL1 倍频系数(PLL倍频),取值范围:4~512
|
|
||||||
* @param pllm: PLL1 预分频系数(进PLL之前的分频),取值范围:2~63
|
|
||||||
* @param pllp: PLL1 的 p 分频系数(PLL之后的分频),分频后作为系统时钟,取值范围:2~128(且必须是 2 的倍数)
|
|
||||||
* @param pllq: PLL1 的 q 分频系数(PLL之后的分频),取值范围:1~128.
|
|
||||||
* @retval 成功返回 0,失败返回 1
|
|
||||||
*/
|
*/
|
||||||
uint8_t Clock_Init(uint32_t plln, uint32_t pllm, uint32_t pllp, uint32_t pllq)
|
void SystemClock_Init(void)
|
||||||
{
|
{
|
||||||
HAL_StatusTypeDef ret = HAL_OK;
|
|
||||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
HAL_StatusTypeDef ret = HAL_OK;
|
||||||
|
|
||||||
|
//锁住SCU (Supply configuration update)
|
||||||
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
|
MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
|
||||||
|
|
||||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY)
|
while (!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//使能 HSE,并选择 HSE 作为 PLL 时钟源
|
||||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||||
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
|
||||||
@ -99,42 +97,47 @@ uint8_t Clock_Init(uint32_t plln, uint32_t pllm, uint32_t pllp, uint32_t pllq)
|
|||||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
|
|
||||||
RCC_OscInitStruct.PLL.PLLN = plln;
|
RCC_OscInitStruct.PLL.PLLM = 5;
|
||||||
RCC_OscInitStruct.PLL.PLLM = pllm;
|
RCC_OscInitStruct.PLL.PLLN = 160;
|
||||||
RCC_OscInitStruct.PLL.PLLP = pllp;
|
RCC_OscInitStruct.PLL.PLLP = 2;
|
||||||
RCC_OscInitStruct.PLL.PLLQ = pllq;
|
RCC_OscInitStruct.PLL.PLLR = 2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 4;
|
||||||
|
|
||||||
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
|
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
|
||||||
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
|
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
|
||||||
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||||
if (ret != HAL_OK)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// QSPI_Enable_Memmapmode(); //QSPI内存映射模式,需要在时钟初始化之前开启,否则会有各种问题
|
/*
|
||||||
|
选择 PLL 的输出作为系统时钟
|
||||||
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK |
|
配置 RCC_CLOCKTYPE_SYSCLK 系统时钟
|
||||||
RCC_CLOCKTYPE_HCLK |
|
配置 RCC_CLOCKTYPE_HCLK 时钟,对应 AHB1 AHB2 AHB3 AHB4 总线
|
||||||
RCC_CLOCKTYPE_D1PCLK1 |
|
配置 RCC_CLOCKTYPE_PCLK1 时钟,对应 APB1 总线
|
||||||
RCC_CLOCKTYPE_PCLK1 |
|
配置 RCC_CLOCKTYPE_PCLK2 时钟,对应 APB2 总线
|
||||||
RCC_CLOCKTYPE_PCLK2 |
|
配置 RCC_CLOCKTYPE_D1PCLK1 时钟,对应 APB3 总线
|
||||||
RCC_CLOCKTYPE_D3PCLK1);
|
配置 RCC_CLOCKTYPE_D3PCLK1 时钟,对应 APB4 总线
|
||||||
|
*/
|
||||||
|
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_D1PCLK1 | RCC_CLOCKTYPE_PCLK1 |
|
||||||
|
RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_D3PCLK1);
|
||||||
|
|
||||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
|
||||||
|
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
|
||||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
|
||||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
|
||||||
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
|
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
|
||||||
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV4;
|
|
||||||
ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
|
ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_4);
|
||||||
if (ret != HAL_OK)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
__HAL_RCC_CSI_ENABLE();
|
__HAL_RCC_CSI_ENABLE();
|
||||||
|
|
||||||
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||||
|
|
||||||
HAL_EnableCompensationCell();
|
HAL_EnableCompensationCell();
|
||||||
|
|
||||||
return 0;
|
__HAL_RCC_D2SRAM1_CLK_ENABLE();
|
||||||
|
__HAL_RCC_D2SRAM2_CLK_ENABLE();
|
||||||
|
__HAL_RCC_D2SRAM3_CLK_ENABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,163 +162,13 @@ uint8_t Get_DCacheSta(void)
|
|||||||
return sta;
|
return sta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void Error_Handler(char *file, uint32_t line)
|
||||||
* @brief QSPI 进入内存映射模式
|
|
||||||
*/
|
|
||||||
void QSPI_Enable_Memmapmode(void)
|
|
||||||
{
|
{
|
||||||
uint32_t tempreg = 0;
|
printf("Wrong parameters value: file %s on line %d\r\n", file, line);
|
||||||
volatile uint32_t *data_reg = &QUADSPI->DR;
|
|
||||||
GPIO_InitTypeDef qspi_gpio;
|
|
||||||
|
|
||||||
RCC->AHB4ENR |= 1 << 1; //使能 PORTB 时钟
|
if (line == 0)
|
||||||
RCC->AHB4ENR |= 1 << 5; //使能 PORTF 时钟
|
return;
|
||||||
RCC->AHB3ENR |= 1 << 14; //QSPI 时钟使能
|
|
||||||
|
|
||||||
qspi_gpio.Pin = GPIO_PIN_6; //PB6 AF10
|
while (1)
|
||||||
qspi_gpio.Mode = GPIO_MODE_AF_PP;
|
;
|
||||||
qspi_gpio.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
||||||
qspi_gpio.Pull = GPIO_NOPULL;
|
|
||||||
qspi_gpio.Alternate = GPIO_AF10_QUADSPI;
|
|
||||||
HAL_GPIO_Init(GPIOB, &qspi_gpio);
|
|
||||||
|
|
||||||
qspi_gpio.Pin = GPIO_PIN_2; //PB2 AF9
|
|
||||||
qspi_gpio.Alternate = GPIO_AF9_QUADSPI;
|
|
||||||
HAL_GPIO_Init(GPIOB, &qspi_gpio);
|
|
||||||
|
|
||||||
qspi_gpio.Pin = GPIO_PIN_6 | GPIO_PIN_7; //PF6 7 AF9
|
|
||||||
qspi_gpio.Alternate = GPIO_AF9_QUADSPI;
|
|
||||||
HAL_GPIO_Init(GPIOF, &qspi_gpio);
|
|
||||||
|
|
||||||
qspi_gpio.Pin = GPIO_PIN_8 | GPIO_PIN_9; //PF8 9 AF10
|
|
||||||
qspi_gpio.Alternate = GPIO_AF10_QUADSPI;
|
|
||||||
HAL_GPIO_Init(GPIOF, &qspi_gpio);
|
|
||||||
|
|
||||||
//QSPI 设置,参考 QSPI 实验的 QSPI_Init 函数
|
|
||||||
RCC->AHB3RSTR |= 1 << 14; //复位 QSPI
|
|
||||||
RCC->AHB3RSTR &= ~(1 << 14); //停止复位 QSPI
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
QUADSPI->CR = 0X01000310; //设置 CR 寄存器
|
|
||||||
QUADSPI->DCR = 0X00160401; //设置 DCR 寄存器
|
|
||||||
QUADSPI->CR |= 1 << 0; //使能 QSPI
|
|
||||||
|
|
||||||
//注意:QSPI QE 位的使能,在 QSPI 烧写算法里面,就已经设置了
|
|
||||||
//所以,这里可以不用设置 QE 位,否则需要加入对 QE 位置 1 的代码
|
|
||||||
//不过,代码必须通过仿真器下载,直接烧录到外部 QSPI FLASH,是不可用的
|
|
||||||
//如果想直接烧录到外部 QSPI FLASH 也可以用,则需要在这里添加 QE 位置 1 的代码
|
|
||||||
|
|
||||||
//W25QXX 进入 QPI 模式(0X38指令)
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
QUADSPI->CCR = 0X00000138; //发送 0X38 指令,W25QXX 进入 QPI 模式
|
|
||||||
while ((QUADSPI->SR & (1 << 1)) == 0)
|
|
||||||
; //等待指令发送完成
|
|
||||||
QUADSPI->FCR |= 1 << 1; //清除发送完成标志位
|
|
||||||
|
|
||||||
//W25QXX 写使能(0X06指令)
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
QUADSPI->CCR = 0X00000106; //发送 0X06 指令,W25QXX 写使能
|
|
||||||
while ((QUADSPI->SR & (1 << 1)) == 0)
|
|
||||||
; //等待指令发送完成
|
|
||||||
QUADSPI->FCR |= 1 << 1; //清除发送完成标志位
|
|
||||||
|
|
||||||
//W25QXX 设置 QPI 相关读参数(0XC0)
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
QUADSPI->CCR = 0X030003C0; //发送 0XC0 指令,W25QXX 读参数设置
|
|
||||||
QUADSPI->DLR = 0;
|
|
||||||
while ((QUADSPI->SR & (1 << 2)) == 0)
|
|
||||||
; //等待 FTF
|
|
||||||
*(volatile uint8_t *)data_reg = 3 << 4; //设置 P4&P5=11,8 个 dummy clocks,104M
|
|
||||||
QUADSPI->CR |= 1 << 2; //终止传输
|
|
||||||
while ((QUADSPI->SR & (1 << 1)) == 0)
|
|
||||||
; //等待数据发送完成
|
|
||||||
QUADSPI->FCR |= 1 << 1; //清除发送完成标志位
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
|
|
||||||
//MemroyMap 模式设置
|
|
||||||
while (QUADSPI->SR & (1 << 5))
|
|
||||||
; //等待 BUSY 位清零
|
|
||||||
QUADSPI->ABR = 0; //交替字节设置为 0,实际上就是 W25Q 0XEB 指令的 M0~M7=0
|
|
||||||
tempreg = 0XEB; //INSTRUCTION[7:0]=0XEB,发送 0XEB 指令(Fast Read QUAD I/O)
|
|
||||||
tempreg |= 3 << 8; //IMODE[1:0]=3,四线传输指令
|
|
||||||
tempreg |= 3 << 10; //ADDRESS[1:0]=3,四线传输地址
|
|
||||||
tempreg |= 2 << 12; //ADSIZE[1:0]=2,24位地址长度
|
|
||||||
tempreg |= 3 << 14; //ABMODE[1:0]=3,四线传输交替字节
|
|
||||||
tempreg |= 0 << 16; //ABSIZE[1:0]=0,8位交替字节 (M0~M7)
|
|
||||||
tempreg |= 6 << 18; //DCYC[4:0]=6,6个dummy周期
|
|
||||||
tempreg |= 3 << 24; //DMODE[1:0]=3,四线传输数据
|
|
||||||
tempreg |= 3 << 26; //FMODE[1:0]=3,内存映射模式
|
|
||||||
QUADSPI->CCR = tempreg; //设置CCR寄存器
|
|
||||||
|
|
||||||
//设置 QSPI FLASH 空间的MPU保护
|
|
||||||
SCB->SHCSR &= ~(1 << 16); //禁止 MemManage
|
|
||||||
MPU->CTRL &= ~(1 << 0); //禁止 MPU
|
|
||||||
MPU->RNR = 0; //设置保护区域编号为 0 (1~7 可以给其他内存用)
|
|
||||||
MPU->RBAR = 0X90000000; //基地址为 0X9000 000,即 QSPI 的起始地址
|
|
||||||
MPU->RASR = 0X0303002D; //设置相关保护参数(禁止共用,允许 cache,允许缓冲)
|
|
||||||
MPU->CTRL = (1 << 2) | (1 << 0); //使能 PRIVDEFENA,使能 MPU
|
|
||||||
SCB->SHCSR |= 1 << 16; //使能 MemManage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__clang__) //使用V6编译器(clang)
|
|
||||||
//THUMB指令不支持汇编内联
|
|
||||||
//采用如下方法实现执行汇编指令WFI
|
|
||||||
void __attribute__((noinline)) WFI_SET(void)
|
|
||||||
{
|
|
||||||
__asm__("wfi");
|
|
||||||
}
|
|
||||||
|
|
||||||
//关闭所有中断(但是不包括fault和NMI中断)
|
|
||||||
void __attribute__((noinline)) INTX_DISABLE(void)
|
|
||||||
{
|
|
||||||
__asm__("cpsid i \t\n"
|
|
||||||
"bx lr");
|
|
||||||
}
|
|
||||||
|
|
||||||
//开启所有中断
|
|
||||||
void __attribute__((noinline)) INTX_ENABLE(void)
|
|
||||||
{
|
|
||||||
__asm__("cpsie i \t\n"
|
|
||||||
"bx lr");
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置栈顶地址
|
|
||||||
//addr:栈顶地址
|
|
||||||
void __attribute__((noinline)) MSR_MSP(uint32_t addr)
|
|
||||||
{
|
|
||||||
__asm__("msr msp, r0 \t\n"
|
|
||||||
"bx r14");
|
|
||||||
}
|
|
||||||
#elif defined(__CC_ARM) //使用V5编译器(ARMCC)
|
|
||||||
|
|
||||||
//THUMB指令不支持汇编内联
|
|
||||||
//采用如下方法实现执行汇编指令WFI
|
|
||||||
__asm void WFI_SET(void)
|
|
||||||
{
|
|
||||||
WFI;
|
|
||||||
}
|
|
||||||
//关闭所有中断(但是不包括fault和NMI中断)
|
|
||||||
__asm void INTX_DISABLE(void)
|
|
||||||
{
|
|
||||||
CPSID I
|
|
||||||
BX LR
|
|
||||||
}
|
|
||||||
//开启所有中断
|
|
||||||
__asm void INTX_ENABLE(void)
|
|
||||||
{
|
|
||||||
CPSIE I
|
|
||||||
BX LR
|
|
||||||
}
|
|
||||||
//设置栈顶地址
|
|
||||||
//addr:栈顶地址
|
|
||||||
__asm void MSR_MSP(uint32_t addr)
|
|
||||||
{
|
|
||||||
MSR MSP, r0 //set Main Stack value
|
|
||||||
BX r14
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//ϵͳ³õʼ»¯
|
//系统常用调用
|
||||||
|
|
||||||
#ifndef __SYS_H
|
#ifndef __SYS_H
|
||||||
#define __SYS_H
|
#define __SYS_H
|
||||||
@ -7,25 +7,16 @@
|
|||||||
#include "core_cm7.h"
|
#include "core_cm7.h"
|
||||||
#include "stm32h7xx_hal.h"
|
#include "stm32h7xx_hal.h"
|
||||||
|
|
||||||
#define Write_Through() (*(__IO uint32_t *)0XE000EF9C = 1UL << 2) //Cache ͸дģʽ
|
//开关全局中断的宏
|
||||||
|
#define ENABLE_INT() __set_PRIMASK(0) //使能全局中断
|
||||||
|
#define DISABLE_INT() __set_PRIMASK(1) //禁止全局中断
|
||||||
|
|
||||||
void MPU_Config(void);
|
void MPU_Config(void);
|
||||||
void Cache_Enable(void);
|
void Cache_Enable(void);
|
||||||
uint8_t Clock_Init(uint32_t plln, uint32_t pllm, uint32_t pllp, uint32_t pllq);
|
void SystemClock_Init(void);
|
||||||
uint8_t Get_ICacheSta(void);
|
uint8_t Get_ICacheSta(void);
|
||||||
uint8_t Get_DCacheSta(void);
|
uint8_t Get_DCacheSta(void);
|
||||||
void QSPI_Enable_Memmapmode(void);
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
void Error_Handler(char *file, uint32_t line);
|
||||||
void __attribute__((noinline)) WFI_SET(void);
|
|
||||||
void __attribute__((noinline)) INTX_DISABLE(void);
|
|
||||||
void __attribute__((noinline)) INTX_ENABLE(void);
|
|
||||||
void __attribute__((noinline)) MSR_MSP(uint32_t addr);
|
|
||||||
#elif defined(__CC_ARM)
|
|
||||||
void WFI_SET(void);
|
|
||||||
void INTX_DISABLE(void);
|
|
||||||
void INTX_ENABLE(void);
|
|
||||||
void MSR_MSP(uint32_t addr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
276
System/systick/systick.c
Normal file
276
System/systick/systick.c
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
//SysTick 及软件定时器库
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "led.h"
|
||||||
|
#include "Clock.h"
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
static volatile uint32_t s_uiDelayCount = 0;
|
||||||
|
static volatile uint8_t s_ucTimeOutFlag = 0;
|
||||||
|
static SOFT_TMR s_tTmr[TMR_COUNT] = {0}; //软件定时器结构体变量
|
||||||
|
volatile uint32_t g_iRunTime = 0; //全局运行时间,单位 ms
|
||||||
|
static volatile uint8_t g_ucEnableSystickISR = 0; //等待变量初始化
|
||||||
|
|
||||||
|
void SysTick_ISR(void);
|
||||||
|
static void SysTick_SoftTimerDec(SOFT_TMR *_tmr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 配置 SysTick 中断,并初始化软件定时器
|
||||||
|
*/
|
||||||
|
void SysTick_Init(void)
|
||||||
|
{
|
||||||
|
//清零所有的软件定时器
|
||||||
|
for (uint8_t i = 0; i < TMR_COUNT; i++)
|
||||||
|
{
|
||||||
|
s_tTmr[i].Count = 0;
|
||||||
|
s_tTmr[i].PreLoad = 0;
|
||||||
|
s_tTmr[i].Flag = 0;
|
||||||
|
s_tTmr[i].Mode = TMR_ONCE_MODE; //缺省是一次性工作模式
|
||||||
|
}
|
||||||
|
|
||||||
|
//配置 SysTick 中断周期为 1ms,并启动 SysTick 中断
|
||||||
|
SysTick_Config(SystemCoreClock / 1000);
|
||||||
|
|
||||||
|
g_ucEnableSystickISR = 1; //执行systick中断
|
||||||
|
}
|
||||||
|
|
||||||
|
void SysTick_ISR(void)
|
||||||
|
{
|
||||||
|
static uint8_t s_count = 0;
|
||||||
|
static uint16_t l_count = 0;
|
||||||
|
|
||||||
|
//用于 Delay_ms
|
||||||
|
if (s_uiDelayCount > 0)
|
||||||
|
if (--s_uiDelayCount == 0)
|
||||||
|
s_ucTimeOutFlag = 1;
|
||||||
|
|
||||||
|
//软件定时器的计数器减 1
|
||||||
|
for (uint8_t i = 0; i < TMR_COUNT; i++)
|
||||||
|
SysTick_SoftTimerDec(&s_tTmr[i]);
|
||||||
|
|
||||||
|
//全局运行时间增 1
|
||||||
|
g_iRunTime++;
|
||||||
|
if (g_iRunTime == UINT32_MAX)
|
||||||
|
g_iRunTime = 0;
|
||||||
|
|
||||||
|
//每隔 1ms 调用一次
|
||||||
|
|
||||||
|
if (++s_count >= 10)
|
||||||
|
{
|
||||||
|
s_count = 0;
|
||||||
|
|
||||||
|
//每隔 10ms 调用一次
|
||||||
|
KEY_Scan10ms();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (++l_count >= 1000)
|
||||||
|
{
|
||||||
|
l_count = 0;
|
||||||
|
|
||||||
|
//每隔 1000ms 调用一次
|
||||||
|
Clock_Handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SysTick_SoftTimerDec(SOFT_TMR *_tmr)
|
||||||
|
{
|
||||||
|
if (_tmr->Count > 0)
|
||||||
|
{
|
||||||
|
//如果定时器变量减到 1 则设置定时器到达标志
|
||||||
|
if (--_tmr->Count == 0)
|
||||||
|
{
|
||||||
|
_tmr->Flag = 1;
|
||||||
|
|
||||||
|
//如果是自动模式,则自动重装计数器
|
||||||
|
if (_tmr->Mode == TMR_AUTO_MODE)
|
||||||
|
_tmr->Count = _tmr->PreLoad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ms 延时
|
||||||
|
* @param n: 延时数
|
||||||
|
*/
|
||||||
|
void Delay_ms(uint32_t n)
|
||||||
|
{
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
|
else if (n == 1)
|
||||||
|
n = 2;
|
||||||
|
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
s_uiDelayCount = n;
|
||||||
|
s_ucTimeOutFlag = 0;
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (s_ucTimeOutFlag == 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief us 延时
|
||||||
|
* @param n: 延时数
|
||||||
|
*/
|
||||||
|
void Delay_us(uint32_t n)
|
||||||
|
{
|
||||||
|
uint32_t ticks;
|
||||||
|
uint32_t told;
|
||||||
|
uint32_t tnow;
|
||||||
|
uint32_t tcnt = 0;
|
||||||
|
uint32_t reload;
|
||||||
|
|
||||||
|
reload = SysTick->LOAD;
|
||||||
|
ticks = n * (SystemCoreClock / 1000000); //需要的节拍数
|
||||||
|
|
||||||
|
tcnt = 0;
|
||||||
|
told = SysTick->VAL; //刚进入时的计数器值
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
tnow = SysTick->VAL;
|
||||||
|
if (tnow != told)
|
||||||
|
{
|
||||||
|
if (tnow < told)
|
||||||
|
tcnt += told - tnow;
|
||||||
|
else
|
||||||
|
tcnt += reload - tnow + told;
|
||||||
|
told = tnow;
|
||||||
|
|
||||||
|
//时间超过、等于要延迟的时间,则退出
|
||||||
|
if (tcnt >= ticks)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动一个定时器,并设置定时周期
|
||||||
|
* @param _id: 定时器 ID
|
||||||
|
* @param _period: 定时周期,单位 ms
|
||||||
|
*/
|
||||||
|
void SysTick_StartTimer(uint8_t _id, uint32_t _period)
|
||||||
|
{
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
s_tTmr[_id].Count = _period; //实时计数器初值
|
||||||
|
s_tTmr[_id].PreLoad = _period; //计数器自动重装值,仅自动模式起作用
|
||||||
|
s_tTmr[_id].Flag = 0; //定时时间到标志
|
||||||
|
s_tTmr[_id].Mode = TMR_ONCE_MODE; //一次性工作模式
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动一个自动定时器,并设置定时周期
|
||||||
|
* @param _id: 定时器 ID
|
||||||
|
* @param _period: 定时周期,单位 ms
|
||||||
|
*/
|
||||||
|
void SysTick_StartAutoTimer(uint8_t _id, uint32_t _period)
|
||||||
|
{
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
s_tTmr[_id].Count = _period; //实时计数器初值
|
||||||
|
s_tTmr[_id].PreLoad = _period; //计数器自动重装值,仅自动模式起作用
|
||||||
|
s_tTmr[_id].Flag = 0; //定时时间到标志
|
||||||
|
s_tTmr[_id].Mode = TMR_AUTO_MODE; //自动工作模式
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 停止一个定时器
|
||||||
|
* @param _id: 定时器 ID
|
||||||
|
*/
|
||||||
|
void SysTick_StopTimer(uint8_t _id)
|
||||||
|
{
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
s_tTmr[_id].Count = 0; //实时计数器初值
|
||||||
|
s_tTmr[_id].Flag = 0; //定时时间到标志
|
||||||
|
s_tTmr[_id].Mode = TMR_ONCE_MODE; //自动工作模式
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 检测定时器是否超时
|
||||||
|
* @param _id: 定时器 ID
|
||||||
|
* @param _period: 定时周期
|
||||||
|
* @retval 返回 0 表示定时未到,1 表示定时到
|
||||||
|
*/
|
||||||
|
uint8_t SysTick_CheckTimer(uint8_t _id)
|
||||||
|
{
|
||||||
|
if (_id >= TMR_COUNT)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (s_tTmr[_id].Flag == 1)
|
||||||
|
{
|
||||||
|
s_tTmr[_id].Flag = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取运行时间,单位 ms。最长可以表示 24.85 天
|
||||||
|
* @retval 运行时间
|
||||||
|
*/
|
||||||
|
int32_t SysTick_GetRunTime(void)
|
||||||
|
{
|
||||||
|
int32_t runtime;
|
||||||
|
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
runtime = g_iRunTime;
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
|
||||||
|
return runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 计算当前运行时间和给定时刻之间的差值。处理了计数器循环
|
||||||
|
* @param _LastTime: 上个时刻
|
||||||
|
* @retval 当前时间和过去时间的差值,单位 ms
|
||||||
|
*/
|
||||||
|
int32_t SysTick_CheckRunTime(int32_t _LastTime)
|
||||||
|
{
|
||||||
|
int32_t now_time;
|
||||||
|
int32_t time_diff;
|
||||||
|
|
||||||
|
DISABLE_INT();
|
||||||
|
|
||||||
|
now_time = g_iRunTime;
|
||||||
|
|
||||||
|
ENABLE_INT();
|
||||||
|
|
||||||
|
if (now_time >= _LastTime)
|
||||||
|
time_diff = now_time - _LastTime;
|
||||||
|
else
|
||||||
|
time_diff = INT32_MAX - _LastTime + now_time;
|
||||||
|
|
||||||
|
return time_diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SysTick 中断服务程序
|
||||||
|
*/
|
||||||
|
void SysTick_Handler(void)
|
||||||
|
{
|
||||||
|
HAL_IncTick();
|
||||||
|
|
||||||
|
if (g_ucEnableSystickISR == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SysTick_ISR();
|
||||||
|
}
|
||||||
36
System/systick/systick.h
Normal file
36
System/systick/systick.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//SysTick 及软件定时器库
|
||||||
|
|
||||||
|
#ifndef __SYSTICK_H
|
||||||
|
#define __SYSTICK_H
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
|
#define TMR_COUNT 4 //软件定时器的个数
|
||||||
|
|
||||||
|
//定时器结构体工作模式
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TMR_ONCE_MODE = 0, //一次工作模式
|
||||||
|
TMR_AUTO_MODE = 1 //自动定时工作模式
|
||||||
|
} TMR_MODE_E;
|
||||||
|
|
||||||
|
//定时器结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
volatile uint8_t Mode; //计数器模式
|
||||||
|
volatile uint8_t Flag; //定时到达标志
|
||||||
|
volatile uint32_t Count; //计数器
|
||||||
|
volatile uint32_t PreLoad; //计数器预装值
|
||||||
|
} SOFT_TMR;
|
||||||
|
|
||||||
|
void SysTick_Init(void);
|
||||||
|
void Delay_ms(uint32_t n);
|
||||||
|
void Delay_us(uint32_t n);
|
||||||
|
void SysTick_StartTimer(uint8_t _id, uint32_t _period);
|
||||||
|
void SysTick_StartAutoTimer(uint8_t _id, uint32_t _period);
|
||||||
|
void SysTick_StopTimer(uint8_t _id);
|
||||||
|
uint8_t SysTick_CheckTimer(uint8_t _id);
|
||||||
|
int32_t SysTick_GetRunTime(void);
|
||||||
|
int32_t SysTick_CheckRunTime(int32_t _LastTime);
|
||||||
|
|
||||||
|
#endif
|
||||||
123
System/tim/tim.c
Normal file
123
System/tim/tim.c
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
//硬件定时器库
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 开启定时中断
|
||||||
|
* @param TIMx: 定时器
|
||||||
|
* @param _ulFreq: 定时频率 (Hz)。0 表示关闭
|
||||||
|
* @param _PreemptionPriority: 抢占优先级
|
||||||
|
* @param _SubPriority: 子优先级
|
||||||
|
*/
|
||||||
|
void TIM_Set(TIM_TypeDef *TIMx, double _ulFreq, uint8_t _PreemptionPriority, uint8_t _SubPriority)
|
||||||
|
{
|
||||||
|
TIM_HandleTypeDef TimHandle = {0};
|
||||||
|
uint16_t usPeriod;
|
||||||
|
uint16_t usPrescaler;
|
||||||
|
uint32_t uiTIMxCLK;
|
||||||
|
|
||||||
|
//使能TIM时钟
|
||||||
|
if (TIMx == TIM1)
|
||||||
|
__HAL_RCC_TIM1_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM2)
|
||||||
|
__HAL_RCC_TIM2_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM3)
|
||||||
|
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM4)
|
||||||
|
__HAL_RCC_TIM4_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM5)
|
||||||
|
__HAL_RCC_TIM5_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM6)
|
||||||
|
__HAL_RCC_TIM6_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM7)
|
||||||
|
__HAL_RCC_TIM7_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM8)
|
||||||
|
__HAL_RCC_TIM8_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM12)
|
||||||
|
__HAL_RCC_TIM12_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM13)
|
||||||
|
__HAL_RCC_TIM13_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM14)
|
||||||
|
__HAL_RCC_TIM14_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM15)
|
||||||
|
__HAL_RCC_TIM15_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM16)
|
||||||
|
__HAL_RCC_TIM16_CLK_ENABLE();
|
||||||
|
else if (TIMx == TIM17)
|
||||||
|
__HAL_RCC_TIM17_CLK_ENABLE();
|
||||||
|
|
||||||
|
if ((TIMx == TIM1) || (TIMx == TIM8) || (TIMx == TIM15) || (TIMx == TIM16) || (TIMx == TIM17))
|
||||||
|
uiTIMxCLK = SystemCoreClock / 2; //APB2 定时器时钟 = 200M
|
||||||
|
else
|
||||||
|
uiTIMxCLK = SystemCoreClock / 2; //APB1 定时器 = 200M
|
||||||
|
|
||||||
|
if (_ulFreq < 100)
|
||||||
|
{
|
||||||
|
usPrescaler = 10000 - 1; //分频比 = 10000
|
||||||
|
usPeriod = ((double)uiTIMxCLK / 10000.0) / _ulFreq - 1.0; //自动重装的值
|
||||||
|
}
|
||||||
|
else if (_ulFreq < 3000)
|
||||||
|
{
|
||||||
|
usPrescaler = 100 - 1; //分频比 = 100
|
||||||
|
usPeriod = ((double)uiTIMxCLK / 100.0) / _ulFreq - 1.0; //自动重装的值
|
||||||
|
}
|
||||||
|
else //大于 4k 的频率
|
||||||
|
{
|
||||||
|
usPrescaler = 0; //分频比 = 1
|
||||||
|
usPeriod = (double)uiTIMxCLK / _ulFreq - 1.0; //自动重装的值
|
||||||
|
}
|
||||||
|
|
||||||
|
//定时器中断更新周期
|
||||||
|
TimHandle.Instance = TIMx;
|
||||||
|
TimHandle.Init.Prescaler = usPrescaler;
|
||||||
|
TimHandle.Init.Period = usPeriod;
|
||||||
|
TimHandle.Init.ClockDivision = 0;
|
||||||
|
TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
TimHandle.Init.RepetitionCounter = 0;
|
||||||
|
TimHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||||
|
HAL_TIM_Base_Init(&TimHandle);
|
||||||
|
|
||||||
|
//使能定时器中断
|
||||||
|
__HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE);
|
||||||
|
|
||||||
|
//配置TIM定时更新中断
|
||||||
|
{
|
||||||
|
uint8_t irq = 0;
|
||||||
|
|
||||||
|
if (TIMx == TIM1)
|
||||||
|
irq = TIM1_UP_IRQn;
|
||||||
|
else if (TIMx == TIM2)
|
||||||
|
irq = TIM2_IRQn;
|
||||||
|
else if (TIMx == TIM3)
|
||||||
|
irq = TIM3_IRQn;
|
||||||
|
else if (TIMx == TIM4)
|
||||||
|
irq = TIM4_IRQn;
|
||||||
|
else if (TIMx == TIM5)
|
||||||
|
irq = TIM5_IRQn;
|
||||||
|
else if (TIMx == TIM6)
|
||||||
|
irq = TIM6_DAC_IRQn;
|
||||||
|
else if (TIMx == TIM7)
|
||||||
|
irq = TIM7_IRQn;
|
||||||
|
else if (TIMx == TIM8)
|
||||||
|
irq = TIM8_UP_TIM13_IRQn;
|
||||||
|
else if (TIMx == TIM12)
|
||||||
|
irq = TIM8_BRK_TIM12_IRQn;
|
||||||
|
else if (TIMx == TIM13)
|
||||||
|
irq = TIM8_UP_TIM13_IRQn;
|
||||||
|
else if (TIMx == TIM14)
|
||||||
|
irq = TIM8_TRG_COM_TIM14_IRQn;
|
||||||
|
else if (TIMx == TIM15)
|
||||||
|
irq = TIM15_IRQn;
|
||||||
|
else if (TIMx == TIM16)
|
||||||
|
irq = TIM16_IRQn;
|
||||||
|
else if (TIMx == TIM17)
|
||||||
|
irq = TIM17_IRQn;
|
||||||
|
|
||||||
|
HAL_NVIC_SetPriority((IRQn_Type)irq, _PreemptionPriority, _SubPriority);
|
||||||
|
HAL_NVIC_EnableIRQ((IRQn_Type)irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
HAL_TIM_Base_Start(&TimHandle);
|
||||||
|
}
|
||||||
8
System/tim/tim.h
Normal file
8
System/tim/tim.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//硬件定时器库
|
||||||
|
|
||||||
|
#ifndef __TIM_H
|
||||||
|
#define __TIM_H
|
||||||
|
|
||||||
|
void TIM_Set(TIM_TypeDef *TIMx, double _ulFreq, uint8_t _PreemptionPriority, uint8_t _SubPriority);
|
||||||
|
|
||||||
|
#endif
|
||||||
1231
System/usart/uart.c
Normal file
1231
System/usart/uart.c
Normal file
File diff suppressed because it is too large
Load Diff
123
System/usart/uart.h
Normal file
123
System/usart/uart.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
//UART 库
|
||||||
|
|
||||||
|
#ifndef __UART_H
|
||||||
|
#define __UART_H
|
||||||
|
|
||||||
|
#define UART1_FIFO_EN 1 //调试用串口
|
||||||
|
#define UART2_FIFO_EN 1 //WiFi 透传
|
||||||
|
#define UART3_FIFO_EN 1 //HC-12
|
||||||
|
#define UART4_FIFO_EN 0
|
||||||
|
#define UART5_FIFO_EN 0
|
||||||
|
#define UART6_FIFO_EN 0
|
||||||
|
#define UART7_FIFO_EN 0
|
||||||
|
#define UART8_FIFO_EN 0
|
||||||
|
|
||||||
|
//定义端口号
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
COM1 = 0, //USART1
|
||||||
|
COM2 = 1, //USART2
|
||||||
|
COM3 = 2, //USART3
|
||||||
|
COM4 = 3, //UART4
|
||||||
|
COM5 = 4, //UART5
|
||||||
|
COM6 = 5, //USART6
|
||||||
|
COM7 = 6, //UART7
|
||||||
|
COM8 = 7 //UART8
|
||||||
|
} COM_PORT_E;
|
||||||
|
|
||||||
|
//定义串口波特率和FIFO缓冲区大小,分为发送缓冲区和接收缓冲区, 支持全双工
|
||||||
|
#if UART1_FIFO_EN == 1
|
||||||
|
#define UART1_BAUD 115200
|
||||||
|
#define UART1_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART1_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART2_FIFO_EN == 1
|
||||||
|
#define UART2_BAUD 115200
|
||||||
|
#define UART2_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART2_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART3_FIFO_EN == 1
|
||||||
|
#define UART3_BAUD 9600
|
||||||
|
#define UART3_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART3_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART4_FIFO_EN == 1
|
||||||
|
#define UART4_BAUD 115200
|
||||||
|
#define UART4_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART4_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART5_FIFO_EN == 1
|
||||||
|
#define UART5_BAUD 115200
|
||||||
|
#define UART5_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART5_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART6_FIFO_EN == 1
|
||||||
|
#define UART6_BAUD 115200
|
||||||
|
#define UART6_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART6_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART7_FIFO_EN == 1
|
||||||
|
#define UART7_BAUD 115200
|
||||||
|
#define UART7_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART7_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UART8_FIFO_EN == 1
|
||||||
|
#define UART8_BAUD 115200
|
||||||
|
#define UART8_TX_BUF_SIZE 1 * 1024
|
||||||
|
#define UART8_RX_BUF_SIZE 1 * 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//回调函数定义
|
||||||
|
typedef void (*UartSendBeforeHandler)(void);
|
||||||
|
typedef void (*UartSendOverHandler)(void);
|
||||||
|
typedef void (*UartReceiveHandler)(uint8_t _byte);
|
||||||
|
|
||||||
|
//串口设备结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
USART_TypeDef *uart; //内部串口设备指针
|
||||||
|
uint8_t *pTxBuf; //发送缓冲区
|
||||||
|
uint8_t *pRxBuf; //接收缓冲区
|
||||||
|
uint16_t usTxBufSize; //发送缓冲区大小
|
||||||
|
uint16_t usRxBufSize; //接收缓冲区大小
|
||||||
|
__IO uint16_t usTxWrite; //发送缓冲区写指针
|
||||||
|
__IO uint16_t usTxRead; //发送缓冲区读指针
|
||||||
|
__IO uint16_t usTxCount; //等待发送的数据个数
|
||||||
|
|
||||||
|
__IO uint16_t usRxWrite; //接收缓冲区写指针
|
||||||
|
__IO uint16_t usRxRead; //接收缓冲区读指针
|
||||||
|
__IO uint16_t usRxCount; //还未读取的新数据个数
|
||||||
|
|
||||||
|
UartSendBeforeHandler SendBefore; //开始发送之前的回调函数指针
|
||||||
|
UartSendOverHandler SendOver; //发送完毕的回调函数指针
|
||||||
|
UartReceiveHandler Receive; //串口收到数据的回调函数指针
|
||||||
|
|
||||||
|
uint8_t Sending; //正在发送中
|
||||||
|
} UART_T;
|
||||||
|
|
||||||
|
void Uart_Init(void);
|
||||||
|
void Uart_SendBuf(COM_PORT_E _ucPort, uint8_t *_ucaBuf, uint16_t _usLen);
|
||||||
|
void Uart_SendChar(COM_PORT_E _ucPort, uint8_t _ucByte);
|
||||||
|
uint8_t Uart_GetChar(COM_PORT_E _ucPort, uint8_t *_pByte);
|
||||||
|
uint8_t Uart_GetBuffUntil(COM_PORT_E _ucPort, uint8_t *_pBuf, uint8_t _endByte, uint16_t _timeout);
|
||||||
|
void Uart_ClearTxFifo(COM_PORT_E _ucPort);
|
||||||
|
void Uart_ClearRxFifo(COM_PORT_E _ucPort);
|
||||||
|
void Uart_SetBaud(COM_PORT_E _ucPort, uint32_t _BaudRate);
|
||||||
|
void Uart_SetUartParam(USART_TypeDef *Instance, uint32_t BaudRate, uint32_t Parity, uint32_t Mode);
|
||||||
|
uint8_t Uart_IsTxEmpty(COM_PORT_E _ucPort);
|
||||||
|
|
||||||
|
void Uart_BindSendBeforeHandle(COM_PORT_E _ucPort, UartSendBeforeHandler SendBefore);
|
||||||
|
void Uart_BindSendOverHandle(COM_PORT_E _ucPort, UartSendOverHandler SendOver);
|
||||||
|
void Uart_BindReceiveHandle(COM_PORT_E _ucPort, UartReceiveHandler Receive);
|
||||||
|
|
||||||
|
void Uart_SetprintfCom(COM_PORT_E _ucPort);
|
||||||
|
void Uart_SetgetcharCom(COM_PORT_E _ucPort);
|
||||||
|
|
||||||
|
#endif
|
||||||
162
User/APP_Ball/APP_Ball.c
Normal file
162
User/APP_Ball/APP_Ball.c
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
//移动球应用
|
||||||
|
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "hc12.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
|
||||||
|
#include "APP_Ball.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
#define START_BYTE '&'
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t x;
|
||||||
|
uint16_t y;
|
||||||
|
} Ball;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
|
||||||
|
Ball ball;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void APP_Ball_DispBall(void);
|
||||||
|
void APP_Ball_Send(void);
|
||||||
|
void APP_Ball_Receive(uint8_t byte);
|
||||||
|
void WriteMem(void *pdata, uint32_t len, uint8_t *list);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动移动球
|
||||||
|
*/
|
||||||
|
void APP_Ball_Launcher(void)
|
||||||
|
{
|
||||||
|
HC12_BindReceiveHandle(APP_Ball_Receive);
|
||||||
|
|
||||||
|
ball.x = 0;
|
||||||
|
ball.y = 0;
|
||||||
|
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
switch (KEY_GetKeyWait())
|
||||||
|
{
|
||||||
|
case JOY_U_DOWN:
|
||||||
|
{
|
||||||
|
if (ball.y - 2 >= 0)
|
||||||
|
{
|
||||||
|
ball.y -= 2;
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
|
||||||
|
APP_Ball_Send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_D_DOWN:
|
||||||
|
{
|
||||||
|
if (ball.y + 2 <= LCD_HEIGHT)
|
||||||
|
{
|
||||||
|
ball.y += 2;
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
|
||||||
|
APP_Ball_Send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_L_DOWN:
|
||||||
|
{
|
||||||
|
if (ball.x - 2 >= 0)
|
||||||
|
{
|
||||||
|
ball.x -= 2;
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
|
||||||
|
APP_Ball_Send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_R_DOWN:
|
||||||
|
{
|
||||||
|
if (ball.x + 2 <= LCD_WIDTH)
|
||||||
|
{
|
||||||
|
ball.x += 2;
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
|
||||||
|
APP_Ball_Send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Ball_DispBall(void)
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
GE_Draw_FillCircle(ball.x, ball.y, 10, BLUE);
|
||||||
|
GE_Draw_Disp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Ball_Send(void)
|
||||||
|
{
|
||||||
|
Ball pack;
|
||||||
|
pack.x = ball.x;
|
||||||
|
pack.y = ball.y;
|
||||||
|
|
||||||
|
char start_byte = START_BYTE;
|
||||||
|
HC12_SendBuff(&start_byte, sizeof(start_byte));
|
||||||
|
HC12_SendBuff(&pack, sizeof(Ball));
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Ball_Receive(uint8_t byte)
|
||||||
|
{
|
||||||
|
static uint8_t is_receiving = FALSE;
|
||||||
|
static uint8_t list[4];
|
||||||
|
static uint8_t list_i = 0;
|
||||||
|
|
||||||
|
if (is_receiving == FALSE && byte == START_BYTE)
|
||||||
|
{
|
||||||
|
is_receiving = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_receiving == TRUE)
|
||||||
|
{
|
||||||
|
list[list_i] = byte;
|
||||||
|
list_i++;
|
||||||
|
|
||||||
|
if (list_i == 4)
|
||||||
|
{
|
||||||
|
WriteMem(&ball, sizeof(Ball), list);
|
||||||
|
APP_Ball_DispBall();
|
||||||
|
list_i = 0;
|
||||||
|
is_receiving = FALSE;
|
||||||
|
|
||||||
|
printf("收到小球位置:x=%d y=%d\n", ball.x, ball.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WriteMem(void *pdata, uint32_t len, uint8_t *list)
|
||||||
|
{
|
||||||
|
uint8_t *p = (uint8_t *)pdata;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < len; i++)
|
||||||
|
p[i] = list[i];
|
||||||
|
}
|
||||||
8
User/APP_Ball/APP_Ball.h
Normal file
8
User/APP_Ball/APP_Ball.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//移动球应用
|
||||||
|
|
||||||
|
#ifndef __APP_BALL
|
||||||
|
#define __APP_BALL
|
||||||
|
|
||||||
|
void APP_Ball_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
633
User/APP_Gobang/APP_Gobang.c
Normal file
633
User/APP_Gobang/APP_Gobang.c
Normal file
@ -0,0 +1,633 @@
|
|||||||
|
//五子棋应用
|
||||||
|
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "hc12.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
|
||||||
|
#include "APP_Gobang.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
#define MAP_COLOR 0xdc84
|
||||||
|
|
||||||
|
#define BROADWIDTH 15
|
||||||
|
#define WIDTH (BROADWIDTH + 1)
|
||||||
|
|
||||||
|
#define BLACK_TURN 0
|
||||||
|
#define WHITE_TURN 1
|
||||||
|
|
||||||
|
#define NO_CHESS 0
|
||||||
|
#define BLACK_CHESS 1
|
||||||
|
#define WHITE_CHESS 2
|
||||||
|
|
||||||
|
#define CHECK_X 0
|
||||||
|
#define CHECK_Y 1
|
||||||
|
#define CHECK_DIAG_LEFT 2
|
||||||
|
#define CHECK_DIAG_RIGHT 3
|
||||||
|
|
||||||
|
#define CHESS_RADIUS 5
|
||||||
|
|
||||||
|
#define CONNETING_STATUS 0
|
||||||
|
#define BATTLING_STATUS 1
|
||||||
|
|
||||||
|
#define NONE_MSG 0
|
||||||
|
#define REQUEST_MSG 'R'
|
||||||
|
#define AGREE_MSG 'A'
|
||||||
|
#define REFUSE_MSG 'N'
|
||||||
|
#define CONFIRM_MSG 'X'
|
||||||
|
|
||||||
|
#define START_BYTE '#'
|
||||||
|
#define END_BYTE '&'
|
||||||
|
|
||||||
|
#define Random() rand()
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
//棋盘交点阵
|
||||||
|
int map[WIDTH][WIDTH] = {{0, 0}};
|
||||||
|
|
||||||
|
//光标位置
|
||||||
|
int cursor_x = 7;
|
||||||
|
int cursor_y = 7;
|
||||||
|
|
||||||
|
//记录执子方
|
||||||
|
int turn = BLACK_TURN;
|
||||||
|
|
||||||
|
//棋子类型
|
||||||
|
int chess_kind = BLACK_CHESS;
|
||||||
|
|
||||||
|
//我方执子类型
|
||||||
|
int my_turn = BLACK_TURN;
|
||||||
|
|
||||||
|
//当前所处状态
|
||||||
|
int status = CONNETING_STATUS;
|
||||||
|
|
||||||
|
//联机消息
|
||||||
|
uint8_t connetion_msg = NONE_MSG;
|
||||||
|
|
||||||
|
uint8_t interval = 240 / WIDTH;
|
||||||
|
uint16_t x_start, x_end, y_start, y_end;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void APP_Gobang_Init(void);
|
||||||
|
void APP_Gobang_DispGobang(void);
|
||||||
|
void APP_Gobang_DispText(void);
|
||||||
|
void APP_Gobang_DispMap(void);
|
||||||
|
void APP_Gobang_DispChess(void);
|
||||||
|
void APP_Gobang_MoveChess(void);
|
||||||
|
void APP_Gobang_DispCursor(void);
|
||||||
|
int APP_Gobang_CheckNum(int check_type);
|
||||||
|
void APP_Gobang_Msg(uint8_t *head, uint8_t *content);
|
||||||
|
void APP_Gobang_SendPosition(void);
|
||||||
|
void APP_Gobang_RevPosition(void);
|
||||||
|
uint8_t APP_Gobang_Connect(void);
|
||||||
|
uint8_t APP_Gobang_InitiateConnet(void);
|
||||||
|
uint8_t APP_Gobang_ReplyConnect(void);
|
||||||
|
void APP_Gobang_DecideMyTurn(void);
|
||||||
|
void APP_Gobang_RevMyTurn(void);
|
||||||
|
void APP_Gobang_ConfirmBeforeStart(void);
|
||||||
|
void APP_Gobang_ConnectRevHandler(uint8_t byte);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动五子棋
|
||||||
|
*/
|
||||||
|
void APP_Gobang_Launcher(void)
|
||||||
|
{
|
||||||
|
srand(SysTick->VAL);
|
||||||
|
APP_Gobang_Init();
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
if (APP_Gobang_Connect() == 0)
|
||||||
|
return;
|
||||||
|
status = BATTLING_STATUS;
|
||||||
|
HC12_BindReceiveHandle(NULL);
|
||||||
|
HC12_ClearReceive;
|
||||||
|
KEY_ClearKey();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
|
||||||
|
if (turn == my_turn)
|
||||||
|
APP_Gobang_MoveChess();
|
||||||
|
else
|
||||||
|
APP_Gobang_RevPosition();
|
||||||
|
|
||||||
|
turn = !turn; //更换执子方
|
||||||
|
|
||||||
|
//判断胜负
|
||||||
|
if (
|
||||||
|
APP_Gobang_CheckNum(CHECK_X) >= 5 ||
|
||||||
|
APP_Gobang_CheckNum(CHECK_Y) >= 5 ||
|
||||||
|
APP_Gobang_CheckNum(CHECK_DIAG_LEFT) >= 5 ||
|
||||||
|
APP_Gobang_CheckNum(CHECK_DIAG_RIGHT) >= 5)
|
||||||
|
{
|
||||||
|
if ((chess_kind == BLACK_CHESS && my_turn == BLACK_TURN) || (chess_kind == WHITE_CHESS && my_turn == WHITE_TURN))
|
||||||
|
APP_Gobang_Msg("游戏结束", "恭喜您获得胜利!按“L”退出游戏");
|
||||||
|
else
|
||||||
|
APP_Gobang_Msg("游戏结束", "很遗憾,您输了!按“L”退出游戏");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化变量
|
||||||
|
*/
|
||||||
|
void APP_Gobang_Init(void)
|
||||||
|
{
|
||||||
|
ge_font_print_set.font_size = FONT_16;
|
||||||
|
|
||||||
|
for (int i = 0; i < WIDTH; i++)
|
||||||
|
for (int j = 0; j < WIDTH; j++)
|
||||||
|
map[i][j] = NO_CHESS;
|
||||||
|
|
||||||
|
cursor_x = cursor_y = 7;
|
||||||
|
turn = BLACK_TURN;
|
||||||
|
chess_kind = BLACK_CHESS;
|
||||||
|
status = CONNETING_STATUS;
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
|
||||||
|
x_start = (LCD_WIDTH - LCD_HEIGHT) / 2 + interval / 2;
|
||||||
|
x_end = x_start + (WIDTH - 1) * interval;
|
||||||
|
y_start = interval / 2;
|
||||||
|
y_end = y_start + (WIDTH - 1) * interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制游戏
|
||||||
|
*/
|
||||||
|
void APP_Gobang_DispGobang(void)
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(MAP_COLOR);
|
||||||
|
APP_Gobang_DispMap();
|
||||||
|
APP_Gobang_DispChess();
|
||||||
|
APP_Gobang_DispCursor();
|
||||||
|
if (status == BATTLING_STATUS)
|
||||||
|
APP_Gobang_DispText();
|
||||||
|
GE_Draw_Disp();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制文字
|
||||||
|
* @param head: 标题
|
||||||
|
* @param content: 内容
|
||||||
|
*/
|
||||||
|
void APP_Gobang_DispText(void)
|
||||||
|
{
|
||||||
|
if (turn == my_turn)
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, interval / 2, BORDER_MAX, BORDER_MAX, "我方");
|
||||||
|
else
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, interval / 2, BORDER_MAX, BORDER_MAX, "对方");
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, interval / 2 + FONT_16, BORDER_MAX, BORDER_MAX, "回合");
|
||||||
|
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, LCD_HEIGHT - interval / 2 - 2 * FONT_16, BORDER_MAX, BORDER_MAX, "我方");
|
||||||
|
if (my_turn == BLACK_TURN)
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, LCD_HEIGHT - interval / 2 - FONT_16, BORDER_MAX, BORDER_MAX, "执黑");
|
||||||
|
else
|
||||||
|
GE_Font_Print_WithSet(LCD_WIDTH - FONT_16 * 2, LCD_HEIGHT - interval / 2 - FONT_16, BORDER_MAX, BORDER_MAX, "执白");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制棋盘
|
||||||
|
*/
|
||||||
|
void APP_Gobang_DispMap(void)
|
||||||
|
{
|
||||||
|
uint8_t i = 0;
|
||||||
|
for (i = 0; i < WIDTH; i++)
|
||||||
|
{
|
||||||
|
GE_Draw_Line(x_start, y_start + i * interval, x_end, y_start + i * interval, BLACK);
|
||||||
|
GE_Draw_Line(x_start + i * interval, y_start, x_start + i * interval, y_end, BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制棋子
|
||||||
|
*/
|
||||||
|
void APP_Gobang_DispChess(void)
|
||||||
|
{
|
||||||
|
uint8_t i, j;
|
||||||
|
for (i = 0; i < WIDTH; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < WIDTH; j++)
|
||||||
|
{
|
||||||
|
if (map[i][j] == BLACK_CHESS)
|
||||||
|
{
|
||||||
|
GE_Draw_FillCircle(x_start + j * interval, y_start + i * interval, CHESS_RADIUS, BLACK);
|
||||||
|
}
|
||||||
|
else if (map[i][j] == WHITE_CHESS)
|
||||||
|
{
|
||||||
|
GE_Draw_FillCircle(x_start + j * interval, y_start + i * interval, CHESS_RADIUS, WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 移动棋子
|
||||||
|
*/
|
||||||
|
void APP_Gobang_MoveChess(void)
|
||||||
|
{
|
||||||
|
KEY_ClearKey();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
switch (KEY_GetKeyWait())
|
||||||
|
{
|
||||||
|
case JOY_U_DOWN:
|
||||||
|
{
|
||||||
|
cursor_x--;
|
||||||
|
|
||||||
|
if (cursor_x < 0)
|
||||||
|
cursor_x = WIDTH - 1;
|
||||||
|
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_D_DOWN:
|
||||||
|
{
|
||||||
|
cursor_x++;
|
||||||
|
|
||||||
|
if (cursor_x > WIDTH - 1)
|
||||||
|
cursor_x = 0;
|
||||||
|
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_L_DOWN:
|
||||||
|
{
|
||||||
|
cursor_y--;
|
||||||
|
|
||||||
|
if (cursor_y < 0)
|
||||||
|
cursor_y = WIDTH - 1;
|
||||||
|
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_R_DOWN:
|
||||||
|
{
|
||||||
|
cursor_y++;
|
||||||
|
|
||||||
|
if (cursor_y > WIDTH - 1)
|
||||||
|
cursor_y = 0;
|
||||||
|
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_OK_DOWN:
|
||||||
|
{
|
||||||
|
if (map[cursor_x][cursor_y] != NO_CHESS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
chess_kind = map[cursor_x][cursor_y] = turn == BLACK_TURN ? BLACK_CHESS : WHITE_CHESS;
|
||||||
|
APP_Gobang_SendPosition();
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 显示光标
|
||||||
|
*/
|
||||||
|
void APP_Gobang_DispCursor(void)
|
||||||
|
{
|
||||||
|
GE_Draw_Circle(x_start + cursor_y * interval, y_start + cursor_x * interval, CHESS_RADIUS, RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 检查某个方向上的连子数
|
||||||
|
* @param check_type: 检查方向
|
||||||
|
* @retval 连子数
|
||||||
|
*/
|
||||||
|
int APP_Gobang_CheckNum(int check_type)
|
||||||
|
{
|
||||||
|
int temp_x = cursor_x, temp_y = cursor_y;
|
||||||
|
int num = 0;
|
||||||
|
|
||||||
|
while (temp_x >= 0 && temp_x < WIDTH && temp_y >= 0 && temp_y < WIDTH && map[temp_x][temp_y] == chess_kind)
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
|
||||||
|
switch (check_type)
|
||||||
|
{
|
||||||
|
case CHECK_X:
|
||||||
|
temp_x--;
|
||||||
|
break;
|
||||||
|
case CHECK_Y:
|
||||||
|
temp_y--;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_LEFT:
|
||||||
|
temp_x--;
|
||||||
|
temp_y--;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_RIGHT:
|
||||||
|
temp_x--;
|
||||||
|
temp_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (check_type)
|
||||||
|
{
|
||||||
|
case CHECK_X:
|
||||||
|
temp_x = cursor_x + 1;
|
||||||
|
break;
|
||||||
|
case CHECK_Y:
|
||||||
|
temp_y = cursor_y + 1;
|
||||||
|
;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_LEFT:
|
||||||
|
temp_x = cursor_x + 1;
|
||||||
|
temp_y = cursor_y + 1;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_RIGHT:
|
||||||
|
temp_x = cursor_x + 1;
|
||||||
|
temp_y = cursor_y - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (temp_x >= 0 && temp_x < WIDTH && temp_y >= 0 && temp_y < WIDTH && map[temp_x][temp_y] == chess_kind)
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
|
||||||
|
switch (check_type)
|
||||||
|
{
|
||||||
|
case CHECK_X:
|
||||||
|
temp_x++;
|
||||||
|
break;
|
||||||
|
case CHECK_Y:
|
||||||
|
temp_y++;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_LEFT:
|
||||||
|
temp_x++;
|
||||||
|
temp_y++;
|
||||||
|
break;
|
||||||
|
case CHECK_DIAG_RIGHT:
|
||||||
|
temp_x++;
|
||||||
|
temp_y--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 消息框,任意键按下后退出
|
||||||
|
* @param head: 标题
|
||||||
|
* @param content: 内容
|
||||||
|
*/
|
||||||
|
void APP_Gobang_Msg(uint8_t *head, uint8_t *content)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Gobang_SendPosition(void)
|
||||||
|
{
|
||||||
|
uint8_t position[6];
|
||||||
|
position[0] = START_BYTE;
|
||||||
|
position[1] = '0' + cursor_x / 10;
|
||||||
|
position[2] = '0' + cursor_x % 10;
|
||||||
|
position[3] = '0' + cursor_y / 10;
|
||||||
|
position[4] = '0' + cursor_y % 10;
|
||||||
|
position[5] = END_BYTE;
|
||||||
|
|
||||||
|
HC12_SendBuff(position, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Gobang_RevPosition(void)
|
||||||
|
{
|
||||||
|
uint8_t byte;
|
||||||
|
uint8_t position[5];
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (HC12_Receive(&byte) == 1)
|
||||||
|
{
|
||||||
|
if (byte == START_BYTE)
|
||||||
|
{
|
||||||
|
HC12_ReceiveBuffUntil(position, END_BYTE, 500);
|
||||||
|
cursor_x = (position[0] - '0') * 10 + position[1] - '0';
|
||||||
|
cursor_y = (position[2] - '0') * 10 + position[3] - '0';
|
||||||
|
|
||||||
|
if (map[cursor_x][cursor_y] == NO_CHESS)
|
||||||
|
{
|
||||||
|
chess_kind = map[cursor_x][cursor_y] = turn == BLACK_TURN ? BLACK_CHESS : WHITE_CHESS;
|
||||||
|
APP_Gobang_DispGobang();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t APP_Gobang_Connect(void)
|
||||||
|
{
|
||||||
|
HC12_BindReceiveHandle(APP_Gobang_ConnectRevHandler);
|
||||||
|
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "当前未联机", "按“OK”以发起联机", NULL);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
switch (KEY_GetKey())
|
||||||
|
{
|
||||||
|
case JOY_OK_DOWN:
|
||||||
|
{
|
||||||
|
if (APP_Gobang_InitiateConnet())
|
||||||
|
{
|
||||||
|
uint8_t *head = (my_turn == BLACK_TURN ? "本局我方执黑" : "本局我方执白");
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, "按“OK”开始游戏", NULL);
|
||||||
|
Delay_ms(500);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
APP_Gobang_ConfirmBeforeStart();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "当前未联机", "按“OK”以发起联机", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_L_DOWN:
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connetion_msg == REQUEST_MSG)
|
||||||
|
{
|
||||||
|
if (APP_Gobang_ReplyConnect())
|
||||||
|
{
|
||||||
|
uint8_t *head = (my_turn == BLACK_TURN ? "本局我方执黑" : "本局我方执白");
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, "按“OK”开始游戏", NULL);
|
||||||
|
Delay_ms(500);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
APP_Gobang_ConfirmBeforeStart();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "当前未联机", "按“OK”以发起联机", NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t APP_Gobang_InitiateConnet(void)
|
||||||
|
{
|
||||||
|
int32_t start_time = SysTick_GetRunTime();
|
||||||
|
|
||||||
|
uint8_t msg[] = {START_BYTE, REQUEST_MSG};
|
||||||
|
HC12_SendBuff(msg, 2);
|
||||||
|
HC12_ClearReceive;
|
||||||
|
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "当前未联机", "请求已发送,等待对方响应...", NULL);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (SysTick_CheckRunTime(start_time) > 10000)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "联机失败", "对方无响应,按“OK”退出", NULL);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connetion_msg == AGREE_MSG)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "联机成功", "按“OK”进入游戏", NULL);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (connetion_msg == REFUSE_MSG)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "联机失败", "对方拒绝联机,按“OK”退出", NULL);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t APP_Gobang_ReplyConnect(void)
|
||||||
|
{
|
||||||
|
uint8_t content[2][GE_GUI_MENUBOX_CONTENT_LEN] = {"是", "否"};
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
|
||||||
|
switch (GE_GUI_MenuBox(60, 75, 200, 90, "对方请求联机,是否接受?", 2, content, NULL))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
uint8_t msg[] = {START_BYTE, AGREE_MSG};
|
||||||
|
HC12_SendBuff(msg, 2);
|
||||||
|
APP_Gobang_DecideMyTurn();
|
||||||
|
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "联机成功", "按“OK”进入游戏", NULL);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
uint8_t msg[] = {START_BYTE, REFUSE_MSG};
|
||||||
|
HC12_SendBuff(msg, 2);
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "联机失败", "已拒绝联机,按“OK”退出", NULL);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
connetion_msg = NONE_MSG;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Gobang_DecideMyTurn(void)
|
||||||
|
{
|
||||||
|
my_turn = Random() % 2;
|
||||||
|
|
||||||
|
uint8_t msg[] = {START_BYTE, !my_turn};
|
||||||
|
HC12_SendBuff(msg, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Gobang_ConfirmBeforeStart(void)
|
||||||
|
{
|
||||||
|
if (my_turn == BLACK_TURN)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "游戏即将开始", "正在确认白色方设备状态...", NULL);
|
||||||
|
while (connetion_msg != CONFIRM_MSG)
|
||||||
|
{
|
||||||
|
Delay_ms(100);
|
||||||
|
}
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, "准备就绪", "按“OK”开始游戏", NULL);
|
||||||
|
Delay_ms(500);
|
||||||
|
KEY_WaitKey(JOY_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint8_t msg[] = {START_BYTE, CONFIRM_MSG};
|
||||||
|
HC12_SendBuff(msg, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APP_Gobang_ConnectRevHandler(uint8_t byte)
|
||||||
|
{
|
||||||
|
static uint8_t is_receiving = FALSE;
|
||||||
|
|
||||||
|
if (is_receiving == FALSE && byte == START_BYTE)
|
||||||
|
{
|
||||||
|
is_receiving = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_receiving == TRUE)
|
||||||
|
{
|
||||||
|
if (byte == REQUEST_MSG || byte == AGREE_MSG || byte == REFUSE_MSG || byte == CONFIRM_MSG)
|
||||||
|
{
|
||||||
|
connetion_msg = byte;
|
||||||
|
is_receiving = FALSE;
|
||||||
|
}
|
||||||
|
else if (byte == BLACK_TURN || byte == WHITE_TURN)
|
||||||
|
{
|
||||||
|
my_turn = byte;
|
||||||
|
is_receiving = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
User/APP_Gobang/APP_Gobang.h
Normal file
8
User/APP_Gobang/APP_Gobang.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//五子棋应用
|
||||||
|
|
||||||
|
#ifndef __APP_GOBANG
|
||||||
|
#define __APP_GOBANG
|
||||||
|
|
||||||
|
void APP_Gobang_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
732
User/APP_Plane/APP_Plane.c
Normal file
732
User/APP_Plane/APP_Plane.c
Normal file
@ -0,0 +1,732 @@
|
|||||||
|
//飞机大战游戏
|
||||||
|
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "led.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
|
||||||
|
#include "fxlib.h"
|
||||||
|
|
||||||
|
#include "APP_Plane_Bitmap.h"
|
||||||
|
|
||||||
|
#include "APP_Plane.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 128
|
||||||
|
#define SCREEN_HEIGHT 64
|
||||||
|
|
||||||
|
#define STATUS_BAR_WIDTH 8
|
||||||
|
|
||||||
|
#define SMALL_PLANE_MAX 32
|
||||||
|
#define MEDIUM_PLANE_MAX 16
|
||||||
|
#define LARGE_PLANE_MAX 2
|
||||||
|
|
||||||
|
#define BULLET_MAX 16
|
||||||
|
|
||||||
|
#define PLANE_TYPE_SMALL 0
|
||||||
|
#define PLANE_TYPE_MEDIUM 1
|
||||||
|
#define PLANE_TYPE_LARGE 2
|
||||||
|
|
||||||
|
#define PLANE_STATUS_NONEXISTENT (-14)
|
||||||
|
#define PLANE_STATUS_EXPLODING_2 (-13)
|
||||||
|
#define PLANE_STATUS_EXPLODING_1 (-6)
|
||||||
|
#define PLANE_STATUS_ALIVE 1
|
||||||
|
|
||||||
|
#define SP_HEALTH_VAL 2
|
||||||
|
#define MP_HEALTH_VAL 6
|
||||||
|
#define LP_HEALTH_VAL 10
|
||||||
|
|
||||||
|
#define BULLET_STATUS_NONEXISTENT 0
|
||||||
|
#define BULLET_STATUS_FLYING 1
|
||||||
|
|
||||||
|
#define DIRECTION_UP 0
|
||||||
|
#define DIRECTION_DOWN 1
|
||||||
|
#define DIRECTION_LEFT 2
|
||||||
|
#define DIRECTION_RIGHT 3
|
||||||
|
|
||||||
|
#define SP_GRAPHIC_WIDTH 7
|
||||||
|
#define SP_GRAPHIC_HEIGHT 7
|
||||||
|
|
||||||
|
#define MP_GRAPHIC_WIDTH 12
|
||||||
|
#define MP_GRAPHIC_HEIGHT 9
|
||||||
|
|
||||||
|
#define LP_GRAPHIC_WIDTH 33
|
||||||
|
#define LP_GRAPHIC_HEIGHT 22
|
||||||
|
|
||||||
|
#define RP_GRAPHIC_WIDTH 13
|
||||||
|
#define RP_GRAPHIC_HEIGHT 13
|
||||||
|
|
||||||
|
#define BULLET_GRAPHIC_WIDTH 5
|
||||||
|
#define BULLET_GRAPHIC_HEIGHT 3
|
||||||
|
|
||||||
|
#define SP_COLLISION_POS_X 1
|
||||||
|
#define SP_COLLISION_POS_Y 1
|
||||||
|
#define SP_COLLISION_WIDTH 5
|
||||||
|
#define SP_COLLISION_HEIGHT 5
|
||||||
|
|
||||||
|
#define MP_COLLISION_POS_X 1
|
||||||
|
#define MP_COLLISION_POS_Y 1
|
||||||
|
#define MP_COLLISION_WIDTH 10
|
||||||
|
#define MP_COLLISION_HEIGHT 7
|
||||||
|
|
||||||
|
#define LP_COLLISION_POS_X 2
|
||||||
|
#define LP_COLLISION_POS_Y 2
|
||||||
|
#define LP_COLLISION_WIDTH 27
|
||||||
|
#define LP_COLLISION_HEIGHT 18
|
||||||
|
|
||||||
|
#define RP_COLLISION_POS_X 2
|
||||||
|
#define RP_COLLISION_POS_Y 2
|
||||||
|
#define RP_COLLISION_WIDTH 8
|
||||||
|
#define RP_COLLISION_HEIGHT 9
|
||||||
|
|
||||||
|
#define BULLET_COLLISION_POS_X (-1)
|
||||||
|
#define BULLET_COLLISION_POS_Y 0
|
||||||
|
#define BULLET_COLLISION_WIDTH 5
|
||||||
|
#define BULLET_COLLISION_HEIGHT 5
|
||||||
|
|
||||||
|
#define COLLISION_ROLE_PLANE 0
|
||||||
|
#define NO_COLLISION_ROLE_PLANE 1
|
||||||
|
|
||||||
|
#define Random() rand()
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int status;
|
||||||
|
} Object;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
|
||||||
|
Object Small_Plane[SMALL_PLANE_MAX];
|
||||||
|
Object Medium_Plane[MEDIUM_PLANE_MAX];
|
||||||
|
Object Large_Plane[LARGE_PLANE_MAX];
|
||||||
|
Object Bullet[BULLET_MAX];
|
||||||
|
Object Role_Plane;
|
||||||
|
|
||||||
|
int SP_Generate_Interval_Max, SP_Generate_Interval_Min, MP_Generate_Interval_Max, MP_Generate_Interval_Min, LP_Generate_Interval_Max, LP_Generate_Interval_Min, Bullet_Generate_Interval;
|
||||||
|
int SP_Move_Interval, MP_Move_Interval, LP_Move_Interval, Bullet_Move_Interval;
|
||||||
|
int Get_Key_Interval, Turbo_Interval;
|
||||||
|
int SP_Destroyed, MP_Destroyed, LP_Destroyed, Score;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void Menu(void);
|
||||||
|
void Game(void);
|
||||||
|
void Move_Plane(int type);
|
||||||
|
void New_Plane(int type);
|
||||||
|
void Move_Role_Plane(int direction);
|
||||||
|
void Move_Bullet(void);
|
||||||
|
void New_Bullet(void);
|
||||||
|
void Init(void);
|
||||||
|
void Draw_All(void);
|
||||||
|
void Game_Over(void);
|
||||||
|
int Collision_Detection(void);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动飞机大战游戏
|
||||||
|
*/
|
||||||
|
void APP_Plane_Launcher(void)
|
||||||
|
{
|
||||||
|
Game();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game()
|
||||||
|
{
|
||||||
|
srand(SysTick->VAL);
|
||||||
|
|
||||||
|
int sp_generate_interval, mp_generate_interval, lp_generate_interval;
|
||||||
|
int sp_move_timer = 0, mp_move_timer = 0, lp_move_timer = 0, bullet_move_timer = 0;
|
||||||
|
int sp_generate_timer = 0, mp_generate_timer = 0, lp_generate_timer = 0, bullet_generate_timer = 0;
|
||||||
|
int get_key_timer = 0, turbo_timer = 0;
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
sp_generate_interval = Random() % (SP_Generate_Interval_Max - SP_Generate_Interval_Min) + SP_Generate_Interval_Min;
|
||||||
|
mp_generate_interval = Random() % (MP_Generate_Interval_Max - MP_Generate_Interval_Min) + MP_Generate_Interval_Min;
|
||||||
|
lp_generate_interval = Random() % (LP_Generate_Interval_Max - LP_Generate_Interval_Min) + LP_Generate_Interval_Min;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
sp_move_timer++;
|
||||||
|
mp_move_timer++;
|
||||||
|
lp_move_timer++;
|
||||||
|
bullet_move_timer++;
|
||||||
|
|
||||||
|
sp_generate_timer++;
|
||||||
|
mp_generate_timer++;
|
||||||
|
lp_generate_timer++;
|
||||||
|
bullet_generate_timer++;
|
||||||
|
|
||||||
|
get_key_timer++;
|
||||||
|
turbo_timer++;
|
||||||
|
|
||||||
|
if (sp_move_timer >= SP_Move_Interval)
|
||||||
|
{
|
||||||
|
Move_Plane(PLANE_TYPE_SMALL);
|
||||||
|
sp_move_timer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sp_generate_timer >= sp_generate_interval)
|
||||||
|
{
|
||||||
|
New_Plane(PLANE_TYPE_SMALL);
|
||||||
|
sp_generate_timer = 0;
|
||||||
|
sp_generate_interval = Random() % (SP_Generate_Interval_Max - SP_Generate_Interval_Min) + SP_Generate_Interval_Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mp_move_timer >= MP_Move_Interval)
|
||||||
|
{
|
||||||
|
Move_Plane(PLANE_TYPE_MEDIUM);
|
||||||
|
mp_move_timer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mp_generate_timer >= mp_generate_interval)
|
||||||
|
{
|
||||||
|
New_Plane(PLANE_TYPE_MEDIUM);
|
||||||
|
mp_generate_timer = 0;
|
||||||
|
mp_generate_interval = Random() % (MP_Generate_Interval_Max - MP_Generate_Interval_Min) + MP_Generate_Interval_Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lp_move_timer >= LP_Move_Interval)
|
||||||
|
{
|
||||||
|
Move_Plane(PLANE_TYPE_LARGE);
|
||||||
|
lp_move_timer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lp_generate_timer >= lp_generate_interval)
|
||||||
|
{
|
||||||
|
New_Plane(PLANE_TYPE_LARGE);
|
||||||
|
lp_generate_timer = 0;
|
||||||
|
lp_generate_interval = Random() % (LP_Generate_Interval_Max - LP_Generate_Interval_Min) + LP_Generate_Interval_Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bullet_move_timer >= Bullet_Move_Interval)
|
||||||
|
{
|
||||||
|
Move_Bullet();
|
||||||
|
bullet_move_timer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bullet_generate_timer >= Bullet_Generate_Interval)
|
||||||
|
{
|
||||||
|
New_Bullet();
|
||||||
|
bullet_generate_timer = 0;
|
||||||
|
Score++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_key_timer >= Get_Key_Interval)
|
||||||
|
{
|
||||||
|
get_key_timer = 0;
|
||||||
|
switch (KEY_GetKey())
|
||||||
|
{
|
||||||
|
case JOY_U_DOWN:
|
||||||
|
Move_Role_Plane(DIRECTION_UP);
|
||||||
|
break;
|
||||||
|
case JOY_D_DOWN:
|
||||||
|
Move_Role_Plane(DIRECTION_DOWN);
|
||||||
|
break;
|
||||||
|
case JOY_L_DOWN:
|
||||||
|
Move_Role_Plane(DIRECTION_LEFT);
|
||||||
|
break;
|
||||||
|
case JOY_R_DOWN:
|
||||||
|
Move_Role_Plane(DIRECTION_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (key_down(K_EXIT))
|
||||||
|
// {
|
||||||
|
// Game_Over();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (turbo_timer >= Turbo_Interval)
|
||||||
|
{
|
||||||
|
if (SP_Generate_Interval_Max > 100)
|
||||||
|
SP_Generate_Interval_Max -= 50;
|
||||||
|
if (SP_Generate_Interval_Min > 50)
|
||||||
|
SP_Generate_Interval_Min -= 25;
|
||||||
|
if (SP_Move_Interval > 10)
|
||||||
|
SP_Move_Interval--;
|
||||||
|
|
||||||
|
if (MP_Generate_Interval_Max > 200)
|
||||||
|
MP_Generate_Interval_Max -= 100;
|
||||||
|
if (MP_Generate_Interval_Min > 100)
|
||||||
|
MP_Generate_Interval_Min -= 50;
|
||||||
|
if (MP_Move_Interval > 15)
|
||||||
|
MP_Move_Interval -= 2;
|
||||||
|
|
||||||
|
if (LP_Generate_Interval_Max > 2000)
|
||||||
|
LP_Generate_Interval_Max -= 2000;
|
||||||
|
if (LP_Generate_Interval_Min > 1000)
|
||||||
|
LP_Generate_Interval_Min -= 1000;
|
||||||
|
if (LP_Move_Interval > 30)
|
||||||
|
LP_Move_Interval -= 3;
|
||||||
|
|
||||||
|
if (Turbo_Interval > 1000)
|
||||||
|
Turbo_Interval -= 1000;
|
||||||
|
turbo_timer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Collision_Dection() == COLLISION_ROLE_PLANE)
|
||||||
|
{
|
||||||
|
Game_Over();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ML_clear_vram();
|
||||||
|
Draw_All();
|
||||||
|
ML_display_vram();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Move_Role_Plane(int direction)
|
||||||
|
{
|
||||||
|
if (direction == DIRECTION_UP && Role_Plane.y > 0)
|
||||||
|
Role_Plane.y--;
|
||||||
|
if (direction == DIRECTION_DOWN && Role_Plane.y + RP_GRAPHIC_HEIGHT < SCREEN_HEIGHT)
|
||||||
|
Role_Plane.y++;
|
||||||
|
if (direction == DIRECTION_LEFT && Role_Plane.x > 0)
|
||||||
|
Role_Plane.x--;
|
||||||
|
if (direction == DIRECTION_RIGHT && Role_Plane.x + RP_GRAPHIC_WIDTH < SCREEN_WIDTH - STATUS_BAR_WIDTH)
|
||||||
|
Role_Plane.x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void New_Bullet()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < BULLET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bullet[i].status == BULLET_STATUS_NONEXISTENT)
|
||||||
|
{
|
||||||
|
Bullet[i].status = BULLET_STATUS_FLYING;
|
||||||
|
Bullet[i].x = Role_Plane.x + RP_GRAPHIC_WIDTH;
|
||||||
|
Bullet[i].y = Role_Plane.y + (RP_GRAPHIC_HEIGHT >> 1) - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void New_Plane(int type)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_SMALL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < SMALL_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Small_Plane[i].status == PLANE_STATUS_NONEXISTENT)
|
||||||
|
{
|
||||||
|
Small_Plane[i].status = SP_HEALTH_VAL;
|
||||||
|
Small_Plane[i].x = SCREEN_WIDTH - STATUS_BAR_WIDTH;
|
||||||
|
Small_Plane[i].y = Random() % (SCREEN_HEIGHT - SP_GRAPHIC_HEIGHT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_MEDIUM)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MEDIUM_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Medium_Plane[i].status == PLANE_STATUS_NONEXISTENT)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].status = MP_HEALTH_VAL;
|
||||||
|
Medium_Plane[i].x = SCREEN_WIDTH - STATUS_BAR_WIDTH;
|
||||||
|
Medium_Plane[i].y = Random() % (SCREEN_HEIGHT - MP_GRAPHIC_HEIGHT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_LARGE)
|
||||||
|
{
|
||||||
|
for (i = 0; i < LARGE_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Large_Plane[i].status == PLANE_STATUS_NONEXISTENT)
|
||||||
|
{
|
||||||
|
Large_Plane[i].status = LP_HEALTH_VAL;
|
||||||
|
Large_Plane[i].x = SCREEN_WIDTH - STATUS_BAR_WIDTH;
|
||||||
|
Large_Plane[i].y = Random() % (SCREEN_HEIGHT - LP_GRAPHIC_HEIGHT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Move_Plane(int type)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_SMALL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < SMALL_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Small_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
Small_Plane[i].x--;
|
||||||
|
if (Small_Plane[i].x < -SP_GRAPHIC_WIDTH)
|
||||||
|
Small_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
else if (Small_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
Small_Plane[i].status--;
|
||||||
|
}
|
||||||
|
else if (Small_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
Small_Plane[i].status--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_MEDIUM)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MEDIUM_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Medium_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].x--;
|
||||||
|
if (Medium_Plane[i].x < -MP_GRAPHIC_WIDTH)
|
||||||
|
Medium_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
else if (Medium_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].status--;
|
||||||
|
}
|
||||||
|
else if (Medium_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].status--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PLANE_TYPE_LARGE)
|
||||||
|
{
|
||||||
|
for (i = 0; i < LARGE_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Large_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
Large_Plane[i].x--;
|
||||||
|
if (Large_Plane[i].x < -LP_GRAPHIC_WIDTH)
|
||||||
|
Large_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
else if (Large_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
Large_Plane[i].status--;
|
||||||
|
}
|
||||||
|
else if (Large_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
Large_Plane[i].status--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Move_Bullet()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < BULLET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bullet[i].status == BULLET_STATUS_FLYING)
|
||||||
|
{
|
||||||
|
Bullet[i].x++;
|
||||||
|
if (Bullet[i].x > SCREEN_WIDTH - STATUS_BAR_WIDTH)
|
||||||
|
Bullet[i].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < SMALL_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
Small_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < MEDIUM_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < LARGE_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
Large_Plane[i].status = PLANE_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < BULLET_MAX; i++)
|
||||||
|
{
|
||||||
|
Bullet[i].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
Role_Plane.x = 0;
|
||||||
|
Role_Plane.y = (SCREEN_HEIGHT - RP_GRAPHIC_HEIGHT) / 2;
|
||||||
|
Role_Plane.status = PLANE_STATUS_ALIVE;
|
||||||
|
|
||||||
|
SP_Generate_Interval_Max = 300; //600
|
||||||
|
SP_Generate_Interval_Min = 150; //300
|
||||||
|
SP_Move_Interval = 3; //20
|
||||||
|
|
||||||
|
MP_Generate_Interval_Max = 600; //1200
|
||||||
|
MP_Generate_Interval_Min = 300; //600
|
||||||
|
MP_Move_Interval = 5; //30
|
||||||
|
|
||||||
|
LP_Generate_Interval_Max = 6000; //12000
|
||||||
|
LP_Generate_Interval_Min = 3000; //6000
|
||||||
|
LP_Move_Interval = 10; //60
|
||||||
|
|
||||||
|
Bullet_Move_Interval = 1; //3
|
||||||
|
Bullet_Generate_Interval = 30; //100
|
||||||
|
|
||||||
|
Get_Key_Interval = 1;
|
||||||
|
Turbo_Interval = 10000;
|
||||||
|
|
||||||
|
SP_Destroyed = 0;
|
||||||
|
MP_Destroyed = 0;
|
||||||
|
LP_Destroyed = 0;
|
||||||
|
Score = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw_All()
|
||||||
|
{
|
||||||
|
int i, j, digit, remain;
|
||||||
|
unsigned char tmp;
|
||||||
|
|
||||||
|
for (i = 0; i < LARGE_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Large_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_LP_CoverArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_LP_ClearArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
}
|
||||||
|
else if (Large_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_LP_CoverArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_LP_ClearArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_1, Large_Plane[i].x, Large_Plane[i].y, 16, 16);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_1, Large_Plane[i].x + LP_GRAPHIC_WIDTH - 16, Large_Plane[i].y + LP_GRAPHIC_HEIGHT - 16, 16, 16);
|
||||||
|
}
|
||||||
|
else if (Large_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_LP_CoverArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_LP_ClearArea, Large_Plane[i].x, Large_Plane[i].y, LP_GRAPHIC_WIDTH, LP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_2, Large_Plane[i].x, Large_Plane[i].y, 16, 16);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_2, Large_Plane[i].x + LP_GRAPHIC_WIDTH - 16, Large_Plane[i].y + LP_GRAPHIC_HEIGHT - 16, 16, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < MEDIUM_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Medium_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_MP_CoverArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_MP_ClearArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
}
|
||||||
|
else if (Medium_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_MP_CoverArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_MP_ClearArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_1, Medium_Plane[i].x + 2, Medium_Plane[i].y, 8, 8);
|
||||||
|
}
|
||||||
|
else if (Medium_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_MP_CoverArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_MP_ClearArea, Medium_Plane[i].x, Medium_Plane[i].y, MP_GRAPHIC_WIDTH, MP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_2, Medium_Plane[i].x + 2, Medium_Plane[i].y, 8, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < SMALL_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Small_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_SP_CoverArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_SP_ClearArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
}
|
||||||
|
else if (Small_Plane[i].status >= PLANE_STATUS_EXPLODING_1)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_SP_CoverArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_SP_ClearArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_1, Small_Plane[i].x, Small_Plane[i].y - 1, 8, 8);
|
||||||
|
}
|
||||||
|
else if (Small_Plane[i].status >= PLANE_STATUS_EXPLODING_2)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_SP_CoverArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_SP_ClearArea, Small_Plane[i].x, Small_Plane[i].y, SP_GRAPHIC_WIDTH, SP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_2, Small_Plane[i].x, Small_Plane[i].y - 1, 8, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < BULLET_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Bullet[i].status == BULLET_STATUS_FLYING)
|
||||||
|
ML_bmp_or_cl(Bitmap_Bullet, Bullet[i].x, Bullet[i].y, BULLET_GRAPHIC_WIDTH, BULLET_GRAPHIC_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Role_Plane.status == PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
ML_bmp_or_cl(Bitmap_RP_CoverArea, Role_Plane.x, Role_Plane.y, RP_GRAPHIC_WIDTH, RP_GRAPHIC_HEIGHT);
|
||||||
|
ML_bmp_xor_cl(Bitmap_RP_ClearArea, Role_Plane.x, Role_Plane.y, RP_GRAPHIC_WIDTH, RP_GRAPHIC_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
j = 10000000;
|
||||||
|
remain = Score;
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
digit = remain / j;
|
||||||
|
ML_bmp_or_cl(Bitmap_Numbers[digit], SCREEN_WIDTH - STATUS_BAR_WIDTH, i * 4, 7, 3);
|
||||||
|
remain -= digit * j;
|
||||||
|
j /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
GE_Draw_Rectangle(32, 56, 257, 129, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Collision_Dection()
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
int x1, y1, w1, h1, x2, y2, w2, h2, x3, y3, w3, h3;
|
||||||
|
|
||||||
|
x1 = Role_Plane.x + RP_COLLISION_POS_X;
|
||||||
|
y1 = Role_Plane.y + RP_COLLISION_POS_Y;
|
||||||
|
w1 = RP_COLLISION_WIDTH;
|
||||||
|
h1 = RP_COLLISION_HEIGHT;
|
||||||
|
|
||||||
|
w2 = SP_COLLISION_WIDTH;
|
||||||
|
h2 = SP_COLLISION_HEIGHT;
|
||||||
|
w3 = BULLET_COLLISION_WIDTH;
|
||||||
|
h3 = BULLET_COLLISION_HEIGHT;
|
||||||
|
for (i = 0; i < SMALL_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Small_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
x2 = Small_Plane[i].x + SP_COLLISION_POS_X;
|
||||||
|
y2 = Small_Plane[i].y + SP_COLLISION_POS_Y;
|
||||||
|
if (x1 - x2 < w2 && x2 - x1 < w1 && y1 - y2 < h2 && y2 - y1 < h1)
|
||||||
|
return COLLISION_ROLE_PLANE;
|
||||||
|
for (j = 0; j < BULLET_MAX; j++)
|
||||||
|
{
|
||||||
|
if (Bullet[j].status == BULLET_STATUS_FLYING)
|
||||||
|
{
|
||||||
|
x3 = Bullet[j].x + BULLET_COLLISION_POS_X;
|
||||||
|
y3 = Bullet[j].y + BULLET_COLLISION_POS_Y;
|
||||||
|
if (x3 - x2 < w2 && x2 - x3 < w3 && y3 - y2 < h2 && y2 - y3 < h3)
|
||||||
|
{
|
||||||
|
Small_Plane[i].status--;
|
||||||
|
if (Small_Plane[i].status == PLANE_STATUS_ALIVE - 1)
|
||||||
|
{
|
||||||
|
SP_Destroyed++;
|
||||||
|
Score += 1000;
|
||||||
|
}
|
||||||
|
Bullet[j].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
w2 = MP_COLLISION_WIDTH;
|
||||||
|
h2 = MP_COLLISION_HEIGHT;
|
||||||
|
w3 = BULLET_COLLISION_WIDTH;
|
||||||
|
h3 = BULLET_COLLISION_HEIGHT;
|
||||||
|
for (i = 0; i < MEDIUM_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Medium_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
x2 = Medium_Plane[i].x + MP_COLLISION_POS_X;
|
||||||
|
y2 = Medium_Plane[i].y + MP_COLLISION_POS_Y;
|
||||||
|
if (x1 - x2 < w2 && x2 - x1 < w1 && y1 - y2 < h2 && y2 - y1 < h1)
|
||||||
|
return COLLISION_ROLE_PLANE;
|
||||||
|
for (j = 0; j < BULLET_MAX; j++)
|
||||||
|
{
|
||||||
|
if (Bullet[j].status == BULLET_STATUS_FLYING)
|
||||||
|
{
|
||||||
|
x3 = Bullet[j].x + BULLET_COLLISION_POS_X;
|
||||||
|
y3 = Bullet[j].y + BULLET_COLLISION_POS_Y;
|
||||||
|
if (x3 - x2 < w2 && x2 - x3 < w3 && y3 - y2 < h2 && y2 - y3 < h3)
|
||||||
|
{
|
||||||
|
Medium_Plane[i].status--;
|
||||||
|
if (Medium_Plane[i].status == PLANE_STATUS_ALIVE - 1)
|
||||||
|
{
|
||||||
|
MP_Destroyed++;
|
||||||
|
Score += 6000;
|
||||||
|
}
|
||||||
|
Bullet[j].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
w2 = LP_COLLISION_WIDTH;
|
||||||
|
h2 = LP_COLLISION_HEIGHT;
|
||||||
|
w3 = BULLET_COLLISION_WIDTH;
|
||||||
|
h3 = BULLET_COLLISION_HEIGHT;
|
||||||
|
for (i = 0; i < LARGE_PLANE_MAX; i++)
|
||||||
|
{
|
||||||
|
if (Large_Plane[i].status >= PLANE_STATUS_ALIVE)
|
||||||
|
{
|
||||||
|
x2 = Large_Plane[i].x + LP_COLLISION_POS_X;
|
||||||
|
y2 = Large_Plane[i].y + LP_COLLISION_POS_Y;
|
||||||
|
if (x1 - x2 < w2 && x2 - x1 < w1 && y1 - y2 < h2 && y2 - y1 < h1)
|
||||||
|
return COLLISION_ROLE_PLANE;
|
||||||
|
for (j = 0; j < BULLET_MAX; j++)
|
||||||
|
{
|
||||||
|
if (Bullet[j].status == BULLET_STATUS_FLYING)
|
||||||
|
{
|
||||||
|
x3 = Bullet[j].x + BULLET_COLLISION_POS_X;
|
||||||
|
y3 = Bullet[j].y + BULLET_COLLISION_POS_Y;
|
||||||
|
if (x3 - x2 < w2 && x2 - x3 < w3 && y3 - y2 < h2 && y2 - y3 < h3)
|
||||||
|
{
|
||||||
|
Large_Plane[i].status--;
|
||||||
|
if (Large_Plane[i].status == PLANE_STATUS_ALIVE - 1)
|
||||||
|
{
|
||||||
|
LP_Destroyed++;
|
||||||
|
Score += 10000;
|
||||||
|
}
|
||||||
|
Bullet[j].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO_COLLISION_ROLE_PLANE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Game_Over()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < BULLET_MAX; i++)
|
||||||
|
{
|
||||||
|
Bullet[i].status = BULLET_STATUS_NONEXISTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
ML_clear_vram();
|
||||||
|
Draw_All();
|
||||||
|
ML_display_vram();
|
||||||
|
Sleep(750);
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_1, Role_Plane.x - 2, Role_Plane.y - 2, 16, 16);
|
||||||
|
ML_display_vram();
|
||||||
|
Sleep(750);
|
||||||
|
ML_clear_vram();
|
||||||
|
Draw_All();
|
||||||
|
ML_bmp_or_cl(Bitmap_Explosion_Large_2, Role_Plane.x - 2, Role_Plane.y - 2, 16, 16);
|
||||||
|
ML_display_vram();
|
||||||
|
Sleep(1500);
|
||||||
|
}
|
||||||
8
User/APP_Plane/APP_Plane.h
Normal file
8
User/APP_Plane/APP_Plane.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//飞机大战游戏
|
||||||
|
|
||||||
|
#ifndef __APP_PLANE
|
||||||
|
#define __APP_PLANE
|
||||||
|
|
||||||
|
void APP_Plane_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
162
User/APP_Plane/APP_Plane_Bitmap.h
Normal file
162
User/APP_Plane/APP_Plane_Bitmap.h
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
#ifndef __APP_PLANE_BITMAP_H
|
||||||
|
#define __APP_PLANE_BITMAP_H
|
||||||
|
|
||||||
|
const unsigned char Bitmap_SP_CoverArea[] = {
|
||||||
|
0x18, 0x38, 0x7a, 0xfe, 0x7a, 0x38, 0x18};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_SP_ClearArea[] = {
|
||||||
|
0x00, 0x10, 0x30, 0x40, 0x30, 0x10, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_MP_CoverArea[] = {
|
||||||
|
0x0f, 0x00, 0x02, 0x00, 0x1f, 0x00, 0x7f, 0xa0, 0xff, 0xf0, 0x7f, 0xa0, 0x1f, 0x00, 0x02, 0x00,
|
||||||
|
0x0f, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_MP_ClearArea[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x56, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_LP_CoverArea[] = {
|
||||||
|
0x01, 0x80, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x08, 0x00, 0x00, 0x07, 0xe0, 0x1f, 0xff, 0x80, 0x0f,
|
||||||
|
0xff, 0xc9, 0xe0, 0x00, 0x1f, 0xff, 0xe7, 0xc0, 0x00, 0x3f, 0xff, 0xcf, 0x80, 0x00, 0x7f, 0xff,
|
||||||
|
0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff,
|
||||||
|
0x80, 0x00, 0x7f, 0xff, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xff, 0x80,
|
||||||
|
0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00,
|
||||||
|
0x3f, 0xff, 0xcf, 0x80, 0x00, 0x1f, 0xff, 0xe7, 0xc0, 0x00, 0x0f, 0xff, 0xc9, 0xe0, 0x00, 0x07,
|
||||||
|
0xe0, 0x1f, 0xff, 0x80, 0x03, 0xc0, 0x08, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_LP_ClearArea[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0xc0, 0x00, 0x0f, 0xcf, 0xc1, 0x80, 0x00, 0x1c, 0x37, 0x87, 0x00, 0x00, 0x33, 0x00,
|
||||||
|
0x0e, 0x00, 0x00, 0x26, 0xff, 0xfe, 0x00, 0x00, 0x1d, 0x00, 0x06, 0x00, 0x00, 0x6b, 0x3f, 0x98,
|
||||||
|
0x00, 0x00, 0x2a, 0xd2, 0xb4, 0x80, 0x00, 0x0a, 0xd2, 0xb4, 0x80, 0x00, 0x2b, 0x3f, 0x98, 0x00,
|
||||||
|
0x00, 0x1d, 0x00, 0x06, 0x00, 0x00, 0x26, 0xff, 0xfe, 0x00, 0x00, 0x32, 0x00, 0x0e, 0x00, 0x00,
|
||||||
|
0x1c, 0x37, 0x87, 0x00, 0x00, 0x0f, 0xcf, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x02,
|
||||||
|
0x40, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_RP_CoverArea[] = {
|
||||||
|
0x18, 0x00, 0x3c, 0x00, 0xff, 0x80, 0x3f, 0x00, 0x1f, 0x80, 0x3f, 0xf0, 0x3f, 0xf8, 0x3f, 0xf0,
|
||||||
|
0x1f, 0x80, 0x3f, 0x00, 0xff, 0x80, 0x3c, 0x00, 0x18, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_RP_ClearArea[] = {
|
||||||
|
0x00, 0x00, 0x08, 0x00, 0x2c, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x14, 0x00, 0x11, 0x30, 0x14, 0x00,
|
||||||
|
0x03, 0x00, 0x0e, 0x00, 0x2c, 0x00, 0x08, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Bullet[] = {
|
||||||
|
0x70, 0xf8, 0x70};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Explosion_1[] = {
|
||||||
|
0x00, 0x00, 0x08, 0x10, 0x3a, 0xac, 0x10, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Explosion_2[] = {
|
||||||
|
0x01, 0x25, 0x12, 0xb1, 0x74, 0x88, 0x97, 0x4c};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Explosion_Large_1[] = {
|
||||||
|
0x00, 0x00, 0x20, 0x00, 0x08, 0x00, 0x20, 0x00, 0x09, 0x00, 0x0c, 0x20, 0x46, 0x10, 0x10, 0x20,
|
||||||
|
0x10, 0x30, 0x0a, 0x10, 0x05, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Explosion_Large_2[] = {
|
||||||
|
0x02,
|
||||||
|
0x00,
|
||||||
|
0x27,
|
||||||
|
0x38,
|
||||||
|
0x07,
|
||||||
|
0x34,
|
||||||
|
0x51,
|
||||||
|
0x61,
|
||||||
|
0x19,
|
||||||
|
0x80,
|
||||||
|
0x27,
|
||||||
|
0xda,
|
||||||
|
0x7d,
|
||||||
|
0xf0,
|
||||||
|
0xb0,
|
||||||
|
0xa9,
|
||||||
|
0x4f,
|
||||||
|
0x30,
|
||||||
|
0x2a,
|
||||||
|
0xa0,
|
||||||
|
0x8f,
|
||||||
|
0x3b,
|
||||||
|
0x03,
|
||||||
|
0x2c,
|
||||||
|
0x1a,
|
||||||
|
0x41,
|
||||||
|
0x29,
|
||||||
|
0xc8,
|
||||||
|
0x44,
|
||||||
|
0x20,
|
||||||
|
0x10,
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Numbers[][3] = {
|
||||||
|
0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x80, 0xf2, 0x92, 0x9e, 0x92, 0x92, 0xfe, 0x1e, 0x10, 0xfe, 0x9e,
|
||||||
|
0x92, 0xf2, 0xfe, 0x92, 0xf2, 0x02, 0x02, 0xfe, 0xfe, 0x92, 0xfe, 0x9e, 0x92, 0xfe};
|
||||||
|
|
||||||
|
const unsigned char Bitmap_Menu[] = {
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xff, 0x1f, 0xff, 0xff, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xef, 0xbf, 0xff, 0xf7, 0xff, 0x1f, 0xff, 0xff, 0x3f, 0xe0, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xf7, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xe0, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xef, 0xbf, 0xff, 0xf7, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xef, 0xbf, 0xfc, 0x07, 0xff, 0x1f, 0xff, 0xff, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xed, 0xff, 0xef, 0xbf, 0xfd, 0xb7, 0xff, 0x1f, 0xff, 0xff, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xed, 0xff, 0xed, 0xbf, 0xfd, 0xb7, 0xff, 0x00, 0x00, 0x07, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xed, 0xff, 0xe1, 0xbf, 0xfd, 0xb7, 0xff, 0x00, 0x00, 0x07, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xfd, 0xb7, 0xff, 0x00, 0x00, 0x07, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xfd, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xff, 0xff, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x6d, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x6d, 0xff, 0xfd, 0xff, 0xfc, 0x07, 0xff, 0x00, 0x00, 0x07, 0x39, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x61, 0xff, 0xe0, 0x3f, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x7d, 0xff, 0xec, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x7d, 0xff, 0xed, 0xbf, 0xfc, 0x07, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xed, 0xbf, 0xfd, 0xf7, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xed, 0xbf, 0xfd, 0xf7, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xe1, 0xbf, 0xfd, 0xb7, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xfc, 0x37, 0xff, 0xff, 0x8f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0x7f, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0x7f, 0xff, 0xef, 0xbf, 0xfc, 0x07, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xef, 0xbf, 0xff, 0xb7, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xef, 0xbf, 0xff, 0xb7, 0xff, 0xff, 0xff, 0xff, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xfd, 0xff, 0xef, 0xbf, 0xff, 0xb7, 0xff, 0xff, 0xff, 0xff, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0x01, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xfd, 0xff, 0xef, 0xbf, 0xfc, 0x07, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xfd, 0xff, 0xef, 0xbf, 0xff, 0xf7, 0xff, 0x00, 0x00, 0x07, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xef, 0xbf, 0xfc, 0x07, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xf7, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xff, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x07, 0xff, 0xff, 0x8f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xfc, 0x07, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xfd, 0xbf, 0xfd, 0xb7, 0xff, 0xff, 0x8f, 0xc7, 0x3f, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe1, 0xbf, 0xfd, 0xb7, 0xff, 0x00, 0x0f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xec, 0x3f, 0xfd, 0xb7, 0xff, 0x00, 0x0f, 0xc7, 0x38, 0x00, 0x1f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xb7, 0xff, 0x00, 0x0f, 0xc7, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, 0x1f, 0x80, 0x07, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xed, 0xbf, 0xff, 0xff, 0xff, 0x1f, 0x80, 0x07, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xed, 0xbf, 0xff, 0xff, 0xff, 0x1f, 0x80, 0x07, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xed, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xed, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x39, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xe7, 0x9f, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,7 +1,9 @@
|
|||||||
|
//阅读器应用
|
||||||
|
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "delay.h"
|
#include "systick.h"
|
||||||
|
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
@ -56,6 +58,7 @@ uint8_t APP_Reader_Menu(void);
|
|||||||
uint8_t APP_Reader_SaveWrite(void);
|
uint8_t APP_Reader_SaveWrite(void);
|
||||||
uint8_t APP_Reader_SaveRead(void);
|
uint8_t APP_Reader_SaveRead(void);
|
||||||
void APP_Reader_Msg(uint8_t *head, uint8_t *content);
|
void APP_Reader_Msg(uint8_t *head, uint8_t *content);
|
||||||
|
void APP_Reader_Msg_NoBlock(uint8_t *head, uint8_t *content);
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
@ -65,9 +68,11 @@ void APP_Reader_Msg(uint8_t *head, uint8_t *content);
|
|||||||
void APP_Reader_Launcher(void)
|
void APP_Reader_Launcher(void)
|
||||||
{
|
{
|
||||||
//GUI 选取文件
|
//GUI 选取文件
|
||||||
if (SD_SelectFile(filename, "txt") != SD_OK)
|
uint8_t ret;
|
||||||
|
if ((ret = SD_SelectFile(filename, "txt")) != SD_OK)
|
||||||
{
|
{
|
||||||
APP_Reader_Msg("警告", "选取文件出错!\n\n请按任意键返回");
|
if (ret == SD_ERROR)
|
||||||
|
APP_Reader_Msg("警告", "选取文件出错!\n\n请按任意键返回");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -104,28 +109,26 @@ void APP_Reader_Launcher(void)
|
|||||||
f_open(&page_file, page_filepath, FA_OPEN_EXISTING | FA_READ); //打开分页文件
|
f_open(&page_file, page_filepath, FA_OPEN_EXISTING | FA_READ); //打开分页文件
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
LCD_Disp_Off;
|
|
||||||
GE_Draw_ClrAll(WHITE);
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
|
||||||
if (APP_Reader_ReadPage(current_font_size, current_page) != 0)
|
if (APP_Reader_ReadPage(current_font_size, current_page) != 0)
|
||||||
{
|
{
|
||||||
GE_Draw_ClrAll(WHITE);
|
GE_Draw_ClrAll(WHITE);
|
||||||
LCD_Disp_On;
|
|
||||||
APP_Reader_Msg("警告", "发生错误!\n\n请按任意键返回");
|
APP_Reader_Msg("警告", "发生错误!\n\n请按任意键返回");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LCD_Disp_On;
|
|
||||||
|
|
||||||
switch (KEY_GetKeyWait())
|
switch (KEY_GetKeyWait())
|
||||||
{
|
{
|
||||||
case KEY1: //设置菜单
|
case JOY_L_UP: //设置菜单
|
||||||
{
|
{
|
||||||
if (APP_Reader_Menu() != 0)
|
if (APP_Reader_Menu() != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY2: //向后翻页
|
|
||||||
|
case JOY_D_DOWN: //向后翻页
|
||||||
{
|
{
|
||||||
if (current_page == page_amount)
|
if (current_page == page_amount)
|
||||||
APP_Reader_Msg("提示", "已到最后一页!");
|
APP_Reader_Msg("提示", "已到最后一页!");
|
||||||
@ -133,17 +136,14 @@ void APP_Reader_Launcher(void)
|
|||||||
current_page++;
|
current_page++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEY3: //目前不存在此键
|
|
||||||
|
case JOY_U_DOWN: //向前翻页
|
||||||
{
|
{
|
||||||
if (current_page == 1)
|
if (current_page == 1)
|
||||||
APP_Reader_Msg("提示", "已到第一页!");
|
APP_Reader_Msg("提示", "已到第一页!");
|
||||||
else
|
else
|
||||||
current_page--;
|
current_page--;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case KEY4: //目前不存在此键
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,16 +176,23 @@ uint8_t APP_Reader_ReadPage(uint8_t font_size, uint32_t page_num)
|
|||||||
|
|
||||||
*((uint8_t *)buffer + page.page_size) = '\0';
|
*((uint8_t *)buffer + page.page_size) = '\0';
|
||||||
|
|
||||||
if (font_size == FONT_16)
|
GE_Font_Print(0, 0, BORDER_MAX, BORDER_MAX, font_size, BLACK, WHITE, TRUE, buffer);
|
||||||
ge_font_print_set.font_size = FONT_16;
|
|
||||||
else
|
|
||||||
ge_font_print_set.font_size = FONT_24;
|
|
||||||
|
|
||||||
GE_Font_Print_WithSet(0, 0, BORDER_MAX, BORDER_MAX, buffer);
|
GE_Font_Print(
|
||||||
|
1,
|
||||||
|
223,
|
||||||
|
BORDER_MAX,
|
||||||
|
BORDER_MAX,
|
||||||
|
FONT_16,
|
||||||
|
BLUE,
|
||||||
|
WHITE,
|
||||||
|
TRUE,
|
||||||
|
"页数:%d/%d %.1f%%",
|
||||||
|
page_num,
|
||||||
|
page_amount,
|
||||||
|
(float)page_num / (float)page_amount * 100.0);
|
||||||
|
|
||||||
char temp_str[15];
|
GE_Draw_Disp();
|
||||||
sprintf(temp_str, "页数:%d/%d %.1f%%", page_num, page_amount, (float)page_num / (float)page_amount * 100.0);
|
|
||||||
GE_Font_Print(1, 223, BORDER_MAX, BORDER_MAX, FONT_16, BLUE, WHITE, TRUE, temp_str);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -197,6 +204,8 @@ uint8_t APP_Reader_ReadPage(uint8_t font_size, uint32_t page_num)
|
|||||||
*/
|
*/
|
||||||
uint8_t APP_Reader_SplitPages(uint8_t font_size)
|
uint8_t APP_Reader_SplitPages(uint8_t font_size)
|
||||||
{
|
{
|
||||||
|
APP_Reader_Msg_NoBlock("提示", "正在分页中...\n\n请稍等");
|
||||||
|
|
||||||
uint32_t br;
|
uint32_t br;
|
||||||
FRESULT f_res;
|
FRESULT f_res;
|
||||||
char ch;
|
char ch;
|
||||||
@ -314,12 +323,18 @@ uint8_t APP_Reader_SplitPages(uint8_t font_size)
|
|||||||
*/
|
*/
|
||||||
uint8_t APP_Reader_Menu(void)
|
uint8_t APP_Reader_Menu(void)
|
||||||
{
|
{
|
||||||
uint8_t content[2][GE_GUI_MENUBOX_CONTENT_LEN] = {"字体设置", "退出"};
|
uint8_t content[3][GE_GUI_MENUBOX_CONTENT_LEN] = {"字体设置", "退出阅读器", "返回"};
|
||||||
|
|
||||||
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
||||||
switch (GE_GUI_MenuBox(50, 50, 220, 140, "菜单", 2, content, NULL))
|
switch (GE_GUI_MenuBox(50, 50, 220, 140, "菜单", 3, content, NULL))
|
||||||
{
|
{
|
||||||
case 1:
|
case 0: //返回
|
||||||
|
{
|
||||||
|
KEY_ClearKey();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: //字体设置
|
||||||
{
|
{
|
||||||
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
||||||
|
|
||||||
@ -361,7 +376,7 @@ uint8_t APP_Reader_Menu(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2: //退出
|
||||||
{
|
{
|
||||||
//关闭文件
|
//关闭文件
|
||||||
f_close(&page_file);
|
f_close(&page_file);
|
||||||
@ -372,6 +387,10 @@ uint8_t APP_Reader_Menu(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3: //返回
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -447,5 +466,16 @@ void APP_Reader_Msg(uint8_t *head, uint8_t *content)
|
|||||||
{
|
{
|
||||||
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
||||||
KEY_GetKeyWait();
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 消息框,任意键按下后退出
|
||||||
|
* @param head: 标题
|
||||||
|
* @param content: 内容
|
||||||
|
*/
|
||||||
|
void APP_Reader_Msg_NoBlock(uint8_t *head, uint8_t *content)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
//阅读器应用
|
||||||
|
|
||||||
#ifndef __APP_READER
|
#ifndef __APP_READER
|
||||||
#define __APP_READER
|
#define __APP_READER
|
||||||
|
|
||||||
|
|||||||
150
User/APP_Setting/APP_Setting.c
Normal file
150
User/APP_Setting/APP_Setting.c
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
//系统设置应用
|
||||||
|
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "hc25.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
#include "WLAN.h"
|
||||||
|
|
||||||
|
#include "APP_Setting.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void APP_Setting_Msg(uint8_t *head, uint8_t *content);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动设置
|
||||||
|
*/
|
||||||
|
void APP_Setting_Launcher(void)
|
||||||
|
{
|
||||||
|
uint8_t content[4][GE_GUI_MENUBOX_CONTENT_LEN] = {"网络设置", "夜间模式", "关于", "退出设置"};
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
label_menu_1:
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
switch (GE_GUI_MenuBox(5, 5, 310, 230, "系统设置", 4, content, NULL))
|
||||||
|
{
|
||||||
|
case 0: //退出设置
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: //网络设置
|
||||||
|
{
|
||||||
|
uint8_t content[1][GE_GUI_MENUBOX_CONTENT_LEN] = {"网络信息"};
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(5, 5, 310, 230, WHITE);
|
||||||
|
switch (GE_GUI_MenuBox(5, 5, 310, 230, "网络设置", 1, content, NULL))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
goto label_menu_1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(5, 5, 310, 230, WHITE);
|
||||||
|
|
||||||
|
uint8_t temp_str[80];
|
||||||
|
|
||||||
|
if (WLAN_CheckNet())
|
||||||
|
{
|
||||||
|
uint8_t temp_ipaddr_str[60];
|
||||||
|
|
||||||
|
Delay_ms(2000);
|
||||||
|
if (WLAN_GetIPAddr(temp_ipaddr_str))
|
||||||
|
{
|
||||||
|
char *ret = strrchr(temp_ipaddr_str, '&');
|
||||||
|
*ret = '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(temp_ipaddr_str, "查询失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(temp_str, "网络已连接\n\nIP地址及归属地:\n%s", temp_ipaddr_str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy(temp_str, "网络未连接");
|
||||||
|
}
|
||||||
|
|
||||||
|
GE_GUI_MsgBox(5, 5, 310, 230, "网络设置", temp_str, NULL);
|
||||||
|
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: //夜间模式
|
||||||
|
{
|
||||||
|
uint8_t content[2][GE_GUI_MENUBOX_CONTENT_LEN] = {"开启", "关闭"};
|
||||||
|
|
||||||
|
GE_Draw_Fill(5, 5, 310, 230, WHITE);
|
||||||
|
switch (GE_GUI_MenuBox(5, 5, 310, 230, "夜间模式", 2, content, NULL))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
LCD_SendCmd(LCD_CMD_DINVON);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
LCD_SendCmd(LCD_CMD_DINVOFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: //关于
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(5, 5, 310, 230, WHITE);
|
||||||
|
GE_GUI_MsgBox(5, 5, 310, 230, "关于", "STM32Player v0.2\nPowered By StopPointTeam.\nAll Rights Reversed.\n\n版权所有,盗版必究", NULL);
|
||||||
|
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4: //退出设置
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 消息框,任意键按下后退出
|
||||||
|
* @param head: 标题
|
||||||
|
* @param content: 内容
|
||||||
|
*/
|
||||||
|
void APP_Setting_Msg(uint8_t *head, uint8_t *content)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
8
User/APP_Setting/APP_Setting.h
Normal file
8
User/APP_Setting/APP_Setting.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//系统设置应用
|
||||||
|
|
||||||
|
#ifndef __APP_SETTING
|
||||||
|
#define __APP_SETTING
|
||||||
|
|
||||||
|
void APP_Setting_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
229
User/APP_Video/APP_Video.c
Normal file
229
User/APP_Video/APP_Video.c
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
//视频播放器应用
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "led.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
#include "SD.h"
|
||||||
|
|
||||||
|
#include "APP_Video.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double fps;
|
||||||
|
uint32_t frame_count;
|
||||||
|
} VideoInfo; //视频信息定义
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
|
||||||
|
FIL video_file; //视频文件
|
||||||
|
char video_filename[32]; //视频文件名
|
||||||
|
char video_filepath[32]; //视频文件路径
|
||||||
|
|
||||||
|
VideoInfo video_info;
|
||||||
|
|
||||||
|
volatile uint32_t current_frame = 0;
|
||||||
|
volatile uint8_t is_to_play = 0;
|
||||||
|
volatile uint8_t is_disp_progress = 0;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void APP_Video_Play(void);
|
||||||
|
uint8_t APP_Video_Menu(void);
|
||||||
|
void APP_Video_Msg(uint8_t *head, uint8_t *content);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动视频播放器
|
||||||
|
*/
|
||||||
|
void APP_Video_Launcher(void)
|
||||||
|
{
|
||||||
|
//GUI 选取文件
|
||||||
|
uint8_t ret;
|
||||||
|
if ((ret = SD_SelectFile(video_filename, "32v")) != SD_OK)
|
||||||
|
{
|
||||||
|
if (ret == SD_ERROR)
|
||||||
|
APP_Video_Msg("警告", "选取文件出错!\n\n请按任意键返回");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SD_GetPath(video_filepath, video_filename);
|
||||||
|
|
||||||
|
//打开文件
|
||||||
|
uint8_t res;
|
||||||
|
if (res = f_open(&video_file, video_filepath, FA_OPEN_EXISTING | FA_READ) != FR_OK)
|
||||||
|
{
|
||||||
|
char temp[10];
|
||||||
|
sprintf(temp, "%d", res);
|
||||||
|
APP_Video_Msg("警告", "打开文件出错!\n\n请按任意键返回");
|
||||||
|
APP_Video_Msg("警告", temp);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//读取视频信息
|
||||||
|
uint32_t br;
|
||||||
|
if (f_read(&video_file, &video_info, sizeof(video_info), &br) != FR_OK)
|
||||||
|
{
|
||||||
|
APP_Video_Msg("警告", "读取视频信息错误!\n\n请按任意键返回");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (video_info.fps <= 0.0 || video_info.fps > 45.0)
|
||||||
|
{
|
||||||
|
APP_Video_Msg("警告", "不支持的视频格式!\n\n请按任意键返回");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置定时器
|
||||||
|
TIM_Set(TIM2, video_info.fps, 0, 0);
|
||||||
|
|
||||||
|
f_lseek(&video_file, 153600);
|
||||||
|
APP_Video_Play();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 播放视频
|
||||||
|
* @retval 成功返回 0,失败返回 1
|
||||||
|
*/
|
||||||
|
void APP_Video_Play(void)
|
||||||
|
{
|
||||||
|
uint32_t br;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (f_read(&video_file, GE_Draw_VRam, sizeof(GE_Draw_VRam), &br) != FR_OK)
|
||||||
|
{
|
||||||
|
APP_Video_Msg("警告", "视频播放出错!\n\n请按任意键返回");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_frame++;
|
||||||
|
|
||||||
|
if (is_disp_progress != 0)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(8, 228, 304, 8, WHITE);
|
||||||
|
GE_Draw_Rectangle(10, 230, 300, 4, GREEN);
|
||||||
|
GE_Draw_Rectangle(11, 231, (float)current_frame / (float)video_info.frame_count * 298.0, 2, BLUE);
|
||||||
|
|
||||||
|
is_disp_progress++; //溢出到 0 时进度条消失
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (KEY_GetKey())
|
||||||
|
{
|
||||||
|
case JOY_R_UP: //进度条
|
||||||
|
{
|
||||||
|
is_disp_progress = !is_disp_progress;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JOY_L_UP: //菜单
|
||||||
|
{
|
||||||
|
//关闭定时器
|
||||||
|
TIM_Set(TIM2, 0, 0, 0);
|
||||||
|
|
||||||
|
if (APP_Video_Menu() == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//打开定时器
|
||||||
|
TIM_Set(TIM2, video_info.fps, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (is_to_play != 1)
|
||||||
|
;
|
||||||
|
|
||||||
|
GE_Draw_Disp();
|
||||||
|
is_to_play = 0;
|
||||||
|
|
||||||
|
if (br == 0)
|
||||||
|
{
|
||||||
|
f_lseek(&video_file, 153600);
|
||||||
|
current_frame = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 播放视频
|
||||||
|
* @retval 返回播放器返回 0,结束播放返回 1
|
||||||
|
*/
|
||||||
|
uint8_t APP_Video_Menu(void)
|
||||||
|
{
|
||||||
|
uint8_t content[3][GE_GUI_MENUBOX_CONTENT_LEN] = {"视频信息", "退出播放器", "返回"};
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
||||||
|
switch (GE_GUI_MenuBox(50, 50, 220, 140, "菜单", 3, content, NULL))
|
||||||
|
{
|
||||||
|
case 0: //返回
|
||||||
|
{
|
||||||
|
KEY_ClearKey();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: //视频信息
|
||||||
|
{
|
||||||
|
char str_info[50];
|
||||||
|
sprintf(str_info, "视频帧率: %.2lf\n视频时长: %.2lfs", video_info.fps, (double)video_info.frame_count / video_info.fps);
|
||||||
|
GE_Draw_Fill(50, 50, 220, 140, WHITE);
|
||||||
|
GE_GUI_MsgBox(50, 50, 220, 140, "视频信息", str_info, NULL);
|
||||||
|
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: //退出播放器
|
||||||
|
{
|
||||||
|
f_close(&video_file);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: //返回
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 消息框,任意键按下后退出
|
||||||
|
* @param head: 标题
|
||||||
|
* @param content: 内容
|
||||||
|
*/
|
||||||
|
void APP_Video_Msg(uint8_t *head, uint8_t *content)
|
||||||
|
{
|
||||||
|
GE_Draw_Fill(60, 75, 200, 90, WHITE);
|
||||||
|
GE_GUI_MsgBox(60, 75, 200, 90, head, content, NULL);
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief TIM2 中断处理
|
||||||
|
*/
|
||||||
|
void TIM2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if ((TIM2->SR & TIM_FLAG_UPDATE) != RESET)
|
||||||
|
{
|
||||||
|
//清除更新标志
|
||||||
|
TIM2->SR = ~TIM_FLAG_UPDATE;
|
||||||
|
|
||||||
|
is_to_play = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
User/APP_Video/APP_Video.h
Normal file
8
User/APP_Video/APP_Video.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//视频播放器应用
|
||||||
|
|
||||||
|
#ifndef __APP_VIDEO
|
||||||
|
#define __APP_VIDEO
|
||||||
|
|
||||||
|
void APP_Video_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
119
User/APP_Weather/APP_Weather.c
Normal file
119
User/APP_Weather/APP_Weather.c
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "key.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
#include "WLAN.h"
|
||||||
|
|
||||||
|
#include "APP_Weather.h"
|
||||||
|
|
||||||
|
/**************************************** 私有定义 ****************************************/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t city[20];
|
||||||
|
uint8_t weather[20];
|
||||||
|
uint8_t temp[20];
|
||||||
|
uint8_t wind_dir[20];
|
||||||
|
uint8_t wind_force[20];
|
||||||
|
uint8_t humidity[20];
|
||||||
|
uint8_t quality[20];
|
||||||
|
} Weather;
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 全局变量 ****************************************/
|
||||||
|
|
||||||
|
Weather weather;
|
||||||
|
uint8_t city_str[30];
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void APP_Weather_SetCity(uint8_t *str);
|
||||||
|
uint8_t APP_Weather_Sync(void);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 启动天气应用
|
||||||
|
*/
|
||||||
|
void APP_Weather_Launcher(void)
|
||||||
|
{
|
||||||
|
APP_Weather_SetCity("杭州");
|
||||||
|
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
|
||||||
|
if (APP_Weather_Sync())
|
||||||
|
{
|
||||||
|
printf("连网获取天气成功\n天气: %s %s %s %s %s %s %s\n",
|
||||||
|
weather.city,
|
||||||
|
weather.weather,
|
||||||
|
weather.temp,
|
||||||
|
weather.wind_dir,
|
||||||
|
weather.wind_force,
|
||||||
|
weather.humidity,
|
||||||
|
weather.quality);
|
||||||
|
|
||||||
|
uint8_t temp_str[200];
|
||||||
|
sprintf(temp_str,
|
||||||
|
"城市:%s\n天气:%s\n温度:%s\n风向:%s\n风力:%s\n湿度:%s\n空气质量:%s\n",
|
||||||
|
weather.city,
|
||||||
|
weather.weather,
|
||||||
|
weather.temp,
|
||||||
|
weather.wind_dir,
|
||||||
|
weather.wind_force,
|
||||||
|
weather.humidity,
|
||||||
|
weather.quality);
|
||||||
|
GE_GUI_MsgBox(5, 5, 310, 230, "天气", temp_str, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("连网获取天气失败\n");
|
||||||
|
|
||||||
|
GE_GUI_MsgBox(5, 5, 310, 230, "天气", "连网获取天气失败", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
KEY_WaitKey(JOY_L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 选择城市
|
||||||
|
* @param str: 城市名
|
||||||
|
*/
|
||||||
|
void APP_Weather_SetCity(uint8_t *str)
|
||||||
|
{
|
||||||
|
strcpy(city_str, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 同步天气
|
||||||
|
* @retval 成功返回 1,失败返回 0
|
||||||
|
*/
|
||||||
|
uint8_t APP_Weather_Sync(void)
|
||||||
|
{
|
||||||
|
uint8_t weather_str[50];
|
||||||
|
if (WLAN_GetWeather(weather_str, city_str) != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
uint8_t *p;
|
||||||
|
|
||||||
|
strtok(weather_str, "&");
|
||||||
|
strcpy(weather.city, weather_str);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.weather, p);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.temp, p);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.wind_dir, p);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.wind_force, p);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.humidity, p);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
strcpy(weather.quality, p);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
6
User/APP_Weather/APP_Weather.h
Normal file
6
User/APP_Weather/APP_Weather.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __APP_WEATHER_H
|
||||||
|
#define __APP_WEATHER_H
|
||||||
|
|
||||||
|
void APP_Weather_Launcher(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
86
User/Clock/Clock.c
Normal file
86
User/Clock/Clock.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include "GameEngine.h"
|
||||||
|
#include "WLAN.h"
|
||||||
|
|
||||||
|
#include "Clock.h"
|
||||||
|
|
||||||
|
ClockTime clock_time = {0, 0, 0, 0, 0, 0};
|
||||||
|
uint8_t is_disp = 0;
|
||||||
|
uint16_t disp_x;
|
||||||
|
uint16_t disp_y;
|
||||||
|
uint8_t disp_mode;
|
||||||
|
|
||||||
|
void Clock_Init(void)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"连网获取时间是否成功: %d\n时间: %d-%d-%d %d:%d:%d\n",
|
||||||
|
Clock_Sync(),
|
||||||
|
clock_time.year,
|
||||||
|
clock_time.month,
|
||||||
|
clock_time.day,
|
||||||
|
clock_time.hour,
|
||||||
|
clock_time.minute,
|
||||||
|
clock_time.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Clock_Sync(void)
|
||||||
|
{
|
||||||
|
uint8_t clock_time_str[20];
|
||||||
|
if (WLAN_GetNetClockTime(clock_time_str) != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
uint8_t *p;
|
||||||
|
|
||||||
|
strtok(clock_time_str, "&");
|
||||||
|
sscanf(clock_time_str, "%d", &clock_time.year);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
sscanf(p, "%d", &clock_time.month);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
sscanf(p, "%d", &clock_time.day);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
sscanf(p, "%d", &clock_time.hour);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
sscanf(p, "%d", &clock_time.minute);
|
||||||
|
p = strtok(NULL, "&");
|
||||||
|
sscanf(p, "%d", &clock_time.second);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clock_Handler(void)
|
||||||
|
{
|
||||||
|
clock_time.second++;
|
||||||
|
|
||||||
|
if (clock_time.second == 60)
|
||||||
|
{
|
||||||
|
clock_time.second = 0;
|
||||||
|
clock_time.minute++;
|
||||||
|
|
||||||
|
if (clock_time.minute == 60)
|
||||||
|
{
|
||||||
|
clock_time.minute = 0;
|
||||||
|
clock_time.hour++;
|
||||||
|
|
||||||
|
if (clock_time.hour == 24)
|
||||||
|
{
|
||||||
|
clock_time.hour = 0;
|
||||||
|
clock_time.day++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static char temp_str[20];
|
||||||
|
// if (is_disp)
|
||||||
|
// {
|
||||||
|
// sprintf(
|
||||||
|
// temp_str,
|
||||||
|
// "%04d %02d %02d %02d %02d %02d",
|
||||||
|
// clock_time.year,
|
||||||
|
// clock_time.month,
|
||||||
|
// clock_time.day,
|
||||||
|
// clock_time.hour,
|
||||||
|
// clock_time.minute,
|
||||||
|
// clock_time.second);
|
||||||
|
// GE_Font_Print(disp_x, disp_y, BORDER_MAX, BORDER_MAX, FONT_16, BLUE, WHITE, FALSE, temp_str);
|
||||||
|
// GE_Draw_Disp();
|
||||||
|
// }
|
||||||
|
}
|
||||||
21
User/Clock/Clock.h
Normal file
21
User/Clock/Clock.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef __CLOCK_H
|
||||||
|
#define __CLOCK_H
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t year;
|
||||||
|
uint8_t month;
|
||||||
|
uint8_t day;
|
||||||
|
uint8_t hour;
|
||||||
|
uint8_t minute;
|
||||||
|
uint8_t second;
|
||||||
|
} ClockTime;
|
||||||
|
|
||||||
|
void Clock_Init(void);
|
||||||
|
uint8_t Clock_Sync(void);
|
||||||
|
|
||||||
|
void Clock_Handler(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
224
User/FxLib/fxlib.c
Normal file
224
User/FxLib/fxlib.c
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
//fxlib 兼容层,用于从 fx-9860 平台向 STM32-Player 移植程序
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "led.h"
|
||||||
|
#include "key.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
|
#include "GameEngine.h"
|
||||||
|
|
||||||
|
#include "fxlib.h"
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void FX_Draw_Point(int16_t x, int16_t y, uint16_t color);
|
||||||
|
|
||||||
|
uint16_t FX_Draw_GetPoint(int16_t x, int16_t y);
|
||||||
|
|
||||||
|
void FX_Draw_Mono(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
uint8_t draw_mode,
|
||||||
|
uint8_t pos_mode,
|
||||||
|
uint16_t mono_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************** FxLib *****************************************/
|
||||||
|
|
||||||
|
void Sleep(int millisecond)
|
||||||
|
{
|
||||||
|
Delay_ms(millisecond);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_clear_vram()
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_clear_screen()
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
GE_Draw_Disp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_display_vram()
|
||||||
|
{
|
||||||
|
GE_Draw_Disp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_or(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_and(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_xor(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_and_cl(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_xor_cl(const unsigned char *bmp, int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_or(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_and(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_xor(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_or_cl(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_and_cl(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_8_xor_cl(const unsigned char *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, 8, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_or(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_and(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_xor(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_OR, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_and_cl(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_AND, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ML_bmp_16_xor_cl(const unsigned short *bmp, int x, int y)
|
||||||
|
{
|
||||||
|
FX_Draw_Mono(x, y, MONO_XOR, UP_LEFT, BLACK, WHITE, bmp, 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
|
void FX_Draw_Point(int16_t x, int16_t y, uint16_t color)
|
||||||
|
{
|
||||||
|
if (x < 0 || x > ML_SCREEN_WIDTH - 1 || y < 0 || y > ML_SCREEN_HEIGHT - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
x = 2 * x + 33;
|
||||||
|
y = 2 * y + 57;
|
||||||
|
|
||||||
|
GE_Draw_Point(x, y, color);
|
||||||
|
GE_Draw_Point(x + 1, y, color);
|
||||||
|
GE_Draw_Point(x, y + 1, color);
|
||||||
|
GE_Draw_Point(x + 1, y + 1, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t FX_Draw_GetPoint(int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
if (x < 0 || x > ML_SCREEN_WIDTH - 1 || y < 0 || y > ML_SCREEN_HEIGHT - 1)
|
||||||
|
return WHITE;
|
||||||
|
|
||||||
|
return GE_Draw_GetPoint(2 * x + 33, 2 * y + 57);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FX_Draw_Mono(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
uint8_t draw_mode,
|
||||||
|
uint8_t pos_mode,
|
||||||
|
uint16_t mono_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height)
|
||||||
|
{
|
||||||
|
if (pos_mode == MID)
|
||||||
|
{
|
||||||
|
x = x - width / 2;
|
||||||
|
y = y - height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t temp8;
|
||||||
|
int16_t x0 = x, y0 = y;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; y - y0 < height; i++)
|
||||||
|
{
|
||||||
|
temp8 = pic[i];
|
||||||
|
|
||||||
|
for (uint16_t j = 0; j < 8; j++)
|
||||||
|
{
|
||||||
|
if (temp8 & 0x80)
|
||||||
|
{
|
||||||
|
if (FX_Draw_GetPoint(x, y) == back_color && (draw_mode == MONO_OR || draw_mode == MONO_XOR || draw_mode == MONO_COVER))
|
||||||
|
FX_Draw_Point(x, y, mono_color);
|
||||||
|
else if (FX_Draw_GetPoint(x, y) == mono_color && draw_mode == MONO_XOR)
|
||||||
|
FX_Draw_Point(x, y, back_color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FX_Draw_GetPoint(x, y) == mono_color && (draw_mode == MONO_AND || draw_mode == MONO_COVER))
|
||||||
|
FX_Draw_Point(x, y, back_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp8 <<= 1;
|
||||||
|
|
||||||
|
x++;
|
||||||
|
if (x - x0 == width)
|
||||||
|
{
|
||||||
|
x = x0;
|
||||||
|
y++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
36
User/FxLib/fxlib.h
Normal file
36
User/FxLib/fxlib.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//fxlib 兼容层,用于从 fx-9860 平台向 STM32-Player 移植程序
|
||||||
|
|
||||||
|
#ifndef __FXLIB_H
|
||||||
|
#define __FXLIB_H
|
||||||
|
|
||||||
|
#define ML_SCREEN_WIDTH 128
|
||||||
|
#define ML_SCREEN_HEIGHT 64
|
||||||
|
|
||||||
|
void Sleep(int millisecond);
|
||||||
|
|
||||||
|
void ML_clear_vram();
|
||||||
|
void ML_clear_screen();
|
||||||
|
void ML_display_vram();
|
||||||
|
|
||||||
|
void ML_bmp_or(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
void ML_bmp_and(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
void ML_bmp_xor(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
void ML_bmp_or_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
void ML_bmp_and_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
void ML_bmp_xor_cl(const unsigned char *bmp, int x, int y, int width, int height);
|
||||||
|
|
||||||
|
void ML_bmp_8_or(const unsigned char *bmp, int x, int y);
|
||||||
|
void ML_bmp_8_and(const unsigned char *bmp, int x, int y);
|
||||||
|
void ML_bmp_8_xor(const unsigned char *bmp, int x, int y);
|
||||||
|
void ML_bmp_8_or_cl(const unsigned char *bmp, int x, int y);
|
||||||
|
void ML_bmp_8_and_cl(const unsigned char *bmp, int x, int y);
|
||||||
|
void ML_bmp_8_xor_cl(const unsigned char *bmp, int x, int y);
|
||||||
|
|
||||||
|
void ML_bmp_16_or(const unsigned short *bmp, int x, int y);
|
||||||
|
void ML_bmp_16_and(const unsigned short *bmp, int x, int y);
|
||||||
|
void ML_bmp_16_xor(const unsigned short *bmp, int x, int y);
|
||||||
|
void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y);
|
||||||
|
void ML_bmp_16_and_cl(const unsigned short *bmp, int x, int y);
|
||||||
|
void ML_bmp_16_xor_cl(const unsigned short *bmp, int x, int y);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,8 +1,8 @@
|
|||||||
//游戏引擎图像绘制库
|
//游戏引擎图像绘制库
|
||||||
|
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
#include "sys.h"
|
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
@ -10,81 +10,40 @@
|
|||||||
|
|
||||||
#include "GE_Draw.h"
|
#include "GE_Draw.h"
|
||||||
|
|
||||||
/**************************************** 私有函数 ****************************************/
|
/**************************************** 显存 ****************************************/
|
||||||
|
|
||||||
void GE_Draw_SetWinAbs(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);
|
uint8_t GE_Draw_VRam[153600];
|
||||||
void GE_Draw_SetWin(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
_ge_draw_set_private ge_draw_set_private;
|
|
||||||
|
|
||||||
_ge_draw_pic_set ge_draw_pic_set;
|
_ge_draw_pic_set ge_draw_pic_set;
|
||||||
|
_ge_draw_mono_set ge_draw_mono_set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 初始化 GE_Draw
|
* @brief 初始化 GE_Draw
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Init(void)
|
void GE_Draw_Init(void)
|
||||||
{
|
{
|
||||||
//私有变量
|
|
||||||
ge_draw_set_private.x_start = 0;
|
|
||||||
ge_draw_set_private.y_start = 0;
|
|
||||||
ge_draw_set_private.x_end = LCD_WIDTH - 1;
|
|
||||||
ge_draw_set_private.y_end = LCD_HEIGHT - 1;
|
|
||||||
|
|
||||||
//绘制图片设置
|
//绘制图片设置
|
||||||
ge_draw_pic_set.is_reverse = FALSE;
|
ge_draw_pic_set.is_reverse = FALSE;
|
||||||
ge_draw_pic_set.pos_mode = UP_LEFT;
|
ge_draw_pic_set.pos_mode = UP_LEFT;
|
||||||
|
|
||||||
|
//绘制单色图设置
|
||||||
|
ge_draw_mono_set.draw_mode = MONO_OR;
|
||||||
|
ge_draw_mono_set.pos_mode = UP_LEFT;
|
||||||
|
ge_draw_mono_set.mono_color = BLACK;
|
||||||
|
ge_draw_mono_set.back_color = WHITE;
|
||||||
|
|
||||||
GE_Draw_ClrAll(WHITE);
|
GE_Draw_ClrAll(WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 使用绝对坐标设置显示窗口。忽略重复设置,高效率
|
* @brief 刷新屏幕
|
||||||
* @param x_start: 0~319
|
|
||||||
* @param y_start: 0~239。窗口左上角坐标
|
|
||||||
* @param x_end: 0~319
|
|
||||||
* @param y_end: 0~239。窗口右下角坐标
|
|
||||||
*/
|
*/
|
||||||
void GE_Draw_SetWinAbs(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end)
|
void GE_Draw_Disp(void)
|
||||||
{
|
{
|
||||||
if (x_end == ge_draw_set_private.x_end && y_end == ge_draw_set_private.y_end)
|
LCD_SetWin(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||||
{
|
LCD_SendCmdDataBytes(LCD_CMD_RAMWR, GE_Draw_VRam, 153600);
|
||||||
if (x_start == ge_draw_set_private.x_start && y_start == ge_draw_set_private.y_start)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ge_draw_set_private.x_start = x_start;
|
|
||||||
ge_draw_set_private.y_start = y_start;
|
|
||||||
|
|
||||||
LCD_SendCmdData16Bits(LCD_CMD_CASET, x_start);
|
|
||||||
LCD_SendCmdData16Bits(LCD_CMD_PASET, y_start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ge_draw_set_private.x_start = x_start;
|
|
||||||
ge_draw_set_private.y_start = y_start;
|
|
||||||
ge_draw_set_private.x_end = x_end;
|
|
||||||
ge_draw_set_private.y_end = y_end;
|
|
||||||
|
|
||||||
LCD_SendCmdData32Bits(LCD_CMD_CASET, (x_start << 16) | x_end);
|
|
||||||
LCD_SendCmdData32Bits(LCD_CMD_PASET, (y_start << 16) | y_end);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 使用窗口大小设置显示窗口。忽略重复设置,高效率
|
|
||||||
* @param x: 0~319
|
|
||||||
* @param y: 0~239。x y 为窗口左上角坐标
|
|
||||||
* @param width: 窗口宽度。需大于 0
|
|
||||||
* @param height: 窗口高度。需大于 0
|
|
||||||
*/
|
|
||||||
void GE_Draw_SetWin(uint16_t x, uint16_t y, uint16_t width, uint16_t height)
|
|
||||||
{
|
|
||||||
GE_Draw_SetWinAbs(x, y, x + width - 1, y + height - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,17 +63,21 @@ void GE_Draw_ClrAll(uint16_t color)
|
|||||||
* @param height: 区域的高
|
* @param height: 区域的高
|
||||||
* @param color: 颜色
|
* @param color: 颜色
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
|
void GE_Draw_Fill(int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t color)
|
||||||
{
|
{
|
||||||
GE_Draw_SetWin(x, y, width, height);
|
uint32_t point_num = width * height;
|
||||||
|
int16_t x0 = x, y0 = y;
|
||||||
|
|
||||||
uint32_t data16_count = width * height;
|
for (uint32_t i = 0; i < point_num; i++)
|
||||||
|
{
|
||||||
|
GE_Draw_Point(x++, y, color);
|
||||||
|
|
||||||
LCD_RAM_Wr;
|
if (x == x0 + width)
|
||||||
LCD_Data_Mode_On;
|
{
|
||||||
|
y++;
|
||||||
for (uint32_t i = 0; i < data16_count; i++)
|
x = x0;
|
||||||
SPI2_Write16Bits(color);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,13 +86,26 @@ void GE_Draw_Fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint1
|
|||||||
* @param y: 0~239
|
* @param y: 0~239
|
||||||
* @param color: 颜色
|
* @param color: 颜色
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Point(uint16_t x, uint16_t y, uint16_t color)
|
void GE_Draw_Point(int16_t x, int16_t y, uint16_t color)
|
||||||
{
|
{
|
||||||
if (x < 0 || x > LCD_WIDTH - 1 || y < 0 || y > LCD_HEIGHT - 1)
|
if (x < 0 || x > LCD_WIDTH - 1 || y < 0 || y > LCD_HEIGHT - 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GE_Draw_SetWinAbs(x, y, LCD_WIDTH - 1, LCD_HEIGHT - 1);
|
GE_Draw_VRam[(x + y * 320) * 2] = color >> 8;
|
||||||
LCD_SendCmdData16Bits(LCD_CMD_RAMWR, color);
|
GE_Draw_VRam[(x + y * 320) * 2 + 1] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取指定坐标的点的颜色。坐标不合法返回白色
|
||||||
|
* @param x: 0~319
|
||||||
|
* @param y: 0~239
|
||||||
|
*/
|
||||||
|
uint16_t GE_Draw_GetPoint(int16_t x, int16_t y)
|
||||||
|
{
|
||||||
|
if (x < 0 || x > LCD_WIDTH - 1 || y < 0 || y > LCD_HEIGHT - 1)
|
||||||
|
return WHITE;
|
||||||
|
|
||||||
|
return ((uint16_t)GE_Draw_VRam[(x + y * 320) * 2] << 8) | GE_Draw_VRam[(x + y * 320) * 2 + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +116,7 @@ void GE_Draw_Point(uint16_t x, uint16_t y, uint16_t color)
|
|||||||
* @param y3: 0~239
|
* @param y3: 0~239
|
||||||
* @param color: 颜色
|
* @param color: 颜色
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color)
|
void GE_Draw_Line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
|
||||||
{
|
{
|
||||||
//使用 Bresenham 算法
|
//使用 Bresenham 算法
|
||||||
int16_t dx = abs(x1 - x0);
|
int16_t dx = abs(x1 - x0);
|
||||||
@ -177,7 +153,7 @@ void GE_Draw_Line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t c
|
|||||||
* @param height: 矩形的高
|
* @param height: 矩形的高
|
||||||
* @param color: 颜色
|
* @param color: 颜色
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
|
void GE_Draw_Rectangle(int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t color)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
|
|
||||||
@ -201,7 +177,7 @@ void GE_Draw_Rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
|
|||||||
* @param r: 圆的半径
|
* @param r: 圆的半径
|
||||||
* @param color: 颜色
|
* @param color: 颜色
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Circle(uint16_t xm, uint16_t ym, uint16_t r, uint16_t color)
|
void GE_Draw_Circle(int16_t xm, int16_t ym, uint16_t r, uint16_t color)
|
||||||
{
|
{
|
||||||
int16_t x = -r, y = 0, err = 2 - 2 * r, rm = r;
|
int16_t x = -r, y = 0, err = 2 - 2 * r, rm = r;
|
||||||
|
|
||||||
@ -220,7 +196,33 @@ void GE_Draw_Circle(uint16_t xm, uint16_t ym, uint16_t r, uint16_t color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 绘制矩形图片。图片为 const unsigned char 数组,4096 色,不含图像头
|
* @brief 以指定颜色填充圆
|
||||||
|
* @param xm: 0~319
|
||||||
|
* @param ym: 0~239
|
||||||
|
* @param r: 圆的半径
|
||||||
|
* @param color: 颜色
|
||||||
|
*/
|
||||||
|
void GE_Draw_FillCircle(int16_t xm, int16_t ym, uint16_t r, uint16_t color)
|
||||||
|
{
|
||||||
|
int16_t x = -r, y = 0, err = 2 - 2 * r, rm = r;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
GE_Draw_Line(xm - x, ym + y, xm + x, ym + y, color);
|
||||||
|
GE_Draw_Line(xm - y, ym - x, xm + y, ym - x, color);
|
||||||
|
GE_Draw_Line(xm + x, ym - y, xm - x, ym - y, color);
|
||||||
|
GE_Draw_Line(xm + y, ym + x, xm - y, ym + x, color);
|
||||||
|
rm = err;
|
||||||
|
if (rm > x)
|
||||||
|
err += ++x * 2 + 1;
|
||||||
|
if (rm <= y)
|
||||||
|
err += ++y * 2 + 1;
|
||||||
|
} while (x < 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制矩形图片。图片为 const unsigned char 数组,4096 色,不含图像头。
|
||||||
|
* 请确保图片完全在屏幕区域内
|
||||||
* @param x: 0~319
|
* @param x: 0~319
|
||||||
* @param y: 0~239
|
* @param y: 0~239
|
||||||
* @param is_reverse: TRUE 为反色。反色模式下刷新较慢
|
* @param is_reverse: TRUE 为反色。反色模式下刷新较慢
|
||||||
@ -230,36 +232,54 @@ void GE_Draw_Circle(uint16_t xm, uint16_t ym, uint16_t r, uint16_t color)
|
|||||||
* @param height: 图片的高
|
* @param height: 图片的高
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Pic(
|
void GE_Draw_Pic(
|
||||||
uint16_t x,
|
int16_t x,
|
||||||
uint16_t y,
|
int16_t y,
|
||||||
uint8_t is_reverse,
|
uint8_t is_reverse,
|
||||||
uint8_t pos_mode,
|
uint8_t pos_mode,
|
||||||
const unsigned char *pic,
|
const unsigned char *pic,
|
||||||
uint16_t width,
|
uint16_t width,
|
||||||
uint16_t height)
|
uint16_t height)
|
||||||
{
|
{
|
||||||
if (pos_mode == UP_LEFT)
|
if (pos_mode == MID)
|
||||||
GE_Draw_SetWin(x, y, width, height);
|
{
|
||||||
else
|
x = x - width / 2;
|
||||||
GE_Draw_SetWin(x - width / 2, y - height / 2, width, height);
|
y = y - height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x == 0 && y == 0 && width == LCD_WIDTH && height == LCD_HEIGHT)
|
||||||
|
memcpy(GE_Draw_VRam, pic, 153600);
|
||||||
|
|
||||||
|
uint32_t point_num = width * height;
|
||||||
|
int16_t x0 = x, y0 = y;
|
||||||
|
uint16_t color;
|
||||||
|
|
||||||
if (is_reverse == TRUE) //反色模式
|
if (is_reverse == TRUE) //反色模式
|
||||||
{
|
{
|
||||||
uint16_t data16_temp;
|
for (uint32_t i = 0; i < point_num; i++)
|
||||||
uint32_t data8_count = width * height * 2;
|
|
||||||
|
|
||||||
LCD_RAM_Wr;
|
|
||||||
LCD_Data_Mode_On;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < data8_count; i += 2)
|
|
||||||
{
|
{
|
||||||
data16_temp = 0xffff - (((uint16_t)pic[i] << 8) | pic[i + 1]); //反色
|
color = 0xffff - (((uint16_t)pic[2 * i] << 8) | pic[2 * i + 1]);
|
||||||
SPI2_Write16Bits(data16_temp);
|
GE_Draw_Point(x++, y, color);
|
||||||
|
|
||||||
|
if (x == x0 + width)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
x = x0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //非反色模式
|
else //非反色模式
|
||||||
{
|
{
|
||||||
LCD_SendCmdDataBytes(LCD_CMD_RAMWR, (uint8_t *)pic, width * height * 2);
|
for (uint32_t i = 0; i < point_num; i++)
|
||||||
|
{
|
||||||
|
color = ((uint16_t)pic[2 * i] << 8) | pic[2 * i + 1];
|
||||||
|
GE_Draw_Point(x++, y, color);
|
||||||
|
|
||||||
|
if (x == x0 + width)
|
||||||
|
{
|
||||||
|
y++;
|
||||||
|
x = x0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +291,7 @@ void GE_Draw_Pic(
|
|||||||
* @param width: 图片的宽
|
* @param width: 图片的宽
|
||||||
* @param height: 图片的高
|
* @param height: 图片的高
|
||||||
*/
|
*/
|
||||||
void GE_Draw_Pic_WithSet(uint16_t x, uint16_t y, const unsigned char *pic, uint16_t width, uint16_t height)
|
void GE_Draw_Pic_WithSet(int16_t x, int16_t y, const unsigned char *pic, uint16_t width, uint16_t height)
|
||||||
{
|
{
|
||||||
GE_Draw_Pic(
|
GE_Draw_Pic(
|
||||||
x,
|
x,
|
||||||
@ -282,3 +302,106 @@ void GE_Draw_Pic_WithSet(uint16_t x, uint16_t y, const unsigned char *pic, uint1
|
|||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制单色位图。图片为 const unsigned char 数组,不含图像头
|
||||||
|
* 请确保图片完全在屏幕区域内
|
||||||
|
* @param x: 0~319
|
||||||
|
* @param y: 0~239
|
||||||
|
* @param draw_mode: 绘制方式。MONO_OR MONO_AND MONO_XOR MONO_COVER
|
||||||
|
* @param pos_mode: UP_LEFT 为从左上角开始显示,MID 为以坐标为中心显示
|
||||||
|
* @param mono_color: 颜色
|
||||||
|
* @param back_color: 背景色。只在 MONO_COVER 时有效
|
||||||
|
* @param pic: 指向图片
|
||||||
|
* @param width: 图片的宽
|
||||||
|
* @param height: 图片的高
|
||||||
|
*/
|
||||||
|
void GE_Draw_Mono(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
uint8_t draw_mode,
|
||||||
|
uint8_t pos_mode,
|
||||||
|
uint16_t mono_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height)
|
||||||
|
{
|
||||||
|
if (pos_mode == MID)
|
||||||
|
{
|
||||||
|
x = x - width / 2;
|
||||||
|
y = y - height / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t temp8;
|
||||||
|
int16_t x0 = x, y0 = y;
|
||||||
|
|
||||||
|
//循环横向输出
|
||||||
|
for (uint16_t i = 0; y - y0 < height; i++)
|
||||||
|
{
|
||||||
|
temp8 = pic[i];
|
||||||
|
|
||||||
|
for (uint16_t j = 0; j < 8; j++)
|
||||||
|
{
|
||||||
|
if (temp8 & 0x80)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
(draw_mode == MONO_OR) ||
|
||||||
|
(draw_mode == MONO_AND && GE_Draw_GetPoint(x, y) == mono_color) ||
|
||||||
|
(draw_mode == MONO_XOR && GE_Draw_GetPoint(x, y) != mono_color) ||
|
||||||
|
(draw_mode == MONO_COVER))
|
||||||
|
{
|
||||||
|
GE_Draw_Point(x, y, mono_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
(draw_mode == MONO_AND && GE_Draw_GetPoint(x, y) != mono_color) ||
|
||||||
|
(draw_mode == MONO_XOR && GE_Draw_GetPoint(x, y) == mono_color) ||
|
||||||
|
(draw_mode == MONO_COVER))
|
||||||
|
{
|
||||||
|
GE_Draw_Point(x, y, back_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
temp8 <<= 1;
|
||||||
|
|
||||||
|
x++;
|
||||||
|
if (x - x0 == width)
|
||||||
|
{
|
||||||
|
x = x0;
|
||||||
|
y++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 绘制单色位图,使用设置。图片为 const unsigned char 数组,不含图像头
|
||||||
|
* 请确保图片完全在屏幕区域内
|
||||||
|
* @param x: 0~319
|
||||||
|
* @param y: 0~239
|
||||||
|
* @param pic: 指向图片
|
||||||
|
* @param width: 图片的宽
|
||||||
|
* @param height: 图片的高
|
||||||
|
*/
|
||||||
|
void GE_Draw_Mono_WithSet(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height)
|
||||||
|
{
|
||||||
|
GE_Draw_Mono(
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
ge_draw_mono_set.draw_mode,
|
||||||
|
ge_draw_mono_set.pos_mode,
|
||||||
|
ge_draw_mono_set.mono_color,
|
||||||
|
ge_draw_mono_set.back_color,
|
||||||
|
pic,
|
||||||
|
width,
|
||||||
|
height);
|
||||||
|
}
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
#ifndef __GE_DRAW_H
|
#ifndef __GE_DRAW_H
|
||||||
#define __GE_DRAW_H
|
#define __GE_DRAW_H
|
||||||
|
|
||||||
//ÑÕÉ«
|
#include "sys.h"
|
||||||
|
|
||||||
|
//颜色宏定义
|
||||||
#define BLACK 0x0000
|
#define BLACK 0x0000
|
||||||
#define NAVY 0x000f
|
#define NAVY 0x000f
|
||||||
#define DARK_GREEN 0x03e0
|
#define DARK_GREEN 0x03e0
|
||||||
@ -21,14 +23,9 @@
|
|||||||
#define YELLOW 0xffe0
|
#define YELLOW 0xffe0
|
||||||
#define WHITE 0xffff
|
#define WHITE 0xffff
|
||||||
|
|
||||||
/**************************************** ˽ÓбäÁ¿ ****************************************/
|
/**************************************** 显存 ****************************************/
|
||||||
typedef struct
|
|
||||||
{
|
extern uint8_t GE_Draw_VRam[153600];
|
||||||
uint16_t x_start;
|
|
||||||
uint16_t y_start;
|
|
||||||
uint16_t x_end;
|
|
||||||
uint16_t y_end;
|
|
||||||
} _ge_draw_set_private;
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
@ -38,6 +35,12 @@ void GE_Draw_Init(void);
|
|||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/**************************************** 刷新屏幕 ****************************************/
|
||||||
|
|
||||||
|
void GE_Draw_Disp(void);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/**************************************** 清空屏幕 ****************************************/
|
/**************************************** 清空屏幕 ****************************************/
|
||||||
|
|
||||||
void GE_Draw_ClrAll(uint16_t color);
|
void GE_Draw_ClrAll(uint16_t color);
|
||||||
@ -46,11 +49,15 @@ void GE_Draw_ClrAll(uint16_t color);
|
|||||||
|
|
||||||
/**************************************** 绘图函数 ****************************************/
|
/**************************************** 绘图函数 ****************************************/
|
||||||
|
|
||||||
void GE_Draw_Fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
void GE_Draw_Fill(int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||||
void GE_Draw_Point(uint16_t x, uint16_t y, uint16_t color);
|
void GE_Draw_Point(int16_t x, int16_t y, uint16_t color);
|
||||||
void GE_Draw_Line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
uint16_t GE_Draw_GetPoint(int16_t x, int16_t y);
|
||||||
void GE_Draw_Rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
|
void GE_Draw_Line(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
|
||||||
void GE_Draw_Circle(uint16_t xm, uint16_t ym, uint16_t r, uint16_t color);
|
void GE_Draw_Rectangle(int16_t x, int16_t y, uint16_t width, uint16_t height, uint16_t color);
|
||||||
|
void GE_Draw_Circle(int16_t xm, int16_t ym, uint16_t r, uint16_t color);
|
||||||
|
void GE_Draw_FillCircle(int16_t xm, int16_t ym, uint16_t r, uint16_t color);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/**************************************** 绘制图片 ****************************************/
|
/**************************************** 绘制图片 ****************************************/
|
||||||
//显示位置
|
//显示位置
|
||||||
@ -66,14 +73,51 @@ typedef struct
|
|||||||
extern _ge_draw_pic_set ge_draw_pic_set;
|
extern _ge_draw_pic_set ge_draw_pic_set;
|
||||||
|
|
||||||
void GE_Draw_Pic(
|
void GE_Draw_Pic(
|
||||||
uint16_t x,
|
int16_t x,
|
||||||
uint16_t y,
|
int16_t y,
|
||||||
uint8_t is_reverse,
|
uint8_t is_reverse,
|
||||||
uint8_t pos_mode,
|
uint8_t pos_mode,
|
||||||
const unsigned char *pic,
|
const unsigned char *pic,
|
||||||
uint16_t width,
|
uint16_t width,
|
||||||
uint16_t height);
|
uint16_t height);
|
||||||
void GE_Draw_Pic_WithSet(uint16_t x, uint16_t y, const unsigned char *pic, uint16_t width, uint16_t height);
|
void GE_Draw_Pic_WithSet(int16_t x, int16_t y, const unsigned char *pic, uint16_t width, uint16_t height);
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
/************************************** 绘制单色位图 **************************************/
|
||||||
|
//是否绘制背景色
|
||||||
|
#define MONO_OR 0
|
||||||
|
#define MONO_AND 1
|
||||||
|
#define MONO_XOR 2
|
||||||
|
#define MONO_COVER 3
|
||||||
|
|
||||||
|
void GE_Draw_Mono(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
uint8_t draw_mode,
|
||||||
|
uint8_t pos_mode,
|
||||||
|
uint16_t mono_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t draw_mode; //绘制方式
|
||||||
|
uint8_t pos_mode; //显示位置
|
||||||
|
uint16_t mono_color; //颜色
|
||||||
|
uint16_t back_color; //背景颜色
|
||||||
|
} _ge_draw_mono_set;
|
||||||
|
|
||||||
|
extern _ge_draw_mono_set ge_draw_mono_set;
|
||||||
|
|
||||||
|
void GE_Draw_Mono_WithSet(
|
||||||
|
int16_t x,
|
||||||
|
int16_t y,
|
||||||
|
const unsigned char *pic,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height);
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,19 @@
|
|||||||
//游戏引擎文字显示库
|
//游戏引擎文字显示库
|
||||||
|
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "GameEngine.h"
|
#include "GameEngine.h"
|
||||||
|
|
||||||
#include "GE_Font.h"
|
#include "GE_Font.h"
|
||||||
|
|
||||||
#define GE_Font_GetACSIIDataSize(__FONT_SIZE__) ((__FONT_SIZE__ / 8 + ((__FONT_SIZE__ % 8) ? 1 : 0)) * (__FONT_SIZE__ / 2))
|
/**************************************** 私有定义 ****************************************/
|
||||||
#define GE_Font_GetGBKDataSize(__FONT_SIZE__) ((__FONT_SIZE__ / 8 + ((__FONT_SIZE__ % 8) ? 1 : 0)) * (__FONT_SIZE__))
|
|
||||||
|
#define GE_Font_GetACSIIDataSize(__font_size__) ((__font_size__ / 8 + ((__font_size__ % 8) ? 1 : 0)) * (__font_size__ / 2))
|
||||||
|
#define GE_Font_GetGBKDataSize(__font_size__) ((__font_size__ / 8 + ((__font_size__ % 8) ? 1 : 0)) * (__font_size__))
|
||||||
|
|
||||||
|
/*****************************************************************************************/
|
||||||
|
|
||||||
/**************************************** 私有函数 ****************************************/
|
/**************************************** 私有函数 ****************************************/
|
||||||
|
|
||||||
@ -213,27 +219,30 @@ uint8_t GE_Font_PrintGBK(uint16_t x, uint16_t y, uint8_t *ch, uint8_t font_size,
|
|||||||
* @param y_start
|
* @param y_start
|
||||||
* @param width: 显示窗的宽
|
* @param width: 显示窗的宽
|
||||||
* @param height: 显示窗口的高
|
* @param height: 显示窗口的高
|
||||||
* @param font_size: 字体大小。注意:若含汉字,只能使用 FONT_12 24 32 48
|
* @param font_size: 字体大小。注意:若含汉字,只能使用 FONT_12 16 24 32
|
||||||
* @param font_color: 字体颜色
|
* @param font_color: 字体颜色
|
||||||
* @param back_color: 背景颜色。透明时无效
|
* @param back_color: 背景颜色。透明时无效
|
||||||
* @param is_transparent: 是否透明
|
* @param is_transparent: 是否透明
|
||||||
* @param str: 字符串。需为 uint8_t *
|
* @param format: 格式字符串
|
||||||
|
* @param arg: 参数表
|
||||||
|
* @retval 打印完全返回 1,未打印完全返回0
|
||||||
*/
|
*/
|
||||||
uint8_t GE_Font_Print(
|
uint8_t GE_Font_Print_Va(
|
||||||
uint16_t x_start,
|
int16_t x_start,
|
||||||
uint16_t y_start,
|
int16_t y_start,
|
||||||
uint16_t width,
|
uint16_t width,
|
||||||
uint16_t height,
|
uint16_t height,
|
||||||
uint8_t font_size,
|
uint8_t font_size,
|
||||||
uint16_t font_color,
|
uint16_t font_color,
|
||||||
uint16_t back_color,
|
uint16_t back_color,
|
||||||
uint8_t is_transparent,
|
uint8_t is_transparent,
|
||||||
uint8_t *str)
|
uint8_t *format,
|
||||||
|
va_list arg)
|
||||||
{
|
{
|
||||||
uint16_t x_end_plus_1;
|
int16_t x_end_plus_1;
|
||||||
uint16_t y_end_plus_1;
|
int16_t y_end_plus_1;
|
||||||
uint16_t x = x_start;
|
int16_t x = x_start;
|
||||||
uint16_t y = y_start;
|
int16_t y = y_start;
|
||||||
|
|
||||||
if (width == BORDER_MAX)
|
if (width == BORDER_MAX)
|
||||||
x_end_plus_1 = LCD_WIDTH;
|
x_end_plus_1 = LCD_WIDTH;
|
||||||
@ -247,6 +256,11 @@ uint8_t GE_Font_Print(
|
|||||||
|
|
||||||
uint8_t is_print_all = FALSE;
|
uint8_t is_print_all = FALSE;
|
||||||
|
|
||||||
|
uint8_t temp_str[1040];
|
||||||
|
uint8_t *str = temp_str;
|
||||||
|
|
||||||
|
vsprintf(str, format, arg);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (*(str) <= 0x80) //ASCII 字符
|
if (*(str) <= 0x80) //ASCII 字符
|
||||||
@ -301,17 +315,70 @@ uint8_t GE_Font_Print(
|
|||||||
return is_print_all;
|
return is_print_all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 在指定区域内显示字符串。支持 ASCII、GBK 汉字
|
||||||
|
* @param x_start
|
||||||
|
* @param y_start
|
||||||
|
* @param width: 显示窗的宽
|
||||||
|
* @param height: 显示窗口的高
|
||||||
|
* @param font_size: 字体大小。注意:若含汉字,只能使用 FONT_12 16 24 32
|
||||||
|
* @param font_color: 字体颜色
|
||||||
|
* @param back_color: 背景颜色。透明时无效
|
||||||
|
* @param is_transparent: 是否透明
|
||||||
|
* @param format: 格式字符串。用法与 printf 相同
|
||||||
|
* @param ...
|
||||||
|
* @retval 打印完全返回 1,未打印完全返回0
|
||||||
|
*/
|
||||||
|
uint8_t GE_Font_Print(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t font_size,
|
||||||
|
uint16_t font_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
uint8_t is_transparent,
|
||||||
|
uint8_t *format,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
va_list aptr;
|
||||||
|
va_start(aptr, format);
|
||||||
|
|
||||||
|
uint8_t ret = GE_Font_Print_Va(
|
||||||
|
x_start,
|
||||||
|
y_start,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
font_size,
|
||||||
|
font_color,
|
||||||
|
back_color,
|
||||||
|
is_transparent,
|
||||||
|
format,
|
||||||
|
aptr);
|
||||||
|
|
||||||
|
va_end(aptr);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 在指定区域内显示字符串,使用设置。支持 ASCII、GBK 汉字
|
* @brief 在指定区域内显示字符串,使用设置。支持 ASCII、GBK 汉字
|
||||||
* @param x_start
|
* @param x_start
|
||||||
* @param y_start
|
* @param y_start
|
||||||
* @param width: 显示窗的宽
|
* @param width: 显示窗的宽
|
||||||
* @param height: 显示窗口的高
|
* @param height: 显示窗口的高
|
||||||
* @param str: 字符串。需为 uint8_t *
|
* @param format: 格式字符串
|
||||||
|
* @param arg: 参数表
|
||||||
|
* @retval 打印完全返回 1,未打印完全返回0
|
||||||
*/
|
*/
|
||||||
uint8_t GE_Font_Print_WithSet(uint16_t x_start, uint16_t y_start, uint16_t width, uint16_t height, uint8_t *str)
|
uint8_t GE_Font_Print_WithSet_Va(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t *format,
|
||||||
|
va_list arg)
|
||||||
{
|
{
|
||||||
return GE_Font_Print(
|
return GE_Font_Print_Va(
|
||||||
x_start,
|
x_start,
|
||||||
y_start,
|
y_start,
|
||||||
width,
|
width,
|
||||||
@ -320,5 +387,39 @@ uint8_t GE_Font_Print_WithSet(uint16_t x_start, uint16_t y_start, uint16_t width
|
|||||||
ge_font_print_set.font_color,
|
ge_font_print_set.font_color,
|
||||||
ge_font_print_set.back_color,
|
ge_font_print_set.back_color,
|
||||||
ge_font_print_set.is_transparent,
|
ge_font_print_set.is_transparent,
|
||||||
str);
|
format,
|
||||||
|
arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 在指定区域内显示字符串,使用设置。支持 ASCII、GBK 汉字
|
||||||
|
* @param x_start
|
||||||
|
* @param y_start
|
||||||
|
* @param width: 显示窗的宽
|
||||||
|
* @param height: 显示窗口的高
|
||||||
|
* @param format: 格式字符串。用法与 printf 相同
|
||||||
|
* @param ...
|
||||||
|
* @retval 打印完全返回 1,未打印完全返回0
|
||||||
|
*/
|
||||||
|
uint8_t GE_Font_Print_WithSet(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t *format,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
va_list aptr;
|
||||||
|
va_start(aptr, format);
|
||||||
|
|
||||||
|
uint8_t ret = GE_Font_Print_WithSet_Va(
|
||||||
|
x_start,
|
||||||
|
y_start,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
format,
|
||||||
|
aptr);
|
||||||
|
|
||||||
|
va_end(aptr);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
#ifndef __GE_FONT_H
|
#ifndef __GE_FONT_H
|
||||||
#define __GE_FONT_H
|
#define __GE_FONT_H
|
||||||
|
|
||||||
|
#include "stdarg.h"
|
||||||
|
|
||||||
void GE_FontInit(void);
|
void GE_FontInit(void);
|
||||||
|
|
||||||
/**************************************** »æÖƺº×Ö ****************************************/
|
/**************************************** »æÖƺº×Ö ****************************************/
|
||||||
@ -27,18 +29,45 @@ typedef struct
|
|||||||
|
|
||||||
extern _ge_font_print_set ge_font_print_set;
|
extern _ge_font_print_set ge_font_print_set;
|
||||||
|
|
||||||
uint8_t GE_Font_Print(
|
uint8_t GE_Font_Print_Va(
|
||||||
uint16_t x_start,
|
int16_t x_start,
|
||||||
uint16_t y_start,
|
int16_t y_start,
|
||||||
uint16_t width,
|
uint16_t width,
|
||||||
uint16_t height,
|
uint16_t height,
|
||||||
uint8_t font_size,
|
uint8_t font_size,
|
||||||
uint16_t font_color,
|
uint16_t font_color,
|
||||||
uint16_t back_color,
|
uint16_t back_color,
|
||||||
uint8_t is_transparent,
|
uint8_t is_transparent,
|
||||||
uint8_t *str);
|
uint8_t *format,
|
||||||
|
va_list arg);
|
||||||
|
|
||||||
uint8_t GE_Font_Print_WithSet(uint16_t x_start, uint16_t y_start, uint16_t width, uint16_t height, uint8_t *str);
|
uint8_t GE_Font_Print(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t font_size,
|
||||||
|
uint16_t font_color,
|
||||||
|
uint16_t back_color,
|
||||||
|
uint8_t is_transparent,
|
||||||
|
uint8_t *format,
|
||||||
|
...);
|
||||||
|
|
||||||
|
uint8_t GE_Font_Print_WithSet_Va(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t *format,
|
||||||
|
va_list arg);
|
||||||
|
|
||||||
|
uint8_t GE_Font_Print_WithSet(
|
||||||
|
int16_t x_start,
|
||||||
|
int16_t y_start,
|
||||||
|
uint16_t width,
|
||||||
|
uint16_t height,
|
||||||
|
uint8_t *format,
|
||||||
|
...);
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ void GE_GUI_DoubleThickRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 消息窗口
|
* @brief 消息窗口。自动刷新屏幕
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param width: 窗口的宽
|
* @param width: 窗口的宽
|
||||||
@ -97,13 +97,17 @@ void GE_GUI_MsgBox(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint
|
|||||||
//内容
|
//内容
|
||||||
GE_Font_Print(x + 6, y + FONT_16 + 10, width - 12, BORDER_MAX, FONT_16, BLACK, WHITE, FALSE, content);
|
GE_Font_Print(x + 6, y + FONT_16 + 10, width - 12, BORDER_MAX, FONT_16, BLACK, WHITE, FALSE, content);
|
||||||
|
|
||||||
|
GE_Draw_Disp();
|
||||||
|
|
||||||
|
KEY_ClearKey();
|
||||||
|
|
||||||
//调用回调函数
|
//调用回调函数
|
||||||
if (handler_func != NULL)
|
if (handler_func != NULL)
|
||||||
handler_func();
|
handler_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 菜单窗口
|
* @brief 菜单窗口。自动刷新屏幕
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param width: 窗口的宽
|
* @param width: 窗口的宽
|
||||||
@ -112,7 +116,7 @@ void GE_GUI_MsgBox(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint
|
|||||||
* @param content_amount: 菜单项数
|
* @param content_amount: 菜单项数
|
||||||
* @param content: 菜单内容数组
|
* @param content: 菜单内容数组
|
||||||
* @param handler_func: 回调函数。设置为 NULL 不执行回调
|
* @param handler_func: 回调函数。设置为 NULL 不执行回调
|
||||||
* @retval 被选中的选项序号,从 1 开始
|
* @retval 被选中的选项序号,从 1 开始。返回 0 表示用户触发 JOY_L_DOWN 事件,此时不调用回调函数
|
||||||
*/
|
*/
|
||||||
uint8_t GE_GUI_MenuBox(
|
uint8_t GE_GUI_MenuBox(
|
||||||
uint16_t x,
|
uint16_t x,
|
||||||
@ -144,25 +148,37 @@ uint8_t GE_GUI_MenuBox(
|
|||||||
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + i * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[i]);
|
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + i * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GE_Draw_Disp();
|
||||||
|
|
||||||
|
KEY_ClearKey();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
uint8_t key = KEY_GetKeyWait();
|
uint8_t key = KEY_GetKeyWait();
|
||||||
|
|
||||||
if (key == KEY2)
|
if (key == JOY_OK_UP)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (key == KEY3 && choice_num > 1)
|
else if (key == JOY_L_DOWN)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (key == JOY_U_DOWN && choice_num > 1)
|
||||||
{
|
{
|
||||||
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[choice_num - 1]);
|
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[choice_num - 1]);
|
||||||
choice_num--;
|
choice_num--;
|
||||||
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, WHITE, BLUE, BLACK, 1, content[choice_num - 1]);
|
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, WHITE, BLUE, BLACK, 1, content[choice_num - 1]);
|
||||||
|
|
||||||
|
GE_Draw_Disp();
|
||||||
}
|
}
|
||||||
else if (key == KEY1 && choice_num < content_amount)
|
else if (key == JOY_D_DOWN && choice_num < content_amount)
|
||||||
{
|
{
|
||||||
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[choice_num - 1]);
|
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, BLACK, WHITE, BLACK, 1, content[choice_num - 1]);
|
||||||
choice_num++;
|
choice_num++;
|
||||||
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, WHITE, BLUE, BLACK, 1, content[choice_num - 1]);
|
GE_GUI_TextBox(x + 4, y + FONT_16 + 8 + (choice_num - 1) * (FONT_16 + 3), width - 8, FONT_16 + 4, WHITE, BLUE, BLACK, 1, content[choice_num - 1]);
|
||||||
|
|
||||||
|
GE_Draw_Disp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,21 +9,10 @@ typedef void (*MenuBoxHandler)(uint8_t choice_num);
|
|||||||
|
|
||||||
void GE_GUI_Init(void);
|
void GE_GUI_Init(void);
|
||||||
|
|
||||||
void GE_GUI_TextBox(
|
|
||||||
uint16_t x,
|
|
||||||
uint16_t y,
|
|
||||||
uint16_t width,
|
|
||||||
uint16_t height,
|
|
||||||
uint16_t font_color,
|
|
||||||
uint16_t fill_color,
|
|
||||||
uint16_t rectangle_color,
|
|
||||||
uint16_t thickness,
|
|
||||||
uint8_t *str);
|
|
||||||
|
|
||||||
void GE_GUI_MsgBox(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *head, uint8_t *content, MsgBoxHandler func);
|
void GE_GUI_MsgBox(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *head, uint8_t *content, MsgBoxHandler func);
|
||||||
|
|
||||||
#define GE_GUI_MENUBOX_MAX_CONTENT_NUM 10 //适用参数 5, 5, 310, 230
|
#define GE_GUI_MENUBOX_MAX_CONTENT_NUM 10 //适用参数 5, 5, 310, 230
|
||||||
#define GE_GUI_MENUBOX_CONTENT_LEN 37 //适用参数 5, 5, 310, 230
|
#define GE_GUI_MENUBOX_CONTENT_LEN 37 //适用参数 5, 5, 310, 230
|
||||||
uint8_t GE_GUI_MenuBox(
|
uint8_t GE_GUI_MenuBox(
|
||||||
uint16_t x,
|
uint16_t x,
|
||||||
uint16_t y,
|
uint16_t y,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
//ÓÎÏ·ÒýÇæ
|
//ÓÎÏ·ÒýÇæ
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "delay.h"
|
#include "systick.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,39 @@
|
|||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
#include "delay.h"
|
#include "systick.h"
|
||||||
|
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
#include "uart.h"
|
||||||
|
#include "adc.h"
|
||||||
|
#include "hc25.h"
|
||||||
|
#include "hc12.h"
|
||||||
|
|
||||||
#include "GameEngine.h"
|
#include "GameEngine.h"
|
||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
|
#include "WLAN.h"
|
||||||
|
|
||||||
#include "APP_Reader.h"
|
#include "APP_Reader.h"
|
||||||
|
#include "APP_Video.h"
|
||||||
|
#include "APP_Plane.h"
|
||||||
|
#include "APP_Setting.h"
|
||||||
|
#include "APP_Weather.h"
|
||||||
|
#include "APP_Gobang.h"
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
MPU_Config(); //配置 MPU
|
MPU_Config(); //配置 MPU
|
||||||
Cache_Enable(); //打开 L1-Cache
|
Cache_Enable(); //打开 L1-Cache
|
||||||
HAL_Init(); //初始化 HAL 库
|
HAL_Init(); //初始化 HAL 库
|
||||||
Clock_Init(160, 5, 2, 4); //设置时钟为 400MHz
|
SystemClock_Init(); //设置时钟
|
||||||
SYSCLK_Init(400); //延时初始化
|
Uart_Init(); //初始化串口
|
||||||
|
SysTick_Init(); //配置 SysTick 中断,并初始化软件定时器
|
||||||
|
ADC_Init(); //初始化 ADC
|
||||||
|
|
||||||
|
Uart_SetprintfCom(COM1); //设置 printf 输出到 COM1
|
||||||
|
Uart_SetgetcharCom(COM1); //设置 getchar 从 COM1 输入
|
||||||
|
|
||||||
//³õʼ»¯ÍâÉè
|
//³õʼ»¯ÍâÉè
|
||||||
LED_Init();
|
LED_Init();
|
||||||
@ -24,17 +42,62 @@ int main(void)
|
|||||||
|
|
||||||
//³õʼ»¯Ä£¿é
|
//³õʼ»¯Ä£¿é
|
||||||
GE_Init();
|
GE_Init();
|
||||||
|
SD_Init();
|
||||||
|
|
||||||
if (SD_Init() == SD_OK)
|
HC25_Init();
|
||||||
{
|
HC12_Init();
|
||||||
APP_Reader_Launcher();
|
|
||||||
SD_DeInit();
|
|
||||||
|
|
||||||
GE_Draw_ClrAll(WHITE);
|
GE_Draw_ClrAll(WHITE);
|
||||||
GE_Draw_Pic_WithSet(0, 0, BORDER_MAX, BORDER_MAX, "阅读器运行结束,请重置!");
|
GE_Draw_Disp();
|
||||||
}
|
|
||||||
|
|
||||||
|
printf("完成系统初始化\n");
|
||||||
|
|
||||||
|
uint8_t content[6][GE_GUI_MENUBOX_CONTENT_LEN] = {"阅读器", "视频播放器", "飞机大战", "天气", "五子棋", "设置"};
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
switch (GE_GUI_MenuBox(5, 5, 310, 230, "STM32Player", 6, content, NULL))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Reader_Launcher();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Video_Launcher();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Plane_Launcher();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Weather_Launcher();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Gobang_Launcher();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
|
GE_Draw_ClrAll(WHITE);
|
||||||
|
APP_Setting_Launcher();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
598
User/Picture/Picture.c
Normal file
598
User/Picture/Picture.c
Normal file
@ -0,0 +1,598 @@
|
|||||||
|
//ͼƬ
|
||||||
|
|
||||||
|
#include "Picture.h"
|
||||||
|
|
||||||
|
const unsigned char test_pic[8850] = { /* 0X10,0X10,0X00,0X4B,0X00,0X3B,0X01,0X1B, */
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF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,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,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F,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|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,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00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0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
|
||||||
|
0X00,0X00,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,0XFF,0XFF,0XFF,0X00,0X00,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,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,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,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,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,
|
||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F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,};
|
||||||
|
|
||||||
|
const unsigned char mono_testpic[590] = { /* 0X10,0X01,0X00,0X4B,0X00,0X3B, */
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0XE0,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,
|
||||||
|
0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X0E,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,
|
||||||
|
0X03,0XE0,0XE0,0X00,0X0E,0X00,0X00,0X00,0X00,0X7F,0X03,0XE0,0XE0,0X00,0X1F,0X80,
|
||||||
|
0X00,0X00,0X01,0XFF,0X03,0XE0,0XE0,0X00,0X1F,0XC0,0X00,0X00,0X07,0XFE,0X03,0XE0,
|
||||||
|
0XE0,0X00,0X1F,0XF0,0X00,0X00,0X0F,0XF8,0X03,0XE0,0XE0,0X00,0X0F,0XF8,0X00,0X00,
|
||||||
|
0X3F,0XF0,0X03,0XE0,0XE0,0X00,0X03,0XFE,0X00,0X00,0XFF,0XC0,0X03,0XE0,0XE0,0X00,
|
||||||
|
0X01,0XFF,0X00,0X01,0XFF,0X00,0X03,0XE0,0XE0,0X00,0X00,0X7F,0XC0,0X07,0XFE,0X00,
|
||||||
|
0X03,0XE0,0XE0,0X00,0X00,0X3F,0XE0,0X1F,0XF8,0X00,0X03,0XE0,0XE0,0X00,0X00,0X0F,
|
||||||
|
0XF8,0X3F,0XE0,0X00,0X03,0XE0,0XE0,0X00,0X00,0X07,0XFE,0XFF,0XC0,0X00,0X03,0XE0,
|
||||||
|
0XE0,0X00,0X00,0X01,0XFF,0XFF,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0XFF,0XFC,
|
||||||
|
0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X3F,0XF8,0X00,0X00,0X03,0XE0,0XE0,0X00,
|
||||||
|
0X00,0X00,0X7F,0XF8,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0XFF,0XFC,0X00,0X00,
|
||||||
|
0X03,0XE0,0XE0,0X00,0X00,0X03,0XFF,0XFF,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X0F,
|
||||||
|
0XFC,0XFF,0X80,0X00,0X03,0XE0,0XE0,0X00,0X00,0X3F,0XF0,0X3F,0XE0,0X00,0X03,0XE0,
|
||||||
|
0XE0,0X00,0X00,0X7F,0XE0,0X1F,0XF8,0X00,0X03,0XE0,0XE0,0X00,0X01,0XFF,0X80,0X07,
|
||||||
|
0XFC,0X00,0X03,0XE0,0XE0,0X00,0X07,0XFE,0X00,0X01,0XFF,0X00,0X03,0XE0,0XE0,0X00,
|
||||||
|
0X0F,0XFC,0X00,0X00,0XFF,0X80,0X03,0XE0,0XE0,0X00,0X3F,0XF0,0X00,0X00,0X3F,0XE0,
|
||||||
|
0X03,0XE0,0XE0,0X00,0XFF,0XC0,0X00,0X00,0X1F,0XF0,0X03,0XE0,0XE0,0X01,0XFF,0X80,
|
||||||
|
0X00,0X00,0X07,0XFC,0X03,0XE0,0XE0,0X07,0XFE,0X00,0X00,0X00,0X03,0XFE,0X03,0XE0,
|
||||||
|
0XE0,0X1F,0XF8,0X00,0X00,0X00,0X00,0XFE,0X03,0XE0,0XE0,0X3F,0XF0,0X00,0X00,0X00,
|
||||||
|
0X00,0X7E,0X03,0XE0,0XE0,0XFF,0XC0,0X00,0X00,0X00,0X00,0X1C,0X03,0XE0,0XE1,0XFF,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE1,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X03,0XE0,0XE1,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0XE0,0X00,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,
|
||||||
|
0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,
|
||||||
|
0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||||
|
0X03,0XE0,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XE0,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,
|
||||||
|
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
|
||||||
|
0XFF,0XFF,0XFF,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,};
|
||||||
@ -1 +1,9 @@
|
|||||||
extern const unsigned char pic_minecraft[153600];
|
//ͼƬ
|
||||||
|
|
||||||
|
#ifndef __PICTURE_H
|
||||||
|
#define __PICTURE_H
|
||||||
|
|
||||||
|
extern const unsigned char test_pic[8850];
|
||||||
|
extern const unsigned char mono_testpic[590];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -91,7 +91,7 @@ uint8_t SD_GetPath(uint8_t *filepath, uint8_t *filename)
|
|||||||
* @brief SD 卡 GUI 文件选择器
|
* @brief SD 卡 GUI 文件选择器
|
||||||
* @param filepath: 返回储存文件路径
|
* @param filepath: 返回储存文件路径
|
||||||
* @param filesuffix: 文件后缀名。NULL 时不限后缀
|
* @param filesuffix: 文件后缀名。NULL 时不限后缀
|
||||||
* @retval 成功返回 0,失败返回 1
|
* @retval 成功返回 0,失败返回 1,用户按下 JOY_L 返回 2
|
||||||
*/
|
*/
|
||||||
uint8_t SD_SelectFile(uint8_t *filename, uint8_t *filesuffix)
|
uint8_t SD_SelectFile(uint8_t *filename, uint8_t *filesuffix)
|
||||||
{
|
{
|
||||||
@ -133,6 +133,9 @@ uint8_t SD_SelectFile(uint8_t *filename, uint8_t *filesuffix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t choice = GE_GUI_MenuBox(5, 5, 310, 230, "请选择文件:", num, content, NULL);
|
uint8_t choice = GE_GUI_MenuBox(5, 5, 310, 230, "请选择文件:", num, content, NULL);
|
||||||
|
|
||||||
|
if (choice == 0)
|
||||||
|
return 2;
|
||||||
|
|
||||||
strcpy(filename, content[choice - 1]);
|
strcpy(filename, content[choice - 1]);
|
||||||
return SD_OK;
|
return SD_OK;
|
||||||
|
|||||||
71
User/WLAN/WLAN.c
Normal file
71
User/WLAN/WLAN.c
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//WLAN ¿â
|
||||||
|
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#include "systick.h"
|
||||||
|
|
||||||
|
#include "led.h"
|
||||||
|
#include "hc25.h"
|
||||||
|
|
||||||
|
#include "Clock.h"
|
||||||
|
|
||||||
|
#include "WLAN.h"
|
||||||
|
|
||||||
|
uint8_t WLAN_CheckNet(void)
|
||||||
|
{
|
||||||
|
uint8_t str[6];
|
||||||
|
|
||||||
|
HC25_ClearReceive;
|
||||||
|
HC25_SendBuff("checknet", 9);
|
||||||
|
|
||||||
|
str[0] = '\0';
|
||||||
|
if (HC25_ReceiveBuffUntil(str, '\n', 1000) && strcmp(str, "OK") == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str)
|
||||||
|
{
|
||||||
|
HC25_ClearReceive;
|
||||||
|
HC25_SendBuff("ipaddr", 7);
|
||||||
|
|
||||||
|
ipaddr_str[0] = '\0';
|
||||||
|
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000) && strcmp(ipaddr_str, "OK") == 0)
|
||||||
|
if (HC25_ReceiveBuffUntil(ipaddr_str, '\n', 1000))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t WLAN_GetNetClockTime(uint8_t *clock_time_str)
|
||||||
|
{
|
||||||
|
HC25_ClearReceive;
|
||||||
|
HC25_SendBuff("time", 5);
|
||||||
|
|
||||||
|
clock_time_str[0] = '\0';
|
||||||
|
|
||||||
|
if (HC25_ReceiveBuffUntil(clock_time_str, '\n', 1000) && strcmp(clock_time_str, "OK") == 0)
|
||||||
|
if (HC25_ReceiveBuffUntil(clock_time_str, '\n', 1000))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t WLAN_GetWeather(uint8_t *weather_str, uint8_t *city_str)
|
||||||
|
{
|
||||||
|
uint8_t temp_str[15] = "weather=";
|
||||||
|
|
||||||
|
HC25_ClearReceive;
|
||||||
|
strcat(temp_str, city_str);
|
||||||
|
HC25_SendBuff(temp_str, strlen(temp_str) + 1);
|
||||||
|
|
||||||
|
weather_str[0] = '\0';
|
||||||
|
|
||||||
|
if (HC25_ReceiveBuffUntil(weather_str, '\n', 1000) && strcmp(weather_str, "OK") == 0)
|
||||||
|
if (HC25_ReceiveBuffUntil(weather_str, '\n', 1000))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
15
User/WLAN/WLAN.h
Normal file
15
User/WLAN/WLAN.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//WLAN ¿â
|
||||||
|
|
||||||
|
#ifndef __WLAN_H
|
||||||
|
#define __WLAN_H
|
||||||
|
|
||||||
|
#include "sys.h"
|
||||||
|
|
||||||
|
#include "Clock.h"
|
||||||
|
|
||||||
|
uint8_t WLAN_CheckNet(void);
|
||||||
|
uint8_t WLAN_GetIPAddr(uint8_t *ipaddr_str);
|
||||||
|
uint8_t WLAN_GetNetClockTime(uint8_t *clock_time_str);
|
||||||
|
uint8_t WLAN_GetWeather(uint8_t *weather_str, uint8_t *city_str);
|
||||||
|
|
||||||
|
#endif
|
||||||
BIN
_media/struct.png
Normal file
BIN
_media/struct.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 627 KiB |
Loading…
x
Reference in New Issue
Block a user