Skip to content

Commit

Permalink
Merge pull request #41 from xrobot-org/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jiu-xiao authored Dec 27, 2023
2 parents 648c572 + a286993 commit 5fda58a
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 8 deletions.
1 change: 0 additions & 1 deletion hw/bsp/dual_canfd/drivers/bsp_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern "C" {

typedef enum {
BSP_USB_CDC,
BSP_GPIO_LED,
/* BSP_USB_XXX, */
BSP_USB_NUM,
BSP_USB_ERR,
Expand Down
1 change: 0 additions & 1 deletion hw/bsp/f103_can/drivers/bsp_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ extern "C" {

typedef enum {
BSP_USB_CDC,
BSP_GPIO_LED,
/* BSP_USB_XXX, */
BSP_USB_NUM,
BSP_USB_ERR,
Expand Down
2 changes: 0 additions & 2 deletions hw/bsp/f103_can/drivers/hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ project(hal)

add_compile_options(-w)

add_compile_definitions(USE_FULL_ASSERT)

file(GLOB ${PROJECT_NAME}_SOURCES_MX "${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/*.c")
file(GLOB ${PROJECT_NAME}_SOURCES_HAL "${HAL_DIR}/Src/*.c")

Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/microswitch/drivers/bsp_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bsp_status_t bsp_uart_receive(bsp_uart_t uart, uint8_t *buff, size_t size,

uint32_t bsp_uart_get_count(bsp_uart_t uart) {
return bsp_uart_get_handle(uart)->RxXferSize -
__HAL_DMA_GET_COUNTER(bsp_uart_get_handle(BSP_UART_MCU)->hdmarx);
__HAL_DMA_GET_COUNTER(bsp_uart_get_handle(uart)->hdmarx);
}

bsp_status_t bsp_uart_abort_receive(bsp_uart_t uart) {
Expand Down
2 changes: 0 additions & 2 deletions hw/bsp/microswitch/drivers/hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ project(hal)

add_compile_options(-w)

add_compile_definitions(USE_FULL_ASSERT)

file(GLOB ${PROJECT_NAME}_SOURCES_MX "${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/*.c")
file(GLOB ${PROJECT_NAME}_SOURCES_HAL "${HAL_DIR}/Src/*.c")

Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/rm-c/drivers/bsp_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@ bsp_status_t bsp_uart_receive(bsp_uart_t uart, uint8_t *buff, size_t size,

uint32_t bsp_uart_get_count(bsp_uart_t uart) {
return bsp_uart_get_handle(uart)->RxXferSize -
__HAL_DMA_GET_COUNTER(bsp_uart_get_handle(BSP_UART_REF)->hdmarx);
__HAL_DMA_GET_COUNTER(bsp_uart_get_handle(uart)->hdmarx);
}
3 changes: 3 additions & 0 deletions hw/mcu/default/bsp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ extern "C" {
#include <stdlib.h>
#include <string.h>

#define XB_TO_STR(_arg) #_arg
#define XB_DEF2STR(_arg) XB_TO_STR(_arg)

#if MCU_DEBUG_BUILD
#define XB_ASSERT(arg) \
if (!(arg)) \
Expand Down
28 changes: 28 additions & 0 deletions hw/mcu/st/cmake/mcu_stm32l0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
include(${MCU_DIR}/default/custom_printf.cmake)

set(CPU_FLAGS
"-mcpu=cortex-m0plus -mthumb -mfloat-abi=soft"
CACHE INTERNAL "" FORCE)

set(GENERAL_FLAGS
"-Wall -Wextra -fno-builtin -fno-exceptions -ffunction-sections -fdata-sections"
CACHE INTERNAL "" FORCE)

set(CMAKE_C_FLAGS
"${CPU_FLAGS} ${GENERAL_FLAGS} -fshort-enums -fdiagnostics-color=auto"
CACHE INTERNAL "" FORCE)

set(CMAKE_CXX_FLAGS
"${CPU_FLAGS} ${GENERAL_FLAGS} -fno-threadsafe-statics -fno-rtti -fshort-enums -fdiagnostics-color=auto"
CACHE INTERNAL "" FORCE)

set(CMAKE_ASM_FLAGS
"${CPU_FLAGS} -x assembler-with-cpp"
CACHE INTERNAL "" FORCE)

# Linker Flag
set(LINKER_SCRIPT ${BOARD_DIR}/ld/LinkerScripts.ld)

set(CMAKE_EXE_LINKER_FLAGS
"-T${LINKER_SCRIPT} --specs=nano.specs --specs=nosys.specs -Wl,--cref,--gc-sections,--print-memory-usage,-Map=${CMAKE_PROJECT_NAME}.map"
CACHE INTERNAL "" FORCE)
2 changes: 2 additions & 0 deletions src/device/motor/dev_mit_motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void MitMotor::Control(float output) {
void MitMotor::SetCurrent(float current) {
if (this->feedback_.temp > 75.0f) {
Relax();
OMLOG_WARNING("motor %s high temperature detected", name_);
return;
}

Expand All @@ -114,6 +115,7 @@ void MitMotor::SetCurrent(float current) {
void MitMotor::SetPos(float pos) {
if (this->feedback_.temp > 75.0f) {
Relax();
OMLOG_WARNING("motor %s high temperature detected", name_);
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/device/motor/dev_rm_motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ float RMMotor::GetLSB() {
void RMMotor::Control(float out) {
if (this->feedback_.temp > 75.0f) {
out = 0.0f;
OMLOG_WARNING("motor %s high temperature detected", name_);
}

clampf(&out, -1.0f, 1.0f);
Expand Down
1 change: 1 addition & 0 deletions src/device/motor/dev_rmd_motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void RMDMotor::Decode(Can::Pack &rx) {
void RMDMotor::Control(float out) {
if (this->feedback_.temp > 75.0f) {
out = 0.0f;
OMLOG_WARNING("motor %s high temperature detected", name_);
}

clampf(&out, -1.0f, 1.0f);
Expand Down

0 comments on commit 5fda58a

Please sign in to comment.