Skip to content

Commit

Permalink
UI added, not tested (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
CuboiLeo authored May 23, 2024
1 parent a064785 commit 72c7fc8
Show file tree
Hide file tree
Showing 32 changed files with 1,207 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"${workspaceFolder}\\src\\devices\\inc",
"${workspaceFolder}\\src\\algo\\inc",
"${workspaceFolder}\\src\\bsp\\inc",
"${workspaceFolder}\\src\\app\\inc"
"${workspaceFolder}\\src\\app\\inc",
"${workspaceFolder}\\src\\ui\\inc"
],
"defines": [
"USE_HAL_DRIVER",
Expand Down
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,20 @@ src/app/src/chassis_task.c \
src/app/src/gimbal_task.c \
src/app/src/launch_task.c \
src/app/src/debug_task.c \
src/app/src/robot.c
src/app/src/robot.c \
src/ui/src/ui_interface.c \
src/ui/src/ui_indicator_0_0.c \
src/ui/src/ui_indicator_0_1.c \
src/ui/src/ui_indicator_0_2.c \
src/ui/src/ui_indicator_0_3.c \
src/ui/src/ui_indicator_0_4.c \
src/ui/src/ui_indicator_0_5.c \
src/ui/src/ui_indicator_0_6.c \
src/ui/src/ui_indicator_0_7.c \
src/ui/src/ui_indicator_0_8.c \
src/ui/src/ui_indicator_0_9.c \
src/ui/src/ui_indicator_0_10.c \
src/ui/src/ui_indicator_1_0.c

# ASM sources
ASM_SOURCES = \
Expand Down Expand Up @@ -209,7 +222,8 @@ C_INCLUDES = \
-Isrc/algo/inc \
-Isrc/devices/inc \
-Isrc/bsp/inc \
-Isrc/app/inc
-Isrc/app/inc \
-Isrc/ui/inc

# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -fdata-sections -ffunction-sections
Expand Down
5 changes: 3 additions & 2 deletions src/app/inc/robot_tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ void Robot_Tasks_UI(void const *argument)
{
portTickType xLastWakeTime;
xLastWakeTime = xTaskGetTickCount();
const TickType_t TimeIncrement = pdMS_TO_TICKS(1);
const TickType_t TimeIncrement = pdMS_TO_TICKS(100);
while (1)
{

ui_update_indicator_0();
ui_update_indicator_1();
vTaskDelayUntil(&xLastWakeTime, TimeIncrement);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/app/src/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "user_math.h"
#include "referee_system.h"
#include "buzzer.h"
#include "ui.h"

extern DJI_Motor_Handle_t *g_yaw;
#define SPIN_TOP_OMEGA (1.0f)
Expand Down Expand Up @@ -49,6 +50,8 @@ void Robot_Init()
CAN_Service_Init();
Referee_System_Init(&huart1);
Jetson_Orin_Init(&huart6);
ui_init_indicator_0();
ui_init_indicator_1();
// Initialize all tasks
Robot_Tasks_Start();
}
Expand Down
82 changes: 82 additions & 0 deletions src/ui/inc/ui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// Created by RM UI Designer
//

#ifndef UI_H
#define UI_H
#ifdef __cplusplus
extern "C" {
#endif

#include "ui_interface.h"

#include "ui_indicator_0_0.h"
#include "ui_indicator_0_1.h"
#include "ui_indicator_0_2.h"
#include "ui_indicator_0_3.h"
#include "ui_indicator_0_4.h"
#include "ui_indicator_0_5.h"
#include "ui_indicator_0_6.h"
#include "ui_indicator_0_7.h"
#include "ui_indicator_0_8.h"
#include "ui_indicator_0_9.h"
#include "ui_indicator_0_10.h"

#define ui_init_indicator_0() \
_ui_init_indicator_0_0(); \
_ui_init_indicator_0_1(); \
_ui_init_indicator_0_2(); \
_ui_init_indicator_0_3(); \
_ui_init_indicator_0_4(); \
_ui_init_indicator_0_5(); \
_ui_init_indicator_0_6(); \
_ui_init_indicator_0_7(); \
_ui_init_indicator_0_8(); \
_ui_init_indicator_0_9(); \
_ui_init_indicator_0_10()

#define ui_update_indicator_0() \
_ui_update_indicator_0_0(); \
_ui_update_indicator_0_1(); \
_ui_update_indicator_0_2(); \
_ui_update_indicator_0_3(); \
_ui_update_indicator_0_4(); \
_ui_update_indicator_0_5(); \
_ui_update_indicator_0_6(); \
_ui_update_indicator_0_7(); \
_ui_update_indicator_0_8(); \
_ui_update_indicator_0_9(); \
_ui_update_indicator_0_10()

#define ui_remove_indicator_0() \
_ui_remove_indicator_0_0(); \
_ui_remove_indicator_0_1(); \
_ui_remove_indicator_0_2(); \
_ui_remove_indicator_0_3(); \
_ui_remove_indicator_0_4(); \
_ui_remove_indicator_0_5(); \
_ui_remove_indicator_0_6(); \
_ui_remove_indicator_0_7(); \
_ui_remove_indicator_0_8(); \
_ui_remove_indicator_0_9(); \
_ui_remove_indicator_0_10()


#include "ui_indicator_1_0.h"

#define ui_init_indicator_1() \
_ui_init_indicator_1_0()

#define ui_update_indicator_1() \
_ui_update_indicator_1_0()

#define ui_remove_indicator_1() \
_ui_remove_indicator_1_0()



#ifdef __cplusplus
}
#endif

#endif //UI_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_0_H
#define UI_indicator_0_0_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Flywheel_Text;

void _ui_init_indicator_0_0();
void _ui_update_indicator_0_0();
void _ui_remove_indicator_0_0();

#endif //UI_indicator_0_0_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_1_H
#define UI_indicator_0_1_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Spintop_Text;

void _ui_init_indicator_0_1();
void _ui_update_indicator_0_1();
void _ui_remove_indicator_0_1();

#endif //UI_indicator_0_1_H
20 changes: 20 additions & 0 deletions src/ui/inc/ui_indicator_0_10.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_10_H
#define UI_indicator_0_10_H

#include "ui_interface.h"

extern ui_interface_round_t *ui_indicator_0_Aim_Circle;
extern ui_interface_line_t *ui_indicator_0_Aim_V_Line;
extern ui_interface_line_t *ui_indicator_0_Aim_H_Line;
extern ui_interface_line_t *ui_indicator_0_Pathway_Left;
extern ui_interface_line_t *ui_indicator_0_Pathway_Right;

void _ui_init_indicator_0_10();
void _ui_update_indicator_0_10();
void _ui_remove_indicator_0_10();

#endif //UI_indicator_0_10_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_2_H
#define UI_indicator_0_2_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Autoaim_Text;

void _ui_init_indicator_0_2();
void _ui_update_indicator_0_2();
void _ui_remove_indicator_0_2();

#endif //UI_indicator_0_2_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_3_H
#define UI_indicator_0_3_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Flywheel_On;

void _ui_init_indicator_0_3();
void _ui_update_indicator_0_3();
void _ui_remove_indicator_0_3();

#endif //UI_indicator_0_3_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_4.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_4_H
#define UI_indicator_0_4_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Flywheel_Off;

void _ui_init_indicator_0_4();
void _ui_update_indicator_0_4();
void _ui_remove_indicator_0_4();

#endif //UI_indicator_0_4_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_5.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_5_H
#define UI_indicator_0_5_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Spintop_On;

void _ui_init_indicator_0_5();
void _ui_update_indicator_0_5();
void _ui_remove_indicator_0_5();

#endif //UI_indicator_0_5_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_6.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_6_H
#define UI_indicator_0_6_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Spintop_Off;

void _ui_init_indicator_0_6();
void _ui_update_indicator_0_6();
void _ui_remove_indicator_0_6();

#endif //UI_indicator_0_6_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_7.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_7_H
#define UI_indicator_0_7_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Autoaim_On;

void _ui_init_indicator_0_7();
void _ui_update_indicator_0_7();
void _ui_remove_indicator_0_7();

#endif //UI_indicator_0_7_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_8.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_8_H
#define UI_indicator_0_8_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Autoaim_Off;

void _ui_init_indicator_0_8();
void _ui_update_indicator_0_8();
void _ui_remove_indicator_0_8();

#endif //UI_indicator_0_8_H
16 changes: 16 additions & 0 deletions src/ui/inc/ui_indicator_0_9.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_0_9_H
#define UI_indicator_0_9_H

#include "ui_interface.h"

extern ui_interface_string_t *ui_indicator_0_Supercap_Percent;

void _ui_init_indicator_0_9();
void _ui_update_indicator_0_9();
void _ui_remove_indicator_0_9();

#endif //UI_indicator_0_9_H
19 changes: 19 additions & 0 deletions src/ui/inc/ui_indicator_1_0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// Created by RM UI Designer
//

#ifndef UI_indicator_1_0_H
#define UI_indicator_1_0_H

#include "ui_interface.h"

extern ui_interface_rect_t *ui_indicator_1_Flywheel_Select;
extern ui_interface_rect_t *ui_indicator_1_Spintop_Select;
extern ui_interface_rect_t *ui_indicator_1_Autoaim_Select;
extern ui_interface_number_t *ui_indicator_1_Supercap;

void _ui_init_indicator_1_0();
void _ui_update_indicator_1_0();
void _ui_remove_indicator_1_0();

#endif //UI_indicator_1_0_H
23 changes: 23 additions & 0 deletions src/ui/inc/ui_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Created by bismarckkk on 2024/2/17.
//

#ifndef SERIAL_TEST_UI_INTERFACE_H
#define SERIAL_TEST_UI_INTERFACE_H

#include <stdio.h>
#include "ui_types.h"

extern int ui_self_id;

void print_message(const uint8_t* message, int length);

#define SEND_MESSAGE(message, length) print_message(message, length)

void ui_proc_1_frame(ui_1_frame_t *msg);
void ui_proc_2_frame(ui_2_frame_t *msg);
void ui_proc_5_frame(ui_5_frame_t *msg);
void ui_proc_7_frame(ui_7_frame_t *msg);
void ui_proc_string_frame(ui_string_frame_t *msg);

#endif //SERIAL_TEST_UI_INTERFACE_H
Loading

0 comments on commit 72c7fc8

Please sign in to comment.