Merge branch 'master' of http://git.brisky.space:441/btl143/firmware_clover
This commit is contained in:
@@ -284,6 +284,7 @@ void TIM1_UP_IRQHandler(void)
|
|||||||
{
|
{
|
||||||
if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
|
if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
|
||||||
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
||||||
|
by_tiny_frame_parse_timer_handle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,20 +5,67 @@
|
|||||||
PARAM_INFO Param_Data[DATA_NUM];
|
PARAM_INFO Param_Data[DATA_NUM];
|
||||||
soft_iic_info_struct eeprom_param;
|
soft_iic_info_struct eeprom_param;
|
||||||
TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
|
TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
|
||||||
|
uint32_t *addre[2];
|
||||||
void jj_param_eeprom_init()
|
float data0 = 1.0f;
|
||||||
|
float data1 = 1.05f;
|
||||||
|
float data2 = 10.0f;
|
||||||
|
float data3 = 100.0f;
|
||||||
|
float data4 = 4.0f;
|
||||||
|
float data5 = 66.0f;
|
||||||
|
float data6 = 13.130f;
|
||||||
|
float data7 = 10.0f;
|
||||||
|
float data8 = 0.0f;
|
||||||
|
/**
|
||||||
|
* @brief 参数初始化注册
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jj_param_eeprom_init(void)
|
||||||
|
{
|
||||||
|
soft_iic_init(&eeprom_param, K24C02_DEV_ADDR, K24C02_SOFT_IIC_DELAY, K24C02_SCL_PIN, K24C02_SDA_PIN); // eeprom初始化
|
||||||
|
PARAM_REG(angle_Kp, &data0, EFLOAT, 1, "an_P:"); // 注冊
|
||||||
|
PARAM_REG(angle_Ki, &data1, EFLOAT, 1, "an_I:"); // 注冊
|
||||||
|
PARAM_REG(angle_Kd, &data2, EFLOAT, 1, "an_D:"); // 注冊
|
||||||
|
PARAM_REG(imgax_Kp, &data3, EFLOAT, 1, "im_P:"); // 注冊
|
||||||
|
PARAM_REG(imgax_Ki, &data4, EFLOAT, 1, "im_I:"); // 注冊
|
||||||
|
PARAM_REG(imgax_Kd, &data5, EFLOAT, 1, "im_D:");
|
||||||
|
PARAM_REG(other , &data6, EFLOAT, 1, "add:");
|
||||||
|
PARAM_REG(delta_x , &data7, EFLOAT, 2, "delta_x:");
|
||||||
|
PARAM_REG(delta_y , &data8, EFLOAT, 0, "delta_y:");
|
||||||
|
jj_param_read(); // 注冊
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief 参数写入
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jj_param_write(void)
|
||||||
|
{
|
||||||
|
for (uint8 i = 0; i < DATA_IN_FLASH_NUM; i++) {
|
||||||
|
switch (Param_Data[i].type) {
|
||||||
|
case EFLOAT:
|
||||||
|
iic_buffer[i].f32 = *((float *)(Param_Data[i].p_data));
|
||||||
|
break;
|
||||||
|
case EUINT32:
|
||||||
|
iic_buffer[i].u32 = *((uint32 *)(Param_Data[i].p_data));
|
||||||
|
break;
|
||||||
|
case EINT32:
|
||||||
|
iic_buffer[i].s32 = *((int32 *)(Param_Data[i].p_data));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
eep_soft_iic_write_8bit_registers(&eeprom_param, (4 * i) >> 8, (4 * i), (uint8 *)&iic_buffer[i], 4);
|
||||||
|
system_delay_ms(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief 参数读出
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jj_param_read(void)
|
||||||
{
|
{
|
||||||
soft_iic_init(&eeprom_param, K24C02_DEV_ADDR, K24C02_SOFT_IIC_DELAY, K24C02_SCL_PIN, K24C02_SDA_PIN); // eeprom 初始化
|
|
||||||
// PARAM_REG(angle_Kp, &an_Kp, EFLOAT, 1, "an_P"); // 注冊
|
|
||||||
// PARAM_REG(angle_Ki, &an_Ki, EFLOAT, 1, "an_I"); // 注冊
|
|
||||||
// PARAM_REG(angle_Kd, &an_Kd, EFLOAT, 1, "an_D"); // 注冊
|
|
||||||
// PARAM_REG(imgax_Kp, &im_Kp, EFLOAT, 1, "im_P"); // 注冊
|
|
||||||
// PARAM_REG(imgax_Ki, &im_Ki, EFLOAT, 1, "im_I"); // 注冊
|
|
||||||
// PARAM_REG(imgax_Kd, &im_Kd, EFLOAT, 1, "im_D"); // 注冊
|
|
||||||
|
|
||||||
for (uint8 i = 0; i < DATA_IN_FLASH_NUM; i++) {
|
for (uint8 i = 0; i < DATA_IN_FLASH_NUM; i++) {
|
||||||
|
|
||||||
soft_iic_read_8bit_registers(&eeprom_param, 4 * i, (uint8 *)&iic_buffer[i], 4);
|
eep_soft_iic_read_8bit_registers(&eeprom_param, (4 * i) >> 8, (4 * i), (uint8 *)&iic_buffer[i], 4);
|
||||||
switch (Param_Data[i].type) {
|
switch (Param_Data[i].type) {
|
||||||
case EFLOAT:
|
case EFLOAT:
|
||||||
*((float *)(Param_Data[i].p_data)) =
|
*((float *)(Param_Data[i].p_data)) =
|
||||||
@@ -38,27 +85,3 @@ void jj_param_eeprom_init()
|
|||||||
system_delay_ms(10);
|
system_delay_ms(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @brief 参数更新
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void jj_param_update()
|
|
||||||
{
|
|
||||||
for (uint8 i = 0; i < DATA_IN_FLASH_NUM; i++) {
|
|
||||||
switch (Param_Data[i].type) {
|
|
||||||
case EFLOAT:
|
|
||||||
iic_buffer[i].f32 = *((float *)(Param_Data[i].p_data));
|
|
||||||
break;
|
|
||||||
case EUINT32:
|
|
||||||
iic_buffer[i].u32 = *((uint32 *)(Param_Data[i].p_data));
|
|
||||||
break;
|
|
||||||
case EINT32:
|
|
||||||
iic_buffer[i].s32 = *((int32 *)(Param_Data[i].p_data));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
soft_iic_write_8bit_registers(&eeprom_param, 4 * i, (uint8 *)&iic_buffer[i], 4);
|
|
||||||
system_delay_ms(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,23 +6,34 @@
|
|||||||
#include "zf_driver_soft_iic.h"
|
#include "zf_driver_soft_iic.h"
|
||||||
/**
|
/**
|
||||||
* @brief 注册需调参数
|
* @brief 注册需调参数
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define PARAM_REG(_data_tag_, _p_data_, _type_, _cmd_,_text_) \
|
#define PARAM_REG(_data_tag_, _p_data_, _type_, _cmd_, _text_) \
|
||||||
Param_Data[_data_tag_].p_data = (void *)_p_data_; \
|
Param_Data[_data_tag_].p_data = (void *)_p_data_; \
|
||||||
Param_Data[_data_tag_].type = _type_; \
|
Param_Data[_data_tag_].type = _type_; \
|
||||||
Param_Data[_data_tag_].cmd = _cmd_; \
|
Param_Data[_data_tag_].cmd = _cmd_; \
|
||||||
Param_Data[_data_tag_].text = _text_;
|
Param_Data[_data_tag_].text = _text_;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DATA_HEAD = -1,
|
|
||||||
angle_Kp,
|
Page1_head=0,
|
||||||
|
|
||||||
|
angle_Kp=Page1_head,
|
||||||
angle_Ki,
|
angle_Ki,
|
||||||
angle_Kd,
|
angle_Kd,
|
||||||
imgax_Kp,
|
other,
|
||||||
|
|
||||||
|
Page2_head,
|
||||||
|
// 第二页参数
|
||||||
|
imgax_Kp=Page2_head,
|
||||||
imgax_Ki,
|
imgax_Ki,
|
||||||
imgax_Kd,
|
imgax_Kd,
|
||||||
|
|
||||||
|
Page3_head,
|
||||||
DATA_IN_FLASH_NUM,
|
DATA_IN_FLASH_NUM,
|
||||||
|
|
||||||
|
delta_x,
|
||||||
|
delta_y,
|
||||||
DATA_NUM,
|
DATA_NUM,
|
||||||
} data_tag_t;
|
} data_tag_t;
|
||||||
|
|
||||||
@@ -30,26 +41,27 @@ typedef enum {
|
|||||||
EUINT32,
|
EUINT32,
|
||||||
EINT32,
|
EINT32,
|
||||||
EFLOAT,
|
EFLOAT,
|
||||||
}ENUM_TYPE;
|
} ENUM_TYPE;
|
||||||
|
|
||||||
typedef union{
|
typedef union {
|
||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
int32_t s32;
|
int32_t s32;
|
||||||
float f32;
|
float f32;
|
||||||
uint8_t u8;
|
uint8_t u8;
|
||||||
}TYPE_UNION;
|
} TYPE_UNION;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *p_data;
|
void *p_data;
|
||||||
ENUM_TYPE type;
|
ENUM_TYPE type;
|
||||||
uint8_t cmd;
|
uint8_t cmd;//01:仅存储 00:仅显示 02:传输并显示
|
||||||
char *text;
|
char *text;
|
||||||
}PARAM_INFO;
|
} PARAM_INFO;
|
||||||
|
extern uint32_t * addre[2];
|
||||||
extern soft_iic_info_struct eeprom_param;
|
extern soft_iic_info_struct eeprom_param;
|
||||||
extern PARAM_INFO Param_Data[DATA_NUM];
|
extern PARAM_INFO Param_Data[DATA_NUM];
|
||||||
extern TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
|
extern TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
|
||||||
void jj_param_eeprom_init();
|
void jj_param_eeprom_init(void);
|
||||||
void jj_param_update();
|
void jj_param_write(void);
|
||||||
void jj_param_show();
|
void jj_param_read(void);
|
||||||
|
extern float data7;
|
||||||
#endif
|
#endif
|
||||||
36
app/main.c
36
app/main.c
@@ -57,16 +57,15 @@ int main(void)
|
|||||||
ips200_init(IPS200_TYPE_SPI);
|
ips200_init(IPS200_TYPE_SPI);
|
||||||
|
|
||||||
by_led_init();
|
by_led_init();
|
||||||
by_buzzer_init();
|
// by_buzzer_init();
|
||||||
by_button_init();
|
by_button_init();
|
||||||
|
|
||||||
// jj_bt_init();
|
jj_bt_init();
|
||||||
// jj_param_eeprom_init();
|
jj_param_eeprom_init();
|
||||||
|
|
||||||
Page_Init();
|
Page_Init();
|
||||||
|
|
||||||
// pit_ms_init(TIM6_PIT, 2);
|
pit_ms_init(TIM1_PIT, 1);
|
||||||
// pit_ms_init(TIM1_PIT, 2);
|
|
||||||
|
|
||||||
by_tiny_frame_init();
|
by_tiny_frame_init();
|
||||||
printf("start running\r\n");
|
printf("start running\r\n");
|
||||||
@@ -79,7 +78,7 @@ int main(void)
|
|||||||
|
|
||||||
frame_now.cmd = 0x06;
|
frame_now.cmd = 0x06;
|
||||||
frame_now.data = 0x19260817;
|
frame_now.data = 0x19260817;
|
||||||
frame_now.reg_addr = 0x4059;
|
frame_now.reg_addr = 0x00;
|
||||||
frame_now.slave_id = 0x0D;
|
frame_now.slave_id = 0x0D;
|
||||||
/** 测试完成后移除 **/
|
/** 测试完成后移除 **/
|
||||||
|
|
||||||
@@ -87,13 +86,11 @@ int main(void)
|
|||||||
by_tiny_frame_read(0x0D, 0x4059, &data_test);
|
by_tiny_frame_read(0x0D, 0x4059, &data_test);
|
||||||
while (1) {
|
while (1) {
|
||||||
Page_Run();
|
Page_Run();
|
||||||
by_buzzer_run();
|
// by_buzzer_run();
|
||||||
|
|
||||||
/** 测试完成后移除 **/
|
/** 测试完成后移除 **/
|
||||||
by_tiny_frame_run();
|
by_tiny_frame_pack_send(&frame_now);
|
||||||
// by_tiny_frame_pack_send(&frame_now);
|
|
||||||
system_delay_ms(10);
|
system_delay_ms(10);
|
||||||
by_tiny_frame_parse_timer_handle();
|
|
||||||
/** 测试完成后移除 **/
|
/** 测试完成后移除 **/
|
||||||
|
|
||||||
if (mt9v03x_finish_flag) {
|
if (mt9v03x_finish_flag) {
|
||||||
@@ -103,14 +100,15 @@ int main(void)
|
|||||||
// ips200_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
// ips200_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
|
||||||
mt9v03x_finish_flag = 0;
|
mt9v03x_finish_flag = 0;
|
||||||
by_led_info_blink();
|
by_led_info_blink();
|
||||||
state_type = COMMON_STATE;
|
// state_type = COMMON_STATE;
|
||||||
img_processing();
|
// img_processing();
|
||||||
get_corners();
|
// get_corners();
|
||||||
aim_distance = COMMON_AIM;
|
// aim_distance = COMMON_AIM;
|
||||||
tracking();
|
// tracking();
|
||||||
ElementJudge();
|
// ElementJudge();
|
||||||
ElementRun();
|
// ElementRun();
|
||||||
MidLineTrack();
|
// MidLineTrack();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,13 @@
|
|||||||
|
|
||||||
PAGE_LIST pagelist[page_max];
|
PAGE_LIST pagelist[page_max];
|
||||||
static uint8_t page_busy = 0;
|
static uint8_t page_busy = 0;
|
||||||
static int8_t now_page = page_menu;
|
|
||||||
static int8_t new_page = page_menu;
|
static int8_t new_page = page_menu;
|
||||||
|
static int8_t now_page = page_menu;
|
||||||
|
|
||||||
|
int8_t Get_new_page(void)
|
||||||
|
{
|
||||||
|
return new_page;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 注册一个基本页面,包含一个初始化函数,循环函数,退出函数,事件函数
|
* @brief 注册一个基本页面,包含一个初始化函数,循环函数,退出函数,事件函数
|
||||||
* @param pageID: 页面编号
|
* @param pageID: 页面编号
|
||||||
@@ -17,11 +21,11 @@ static int8_t new_page = page_menu;
|
|||||||
* @param eventCallback: 事件函数回调
|
* @param eventCallback: 事件函数回调
|
||||||
* @retval 无
|
* @retval 无
|
||||||
*/
|
*/
|
||||||
void Page_Register(uint8_t pageID, char *pageText,
|
void Page_Register(uint8_t pageID,
|
||||||
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
||||||
CallbackFunction_t exitCallback, EventFunction_t eventCallback)
|
CallbackFunction_t exitCallback, EventFunction_t eventCallback)
|
||||||
{
|
{
|
||||||
pagelist[pageID].Text = pageText;
|
|
||||||
pagelist[pageID].SetupCallback = setupCallback;
|
pagelist[pageID].SetupCallback = setupCallback;
|
||||||
pagelist[pageID].LoopCallback = loopCallback;
|
pagelist[pageID].LoopCallback = loopCallback;
|
||||||
pagelist[pageID].ExitCallback = exitCallback;
|
pagelist[pageID].ExitCallback = exitCallback;
|
||||||
@@ -123,9 +127,11 @@ void Page_Run(void)
|
|||||||
*/
|
*/
|
||||||
void Page_Init(void)
|
void Page_Init(void)
|
||||||
{
|
{
|
||||||
PAGE_REG(page_menu);
|
PAGE_REG(page_menu, "main");
|
||||||
PAGE_REG(page_rtcam);
|
PAGE_REG(page_rtcam, "rtcam");
|
||||||
PAGE_REG(page_param);
|
PAGE_REG(page_param1, "Param1");
|
||||||
|
PAGE_REG(page_param2, "param2");
|
||||||
|
PAGE_REG(page_dparam, "dparam");
|
||||||
// PAGE_REG(page_argv);
|
// PAGE_REG(page_argv);
|
||||||
// PAGE_REG(page_sys);
|
// PAGE_REG(page_sys);
|
||||||
// PAGE_REG(page_run);
|
// PAGE_REG(page_run);
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ enum PageID {
|
|||||||
//......
|
//......
|
||||||
page_menu,
|
page_menu,
|
||||||
page_rtcam,
|
page_rtcam,
|
||||||
page_param,
|
page_param1,
|
||||||
|
page_param2,
|
||||||
|
page_dparam,
|
||||||
// page_argv,
|
// page_argv,
|
||||||
// page_sys,
|
// page_sys,
|
||||||
// page_run,
|
// page_run,
|
||||||
@@ -46,13 +48,15 @@ typedef struct {
|
|||||||
} PAGE_LIST;
|
} PAGE_LIST;
|
||||||
|
|
||||||
// 页面注册函数
|
// 页面注册函数
|
||||||
#define PAGE_REG(name) \
|
#define PAGE_REG(_name_, _text_) \
|
||||||
do { \
|
do { \
|
||||||
extern void PageRegister_##name(unsigned char pageID); \
|
extern void PageRegister_##_name_(unsigned char pageID); \
|
||||||
PageRegister_##name(name); \
|
PageRegister_##_name_(_name_); \
|
||||||
} while (0)
|
} while (0); \
|
||||||
|
pagelist[_name_].Text = _text_ ;
|
||||||
|
|
||||||
void Page_Register(uint8_t pageID, char *pageText,
|
|
||||||
|
void Page_Register(uint8_t pageID,
|
||||||
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
CallbackFunction_t setupCallback, CallbackFunction_t loopCallback,
|
||||||
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
|
CallbackFunction_t exitCallback, EventFunction_t eventCallback);
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ void Page_OpenCurrentPage(void);
|
|||||||
uint8_t Page_GetStatus(void);
|
uint8_t Page_GetStatus(void);
|
||||||
void Page_Run(void);
|
void Page_Run(void);
|
||||||
void Page_Init(void);
|
void Page_Init(void);
|
||||||
|
int8_t Get_new_page(void);
|
||||||
|
|
||||||
extern PAGE_LIST pagelist[page_max];
|
extern PAGE_LIST pagelist[page_max];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
72
app/page/page_dparam.c
Normal file
72
app/page/page_dparam.c
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
#include "zf_common_headfile.h"
|
||||||
|
#include "page_ui_widget.h"
|
||||||
|
#include "page.h"
|
||||||
|
#include "jj_param.h"
|
||||||
|
// #define LINE_HEAD 1
|
||||||
|
// #define LINE_END 7
|
||||||
|
// static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||||
|
// static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* 以下为页面模板函数
|
||||||
|
*
|
||||||
|
***************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面初始化事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Setup()
|
||||||
|
{
|
||||||
|
ips200_clear();
|
||||||
|
// 显示参数名称
|
||||||
|
ips200_show_string(0, 0, "Dparam");
|
||||||
|
|
||||||
|
ips200_show_string(20, 18 + 2, (Param_Data[delta_x].text));
|
||||||
|
ips200_show_string(20, 18 + 20, (Param_Data[delta_y].text));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面退出事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Exit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面循环执行的内容
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Loop()
|
||||||
|
{
|
||||||
|
// 刷新参数数值
|
||||||
|
ips200_show_float(90, 18 + 2, *((float *)(Param_Data[delta_x].p_data)), 4, 5);
|
||||||
|
ips200_show_float(90, 18 + 20, *((float *)(Param_Data[delta_x].p_data)), 4, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面事件
|
||||||
|
* @param btn:发出事件的按键
|
||||||
|
* @param event:事件编号
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Event(page_event event)
|
||||||
|
{
|
||||||
|
if (page_event_press_long == event) {
|
||||||
|
Page_Shift(page_menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面注册函数
|
||||||
|
*
|
||||||
|
* @param pageID
|
||||||
|
*/
|
||||||
|
void PageRegister_page_dparam(unsigned char pageID)
|
||||||
|
{
|
||||||
|
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ static void Setup()
|
|||||||
{
|
{
|
||||||
ips200_clear();
|
ips200_clear();
|
||||||
Print_Menu_p();
|
Print_Menu_p();
|
||||||
Print_Curser(Curser, Curser_Last,RGB565_PURPLE);
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,9 +57,9 @@ static void Event(page_event event)
|
|||||||
Curser_Last = Curser;
|
Curser_Last = Curser;
|
||||||
|
|
||||||
if (page_event_forward == event) {
|
if (page_event_forward == event) {
|
||||||
Curser--; // 光标上移
|
Curser++; // 光标上移
|
||||||
} else if (page_event_backward == event) {
|
} else if (page_event_backward == event) {
|
||||||
Curser++; // 光标下移
|
Curser--; // 光标下移
|
||||||
} else if (page_event_press_short == event) {
|
} else if (page_event_press_short == event) {
|
||||||
if (page_max > Curser && page_menu < Curser) {
|
if (page_max > Curser && page_menu < Curser) {
|
||||||
Page_Shift(Curser); // 切换到光标选中的页面
|
Page_Shift(Curser); // 切换到光标选中的页面
|
||||||
@@ -72,7 +72,7 @@ static void Event(page_event event)
|
|||||||
Curser = LINE_HEAD;
|
Curser = LINE_HEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print_Curser(Curser, Curser_Last,RGB565_PURPLE);
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +82,7 @@ static void Event(page_event event)
|
|||||||
*/
|
*/
|
||||||
void PageRegister_page_menu(unsigned char pageID)
|
void PageRegister_page_menu(unsigned char pageID)
|
||||||
{
|
{
|
||||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
#include "jj_param.h"
|
|
||||||
#include "page_ui_widget.h"
|
|
||||||
#include "page.h"
|
|
||||||
|
|
||||||
#define LINE_HEAD 0
|
|
||||||
#define LINE_END DATA_NUM - 2
|
|
||||||
static char Text[] = "Param";
|
|
||||||
int event_flag = 0;
|
|
||||||
int32_t index_power = 0;
|
|
||||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
|
||||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
|
||||||
void jj_param_show();
|
|
||||||
/***************************************************************************************
|
|
||||||
*
|
|
||||||
* 以下为页面模板函数
|
|
||||||
*
|
|
||||||
***************************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief 页面初始化事件
|
|
||||||
* @param 无
|
|
||||||
* @retval 无
|
|
||||||
*/
|
|
||||||
static void Setup()
|
|
||||||
{
|
|
||||||
ips200_clear();
|
|
||||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
|
||||||
for (int16 i = 0; i < DATA_NUM - 1; i++) {
|
|
||||||
ips200_show_string(10, i * 18 + 2, Param_Data[i].text);
|
|
||||||
if (Param_Data[i].type == EINT32)
|
|
||||||
ips200_show_int(50, i * 18 + 2, *((int32 *)(Param_Data[i].p_data)), 5);
|
|
||||||
else if (Param_Data[i].type == EFLOAT)
|
|
||||||
ips200_show_float(50, i * 18 + 2, *((float *)(Param_Data[i].p_data)), 4, 5);
|
|
||||||
}
|
|
||||||
ips200_show_int(50, (DATA_NUM-1)* 18 + 2, index_power, 5);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 页面退出事件
|
|
||||||
* @param 无
|
|
||||||
* @retval 无
|
|
||||||
*/
|
|
||||||
static void Exit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 页面循环执行的内容
|
|
||||||
* @param 无
|
|
||||||
* @retval 无
|
|
||||||
*/
|
|
||||||
static void Loop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief 页面事件
|
|
||||||
* @param btn:发出事件的按键
|
|
||||||
* @param event:事件编号
|
|
||||||
* @retval 无
|
|
||||||
*/
|
|
||||||
static void Event(page_event event)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (0 == event_flag) {
|
|
||||||
|
|
||||||
Curser_Last = Curser;
|
|
||||||
if (page_event_forward == event) {
|
|
||||||
Curser--; // 光标上移
|
|
||||||
} else if (page_event_backward == event) {
|
|
||||||
Curser++; // 光标下移
|
|
||||||
} else if (page_event_press_short == event) {
|
|
||||||
event_flag = 1; // 选中参数
|
|
||||||
Print_Curser(Curser, Curser_Last, RGB565_RED);
|
|
||||||
return;
|
|
||||||
} else if (page_event_press_long == event) {
|
|
||||||
jj_param_update();
|
|
||||||
Page_Shift(page_menu);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Curser < LINE_HEAD) {
|
|
||||||
Curser = LINE_END;
|
|
||||||
} else if (Curser > LINE_END) {
|
|
||||||
Curser = LINE_HEAD;
|
|
||||||
}
|
|
||||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
|
||||||
} else if (1 == event_flag) {
|
|
||||||
if (page_event_forward == event) {
|
|
||||||
if (Param_Data[Curser].type == EFLOAT) {
|
|
||||||
*((float *)(Param_Data[Curser].p_data)) += powf(10.0f,(float)index_power);
|
|
||||||
} else if (Param_Data[Curser].type == EINT32) {
|
|
||||||
*((int32 *)(Param_Data[Curser].p_data)) += 1;
|
|
||||||
} else if (Param_Data[Curser].type == EUINT32) {
|
|
||||||
*((uint32 *)(Param_Data[Curser].p_data)) += 1;
|
|
||||||
}
|
|
||||||
} else if (page_event_backward == event) {
|
|
||||||
if (Param_Data[Curser].type == EFLOAT) {
|
|
||||||
*((float *)(Param_Data[Curser].p_data)) -=powf(10.0f,(float)index_power);
|
|
||||||
} else if (Param_Data[Curser].type == EINT32) {
|
|
||||||
*((int32 *)(Param_Data[Curser].p_data)) -= 1;
|
|
||||||
} else if (Param_Data[Curser].type == EUINT32) {
|
|
||||||
*((uint32 *)(Param_Data[Curser].p_data)) -= 1;
|
|
||||||
}
|
|
||||||
} else if (page_event_press_short == event) {
|
|
||||||
index_power++;
|
|
||||||
if (index_power > 2) {
|
|
||||||
index_power = -2;
|
|
||||||
}
|
|
||||||
ips200_show_int(50, (DATA_NUM-1)* 18 + 2, index_power, 5);
|
|
||||||
} else if (page_event_press_long == event) {
|
|
||||||
event_flag = 0;
|
|
||||||
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
|
||||||
}
|
|
||||||
jj_param_show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void jj_param_show()
|
|
||||||
{
|
|
||||||
if (EINT32 == Param_Data[Curser].type)
|
|
||||||
ips200_show_int(50, Curser * 18 + 2, *((int32 *)(Param_Data[Curser].p_data)), 5);
|
|
||||||
else if (EUINT32 == Param_Data[Curser].type)
|
|
||||||
ips200_show_uint(50, Curser * 18 + 2, *((int32 *)(Param_Data[Curser].p_data)), 5);
|
|
||||||
else if (EFLOAT == Param_Data[Curser].type)
|
|
||||||
ips200_show_float(50, Curser * 18 + 2, *((float *)(Param_Data[Curser].p_data)), 4, 5);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief 页面注册函数
|
|
||||||
*
|
|
||||||
* @param pageID
|
|
||||||
*/
|
|
||||||
void PageRegister_page_param(unsigned char pageID)
|
|
||||||
{
|
|
||||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,6 @@
|
|||||||
#define LINE_HEAD 11
|
#define LINE_HEAD 11
|
||||||
#define LINE_END 16
|
#define LINE_END 16
|
||||||
|
|
||||||
static char Text[] = "RealTime Image";
|
|
||||||
|
|
||||||
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||||
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
@@ -81,7 +79,7 @@ static void Event(page_event event)
|
|||||||
*/
|
*/
|
||||||
void PageRegister_page_rtcam(unsigned char pageID)
|
void PageRegister_page_rtcam(unsigned char pageID)
|
||||||
{
|
{
|
||||||
Page_Register(pageID, Text, Setup, Loop, Exit, Event);
|
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
|
|||||||
160
app/page/page_sparam1.c
Normal file
160
app/page/page_sparam1.c
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
#include "jj_param.h"
|
||||||
|
#include "page_ui_widget.h"
|
||||||
|
#include "page.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define LINE_HEAD 1
|
||||||
|
|
||||||
|
static int16 pafrist;
|
||||||
|
static int16 paend;
|
||||||
|
static int16 palong;
|
||||||
|
static int event_flag = 0;
|
||||||
|
static int32_t index_power = 0;
|
||||||
|
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||||
|
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* 以下为页面模板函数
|
||||||
|
*
|
||||||
|
***************************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief 页面初始化事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Setup()
|
||||||
|
{
|
||||||
|
ips200_clear();
|
||||||
|
|
||||||
|
if (Get_new_page() == page_param1) {
|
||||||
|
pafrist = 0;
|
||||||
|
paend = Page2_head;
|
||||||
|
ips200_show_string(0, 0, "Param1");
|
||||||
|
} else if (Get_new_page() == page_param2) {
|
||||||
|
pafrist = Page2_head;
|
||||||
|
paend = Page3_head;
|
||||||
|
ips200_show_string(0, 0, "Param2");
|
||||||
|
}
|
||||||
|
|
||||||
|
palong = paend - pafrist;
|
||||||
|
if (Curser < LINE_HEAD) {
|
||||||
|
Curser = palong;
|
||||||
|
} else if (Curser > palong) {
|
||||||
|
Curser = LINE_HEAD;
|
||||||
|
}
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
for (int16 i = 0; i < palong; i++) {
|
||||||
|
ips200_show_string(20, i * 18 + 20, Param_Data[i + pafrist].text);
|
||||||
|
if (Param_Data[i].type == EINT32)
|
||||||
|
ips200_show_int(60, i * 18 + 20, *((int32 *)(Param_Data[i + pafrist].p_data)), 5);
|
||||||
|
else if (Param_Data[i].type == EFLOAT)
|
||||||
|
ips200_show_float(60, i * 18 + 20, *((float *)(Param_Data[i + pafrist].p_data)), 4, 5);
|
||||||
|
}
|
||||||
|
ips200_show_int(50, palong * 18 + 20, index_power, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面退出事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Exit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面循环执行的内容
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief 页面事件
|
||||||
|
* @param btn:发出事件的按键
|
||||||
|
* @param event:事件编号
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Event(page_event event)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (0 == event_flag) {
|
||||||
|
|
||||||
|
Curser_Last = Curser;
|
||||||
|
if (page_event_forward == event) {
|
||||||
|
Curser++; // 光标上移
|
||||||
|
} else if (page_event_backward == event) {
|
||||||
|
Curser--; // 光标下移
|
||||||
|
} else if (page_event_press_short == event) {
|
||||||
|
event_flag = 1; // 选中参数
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_RED);
|
||||||
|
return;
|
||||||
|
} else if (page_event_press_long == event) {
|
||||||
|
jj_param_write();
|
||||||
|
Page_Shift(page_menu);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Curser < LINE_HEAD) {
|
||||||
|
Curser = palong;
|
||||||
|
} else if (Curser > palong) {
|
||||||
|
Curser = LINE_HEAD;
|
||||||
|
}
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
} else if (1 == event_flag) {
|
||||||
|
if (page_event_forward == event) {
|
||||||
|
switch (Param_Data[Curser + pafrist - 1].type) {
|
||||||
|
case EFLOAT:
|
||||||
|
*((float *)(Param_Data[Curser + pafrist - 1].p_data)) += powf(10, index_power);
|
||||||
|
break;
|
||||||
|
case EINT32:
|
||||||
|
*((int32 *)(Param_Data[Curser + pafrist - 1].p_data)) += 1;
|
||||||
|
break;
|
||||||
|
case EUINT32:
|
||||||
|
*((uint32 *)(Param_Data[Curser + pafrist - 1].p_data)) += 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (page_event_backward == event) {
|
||||||
|
switch (Param_Data[Curser + pafrist - 1].type) {
|
||||||
|
case EFLOAT:
|
||||||
|
*((float *)(Param_Data[Curser + pafrist - 1].p_data)) -= powf(10.0f, (float)index_power);
|
||||||
|
break;
|
||||||
|
case EINT32:
|
||||||
|
*((int32 *)(Param_Data[Curser + pafrist - 1].p_data)) -= 1;
|
||||||
|
break;
|
||||||
|
case EUINT32:
|
||||||
|
*((uint32 *)(Param_Data[Curser + pafrist - 1].p_data)) -= 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (page_event_press_short == event) {
|
||||||
|
index_power++;
|
||||||
|
if (index_power > 2) {
|
||||||
|
index_power = -2;
|
||||||
|
}
|
||||||
|
ips200_show_int(50, palong * 18 + 20, index_power, 5);
|
||||||
|
} else if (page_event_press_long == event) {
|
||||||
|
event_flag = 0;
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
}
|
||||||
|
if (EINT32 == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_int(60, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + pafrist - 1].p_data)), 5);
|
||||||
|
else if (EUINT32 == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_uint(60, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + pafrist - 1].p_data)), 5);
|
||||||
|
else if (EFLOAT == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_float(60, Curser * 18 + 2, *((float *)(Param_Data[Curser + pafrist - 1].p_data)), 4, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面注册函数
|
||||||
|
*
|
||||||
|
* @param pageID
|
||||||
|
*/
|
||||||
|
void PageRegister_page_param1(unsigned char pageID)
|
||||||
|
{
|
||||||
|
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||||
|
}
|
||||||
160
app/page/page_sparam2.c
Normal file
160
app/page/page_sparam2.c
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
#include "jj_param.h"
|
||||||
|
#include "page_ui_widget.h"
|
||||||
|
#include "page.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define LINE_HEAD 1
|
||||||
|
|
||||||
|
static int16 pafrist;
|
||||||
|
static int16 paend;
|
||||||
|
static int16 palong;
|
||||||
|
static int event_flag = 0;
|
||||||
|
static int32_t index_power = 0;
|
||||||
|
static int8_t Curser = LINE_HEAD; // 定义光标位置
|
||||||
|
static int8_t Curser_Last = LINE_HEAD; // 定义光标位置
|
||||||
|
/***************************************************************************************
|
||||||
|
*
|
||||||
|
* 以下为页面模板函数
|
||||||
|
*
|
||||||
|
***************************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief 页面初始化事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Setup()
|
||||||
|
{
|
||||||
|
ips200_clear();
|
||||||
|
|
||||||
|
if (Get_new_page() == page_param1) {
|
||||||
|
pafrist = 0;
|
||||||
|
paend = Page2_head;
|
||||||
|
ips200_show_string(0, 0, "Param1");
|
||||||
|
} else if (Get_new_page() == page_param2) {
|
||||||
|
pafrist = Page2_head;
|
||||||
|
paend = Page3_head;
|
||||||
|
ips200_show_string(0, 0, "Param2");
|
||||||
|
}
|
||||||
|
|
||||||
|
palong = paend - pafrist;
|
||||||
|
if (Curser < LINE_HEAD) {
|
||||||
|
Curser = palong;
|
||||||
|
} else if (Curser > palong) {
|
||||||
|
Curser = LINE_HEAD;
|
||||||
|
}
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
for (int16 i = 0; i < palong; i++) {
|
||||||
|
ips200_show_string(20, i * 18 + 20, Param_Data[i + pafrist].text);
|
||||||
|
if (Param_Data[i].type == EINT32)
|
||||||
|
ips200_show_int(60, i * 18 + 20, *((int32 *)(Param_Data[i + pafrist].p_data)), 5);
|
||||||
|
else if (Param_Data[i].type == EFLOAT)
|
||||||
|
ips200_show_float(60, i * 18 + 20, *((float *)(Param_Data[i + pafrist].p_data)), 4, 5);
|
||||||
|
}
|
||||||
|
ips200_show_int(50, palong * 18 + 20, index_power, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面退出事件
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Exit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面循环执行的内容
|
||||||
|
* @param 无
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief 页面事件
|
||||||
|
* @param btn:发出事件的按键
|
||||||
|
* @param event:事件编号
|
||||||
|
* @retval 无
|
||||||
|
*/
|
||||||
|
static void Event(page_event event)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (0 == event_flag) {
|
||||||
|
|
||||||
|
Curser_Last = Curser;
|
||||||
|
if (page_event_forward == event) {
|
||||||
|
Curser++; // 光标上移
|
||||||
|
} else if (page_event_backward == event) {
|
||||||
|
Curser--; // 光标下移
|
||||||
|
} else if (page_event_press_short == event) {
|
||||||
|
event_flag = 1; // 选中参数
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_RED);
|
||||||
|
return;
|
||||||
|
} else if (page_event_press_long == event) {
|
||||||
|
jj_param_write();
|
||||||
|
Page_Shift(page_menu);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Curser < LINE_HEAD) {
|
||||||
|
Curser = palong;
|
||||||
|
} else if (Curser > palong) {
|
||||||
|
Curser = LINE_HEAD;
|
||||||
|
}
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
} else if (1 == event_flag) {
|
||||||
|
if (page_event_forward == event) {
|
||||||
|
switch (Param_Data[Curser + pafrist - 1].type) {
|
||||||
|
case EFLOAT:
|
||||||
|
*((float *)(Param_Data[Curser + pafrist - 1].p_data)) += powf(10, index_power);
|
||||||
|
break;
|
||||||
|
case EINT32:
|
||||||
|
*((int32 *)(Param_Data[Curser + pafrist - 1].p_data)) += 1;
|
||||||
|
break;
|
||||||
|
case EUINT32:
|
||||||
|
*((uint32 *)(Param_Data[Curser + pafrist - 1].p_data)) += 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (page_event_backward == event) {
|
||||||
|
switch (Param_Data[Curser + pafrist - 1].type) {
|
||||||
|
case EFLOAT:
|
||||||
|
*((float *)(Param_Data[Curser + pafrist - 1].p_data)) -= powf(10.0f, (float)index_power);
|
||||||
|
break;
|
||||||
|
case EINT32:
|
||||||
|
*((int32 *)(Param_Data[Curser + pafrist - 1].p_data)) -= 1;
|
||||||
|
break;
|
||||||
|
case EUINT32:
|
||||||
|
*((uint32 *)(Param_Data[Curser + pafrist - 1].p_data)) -= 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (page_event_press_short == event) {
|
||||||
|
index_power++;
|
||||||
|
if (index_power > 2) {
|
||||||
|
index_power = -2;
|
||||||
|
}
|
||||||
|
ips200_show_int(50, palong * 18 + 20, index_power, 5);
|
||||||
|
} else if (page_event_press_long == event) {
|
||||||
|
event_flag = 0;
|
||||||
|
Print_Curser(Curser, Curser_Last, RGB565_PURPLE);
|
||||||
|
}
|
||||||
|
if (EINT32 == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_int(60, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + pafrist - 1].p_data)), 5);
|
||||||
|
else if (EUINT32 == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_uint(60, Curser * 18 + 2, *((int32 *)(Param_Data[Curser + pafrist - 1].p_data)), 5);
|
||||||
|
else if (EFLOAT == Param_Data[Curser + pafrist - 1].type)
|
||||||
|
ips200_show_float(60, Curser * 18 + 2, *((float *)(Param_Data[Curser + pafrist - 1].p_data)), 4, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 页面注册函数
|
||||||
|
*
|
||||||
|
* @param pageID
|
||||||
|
*/
|
||||||
|
void PageRegister_page_param2(unsigned char pageID)
|
||||||
|
{
|
||||||
|
Page_Register(pageID, Setup, Loop, Exit, Event);
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "by_tiny_frame_parse.h"
|
#include "by_tiny_frame_parse.h"
|
||||||
#include "by_tiny_frame_pack.h"
|
#include "by_tiny_frame_pack.h"
|
||||||
|
|
||||||
|
#include "jj_param.h"
|
||||||
|
|
||||||
void by_tiny_frame_read_write_run(void)
|
void by_tiny_frame_read_write_run(void)
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
@@ -13,31 +15,31 @@ void by_tiny_frame_read_write_run(void)
|
|||||||
|
|
||||||
void by_tiny_frame_read_write_handle(by_tf_parse_frame_t frame_s, uint8_t status)
|
void by_tiny_frame_read_write_handle(by_tf_parse_frame_t frame_s, uint8_t status)
|
||||||
{
|
{
|
||||||
by_tf_pack_frame_t frame_pack_s;
|
// by_tf_pack_frame_t frame_pack_s;
|
||||||
|
|
||||||
frame_pack_s.slave_id = BY_TF_DEVICE_SLAVE_ADDRESS;
|
// frame_pack_s.slave_id = BY_TF_DEVICE_SLAVE_ADDRESS;
|
||||||
frame_pack_s.cmd = frame_s.cmd;
|
// frame_pack_s.cmd = frame_s.cmd;
|
||||||
frame_pack_s.reg_addr = frame_s.reg_addr;
|
// frame_pack_s.reg_addr = frame_s.reg_addr;
|
||||||
|
|
||||||
if (status) {
|
// if (status) {
|
||||||
// 接收出错,一般为 CRC 校验错误
|
// // 接收出错,一般为 CRC 校验错误
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
switch (frame_s.cmd) {
|
// switch (frame_s.cmd) {
|
||||||
case 0x03:
|
// case 0x03:
|
||||||
// 添加查询接口,操作完成后应答
|
// // 添加查询接口,操作完成后应答,主机接收,即读取
|
||||||
frame_pack_s.data = 0XFFFFFFFF; // 示例
|
// frame_pack_s.data =(uint32_t)(addre[frame_pack_s.reg_addr]);
|
||||||
by_tiny_frame_pack_send(&frame_pack_s);
|
// by_tiny_frame_pack_send(&frame_pack_s);
|
||||||
break;
|
// break;
|
||||||
case 0x06:
|
// case 0x06:
|
||||||
// 添加写入接口,操作完成后应答
|
// // 添加写入接口,操作完成后应答,主机发送,即写入
|
||||||
frame_pack_s.data = frame_s.data;
|
// *addre[frame_pack_s.reg_addr] = frame_pack_s.data;
|
||||||
by_tiny_frame_pack_send(&frame_pack_s);
|
// by_tiny_frame_pack_send(&frame_pack_s);
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
|
||||||
#if (BY_TF_DEBUG)
|
#if (BY_TF_DEBUG)
|
||||||
printf("****** EXECUTE CMD SUCCESSFUL ******\r\n");
|
printf("****** EXECUTE CMD SUCCESSFUL ******\r\n");
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
//====================================================软件 IIC 驱动====================================================
|
//====================================================软件 IIC 驱动====================================================
|
||||||
#define K24C02_SOFT_IIC_DELAY (500) // 软件 IIC 的时钟延时周期 数值越小 IIC 通信速率越快
|
#define K24C02_SOFT_IIC_DELAY (500) // 软件 IIC 的时钟延时周期 数值越小 IIC 通信速率越快
|
||||||
#define K24C02_SCL_PIN (D13) // 软件 IIC SCL 引脚 连接 K24C02 的 SCL 引脚
|
#define K24C02_SCL_PIN (D13) // 软件 IIC SCL 引脚 连接 K24C02 的 SCL 引脚
|
||||||
#define K24C02_SDA_PIN (D14) // 软件 IIC SDA 引脚 连接 K24C02 的 SDA 引脚
|
#define K24C02_SDA_PIN (D12) // 软件 IIC SDA 引脚 连接 K24C02 的 SDA 引脚
|
||||||
//====================================================软件 IIC 驱动====================================================
|
//====================================================软件 IIC 驱动====================================================
|
||||||
#else
|
#else
|
||||||
//====================================================硬件 IIC 驱动====================================================
|
//====================================================硬件 IIC 驱动====================================================
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
#define MT9V03X_IMAGE_SIZE ( MT9V03X_W * MT9V03X_H ) // 整体图像大小不能超过 65535
|
#define MT9V03X_IMAGE_SIZE ( MT9V03X_W * MT9V03X_H ) // 整体图像大小不能超过 65535
|
||||||
#define MT9V03X_COF_BUFFER_SIZE ( 64 ) // 配置串口缓冲区大小 不低于 64
|
#define MT9V03X_COF_BUFFER_SIZE ( 64 ) // 配置串口缓冲区大小 不低于 64
|
||||||
|
|
||||||
#define MT9V03X_AUTO_EXP_DEF (0 ) // 自动曝光设置 默认不开启自动曝光设置 范围 [0-63] 0 为关闭
|
#define MT9V03X_AUTO_EXP_DEF (0 ) // 自动曝光设置 默认不开启自动曝光设置 范围 [0-63] 0 为关闭
|
||||||
// 如果自动曝光开启 EXP_TIME 命令设置自动曝光时间的上限
|
// 如果自动曝光开启 EXP_TIME 命令设置自动曝光时间的上限
|
||||||
// 一般情况是不需要开启自动曝光设置 如果遇到光线非常不均匀的情况可以尝试设置自动曝光,增加图像稳定性
|
// 一般情况是不需要开启自动曝光设置 如果遇到光线非常不均匀的情况可以尝试设置自动曝光,增加图像稳定性
|
||||||
#define MT9V03X_EXP_TIME_DEF (512) // 曝光时间 摄像头收到后会自动计算出最大曝光时间,如果设置过大则设置为计算出来的最大曝光值
|
#define MT9V03X_EXP_TIME_DEF (512) // 曝光时间 摄像头收到后会自动计算出最大曝光时间,如果设置过大则设置为计算出来的最大曝光值
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
// 摄像头收偏移数据后会自动计算最大偏移,如果超出则设置计算出来的最大偏移
|
// 摄像头收偏移数据后会自动计算最大偏移,如果超出则设置计算出来的最大偏移
|
||||||
#define MT9V03X_UD_OFFSET_DEF (0 ) // 图像上下偏移量 正值 上偏移 负值 下偏移 行为 120 240 480 时无法设置偏移
|
#define MT9V03X_UD_OFFSET_DEF (0 ) // 图像上下偏移量 正值 上偏移 负值 下偏移 行为 120 240 480 时无法设置偏移
|
||||||
// 摄像头收偏移数据后会自动计算最大偏移,如果超出则设置计算出来的最大偏移
|
// 摄像头收偏移数据后会自动计算最大偏移,如果超出则设置计算出来的最大偏移
|
||||||
#define MT9V03X_GAIN_DEF (32 ) // 图像增益 范围 [16-64] 增益可以在曝光时间固定的情况下改变图像亮暗程度
|
#define MT9V03X_GAIN_DEF (64 ) // 图像增益 范围 [16-64] 增益可以在曝光时间固定的情况下改变图像亮暗程度
|
||||||
#define MT9V03X_PCLK_MODE_DEF (1 ) // 像素时钟模式 范围 [0-1] 默认:0 可选参数为:[0:不输出消隐信号,1:输出消隐信号]
|
#define MT9V03X_PCLK_MODE_DEF (1 ) // 像素时钟模式 范围 [0-1] 默认:0 可选参数为:[0:不输出消隐信号,1:输出消隐信号]
|
||||||
// 通常都设置为 0,如果使用 CH32V307 的 DVP 接口或 STM32 的 DCMI 接口采集需要设置为 1
|
// 通常都设置为 0,如果使用 CH32V307 的 DVP 接口或 STM32 的 DCMI 接口采集需要设置为 1
|
||||||
// 仅总钻风 MT9V034 V1.5 以及以上版本支持该命令
|
// 仅总钻风 MT9V034 V1.5 以及以上版本支持该命令
|
||||||
|
|||||||
@@ -709,3 +709,33 @@ void soft_iic_init (soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay
|
|||||||
gpio_init(scl_pin, GPO, GPIO_HIGH, GPO_PUSH_PULL); // 提取对应IO索引 AF功能编码
|
gpio_init(scl_pin, GPO, GPIO_HIGH, GPO_PUSH_PULL); // 提取对应IO索引 AF功能编码
|
||||||
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // 提取对应IO索引 AF功能编码
|
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // 提取对应IO索引 AF功能编码
|
||||||
}
|
}
|
||||||
|
void eep_soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, uint8 *data, uint32 len)
|
||||||
|
{
|
||||||
|
zf_assert(soft_iic_obj != NULL);
|
||||||
|
zf_assert(data != NULL);
|
||||||
|
soft_iic_start(soft_iic_obj);
|
||||||
|
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||||
|
soft_iic_send_data(soft_iic_obj, register_name_h);
|
||||||
|
soft_iic_send_data(soft_iic_obj, register_name_l);
|
||||||
|
soft_iic_start(soft_iic_obj);
|
||||||
|
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1 | 0x01);
|
||||||
|
while(len --)
|
||||||
|
{
|
||||||
|
*data ++ = soft_iic_read_data(soft_iic_obj, len == 0);
|
||||||
|
}
|
||||||
|
soft_iic_stop(soft_iic_obj);
|
||||||
|
}
|
||||||
|
void eep_soft_iic_write_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h,const uint8 register_name_l, const uint8 *data, uint32 len)
|
||||||
|
{
|
||||||
|
zf_assert(soft_iic_obj != NULL);
|
||||||
|
zf_assert(data != NULL);
|
||||||
|
soft_iic_start(soft_iic_obj);
|
||||||
|
soft_iic_send_data(soft_iic_obj, soft_iic_obj->addr << 1);
|
||||||
|
soft_iic_send_data(soft_iic_obj, register_name_h);
|
||||||
|
soft_iic_send_data(soft_iic_obj, register_name_l);
|
||||||
|
while(len --)
|
||||||
|
{
|
||||||
|
soft_iic_send_data(soft_iic_obj, *data ++);
|
||||||
|
}
|
||||||
|
soft_iic_stop(soft_iic_obj);
|
||||||
|
}
|
||||||
@@ -1,83 +1,83 @@
|
|||||||
/*********************************************************************************************************************
|
/*********************************************************************************************************************
|
||||||
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
||||||
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
||||||
*
|
*
|
||||||
* 本文件是CH32V307VCT6 开源库的一部分
|
* 本文件是CH32V307VCT6 开源库的一部分
|
||||||
*
|
*
|
||||||
* CH32V307VCT6 开源库 是免费软件
|
* CH32V307VCT6 开源库 是免费软件
|
||||||
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
|
||||||
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
||||||
*
|
*
|
||||||
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
||||||
* 甚至没有隐含的适销性或适合特定用途的保证
|
* 甚至没有隐含的适销性或适合特定用途的保证
|
||||||
* 更多细节请参见 GPL
|
* 更多细节请参见 GPL
|
||||||
*
|
*
|
||||||
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
||||||
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* 额外注明:
|
* 额外注明:
|
||||||
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
||||||
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
||||||
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
||||||
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
||||||
*
|
*
|
||||||
* 文件名称 zf_driver_soft_iic
|
* 文件名称 zf_driver_soft_iic
|
||||||
* 公司名称 成都逐飞科技有限公司
|
* 公司名称 成都逐飞科技有限公司
|
||||||
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
|
||||||
* 开发环境 MounRiver Studio V1.8.1
|
* 开发环境 MounRiver Studio V1.8.1
|
||||||
* 适用平台 CH32V307VCT6
|
* 适用平台 CH32V307VCT6
|
||||||
* 店铺链接 https://seekfree.taobao.com/
|
* 店铺链接 https://seekfree.taobao.com/
|
||||||
*
|
*
|
||||||
* 修改记录
|
* 修改记录
|
||||||
* 日期 作者 备注
|
* 日期 作者 备注
|
||||||
* 2022-09-15 大W first version
|
* 2022-09-15 大W first version
|
||||||
********************************************************************************************************************/
|
********************************************************************************************************************/
|
||||||
|
|
||||||
#ifndef _zf_driver_soft_iic_h_
|
#ifndef _zf_driver_soft_iic_h_
|
||||||
#define _zf_driver_soft_iic_h_
|
#define _zf_driver_soft_iic_h_
|
||||||
|
|
||||||
|
|
||||||
#include "zf_driver_gpio.h"
|
#include "zf_driver_gpio.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
gpio_pin_enum scl_pin; // 用于记录对应的引脚编号
|
gpio_pin_enum scl_pin; // 用于记录对应的引脚编号
|
||||||
gpio_pin_enum sda_pin; // 用于记录对应的引脚编号
|
gpio_pin_enum sda_pin; // 用于记录对应的引脚编号
|
||||||
uint8 addr; // 器件地址 七位地址模式
|
uint8 addr; // 器件地址 七位地址模式
|
||||||
uint32 delay; // 模拟 IIC 软延时时长
|
uint32 delay; // 模拟 IIC 软延时时长
|
||||||
}soft_iic_info_struct;
|
} soft_iic_info_struct;
|
||||||
|
|
||||||
void soft_iic_write_8bit (soft_iic_info_struct *soft_iic_obj, const uint8 data);
|
void soft_iic_write_8bit(soft_iic_info_struct *soft_iic_obj, const uint8 data);
|
||||||
void soft_iic_write_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len);
|
void soft_iic_write_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *data, uint32 len);
|
||||||
|
|
||||||
void soft_iic_write_16bit (soft_iic_info_struct *soft_iic_obj, const uint16 data);
|
void soft_iic_write_16bit(soft_iic_info_struct *soft_iic_obj, const uint16 data);
|
||||||
void soft_iic_write_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len);
|
void soft_iic_write_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *data, uint32 len);
|
||||||
|
|
||||||
void soft_iic_write_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data);
|
void soft_iic_write_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 data);
|
||||||
void soft_iic_write_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len);
|
void soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, const uint8 *data, uint32 len);
|
||||||
|
|
||||||
void soft_iic_write_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data);
|
void soft_iic_write_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 data);
|
||||||
void soft_iic_write_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len);
|
void soft_iic_write_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, const uint16 *data, uint32 len);
|
||||||
|
|
||||||
uint8 soft_iic_read_8bit (soft_iic_info_struct *soft_iic_obj);
|
uint8 soft_iic_read_8bit(soft_iic_info_struct *soft_iic_obj);
|
||||||
void soft_iic_read_8bit_array (soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len);
|
void soft_iic_read_8bit_array(soft_iic_info_struct *soft_iic_obj, uint8 *data, uint32 len);
|
||||||
|
|
||||||
uint16 soft_iic_read_16bit (soft_iic_info_struct *soft_iic_obj);
|
uint16 soft_iic_read_16bit(soft_iic_info_struct *soft_iic_obj);
|
||||||
void soft_iic_read_16bit_array (soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len);
|
void soft_iic_read_16bit_array(soft_iic_info_struct *soft_iic_obj, uint16 *data, uint32 len);
|
||||||
|
|
||||||
uint8 soft_iic_read_8bit_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
uint8 soft_iic_read_8bit_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||||
void soft_iic_read_8bit_registers (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len);
|
void soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 *data, uint32 len);
|
||||||
|
|
||||||
uint16 soft_iic_read_16bit_register (soft_iic_info_struct *soft_iic_obj, const uint16 register_name);
|
uint16 soft_iic_read_16bit_register(soft_iic_info_struct *soft_iic_obj, const uint16 register_name);
|
||||||
void soft_iic_read_16bit_registers (soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len);
|
void soft_iic_read_16bit_registers(soft_iic_info_struct *soft_iic_obj, const uint16 register_name, uint16 *data, uint32 len);
|
||||||
|
|
||||||
void soft_iic_transfer_8bit_array (soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len);
|
void soft_iic_transfer_8bit_array(soft_iic_info_struct *soft_iic_obj, const uint8 *write_data, uint32 write_len, uint8 *read_data, uint32 read_len);
|
||||||
void soft_iic_transfer_16bit_array (soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len);
|
void soft_iic_transfer_16bit_array(soft_iic_info_struct *soft_iic_obj, const uint16 *write_data, uint32 write_len, uint16 *read_data, uint32 read_len);
|
||||||
|
|
||||||
void soft_iic_sccb_write_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data);
|
void soft_iic_sccb_write_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name, uint8 data);
|
||||||
uint8 soft_iic_sccb_read_register (soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
uint8 soft_iic_sccb_read_register(soft_iic_info_struct *soft_iic_obj, const uint8 register_name);
|
||||||
|
|
||||||
void soft_iic_init (soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin);
|
void soft_iic_init(soft_iic_info_struct *soft_iic_obj, uint8 addr, uint32 delay, gpio_pin_enum scl_pin, gpio_pin_enum sda_pin);
|
||||||
|
|
||||||
|
void eep_soft_iic_write_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, const uint8 *data, uint32 len);
|
||||||
|
void eep_soft_iic_read_8bit_registers(soft_iic_info_struct *soft_iic_obj, const uint8 register_name_h, const uint8 register_name_l, uint8 *data, uint32 len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user