WIP
This commit is contained in:
parent
ee09dcef00
commit
83f510bb59
13 changed files with 213 additions and 64 deletions
|
@ -78,8 +78,10 @@ void MainLoop()
|
|||
|
||||
for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
|
||||
if(!g_uartStatuses[idx].txBuffer.busy && send) {
|
||||
uint16_t len = sizeof(text2Send) - 1 - (rand() & randmask);
|
||||
DIAG_ENTER_BUSY();
|
||||
PostPacket(&g_uartStatuses[idx], text2Send, sizeof(text2Send) - 1 - (rand() & randmask), &g_crcStatus, 1);
|
||||
MemcpyDma(GetTxBuffer(&g_uartStatuses[idx]), text2Send, len);
|
||||
PostPacket(&g_uartStatuses[idx], NULL, len, &g_crcStatus, 1);
|
||||
DIAG_EXIT_BUSY();
|
||||
}
|
||||
for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "f4ll/crchandler.h"
|
||||
#include "f4ll/memcpydma.h"
|
||||
#include "f4ll/consolehandler.h"
|
||||
#include "f4ll/irqlock.h"
|
||||
extern "C" {
|
||||
#include "main.h"
|
||||
#include "globals.h"
|
||||
|
@ -34,6 +35,7 @@ extern "C" void MainLoop()
|
|||
"Megszentsegtelenithetetlensegeskedeseitekert\r\n"
|
||||
"--------------------------------------------\r\n\0\0\0";
|
||||
|
||||
|
||||
f4ll::MemcpyDma::Init(MEMCPY_DMA_ENGINE, MEMCPY_DMA_STREAM);
|
||||
f4ll::CrcHandler::Init(DMA2, LL_DMA_STREAM_4);
|
||||
f4ll::ConsoleHandler::Init(UART4, CONSOLE_DMA_ENGINE, 0u, CONSOLE_TX_DMA_STREAM);
|
||||
|
@ -44,8 +46,9 @@ extern "C" void MainLoop()
|
|||
f4ll::PacketUsart u6{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 };
|
||||
|
||||
f4ll::PacketUsart * usarts[] = { &u1, &u2, &u3, &u6 };
|
||||
for(unsigned int i=0; i < sizeof(usarts) / sizeof(usarts[0]); ++i)
|
||||
g_usarts[i] = usarts[i];
|
||||
f4ll::PacketUsart **dst = g_usarts;
|
||||
for(auto usart: usarts)
|
||||
*dst++ = usart;
|
||||
|
||||
uint32_t lastStatsTick = 0;
|
||||
uint32_t prevSentTick = 0;
|
||||
|
@ -62,7 +65,7 @@ extern "C" void MainLoop()
|
|||
|
||||
lastStatsTick = HAL_GetTick();
|
||||
|
||||
for(auto u : usarts)
|
||||
for(auto u : g_usarts)
|
||||
u->SetupReceive();
|
||||
|
||||
for(;;) {
|
||||
|
@ -72,7 +75,7 @@ extern "C" void MainLoop()
|
|||
if(send)
|
||||
prevSentTick += PACKAGE_DELAY_MS;
|
||||
|
||||
for(auto u : usarts) {
|
||||
for(auto u : g_usarts) {
|
||||
if(!u->IsTxBusy() && send) {
|
||||
//DIAG_ENTER_BUSY();
|
||||
auto len = sizeof(text2Send) - 1 - (rand() & randmask);
|
||||
|
@ -88,10 +91,10 @@ extern "C" void MainLoop()
|
|||
}
|
||||
}
|
||||
if(tick - lastStatsTick > STATS_DELAY_MS) {
|
||||
f4ll::ConsoleHandler::Instance().PrintStats(statId, *usarts[statId]);
|
||||
f4ll::ConsoleHandler::Instance().PrintStats(statId, *g_usarts[statId]);
|
||||
lastStatsTick += STATS_DELAY_MS;
|
||||
++statId;
|
||||
if(statId >= sizeof(usarts) / sizeof(usarts[0]))
|
||||
if(statId >= sizeof(g_usarts) / sizeof(g_usarts[0]))
|
||||
statId = 0;
|
||||
}
|
||||
// uint32_t ein = LL_GPIO_ReadInputPort(KEY1_GPIO_Port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue