added MLZR_Comm

This commit is contained in:
2024-06-03 22:04:46 +02:00
parent 41cc7a9ff6
commit 1e0fd80f5c
10 changed files with 112 additions and 11 deletions

6
.gitmodules vendored
View File

@@ -19,3 +19,9 @@
[submodule "proto"]
path = proto
url = git@git.lan:oliver/cls-proto.git
[submodule "lib/TinyFrame"]
path = lib/TinyFrame
url = https://github.com/MightyPork/TinyFrame.git
[submodule "Application/MLZR_Comm"]
path = Application/MLZR_Comm
url = git@git.lan:ODDIY/MLZR_Comm.git

View File

@@ -3,4 +3,5 @@ add_subdirectory(CLS)
add_subdirectory(CLS_BSP)
add_subdirectory(BSP)
add_subdirectory(ram_loader)
add_subdirectory(MLZR_Comm)
add_subdirectory(Vehicle)

1
Application/MLZR_Comm Submodule

Submodule Application/MLZR_Comm added at 48a98f4c82

View File

@@ -143,7 +143,7 @@ target_sources(${CMAKE_PROJECT_NAME} PUBLIC ${sources_SRCS})
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Tasks CLS CLS_BSP BSP EE24 INA219 ulog ram_loader Vehicle)
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC PROTOS)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC uart_driver)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC mlzr_comm TinyFrame uart_driver)
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC lwrb)
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE

View File

@@ -162,6 +162,7 @@ void AddHeadlightMessages();
#include "CLS_BSP.h"
#include "CLSAddress.h"
#include "mlzr_comm.h"
/* USER CODE END Header_StartDefaultTask */
void StartDefaultTask(void *argument)
{
@@ -171,6 +172,9 @@ void StartDefaultTask(void *argument)
BSP_EE24_Init();
BSP_INA_Init();
MLZR_INIT();
retSD = f_mount(&SDFatFS,SDPath,0);
retSD = f_open(&SDFile, "counter.bin", FA_READ);

View File

@@ -22,6 +22,7 @@
#include "stm32h7xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "AsyncComm.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -41,7 +42,8 @@
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
extern uart_desc_t uart_duplex;
extern uart_desc_t uart_half;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
@@ -233,7 +235,7 @@ void DMA1_Stream0_IRQHandler(void)
/* USER CODE END DMA1_Stream0_IRQn 0 */
/* USER CODE BEGIN DMA1_Stream0_IRQn 1 */
usart_dma_irq_handler(&uart_duplex);
/* USER CODE END DMA1_Stream0_IRQn 1 */
}
@@ -247,7 +249,7 @@ void DMA1_Stream1_IRQHandler(void)
/* USER CODE END DMA1_Stream1_IRQn 0 */
/* USER CODE BEGIN DMA1_Stream1_IRQn 1 */
usart_dma_irq_handler_tx(&uart_duplex);
/* USER CODE END DMA1_Stream1_IRQn 1 */
}
@@ -261,7 +263,7 @@ void DMA1_Stream2_IRQHandler(void)
/* USER CODE END DMA1_Stream2_IRQn 0 */
/* USER CODE BEGIN DMA1_Stream2_IRQn 1 */
usart_dma_irq_handler(&uart_half);
/* USER CODE END DMA1_Stream2_IRQn 1 */
}
@@ -275,7 +277,7 @@ void DMA1_Stream3_IRQHandler(void)
/* USER CODE END DMA1_Stream3_IRQn 0 */
/* USER CODE BEGIN DMA1_Stream3_IRQn 1 */
usart_dma_irq_handler_tx(&uart_half);
/* USER CODE END DMA1_Stream3_IRQn 1 */
}
@@ -400,7 +402,7 @@ void USART1_IRQHandler(void)
/* USER CODE END USART1_IRQn 0 */
/* USER CODE BEGIN USART1_IRQn 1 */
usart_irq_handler(&uart_duplex);
/* USER CODE END USART1_IRQn 1 */
}
@@ -413,7 +415,7 @@ void USART3_IRQHandler(void)
/* USER CODE END USART3_IRQn 0 */
/* USER CODE BEGIN USART3_IRQn 1 */
usart_irq_handler(&uart_half);
/* USER CODE END USART3_IRQn 1 */
}

View File

@@ -157,7 +157,7 @@ void MX_USART1_UART_Init(void)
/* USER CODE END USART1_Init 1 */
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
USART_InitStruct.BaudRate = 1000000;
USART_InitStruct.BaudRate = 2000000;
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
@@ -273,7 +273,7 @@ void MX_USART3_UART_Init(void)
/* USER CODE END USART3_Init 1 */
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
USART_InitStruct.BaudRate = 1000000;
USART_InitStruct.BaudRate = 2000000;
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
USART_InitStruct.Parity = LL_USART_PARITY_NONE;

View File

@@ -4,5 +4,10 @@ add_subdirectory(nanopb)
add_subdirectory(ulog)
add_subdirectory(ina219)
add_library(EE24 STATIC "ee24/ee24.c")
target_include_directories(EE24 PUBLIC "ee24")
target_include_directories(EE24 PUBLIC "ee24")
add_library(TinyFrame STATIC "TinyFrame/TinyFrame.c")
target_include_directories(TinyFrame PUBLIC "./TinyFrame" "./TinyFrameConf")

1
lib/TinyFrame Submodule

Submodule lib/TinyFrame added at a29167a69f

View File

@@ -0,0 +1,81 @@
//
// TinyFrame configuration file.
//
// Rename to TF_Config.h
//
#ifndef TF_CONFIG_H
#define TF_CONFIG_H
#include <stdint.h>
#include <stdio.h> // used by the TF_Error() macro defined below
//#include <esp8266.h> // when using with esphttpd
//----------------------------- FRAME FORMAT ---------------------------------
// The format can be adjusted to fit your particular application needs
// If the connection is reliable, you can disable the SOF byte and checksums.
// That can save up to 9 bytes of overhead.
// ,-----+-----+-----+------+------------+- - - -+-------------,
// | SOF | ID | LEN | TYPE | HEAD_CKSUM | DATA | DATA_CKSUM |
// | 0-1 | 1-4 | 1-4 | 1-4 | 0-4 | ... | 0-4 | <- size (bytes)
// '-----+-----+-----+------+------------+- - - -+-------------'
// !!! BOTH PEERS MUST USE THE SAME SETTINGS !!!
// Adjust sizes as desired (1,2,4)
#define TF_ID_BYTES 2
#define TF_LEN_BYTES 2
#define TF_TYPE_BYTES 2
// Checksum type. Options:
// TF_CKSUM_NONE, TF_CKSUM_XOR, TF_CKSUM_CRC8, TF_CKSUM_CRC16, TF_CKSUM_CRC32
// TF_CKSUM_CUSTOM8, TF_CKSUM_CUSTOM16, TF_CKSUM_CUSTOM32
// Custom checksums require you to implement checksum functions (see TinyFrame.h)
#define TF_CKSUM_TYPE TF_CKSUM_CRC16
// Use a SOF byte to mark the start of a frame
#define TF_USE_SOF_BYTE 1
// Value of the SOF byte (if TF_USE_SOF_BYTE == 1)
#define TF_SOF_BYTE 0x01
//----------------------- PLATFORM COMPATIBILITY ----------------------------
// used for timeout tick counters - should be large enough for all used timeouts
typedef uint16_t TF_TICKS;
// used in loops iterating over listeners
typedef uint8_t TF_COUNT;
//----------------------------- PARAMETERS ----------------------------------
// Maximum received payload size (static buffer)
// Larger payloads will be rejected.
#define TF_MAX_PAYLOAD_RX 1024
// Size of the sending buffer. Larger payloads will be split to pieces and sent
// in multiple calls to the write function. This can be lowered to reduce RAM usage.
#define TF_SENDBUF_LEN 1024
// --- Listener counts - determine sizes of the static slot tables ---
// Frame ID listeners (wait for response / multi-part message)
#define TF_MAX_ID_LST 50
// Frame Type listeners (wait for frame with a specific first payload byte)
#define TF_MAX_TYPE_LST 5
// Generic listeners (fallback if no other listener catches it)
#define TF_MAX_GEN_LST 5
// Timeout for receiving & parsing a frame
// ticks = number of calls to TF_Tick()
#define TF_PARSER_TIMEOUT_TICKS 10
// Whether to use mutex - requires you to implement TF_ClaimTx() and TF_ReleaseTx()
#define TF_USE_MUTEX 1
// Error reporting function. To disable debug, change to empty define
#define TF_Error(format, ...) printf("[TF] " format "\n", ##__VA_ARGS__)
//------------------------- End of user config ------------------------------
#endif //TF_CONFIG_H