added display messages
This commit is contained in:
@@ -13,6 +13,7 @@ target_sources(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_LIST_DIR}/LightTask.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/LightState.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/Headlight_can.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/DisplayComm.c
|
||||
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/UsbDataHandler.h
|
||||
@@ -24,4 +25,4 @@ target_sources(${PROJECT_NAME}
|
||||
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC PROTOS CLS)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Revision CLS_BSP BSP ulog Vehicle ram_loader)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Revision CLS_BSP BSP ulog Vehicle ram_loader mlzr_comm TinyFrame)
|
||||
@@ -318,10 +318,9 @@ extern uint8_t gCLS_DEVICE_ADDRESS;
|
||||
void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
||||
memset(&list,0,sizeof(list));
|
||||
// add yourself
|
||||
|
||||
CLS_Position_t position = CLS_BSP_GetPosition();
|
||||
CLS_Type_t type = CLS_BSP_GetDeviceType();
|
||||
|
||||
|
||||
list.devices[list.devices_count].available = true;
|
||||
list.devices[list.devices_count].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS, CLS_CH_STA_HEATBEAT);
|
||||
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS;
|
||||
@@ -333,7 +332,21 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
||||
list.devices[list.devices_count].fw_version[1] = VERSION_INFO.patch;
|
||||
list.devices[list.devices_count].fw_version[2] = VERSION_INFO.minor;
|
||||
list.devices[list.devices_count].fw_version[3] = VERSION_INFO.major;
|
||||
|
||||
list.devices_count++;
|
||||
|
||||
//add display
|
||||
list.devices[list.devices_count].available = true;
|
||||
list.devices[list.devices_count].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS+1, CLS_CH_STA_HEATBEAT);
|
||||
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS+1;
|
||||
list.devices[list.devices_count].type = cls_device_Type_DISPLAY; // enum to uint
|
||||
list.devices[list.devices_count].position[0] = position.p0;
|
||||
list.devices[list.devices_count].position[1] = position.p1;
|
||||
list.devices[list.devices_count].position_count = 2;
|
||||
list.devices[list.devices_count].fw_version[0] = 0;
|
||||
list.devices[list.devices_count].fw_version[1] = 0;
|
||||
list.devices[list.devices_count].fw_version[2] = 0;
|
||||
list.devices[list.devices_count].fw_version[3] = 0;
|
||||
|
||||
list.devices_count++;
|
||||
|
||||
for (size_t i = 0; i < 16; i++)
|
||||
|
||||
16
Application/Tasks/DisplayComm.c
Normal file
16
Application/Tasks/DisplayComm.c
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "UsbDataHandler.h"
|
||||
#include "stdint.h"
|
||||
#include "mlzr_comm.h"
|
||||
#include "pb_decode.h"
|
||||
#include "display.pb.h"
|
||||
|
||||
static cls_display_SetLayout msg_cls_display_SetLayout;
|
||||
|
||||
|
||||
void DataClbk_cls_display_SetLayout(void* msg, uint32_t length) {
|
||||
DATA_CLBK_SETUP(cls_display_SetLayout);
|
||||
uint8_t num = (uint8_t)msg_cls_display_SetLayout.layout;
|
||||
TF_SendSimple(tf_fallback,0x0F, &num, sizeof(num));
|
||||
}
|
||||
@@ -156,8 +156,13 @@ void DataClbk_cls_firmware_Done(void *msg, uint32_t length) {
|
||||
|
||||
if(msg_cls_firmware_Done.device_id == gCLS_DEVICE_ADDRESS) {
|
||||
RamLoader_LoadApplication();
|
||||
} else {
|
||||
} else if (msg_cls_firmware_Done.device_id == gCLS_DEVICE_ADDRESS +1) {
|
||||
// send fw to display
|
||||
// todo !
|
||||
|
||||
} {
|
||||
|
||||
// send fw to slave
|
||||
FirmwareUpdateArgs args;
|
||||
args.device = msg_cls_firmware_Done.device_id;
|
||||
memcpy(args.name, msg_cls_firmware_Start.name, sizeof(args.name));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <pb_decode.h>
|
||||
#include "cls_device.pb.h"
|
||||
#include "usb.pb.h"
|
||||
#include "display.pb.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
/* Declare the thread function */
|
||||
@@ -67,6 +68,7 @@ union {
|
||||
cls_headlight_SaveSettings msg_cls_headlight_SaveSettings;
|
||||
cls_headlight_RequestSettings msg_cls_headlight_RequestSettings;
|
||||
cls_headlight_RequestBrightness msg_cls_headlight_RequestBrightness;
|
||||
cls_display_SetLayout msg_cls_display_SetLayout;
|
||||
} mem_msg_decode;
|
||||
|
||||
|
||||
@@ -129,6 +131,7 @@ message_handler_t message_handlers[] = {
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_SAVE_SETTINGS, cls_headlight_SaveSettings),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_REQUEST_SETTINGS, cls_headlight_RequestSettings),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_HEADLIGHT_REQUEST_BRIGHTNESS, cls_headlight_RequestBrightness),
|
||||
MESSAGE_HANDLER(cls_usb_PackageType_DISPLAY_SET_LAYOUT, cls_display_SetLayout),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ void DataClbk_cls_headlight_Settings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_SaveSettings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_RequestSettings(void* msg, uint32_t length);
|
||||
void DataClbk_cls_headlight_RequestBrightness(void* msg, uint32_t length);
|
||||
void DataClbk_cls_display_SetLayout(void* msg, uint32_t length);
|
||||
|
||||
#include "usb.pb.h"
|
||||
void USBDataResonse(void * msg, const pb_msgdesc_t *fields, cls_usb_PackageType typeid);
|
||||
|
||||
Reference in New Issue
Block a user