From 98ae8535afd447bbf4424a19d504f49bec6093fd Mon Sep 17 00:00:00 2001 From: Thomas Kuschel Date: Sat, 26 Oct 2024 23:24:45 +0200 Subject: [PATCH] CHG ringbuffer delimiter to \r --- stm32l4a6zg-f0x.at1/Core/Inc/at1_defines.h | 2 +- stm32l4a6zg-f0x.at1/Core/Inc/ringbuf.h | 4 ++++ stm32l4a6zg-f0x.at1/Core/Src/ringbuf.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stm32l4a6zg-f0x.at1/Core/Inc/at1_defines.h b/stm32l4a6zg-f0x.at1/Core/Inc/at1_defines.h index 9c39621..0523196 100644 --- a/stm32l4a6zg-f0x.at1/Core/Inc/at1_defines.h +++ b/stm32l4a6zg-f0x.at1/Core/Inc/at1_defines.h @@ -26,7 +26,7 @@ extern "C" { #define STR(x) STR_HELPER(x) #endif #define VERSION_MAJOR 0 -#define VERSION_MINOR 5 +#define VERSION_MINOR 6 #ifdef DEBUG #define VERSION_DEBUG ".D" #else diff --git a/stm32l4a6zg-f0x.at1/Core/Inc/ringbuf.h b/stm32l4a6zg-f0x.at1/Core/Inc/ringbuf.h index f8d85c8..ac9f881 100644 --- a/stm32l4a6zg-f0x.at1/Core/Inc/ringbuf.h +++ b/stm32l4a6zg-f0x.at1/Core/Inc/ringbuf.h @@ -8,6 +8,10 @@ #ifndef _INC_RINGBUF_H_ #define _INC_RINGBUF_H_ +/* Defines */ +/* given, was \n, should be \r */ +#define RINGBUF_DELIMITER '\r' + #define RING_STATISTICS_ENABLED 1 #define RINGBUF_MAX_READ_LEN 80 diff --git a/stm32l4a6zg-f0x.at1/Core/Src/ringbuf.c b/stm32l4a6zg-f0x.at1/Core/Src/ringbuf.c index 808c064..506d93b 100644 --- a/stm32l4a6zg-f0x.at1/Core/Src/ringbuf.c +++ b/stm32l4a6zg-f0x.at1/Core/Src/ringbuf.c @@ -135,7 +135,7 @@ int ringbuf_push(struct ringbuf *ring, const uint8_t *data, size_t size) { ring->head += (uint16_t)size; } for (delimiterpos = 0; delimiterpos < size; delimiterpos++) { - if (data[delimiterpos] == '\n' || data[delimiterpos] == 0 ) { + if (data[delimiterpos] == RINGBUF_DELIMITER || data[delimiterpos] == 0 ) { delimiterfound++; ptr = ring->buf + ((head + delimiterpos) % ring->size); *ptr = 0;