Skip to content

Commit

Permalink
enable more compilation warnings, upload final build artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
benedekkupper committed Aug 2, 2024
1 parent d4fa7f3 commit eb38136
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/cmake-gcc-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

- name: Upload final build artifacts
uses: actions/upload-artifact@v4
with:
name: stm32-i2c-hid
path: ${{github.workspace}}/build/stm32-i2c-hid.*
3 changes: 2 additions & 1 deletion cmake/gcc-arm-none-eabi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ set(TARGET_FLAGS "-mcpu=cortex-m0 ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -ffunction-sections ")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra ")
# skip warnings
if(FALSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wpedantic ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic ")
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand Down
7 changes: 4 additions & 3 deletions stm32-i2c-hid/hid/demo_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ demo_app& demo_app::instance()
return app;
}

void demo_app::start(protocol prot)
void demo_app::start([[maybe_unused]] protocol prot)
{
receive_report(&_raw_out_buffer);
}
Expand All @@ -70,7 +70,7 @@ void demo_app::button_state_change(bool pressed)
}
}

void demo_app::set_report(report::type type, const std::span<const uint8_t>& data)
void demo_app::set_report([[maybe_unused]] report::type type, const std::span<const uint8_t>& data)
{
// only output reports provided
assert(type == report::type::OUTPUT);
Expand All @@ -91,7 +91,8 @@ void demo_app::set_report(report::type type, const std::span<const uint8_t>& dat
receive_report(&_raw_out_buffer);
}

void demo_app::get_report(report::selector select, const std::span<uint8_t>& buffer)
void demo_app::get_report(report::selector select,
[[maybe_unused]] const std::span<uint8_t>& buffer)
{
if (select == _keys_buffer.selector())
{
Expand Down
10 changes: 5 additions & 5 deletions stm32-i2c-hid/i2c_hid_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
}
}

extern "C" void HAL_I2C_AddrCallback(I2C_HandleTypeDef* hi2c, uint8_t TransferDirection,
uint16_t AddrMatchCode)
extern "C" void HAL_I2C_AddrCallback([[maybe_unused]] I2C_HandleTypeDef* hi2c,
uint8_t TransferDirection, uint16_t AddrMatchCode)
{
get_i2c_slave().handle_start(static_cast<i2c::direction>(TransferDirection));
}

extern "C" void HAL_I2C_ListenCpltCallback(I2C_HandleTypeDef* hi2c)
extern "C" void HAL_I2C_ListenCpltCallback([[maybe_unused]] I2C_HandleTypeDef* hi2c)
{
get_i2c_slave().handle_stop();
}

extern "C" void HAL_I2C_SlaveTxCpltCallback(I2C_HandleTypeDef* hi2c)
extern "C" void HAL_I2C_SlaveTxCpltCallback([[maybe_unused]] I2C_HandleTypeDef* hi2c)
{
get_i2c_slave().handle_tx_complete();
}

extern "C" void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef* hi2c)
extern "C" void HAL_I2C_SlaveRxCpltCallback([[maybe_unused]] I2C_HandleTypeDef* hi2c)
{
get_i2c_slave().handle_rx_complete();
}
1 change: 1 addition & 0 deletions stm32-i2c-hid/newlib_diet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C" void _fini(void) {}
extern "C" void __register_exitproc(void) {}

void operator delete(void*, unsigned int) {}
void operator delete(void*) {}

/* needed to avoid pulling in a lot of library code */
#ifndef NDEBUG
Expand Down
2 changes: 1 addition & 1 deletion stm32-i2c-hid/st/hal_i2c_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void hal_i2c_slave::start_listen()
HAL_I2C_EnableListen_IT(handle_);
}

void hal_i2c_slave::stop_listen(i2c::address slave_addr)
void hal_i2c_slave::stop_listen([[maybe_unused]] i2c::address slave_addr)
{
HAL_I2C_DisableListen_IT(handle_);
}
Expand Down

0 comments on commit eb38136

Please sign in to comment.