SystemK v02.00 #8

Closed
Joe wants to merge 16 commits from SystemK_interface_improvements into main
Owner

SystemK v02.00

Summary

Updates the 2020TPC platform to SystemK v02.00, which introduces a set of HAL interface improvements documented in SystemK PR #15 and
SystemK/INTERFACE_IMPROVEMENTS.md. All platform implementation files are updated to match the new interfaces. Changes are applied identically to both 2020TPCApp1.cydsn and 2020TPCAppNoDFU.cydsn.


Changes

SystemK submodule (2020TPCApp1.cydsn/SystemK, 2020TPCAppNoDFU.cydsn/SystemK)

Updated from v01.01 to v02.00. Key interface changes in the new SystemK:

Phase Change
1.1 Added BLE_Init() to BLE_HW_Interface.h
1.2 Added SETTINGS_Load() to Settings_Interface.h
1.3 Documented BLE_Quiet / BLE_Unquiet semantics in BLE_HW_Interface.h
2.1 HW_Execute_Console_Command parameter changed from const uint8_t * to const char *
2.2 BLE_GetMyAddress parameter tightened to uint8_t BD_ADDR[BD_ADDR_SIZE]
2.3 SETTINGS_get_device_name gains a max_len parameter
3.1 HW_NeoPixels_Get_My_Color() removed from the HAL
3.2 HW_NeoPixels_Set_RGB() replaced by HW_NeoPixels_Set_Color(color_t)
4.1 AudioAction_T.Data changed from void * to typed AudioActionData_T union
4.2 Prepare_Tag / Send_Tag now accept explicit packet/handle arguments
4.3 Generic SETTINGS_get/set_uint8_t/uint32_t replaced by per-setting typed accessors

README.md

Updated the SystemK version number in the dependency table from 1.0 to 02.00.


NVM/NVM_Settings.c (Phase 1.2, 2.3, 4.3)

  • Replaced the four generic SETTINGS_get_uint8_t, SETTINGS_set_uint8_t,
    SETTINGS_get_uint32_t, and SETTINGS_set_uint32_t functions with 20
    typed per-setting accessors matching the new Settings_Interface.h:
    SETTINGS_get/set_Is_Right_Handed, _Audio_Volume, _Team_ID,
    _Player_ID, _Weapon_ID, _Max_Health, _N_Special_Weapons_On_Reentry,
    _T_Start_Game_in_ms, _T_Game_Length_in_ms, _Secondary_Color, and the
    read-only SETTINGS_get_Device_Type.
  • Added SETTINGS_Load(). On this platform, NVM is loaded asynchronously
    by the RTOS NVM task after the scheduler starts, so SETTINGS_Load() returns
    SYSTEMK_RESULT_SUCCESS immediately.
  • Updated SETTINGS_get_device_name to accept the new max_len parameter
    and pass it to strncpy.

HW/HW_NeoPixels.c (Phase 3.1, 3.2)

  • Renamed HW_NeoPixels_Set_RGB(channel, position, r, g, b) to
    HW_NeoPixels_Set_Color(channel, position, color_t color). Gamma
    correction (Gamma8[] table lookup) and RGB component extraction now happen
    inside the HAL function rather than at every call site. The hardware
    color-order (RGB / GRB) swapping that was previously done in
    Single_Channel_Helpers.h is handled here as before.
  • Updated the internal NeoPixels_Set_Color_On_All_Channels helper to call
    HW_NeoPixels_Set_Color directly (removing the manual Gamma8[] expansion).
  • Removed HW_NeoPixels_Get_My_Color(). Team color is game logic, not
    hardware; the equivalent is now GAME_Get_My_Color() defined in
    SystemK/Game/Game.h.

Audio.c (Phase 4.1)

  • Fixed two *((uint8_t *)action.Data) pointer dereferences (in the
    AUDIO_SET_VOLUME and AUDIO_PRONOUNCE_NUMBER_0_TO_100 cases) to use the
    new typed union member: action.Data.number.

COMM/BLE/COMM_BLE.c (Phase 1.1, 2.2)

  • Added BLE_Init(), the new HAL entry point required by BLE_HW_Interface.h.
    It delegates to the existing internal COMM_BLE_Init().
  • Updated BLE_GetMyAddress signature from uint8_t * BD_ADDR to
    uint8_t BD_ADDR[BD_ADDR_SIZE] to match the tightened interface declaration.

COMM/BLE/COMM_BLE_UART.c (Phase 2.1)

  • Added an explicit (const char8 * const) cast on the call to
    COMM_Console_Execute_Internal_Command to match the updated
    const char8 * parameter type.

COMM/COMM_Console.c and COMM/COMM_Console.h (Phase 2.1)

  • Updated HW_Execute_Console_Command parameter from const uint8_t * const
    to const char * const, matching the corrected Console_HW_Interface.h.
  • Updated the internal helper COMM_Console_Execute_Internal_Command (and
    its declaration in COMM_Console.h) from const uint8_t * const to
    const char8 * const.

CONFIG/CONFIG_RTOS.c (Phase 1.1)

  • Removed the direct COMM_BLE_Init() call from CONFIG_InitTasks().
    BLE initialization is now triggered by BLE_Init(), which is called from
    Initialize_SystemK() in CONFIG_RunTasks(), making the initialization
    sequence explicit and under SystemK's control.

Fire_Control.c (Phase 4.2)

  • Replaced the no-argument Prepare_Tag() / Send_Tag() functions with
    the new explicit-packet signatures:
    • PreparedTag_T *Prepare_Tag(const TagPacket_T *packet) — encodes the
      supplied packet into a pulse train, sets the IR modulation frequency, stores
      the result in a static PreparedTag_T, and returns a pointer to it.
    • SystemKResult_T Send_Tag(PreparedTag_T *tag) — initiates the pulse train
      via tag->pulse_train.
  • Removed the TagPacket_T Shot_Packet module-level variable (the packet is
    now built by the caller via GAME_Build_My_Tag_Packet() in Game.h).
  • Added static PreparedTag_T Shot_Prepared_Tag to hold the platform's
    encoded tag between Prepare_Tag and Send_Tag calls.

COMM/ConsoleCommands/COMM_STATE_ConsoleCommands.c (Phase 4.2)

  • Updated the event tag and event tag <n> console commands to use the
    new two-step IR API: Prepare_Tag(GAME_Build_My_Tag_Packet()) is called once
    (per command invocation) to build and encode the current tag packet, and
    Send_Tag(prepared) is called once per shot.
# SystemK v02.00 ## Summary Updates the 2020TPC platform to SystemK v02.00, which introduces a set of HAL interface improvements documented in [SystemK PR #15](https://git.ktag.clubk.club/Software/SystemK/pulls/15) and `SystemK/INTERFACE_IMPROVEMENTS.md`. All platform implementation files are updated to match the new interfaces. Changes are applied identically to both `2020TPCApp1.cydsn` and `2020TPCAppNoDFU.cydsn`. --- ## Changes ### SystemK submodule (`2020TPCApp1.cydsn/SystemK`, `2020TPCAppNoDFU.cydsn/SystemK`) Updated from v01.01 to v02.00. Key interface changes in the new SystemK: | Phase | Change | |-------|--------| | 1.1 | Added `BLE_Init()` to `BLE_HW_Interface.h` | | 1.2 | Added `SETTINGS_Load()` to `Settings_Interface.h` | | 1.3 | Documented `BLE_Quiet` / `BLE_Unquiet` semantics in `BLE_HW_Interface.h` | | 2.1 | `HW_Execute_Console_Command` parameter changed from `const uint8_t *` to `const char *` | | 2.2 | `BLE_GetMyAddress` parameter tightened to `uint8_t BD_ADDR[BD_ADDR_SIZE]` | | 2.3 | `SETTINGS_get_device_name` gains a `max_len` parameter | | 3.1 | `HW_NeoPixels_Get_My_Color()` removed from the HAL | | 3.2 | `HW_NeoPixels_Set_RGB()` replaced by `HW_NeoPixels_Set_Color(color_t)` | | 4.1 | `AudioAction_T.Data` changed from `void *` to typed `AudioActionData_T` union | | 4.2 | `Prepare_Tag` / `Send_Tag` now accept explicit packet/handle arguments | | 4.3 | Generic `SETTINGS_get/set_uint8_t/uint32_t` replaced by per-setting typed accessors | --- ### `README.md` Updated the SystemK version number in the dependency table from `1.0` to `02.00`. --- ### `NVM/NVM_Settings.c` (Phase 1.2, 2.3, 4.3) - **Replaced** the four generic `SETTINGS_get_uint8_t`, `SETTINGS_set_uint8_t`, `SETTINGS_get_uint32_t`, and `SETTINGS_set_uint32_t` functions with 20 typed per-setting accessors matching the new `Settings_Interface.h`: `SETTINGS_get/set_Is_Right_Handed`, `_Audio_Volume`, `_Team_ID`, `_Player_ID`, `_Weapon_ID`, `_Max_Health`, `_N_Special_Weapons_On_Reentry`, `_T_Start_Game_in_ms`, `_T_Game_Length_in_ms`, `_Secondary_Color`, and the read-only `SETTINGS_get_Device_Type`. - **Added** `SETTINGS_Load()`. On this platform, NVM is loaded asynchronously by the RTOS NVM task after the scheduler starts, so `SETTINGS_Load()` returns `SYSTEMK_RESULT_SUCCESS` immediately. - **Updated** `SETTINGS_get_device_name` to accept the new `max_len` parameter and pass it to `strncpy`. --- ### `HW/HW_NeoPixels.c` (Phase 3.1, 3.2) - **Renamed** `HW_NeoPixels_Set_RGB(channel, position, r, g, b)` to `HW_NeoPixels_Set_Color(channel, position, color_t color)`. Gamma correction (`Gamma8[]` table lookup) and RGB component extraction now happen inside the HAL function rather than at every call site. The hardware color-order (RGB / GRB) swapping that was previously done in `Single_Channel_Helpers.h` is handled here as before. - **Updated** the internal `NeoPixels_Set_Color_On_All_Channels` helper to call `HW_NeoPixels_Set_Color` directly (removing the manual `Gamma8[]` expansion). - **Removed** `HW_NeoPixels_Get_My_Color()`. Team color is game logic, not hardware; the equivalent is now `GAME_Get_My_Color()` defined in `SystemK/Game/Game.h`. --- ### `Audio.c` (Phase 4.1) - **Fixed** two `*((uint8_t *)action.Data)` pointer dereferences (in the `AUDIO_SET_VOLUME` and `AUDIO_PRONOUNCE_NUMBER_0_TO_100` cases) to use the new typed union member: `action.Data.number`. --- ### `COMM/BLE/COMM_BLE.c` (Phase 1.1, 2.2) - **Added** `BLE_Init()`, the new HAL entry point required by `BLE_HW_Interface.h`. It delegates to the existing internal `COMM_BLE_Init()`. - **Updated** `BLE_GetMyAddress` signature from `uint8_t * BD_ADDR` to `uint8_t BD_ADDR[BD_ADDR_SIZE]` to match the tightened interface declaration. --- ### `COMM/BLE/COMM_BLE_UART.c` (Phase 2.1) - **Added** an explicit `(const char8 * const)` cast on the call to `COMM_Console_Execute_Internal_Command` to match the updated `const char8 *` parameter type. --- ### `COMM/COMM_Console.c` and `COMM/COMM_Console.h` (Phase 2.1) - **Updated** `HW_Execute_Console_Command` parameter from `const uint8_t * const` to `const char * const`, matching the corrected `Console_HW_Interface.h`. - **Updated** the internal helper `COMM_Console_Execute_Internal_Command` (and its declaration in `COMM_Console.h`) from `const uint8_t * const` to `const char8 * const`. --- ### `CONFIG/CONFIG_RTOS.c` (Phase 1.1) - **Removed** the direct `COMM_BLE_Init()` call from `CONFIG_InitTasks()`. BLE initialization is now triggered by `BLE_Init()`, which is called from `Initialize_SystemK()` in `CONFIG_RunTasks()`, making the initialization sequence explicit and under SystemK's control. --- ### `Fire_Control.c` (Phase 4.2) - **Replaced** the no-argument `Prepare_Tag()` / `Send_Tag()` functions with the new explicit-packet signatures: - `PreparedTag_T *Prepare_Tag(const TagPacket_T *packet)` — encodes the supplied packet into a pulse train, sets the IR modulation frequency, stores the result in a static `PreparedTag_T`, and returns a pointer to it. - `SystemKResult_T Send_Tag(PreparedTag_T *tag)` — initiates the pulse train via `tag->pulse_train`. - **Removed** the `TagPacket_T Shot_Packet` module-level variable (the packet is now built by the caller via `GAME_Build_My_Tag_Packet()` in `Game.h`). - **Added** `static PreparedTag_T Shot_Prepared_Tag` to hold the platform's encoded tag between `Prepare_Tag` and `Send_Tag` calls. --- ### `COMM/ConsoleCommands/COMM_STATE_ConsoleCommands.c` (Phase 4.2) - **Updated** the `event tag` and `event tag <n>` console commands to use the new two-step IR API: `Prepare_Tag(GAME_Build_My_Tag_Packet())` is called once (per command invocation) to build and encode the current tag packet, and `Send_Tag(prepared)` is called once per shot.
Author
Owner

I forgot to merge this, and now we're working on SystemK v02.01. Closing as no longer relevant.

I forgot to merge this, and now we're working on SystemK v02.01. Closing as no longer relevant.
Joe closed this pull request 2026-06-04 01:50:54 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Software/2020TPC-SW!8
No description provided.