From e4dca3fcc4892e81d6d4ef999a4343dce8112e48 Mon Sep 17 00:00:00 2001 From: Niel Nielsen Date: Tue, 7 Apr 2026 10:57:08 +0200 Subject: [PATCH] align with RRG --- firmware/application/src/app_cmd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/firmware/application/src/app_cmd.c b/firmware/application/src/app_cmd.c index 36b2a39..9f2991e 100644 --- a/firmware/application/src/app_cmd.c +++ b/firmware/application/src/app_cmd.c @@ -760,6 +760,8 @@ static data_frame_tx_t *cmd_processor_ioprox_write_to_t55xx(uint16_t cmd, uint16 return data_frame_make(cmd, status, 0, NULL); } + + /** * @brief Decode raw8 data to structured ioProx format * @param raw8 Input 8 bytes @@ -833,6 +835,21 @@ static data_frame_tx_t *cmd_processor_viking_write_to_t55xx(uint16_t cmd, uint16 return data_frame_make(cmd, status, 0, NULL); } + +static data_frame_tx_t *cmd_processor_pac_write_to_t55xx(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) { + typedef struct { + uint8_t id[LF_PAC_TAG_ID_SIZE]; + uint8_t new_key[4]; + uint8_t old_keys[4]; + } PACKED payload_t; + payload_t *payload = (payload_t *)data; + if (length < sizeof(payload_t) || (length - offsetof(payload_t, old_keys)) % sizeof(payload->old_keys) != 0) { + return data_frame_make(cmd, STATUS_PAR_ERR, 0, NULL); + } + status = write_pac_to_t55xx(payload->id, payload->new_key, payload->old_keys, (length - offsetof(payload_t, old_keys)) / sizeof(payload->old_keys)); + return data_frame_make(cmd, status, 0, NULL); +} + static data_frame_tx_t *cmd_processor_lf_t55xx_write(uint16_t cmd, uint16_t status, uint16_t length, uint8_t *data) { typedef struct { uint8_t block; /* block number */