more CLS device info
This commit is contained in:
@@ -26,3 +26,20 @@ HAL_StatusTypeDef CLS_BSP_CAN_SetUniversalFilter(const CLS_BSP_CAN_UniversalFilt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLS_Type_t CLS_BSP_GetDeviceType(void) {
|
||||||
|
return CLS_TYPE_MASTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CLS_BSP_SetDeviceType(CLS_Type_t type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
CLS_Position_t CLS_BSP_GetPosition(void) {
|
||||||
|
CLS_Position_t position;
|
||||||
|
position.p0 = CLS_POSITION_FRONT;
|
||||||
|
position.p1 = CLS_POSITION_CENTER;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLS_BSP_SetPosition(CLS_Position_t position) {
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifdef CLS_BSP_FDCAN
|
#ifdef CLS_BSP_FDCAN
|
||||||
|
|
||||||
#include "fdcan.h"
|
#include "fdcan.h"
|
||||||
|
#include "CLS.h"
|
||||||
|
|
||||||
typedef FDCAN_TxHeaderTypeDef CLS_BSP_TxHeaderType;
|
typedef FDCAN_TxHeaderTypeDef CLS_BSP_TxHeaderType;
|
||||||
|
|
||||||
@@ -50,4 +51,10 @@ typedef struct {
|
|||||||
|
|
||||||
HAL_StatusTypeDef CLS_BSP_CAN_AddMessageToSend(CLS_BSP_TxHeaderType * header, uint8_t * data);
|
HAL_StatusTypeDef CLS_BSP_CAN_AddMessageToSend(CLS_BSP_TxHeaderType * header, uint8_t * data);
|
||||||
|
|
||||||
HAL_StatusTypeDef CLS_BSP_CAN_SetUniversalFilter(const CLS_BSP_CAN_UniversalFilter * filter);
|
HAL_StatusTypeDef CLS_BSP_CAN_SetUniversalFilter(const CLS_BSP_CAN_UniversalFilter * filter);
|
||||||
|
|
||||||
|
CLS_Type_t CLS_BSP_GetDeviceType(void);
|
||||||
|
void CLS_BSP_SetDeviceType(CLS_Type_t type);
|
||||||
|
|
||||||
|
CLS_Position_t CLS_BSP_GetPosition(void);
|
||||||
|
void CLS_BSP_SetPosition(CLS_Position_t position);
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ target_sources(${PROJECT_NAME}
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/CLS_BSP.h
|
${CMAKE_CURRENT_LIST_DIR}/CLS_BSP.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE CLS)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
add_subdirectory(Tasks)
|
add_subdirectory(Tasks)
|
||||||
add_subdirectory(CLS_BSP)
|
|
||||||
add_subdirectory(CLS)
|
add_subdirectory(CLS)
|
||||||
|
add_subdirectory(CLS_BSP)
|
||||||
add_subdirectory(BSP)
|
add_subdirectory(BSP)
|
||||||
@@ -20,4 +20,4 @@ target_sources(${PROJECT_NAME}
|
|||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC PROTOS CLS)
|
target_link_libraries(${PROJECT_NAME} PUBLIC PROTOS CLS)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE CLS_BSP BSP)
|
target_link_libraries(${PROJECT_NAME} PRIVATE Revision CLS_BSP BSP)
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "firmware.pb.h"
|
#include "firmware.pb.h"
|
||||||
#include "cls_device.pb.h"
|
#include "cls_device.pb.h"
|
||||||
#include "usb.pb.h"
|
#include "usb.pb.h"
|
||||||
|
#include "version_info.h"
|
||||||
// Define thread flags
|
// Define thread flags
|
||||||
#define FLAG_FDCAN_RX_FIFO0 (1<<0)
|
#define FLAG_FDCAN_RX_FIFO0 (1<<0)
|
||||||
#define FLAG_FDCAN_RX_FIFO1 (1<<1)
|
#define FLAG_FDCAN_RX_FIFO1 (1<<1)
|
||||||
@@ -133,22 +133,43 @@ extern uint8_t gCLS_DEVICE_ADDRESS;
|
|||||||
void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
||||||
memset(&list,0,sizeof(list));
|
memset(&list,0,sizeof(list));
|
||||||
// add yourself
|
// add yourself
|
||||||
|
|
||||||
|
CLS_Position_t position = CLS_BSP_GetPosition();
|
||||||
|
CLS_Type_t type = CLS_BSP_GetDeviceType();
|
||||||
|
uint32_t fw32 = (VERSION_INFO.major<<24) +(VERSION_INFO.minor<<16) + (VERSION_INFO.patch<<8) +VERSION_INFO.count ;
|
||||||
|
uint16_t pos16 = (position.p1<< 4) + position.p0;
|
||||||
|
uint16_t type16 = type;
|
||||||
|
|
||||||
list.devices[list.devices_count].available = true;
|
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].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS, CLS_CH_STA_HEATBEAT);
|
||||||
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS;
|
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS;
|
||||||
list.devices[list.devices_count].counter = (osKernelGetTickCount()/500)%256;
|
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
|
||||||
|
list.devices[list.devices_count].fw_version = fw32;
|
||||||
|
|
||||||
list.devices_count++;
|
list.devices_count++;
|
||||||
|
|
||||||
for (size_t i = 0; i < 16; i++)
|
for (size_t i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
uint16_t canid = (GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, i, CLS_CH_STA_HEATBEAT));
|
uint16_t canid = (GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, i, CLS_CH_STA_HEATBEAT));
|
||||||
const CanDataMessage * msg =CanData_getDataMessage(canid);
|
const CanDataMessage * msg =CanData_getDataMessage(canid);
|
||||||
|
|
||||||
if(msg) {
|
if(msg) {
|
||||||
if(msg->data_length > 0) {
|
if(msg->data_length > 0) {
|
||||||
|
|
||||||
|
CLS_HeatbeatData_t data = {0};
|
||||||
|
memcpy(&data, msg->data, msg->data_length);
|
||||||
|
|
||||||
|
CLS_Position_t position = data.position;
|
||||||
|
CLS_Type_t type = data.type;
|
||||||
|
uint32_t fw32 = (data.firmware_version.major<<24) +(data.firmware_version.minor<<16) + (data.firmware_version.patch<<8) +data.firmware_version.count ;
|
||||||
|
uint16_t pos16 = (position.p1<< 4) + position.p0;
|
||||||
|
uint16_t type16 = type;
|
||||||
|
|
||||||
list.devices[list.devices_count].available = true;
|
list.devices[list.devices_count].available = true;
|
||||||
list.devices[list.devices_count].canid = canid;
|
list.devices[list.devices_count].canid = canid;
|
||||||
list.devices[list.devices_count].device = i;
|
list.devices[list.devices_count].device = i;
|
||||||
list.devices[list.devices_count].counter = msg->data[0];
|
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
|
||||||
|
list.devices[list.devices_count].fw_version = fw32;
|
||||||
list.devices_count++;
|
list.devices_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ include_directories(
|
|||||||
$<$<COMPILE_LANGUAGE:ASM>: ${include_asm_DIRS}>
|
$<$<COMPILE_LANGUAGE:ASM>: ${include_asm_DIRS}>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_subdirectory("Revision")
|
||||||
add_subdirectory("lib")
|
add_subdirectory("lib")
|
||||||
add_subdirectory("Application")
|
add_subdirectory("Application")
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ SECTIONS
|
|||||||
_edata = .; /* define a global symbol at data end */
|
_edata = .; /* define a global symbol at data end */
|
||||||
} >RAM_D1 AT> FLASH
|
} >RAM_D1 AT> FLASH
|
||||||
|
|
||||||
|
.version :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sversion = .; /* create a global symbol at data start */
|
||||||
|
*(.version) /* .data sections */
|
||||||
|
*(.version*) /* .data* sections */
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
|
||||||
/* Uninitialized data section */
|
/* Uninitialized data section */
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.bss :
|
.bss :
|
||||||
|
|||||||
2
proto
2
proto
Submodule proto updated: 3937207744...e4c5d99604
Reference in New Issue
Block a user