init commit
This commit is contained in:
commit
91399c2e8f
119 changed files with 27396 additions and 0 deletions
52
plan_manage_main/src/app/include/config.h
Normal file
52
plan_manage_main/src/app/include/config.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* config.h - 配置整个工程
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 模拟定时器使用的定时器
|
||||
*/
|
||||
#define SIMULAT_TIMER_PITX PIT1
|
||||
|
||||
|
||||
/*
|
||||
* 调试模块
|
||||
*/
|
||||
#define DEBUG_UARTX UART1
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 输入模块
|
||||
*/
|
||||
#define UP_KEY_PINX PTE20
|
||||
#define DOWN_KEY_PINX PTA17
|
||||
#define OK_KEY_PINX PTE23
|
||||
#define RET_KEY_PINX PTA4
|
||||
#define AMS_KEY_PINX PTA5
|
||||
#define WIFI_KEY_PINX PTD7
|
||||
#define MR_KEY_PINX PTE30
|
||||
#define MB_KEY_PINX PTA16
|
||||
#define MUVB_KEY_PINX PTD6
|
||||
|
||||
#define KNOB_A_PINX PTD3
|
||||
#define KNOB_B_PINX PTD4
|
||||
#define KNOB_KEY_PINX PTD5
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 显示模块
|
||||
*/
|
||||
#define TFT_UARTX UART2
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // CONFIG_H
|
||||
53
plan_manage_main/src/app/include/debug.h
Normal file
53
plan_manage_main/src/app/include/debug.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* debug.h - 调试
|
||||
*/
|
||||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
|
||||
#define REC_DEBUG_UART_LEN 20
|
||||
|
||||
|
||||
enum rec_uart_flag_
|
||||
{
|
||||
A = 0, C, B, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
extern volatile float recval_debug_uart[26];
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* debug_init() - 初始化调试功能
|
||||
*/
|
||||
void debug_init(void);
|
||||
|
||||
/*
|
||||
* str_to_fp() - 将字符串转换为浮点数
|
||||
* @str: 字符串地址
|
||||
* @len: 字符串长度
|
||||
*
|
||||
* 这个函数传入的字符串格式应符合c语言标准浮点格式,并且没有'\0'
|
||||
*/
|
||||
float str_to_fp(char str[], uint8_t len);
|
||||
|
||||
/*
|
||||
* rec_debug_uart() - 接收uart传入的调试信息,并转换为浮点数
|
||||
*
|
||||
*/
|
||||
void rec_debug_uart(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
0
plan_manage_main/src/app/include/display.h
Normal file
0
plan_manage_main/src/app/include/display.h
Normal file
0
plan_manage_main/src/app/include/flash.h
Normal file
0
plan_manage_main/src/app/include/flash.h
Normal file
37
plan_manage_main/src/app/include/input.h
Normal file
37
plan_manage_main/src/app/include/input.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 文件:input.h
|
||||
* 功能:将外设输入的数据转换为单片机内存中的数据
|
||||
*/
|
||||
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
|
||||
typedef struct InData_
|
||||
{
|
||||
uint8_t isWifiOn : 1;
|
||||
uint8_t isPlanMode : 1;
|
||||
|
||||
uint8_t isRedL : 1;
|
||||
uint8_t isBlueL : 1;
|
||||
uint8_t isUvbL : 1;
|
||||
|
||||
uint8_t knobV;
|
||||
} InData;
|
||||
|
||||
|
||||
void InitInput(void);
|
||||
|
||||
void
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // INPUT_H
|
||||
48
plan_manage_main/src/app/include/isr.h
Normal file
48
plan_manage_main/src/app/include/isr.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* isr.h - 重新宏定义中断号,重映射中断向量表里的中断函数地址,
|
||||
* 使其指向所定义的中断服务函数。
|
||||
*
|
||||
* 只能在"vectors.c"包含,而且必须在"vectors.h"包含的后面!!!
|
||||
*/
|
||||
|
||||
#ifndef ISR_H
|
||||
#define ISR_H
|
||||
|
||||
|
||||
|
||||
#ifdef VECTOR_028
|
||||
#undef VECTOR_028
|
||||
#define VECTOR_028 UART0_isr
|
||||
#endif
|
||||
|
||||
#ifdef VECTOR_038
|
||||
#undef VECTOR_038
|
||||
#define VECTOR_038 PIT_isr
|
||||
#endif
|
||||
|
||||
#ifdef VECTOR_046
|
||||
#undef VECTOR_046
|
||||
#define VECTOR_046 PTA_isr
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VECTOR_047
|
||||
#undef VECTOR_047
|
||||
#define VECTOR_047 PTD_isr
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void PIT_isr(void);
|
||||
|
||||
|
||||
void PTA_isr(void);
|
||||
|
||||
|
||||
void PTD_isr(void);
|
||||
|
||||
|
||||
void UART0_isr(void);
|
||||
|
||||
|
||||
#endif /* ISR_H */
|
||||
57
plan_manage_main/src/app/include/key.h
Normal file
57
plan_manage_main/src/app/include/key.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* key.h - 监测并采集按键的输入
|
||||
* 共有四种输入,无键,单击,双击,长击。
|
||||
* 使用一个定时器每10ms采集一次io状态来实现的。
|
||||
*/
|
||||
|
||||
#ifndef KEY_H
|
||||
#define KEY_H
|
||||
|
||||
|
||||
typedef enum key_mean_
|
||||
{
|
||||
N_KEY = 0, S_KEY, D_KEY, L_KEY
|
||||
} key_mean;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* key_type - 按键的种类
|
||||
*/
|
||||
typedef enum key_type_
|
||||
{
|
||||
UP_KEY = 0, DOWN_KEY, OK_KEY, RET_KEY, AMS_KEY, WIFI_KEY, MR_KEY, MB_KEY, MUVB_KEY
|
||||
} key_type;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* key_init() - 按键模块初始化
|
||||
*
|
||||
*/
|
||||
void key_init(void);
|
||||
|
||||
|
||||
/*
|
||||
* key_detect() - 检测按键
|
||||
*
|
||||
* 要求每隔10ms调用一次
|
||||
*/
|
||||
void key_detect(void);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get_key_mean() - 得到指定的按键信息
|
||||
*
|
||||
* 这个函数中在取得信息后会将对应按键重新标记为N_KEY
|
||||
*/
|
||||
key_mean get_key_mean(key_type key_t);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // KEY_H
|
||||
56
plan_manage_main/src/app/include/knob.h
Normal file
56
plan_manage_main/src/app/include/knob.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* knob.h - 提供旋钮输入的接口函数
|
||||
*
|
||||
* 使用的是一个数字旋钮,利用计数来采集输入
|
||||
*/
|
||||
|
||||
#ifndef KNOB_H
|
||||
#define KNOB_H
|
||||
|
||||
#include "arm_cm0.h"
|
||||
#include "vectors.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* knob_init() - 为旋钮输入而执行的初始化
|
||||
*
|
||||
* 旋钮的检测初始化后默认是禁止的
|
||||
*/
|
||||
void knob_init(void);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* knob_enable() - 使能旋钮脉冲检测
|
||||
*/
|
||||
void knob_enable(void);
|
||||
|
||||
|
||||
/*
|
||||
* knob_disable() - 禁止旋钮脉冲检测
|
||||
*/
|
||||
void knob_disable(void);
|
||||
|
||||
|
||||
/*
|
||||
* knob_clear() - 清除旋钮值
|
||||
*/
|
||||
void knob_clear(void);
|
||||
|
||||
/*
|
||||
* get_knob_val() - 返回旋钮值
|
||||
*/
|
||||
int32_t get_knob_val(void);
|
||||
|
||||
|
||||
/*
|
||||
* knob_detect() - 旋钮检测
|
||||
*
|
||||
* 这个函数需要在旋钮编码器的A相输出发生沿跳变时调用,即上下沿中断时
|
||||
*/
|
||||
void knob_detect(void);
|
||||
|
||||
|
||||
#endif /* KNOB_H */
|
||||
0
plan_manage_main/src/app/include/output.h
Normal file
0
plan_manage_main/src/app/include/output.h
Normal file
0
plan_manage_main/src/app/include/plan_handle.h
Normal file
0
plan_manage_main/src/app/include/plan_handle.h
Normal file
9
plan_manage_main/src/app/include/pm_init.h
Normal file
9
plan_manage_main/src/app/include/pm_init.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* pm_init.h - 对整个应用程序的初始化
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* pm_init() - 初始化
|
||||
*/
|
||||
void pm_init(void);
|
||||
107
plan_manage_main/src/app/include/simulat_timer.h
Normal file
107
plan_manage_main/src/app/include/simulat_timer.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* simulat_timer.h - 实现一个模拟定时器
|
||||
*/
|
||||
|
||||
#ifndef SIMULAT_TIMER_H
|
||||
#define SIMULAT_TIMER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* 模拟定时器的数量
|
||||
*/
|
||||
#define SIMULAT_TIMER_NUM 3
|
||||
|
||||
|
||||
|
||||
typedef struct st_register_
|
||||
{
|
||||
uint8_t count; // 定时器计数
|
||||
uint32_t cmr; // 比较寄存器
|
||||
struct
|
||||
{
|
||||
uint8_t ten : 1; // 使能标志
|
||||
uint8_t tov : 1; // 溢出标志
|
||||
uint8_t tfc : 1; // 自由运行标志
|
||||
uint8_t tcf : 1; // 比较标志
|
||||
} flag;
|
||||
} st_register;
|
||||
|
||||
|
||||
typedef enum st_mode_
|
||||
{
|
||||
COMPARE = 0,
|
||||
NO_COMPARE
|
||||
} st_mode;
|
||||
|
||||
/*
|
||||
* st_init() - 初始化实现模拟定时器所需的pit定时器
|
||||
*
|
||||
* 基础定时为1ms
|
||||
*/
|
||||
void st_base_init(void);
|
||||
|
||||
|
||||
/*
|
||||
* st_init() - 初始化一个给定编号的模拟定时器
|
||||
* @n: 定时器编号
|
||||
* @st_m: 定时模式
|
||||
* @cmr_v: 定时器比较值,在非比较模式可以为任意值
|
||||
*
|
||||
* 这个函数返回0表示正常完成了初始化任务,返回~0表示定时器已打开或不存在
|
||||
*/
|
||||
uint8_t st_init(uint8_t n, st_mode st_m, uint32_t cmr_v);
|
||||
|
||||
|
||||
/*
|
||||
* st_close() - 关闭一个给定编号的模拟定时器
|
||||
* @n: 定时器编号
|
||||
*/
|
||||
void st_close(uint8_t n);
|
||||
|
||||
/*
|
||||
* st_tcf() - 查询tcf位返回
|
||||
* @n: 定时器编号
|
||||
*
|
||||
* 这个函数在没有过比较值的时候返回0,已过比较值得时候返回1,对于不存在或未打开
|
||||
*/
|
||||
uint8_t st_tcf(uint8_t n);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* st_tov() - 查询tov位返回
|
||||
* @n: 定时器编号
|
||||
*
|
||||
* 这个函数在没有溢出时返回0,没有溢出时返回1,对于不存在或未打开
|
||||
*/
|
||||
uint8_t st_tov(uint8_t n);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* st_count() - 查询当前模拟定时值
|
||||
* @n: 定时器编号
|
||||
*
|
||||
* 对于不存在或未打开
|
||||
*/
|
||||
uint32_t st_count(uint8_t n);
|
||||
|
||||
|
||||
|
||||
/********************ISR******************/
|
||||
|
||||
/*
|
||||
* st_base() -定时调用以模拟N路定时器
|
||||
*
|
||||
* 定时的最小间隔等于这个函数被调用的周期
|
||||
*/
|
||||
void st_base(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* SIMULAT_TIMER_H */
|
||||
25
plan_manage_main/src/app/include/tft.h
Normal file
25
plan_manage_main/src/app/include/tft.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* tft.h - tft接口
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TFT_H
|
||||
#define TFT_H
|
||||
|
||||
|
||||
void tft_init(void);
|
||||
|
||||
void tft_up(void);
|
||||
|
||||
void tft_down(void);
|
||||
|
||||
void tft_ok(void);
|
||||
|
||||
void tft_ret(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* TFT_H */
|
||||
0
plan_manage_main/src/app/include/time.h
Normal file
0
plan_manage_main/src/app/include/time.h
Normal file
Loading…
Add table
Add a link
Reference in a new issue