aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/backlog.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-26 14:15:14 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-26 14:15:14 +0200
commit5829fb58101a9edb6b9d31c9e22183f5159e1480 (patch)
tree684073a504f5bd9d8af7c459a32c07f37c799a3e /stm32f091/backlog.h
parent3608f1cc19f4bc102c1f0c5a3ab242e2e318a0b9 (diff)
implement backlog database functions
Diffstat (limited to 'stm32f091/backlog.h')
-rw-r--r--stm32f091/backlog.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/stm32f091/backlog.h b/stm32f091/backlog.h
index 7051ecf..465b3c0 100644
--- a/stm32f091/backlog.h
+++ b/stm32f091/backlog.h
@@ -20,10 +20,10 @@ typedef struct {
} ws_s_backlog_record;
typedef struct {
- uint16_t buffer_size; /**< buffer size (buffer_size + 1 = amount of records) */
+ uint16_t buffer_size; /**< buffer size (amount of records) */
uint16_t buffer_start; /** first record index */
uint16_t buffer_end; /** last record index */
- ws_s_backlog_record* records; /** pointer to record array */
+ ws_s_backlog_record records[]; /** record array */
} ws_s_backlog_database;
// disable struct packing
@@ -38,7 +38,7 @@ extern ws_s_backlog_database* WS_G_BACKLOG_DATABASE;
* automatically sets record.id, pushes buffer_end forwards and overwrites the
* last record if the buffer is full
*/
-void ws_backlog_add_record(ws_s_backlog_record* record);
+void ws_backlog_add_record(ws_s_backlog_record record);
/**
* there's intentionally no function to retrieve multiple records as an array,
@@ -52,3 +52,6 @@ void ws_backlog_add_record(ws_s_backlog_record* record);
/** @brief get pointer to record with index `record_index` from the database */
ws_s_backlog_record* ws_backlog_get_record(uint16_t record_index);
+/** @brief get pointer to last record with offset `record_offset` from the database */
+ws_s_backlog_record* ws_backlog_get_last_record(uint16_t record_offset);
+