FEATURE: Added format lib

This commit is contained in:
Robin Dietzel 2023-01-13 14:58:47 +01:00
parent ed4c53c740
commit 31ae2b6664
4 changed files with 10 additions and 3 deletions

View File

@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.2)
# specify cross-compilers and tools # specify cross-compilers and tools
set(CMAKE_C_COMPILER arm-none-eabi-gcc) set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++) set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-gcc) set(CMAKE_ASM_COMPILER arm-none-eabi-gcc)
set(CMAKE_AR arm-none-eabi-ar) set(CMAKE_AR arm-none-eabi-ar)
set(CMAKE_OBJCOPY arm-none-eabi-objcopy) set(CMAKE_OBJCOPY arm-none-eabi-objcopy)
set(CMAKE_OBJDUMP arm-none-eabi-objdump) set(CMAKE_OBJDUMP arm-none-eabi-objdump)
@ -59,6 +59,8 @@ else ()
add_compile_options(-Og -g) add_compile_options(-Og -g)
endif () endif ()
add_subdirectory(Lib/fmt)
include_directories(USB_DEVICE/App USB_DEVICE/Target Core/Inc Drivers/STM32F4xx_HAL_Driver/Inc Drivers/STM32F4xx_HAL_Driver/Inc/Legacy Middlewares/ST/STM32_USB_Device_Library/Core/Inc Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc Drivers/CMSIS/Device/ST/STM32F4xx/Include Drivers/CMSIS/Include Middlewares/floatpump/Inc) include_directories(USB_DEVICE/App USB_DEVICE/Target Core/Inc Drivers/STM32F4xx_HAL_Driver/Inc Drivers/STM32F4xx_HAL_Driver/Inc/Legacy Middlewares/ST/STM32_USB_Device_Library/Core/Inc Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc Drivers/CMSIS/Device/ST/STM32F4xx/Include Drivers/CMSIS/Include Middlewares/floatpump/Inc)
add_definitions(-DDEBUG -DUSE_HAL_DRIVER -DSTM32F411xE) add_definitions(-DDEBUG -DUSE_HAL_DRIVER -DSTM32F411xE)
@ -73,6 +75,8 @@ add_link_options(-T ${LINKER_SCRIPT})
add_executable(${PROJECT_NAME}.elf ${SOURCES} ${LINKER_SCRIPT}) add_executable(${PROJECT_NAME}.elf ${SOURCES} ${LINKER_SCRIPT})
target_link_libraries(${PROJECT_NAME}.elf fmt::fmt-header-only)
set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex) set(HEX_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex)
set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin) set(BIN_FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin)

View File

@ -7,6 +7,6 @@
// Auto generated header file containing the last git revision // Auto generated header file containing the last git revision
#define GIT_HASH "ed9a66b" #define GIT_HASH "e0a068f"
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H #endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H

View File

@ -2,6 +2,8 @@
#include "usb_device.h" #include "usb_device.h"
#include "usbd_cdc_if.h" #include "usbd_cdc_if.h"
#include "fmt/core.h"
#include "LCD_I2C_Driver.h" #include "LCD_I2C_Driver.h"
#include "InitSequence.h" #include "InitSequence.h"
@ -288,7 +290,7 @@ int main(void) {
display.LCDSetCursor(0, 3); display.LCDSetCursor(0, 3);
if (S_refillcooldown > 0) { if (S_refillcooldown > 0) {
display.LCDSendCString(const_cast<char *>(std::string("Cooldown: " + std::to_string(S_refillcooldown / 60) + "min").c_str())); display.LCDSendCString(const_cast<char *>(fmt::format("Nsp. wartet: {:3} min", S_refillcooldown / 60).c_str()));
} else if (S_refillempty) { } else if (S_refillempty) {
display.LCDSendCString(const_cast<char *>(std::string("Nachspeisung mangel ").c_str())); display.LCDSendCString(const_cast<char *>(std::string("Nachspeisung mangel ").c_str()));
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET);

1
Lib/fmt Submodule

@ -0,0 +1 @@
Subproject commit 676c2a107e9575663f79095d9b2c9d15168e1285