Windows fixes

This commit is contained in:
Marek Kraus 2022-11-07 15:22:06 +01:00
parent 17a6c2f4a1
commit e3dea5b85d
2 changed files with 3 additions and 2 deletions

View File

@ -35,6 +35,8 @@ target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c ${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c) ${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
if(WIN32) if(WIN32)
target_link_libraries(libblisp_obj PRIVATE Setupapi.lib) target_link_libraries(libblisp_obj PRIVATE Setupapi.lib)
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD) target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
@ -48,7 +50,6 @@ elseif(UNIX AND NOT APPLE)
LIBSERIALPORT_ATBUILD LIBSERIALPORT_ATBUILD
"SP_API=__attribute__((visibility(\"default\")))" "SP_API=__attribute__((visibility(\"default\")))"
"SP_PRIV=__attribute__((visibility(\"hidden\")))") "SP_PRIV=__attribute__((visibility(\"hidden\")))")
target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.") write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
elseif(APPLE) elseif(APPLE)
target_sources(libblisp_obj PRIVATE target_sources(libblisp_obj PRIVATE

View File

@ -84,7 +84,7 @@ int32_t blisp_send_command(struct blisp_device* device, uint8_t command, void* p
uint32_t checksum = 0; uint32_t checksum = 0;
checksum += device->tx_buffer[2] + device->tx_buffer[3]; checksum += device->tx_buffer[2] + device->tx_buffer[3];
for (uint16_t i = 0; i < payload_size; i++) { for (uint16_t i = 0; i < payload_size; i++) {
checksum += *(uint8_t*)(payload + i); checksum += *(uint8_t*)((uint8_t*)payload + i);
} }
device->tx_buffer[1] = checksum & 0xFF; device->tx_buffer[1] = checksum & 0xFF;
} }