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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,21 +8,32 @@
|
|||||||
* @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
|
||||||
34
app/main.c
34
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 @@
|
|||||||
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
#define K24C02_SOFT_IIC_DELAY (500) // <20><><EFBFBD><EFBFBD> IIC <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> <20><>ֵԽС IIC ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>
|
#define K24C02_SOFT_IIC_DELAY (500) // <20><><EFBFBD><EFBFBD> IIC <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> <20><>ֵԽС IIC ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>
|
||||||
#define K24C02_SCL_PIN (D13) // <20><><EFBFBD><EFBFBD> IIC SCL <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SCL <20><><EFBFBD><EFBFBD>
|
#define K24C02_SCL_PIN (D13) // <20><><EFBFBD><EFBFBD> IIC SCL <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SCL <20><><EFBFBD><EFBFBD>
|
||||||
#define K24C02_SDA_PIN (D14) // <20><><EFBFBD><EFBFBD> IIC SDA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SDA <20><><EFBFBD><EFBFBD>
|
#define K24C02_SDA_PIN (D12) // <20><><EFBFBD><EFBFBD> IIC SDA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SDA <20><><EFBFBD><EFBFBD>
|
||||||
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
#else
|
#else
|
||||||
//====================================================Ӳ<><D3B2> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================Ӳ<><D3B2> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
||||||
#define MT9V03X_UD_OFFSET_DEF (0 ) // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> <20><>ֵ <20><>ƫ<EFBFBD><C6AB> <20><>ֵ <20><>ƫ<EFBFBD><C6AB> <20><>Ϊ 120 240 480 ʱ<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
#define MT9V03X_UD_OFFSET_DEF (0 ) // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD> <20><>ֵ <20><>ƫ<EFBFBD><C6AB> <20><>ֵ <20><>ƫ<EFBFBD><C6AB> <20><>Ϊ 120 240 480 ʱ<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
||||||
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
// <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD><DDBA><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
||||||
#define MT9V03X_GAIN_DEF (32 ) // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Χ [16-64] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸ı<C2B8>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>
|
#define MT9V03X_GAIN_DEF (64 ) // ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Χ [16-64] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸ı<C2B8>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD>
|
||||||
#define MT9V03X_PCLK_MODE_DEF (1 ) // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ģʽ <20><>Χ [0-1] Ĭ<>ϣ<EFBFBD>0 <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>[0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>]
|
#define MT9V03X_PCLK_MODE_DEF (1 ) // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ģʽ <20><>Χ [0-1] Ĭ<>ϣ<EFBFBD>0 <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>[0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>źţ<C5BA>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>]
|
||||||
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> CH32V307 <20><> DVP <20>ӿڻ<D3BF> STM32 <20><> DCMI <20>ӿڲɼ<DAB2><C9BC><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ 1
|
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> CH32V307 <20><> DVP <20>ӿڻ<D3BF> STM32 <20><> DCMI <20>ӿڲɼ<DAB2><C9BC><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ϊ 1
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V034 V1.5 <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ϰ汾֧<E6B1BE>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MT9V034 V1.5 <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ϰ汾֧<E6B1BE>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|||||||
@@ -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); // <20><>ȡ<EFBFBD><C8A1>ӦIO<49><4F><EFBFBD><EFBFBD> AF<41><46><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
gpio_init(scl_pin, GPO, GPIO_HIGH, GPO_PUSH_PULL); // <20><>ȡ<EFBFBD><C8A1>ӦIO<49><4F><EFBFBD><EFBFBD> AF<41><46><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
||||||
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // <20><>ȡ<EFBFBD><C8A1>ӦIO<49><4F><EFBFBD><EFBFBD> AF<41><46><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
gpio_init(sda_pin, GPO, GPIO_HIGH, GPO_OPEN_DTAIN); // <20><>ȡ<EFBFBD><C8A1>ӦIO<49><4F><EFBFBD><EFBFBD> AF<41><46><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
||||||
}
|
}
|
||||||
|
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,42 +1,41 @@
|
|||||||
/*********************************************************************************************************************
|
/*********************************************************************************************************************
|
||||||
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
||||||
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||||
*
|
*
|
||||||
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNUͨ<55>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNUͨ<55>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><> GPL <20>ĵ<EFBFBD>3<EFBFBD>棨<EFBFBD><E6A3A8> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
* <20><> GPL <20>ĵ<EFBFBD>3<EFBFBD>棨<EFBFBD><E6A3A8> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
||||||
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
||||||
* <20><><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> GPL
|
* <20><><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> GPL
|
||||||
*
|
*
|
||||||
* <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ͬʱ<CDAC>յ<EFBFBD>һ<EFBFBD><D2BB> GPL <20>ĸ<EFBFBD><C4B8><EFBFBD>
|
* <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ͬʱ<CDAC>յ<EFBFBD>һ<EFBFBD><D2BB> GPL <20>ĸ<EFBFBD><C4B8><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><https://www.gnu.org/licenses/>
|
* <20><><EFBFBD><EFBFBD>û<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><https://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
|
* <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ʹ<EFBFBD><CAB9> GPL3.0 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>֤Э<D6A4><D0AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>İ汾
|
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ʹ<EFBFBD><CAB9> GPL3.0 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>֤Э<D6A4><D0AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>İ汾
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD> libraries/doc <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD> GPL3_permission_statement.txt <20>ļ<EFBFBD><C4BC><EFBFBD>
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD> libraries/doc <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD> GPL3_permission_statement.txt <20>ļ<EFBFBD><C4BC><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> libraries <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD> LICENSE <20>ļ<EFBFBD>
|
* <20><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> libraries <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD> LICENSE <20>ļ<EFBFBD>
|
||||||
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
*
|
*
|
||||||
* <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> zf_driver_soft_iic
|
* <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> zf_driver_soft_iic
|
||||||
* <20><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD> <20>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD><EFBFBD>˾
|
* <20><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD> <20>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD><EFBFBD>˾
|
||||||
* <20>汾<EFBFBD><E6B1BE>Ϣ <20>鿴 libraries/doc <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> version <20>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
|
* <20>汾<EFBFBD><E6B1BE>Ϣ <20>鿴 libraries/doc <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> version <20>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MounRiver Studio V1.8.1
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MounRiver Studio V1.8.1
|
||||||
* <20><><EFBFBD><EFBFBD>ƽ̨ CH32V307VCT6
|
* <20><><EFBFBD><EFBFBD>ƽ̨ CH32V307VCT6
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> https://seekfree.taobao.com/
|
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> https://seekfree.taobao.com/
|
||||||
*
|
*
|
||||||
* <20>ļ<DEB8>¼
|
* <20>ļ<DEB8>¼
|
||||||
* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ע
|
* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ע
|
||||||
* 2022-09-15 <20><>W first version
|
* 2022-09-15 <20><>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
|
||||||
@@ -45,39 +44,40 @@ typedef struct
|
|||||||
gpio_pin_enum sda_pin; // <20><><EFBFBD>ڼ<EFBFBD>¼<EFBFBD><C2BC>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
gpio_pin_enum sda_pin; // <20><><EFBFBD>ڼ<EFBFBD>¼<EFBFBD><C2BC>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
|
||||||
uint8 addr; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ <20><>λ<EFBFBD><CEBB>ַģʽ
|
uint8 addr; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ <20><>λ<EFBFBD><CEBB>ַģʽ
|
||||||
uint32 delay; // ģ<><C4A3> IIC <20><><EFBFBD><EFBFBD>ʱʱ<CAB1><CAB1>
|
uint32 delay; // ģ<><C4A3> IIC <20><><EFBFBD><EFBFBD>ʱʱ<CAB1><CAB1>
|
||||||
}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