This commit is contained in:
David Rice
2026-01-19 14:56:14 +00:00
parent 03ab678b79
commit 17b1b7b762
8 changed files with 11530 additions and 11477 deletions

View File

@@ -6,12 +6,11 @@
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
* Copyright (c) 2026 Arrive.
* Author: D. Rice
*
* Version: 0.1
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
@@ -51,7 +50,8 @@ TIM_HandleTypeDef htim2;
UART_HandleTypeDef huart2;
/* USER CODE BEGIN PV */
uint8_t fw_rev_h = 0;
uint8_t fw_rev_l = 1;
uint8_t rx_hold_buffer[2];
uint8_t rx_buffer[32];
uint8_t tx_buffer[32];
@@ -589,13 +589,19 @@ void serial_number_task (void)
tx_buffer[0] = IN_SYNC_BYTE_1;
tx_buffer[1] = IN_SYNC_BYTE_2;
tx_buffer[2] = tx_len;
for (tx_len_counter = 0x00; tx_len_counter < tx_len; tx_len_counter++)
{
tx_buffer[tx_len_counter + 3] = serial_number[tx_len_counter];
}
tx_buffer[tx_len + 3] = 0x3A;
tx_buffer[tx_len + 4] = fw_rev_h + 0x30;
tx_buffer[tx_len + 5] = fw_rev_l + 0x30;
tx_len = 0x16;
tx_buffer[2] = tx_len;
tx_checksum = 0x00;
/* Need to apply checksum to all data bits */
@@ -606,10 +612,10 @@ void serial_number_task (void)
tx_checksum = ~tx_checksum;
tx_buffer[22] = (uint8_t)((tx_checksum >> 8) & 0xFF);
tx_buffer[23] = (uint8_t)(tx_checksum & 0xFF);
tx_buffer[tx_len + 3] = (uint8_t)((tx_checksum >> 8) & 0xFF);
tx_buffer[tx_len + 4] = (uint8_t)(tx_checksum & 0xFF);
tx_len = 0x18;
tx_len = 0x1B;
HAL_UART_Transmit(&huart2, tx_buffer, tx_len, 100);
}