mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Incredibly ugly workaround
This commit is contained in:
parent
519048b32b
commit
b0b775ffb0
@ -6,6 +6,10 @@
|
||||
# error "The ID used to communicate SPATZ initialization was not defined."
|
||||
#endif // STA_INIT_SPATZ_ID
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <usart.h>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
namespace spatz
|
||||
@ -30,26 +34,41 @@ namespace sta
|
||||
{
|
||||
sta::lock_guard<sta::Mutex> lock(*mutex_);
|
||||
|
||||
Debug->println("%d", id);
|
||||
Debug->read(buffer, length);
|
||||
Debug->printf("%d", id);
|
||||
Debug->read(buffer, length);
|
||||
}
|
||||
|
||||
void request(uint8_t id, float * buffer, size_t length)
|
||||
{
|
||||
sta::lock_guard<sta::Mutex> lock(*mutex_);
|
||||
mutex_->acquire();
|
||||
|
||||
// Debug->println(id, IntegerBase::DEC);
|
||||
bool success = false;
|
||||
|
||||
Debug->printf("%d", id);
|
||||
Debug->read(buffer, length);
|
||||
while (!success)
|
||||
{
|
||||
Debug->printf("%d", id);
|
||||
|
||||
HAL_StatusTypeDef state = HAL_UART_Receive(&huart1, reinterpret_cast<uint8_t*>(buffer), length * sizeof(float), 100);
|
||||
|
||||
if (state == HAL_TIMEOUT)
|
||||
{
|
||||
success = false;
|
||||
Debug->println(">ERROR");
|
||||
break;
|
||||
}
|
||||
|
||||
success = true;
|
||||
}
|
||||
|
||||
mutex_->release();
|
||||
}
|
||||
|
||||
void request(uint8_t id, double * buffer, size_t length)
|
||||
{
|
||||
sta::lock_guard<sta::Mutex> lock(*mutex_);
|
||||
|
||||
Debug->println("%d", id);
|
||||
Debug->read(buffer, length);
|
||||
Debug->printf("%d", id);
|
||||
Debug->read(buffer, length);
|
||||
}
|
||||
} // namespace spatz
|
||||
} // namespace sta
|
||||
|
@ -33,7 +33,7 @@ namespace sta
|
||||
{
|
||||
STA_ASSERT(buffer != nullptr);
|
||||
|
||||
HAL_UART_Receive(handle_, buffer, size, HAL_MAX_DELAY);
|
||||
HAL_UART_Receive(handle_, buffer, size, 1);
|
||||
}
|
||||
|
||||
void STM32UART::fill(uint8_t value, size_t count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user