12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "log_api.h"
- #include "log.h"
- #include "rtc.h"
- #include "ringfs.h"
- #include "spi_flash.h"
- #include "FreeRTOS.h"
- #include "task.h"
- #include "semphr.h"
- #include "rtc.h"
- #include <string.h>
- #include <stdio.h>
- #include <inttypes.h>
- #undef DBG
- #define DBG if(1)
- extern struct ringfs fs_archive;
- //
- void log_get_entry_count(entry_type_t entry_type)
- {
- int count_flash = 0;
-
- count_flash = ringfs_count_exact(&fs_archive);
- printf("Count archive entry: %u\r\n", count_flash);
- }
- //
- //void log_get_entry(uint32_t position)
- void log_get_entry(uint32_t position, uint32_t sector, uint32_t slot)
- {
- archive_entry_t entry = {0};
-
- int cur_position = fs_archive.cursor_position = position;
- int cur_sector = fs_archive.cursor.sector;
- int cur_slot = fs_archive.cursor.slot;
-
- fs_archive.cursor_position = position;
- fs_archive.cursor.sector = sector;
- fs_archive.cursor.slot = slot;
-
- log_fetch(&entry, ARCHIVE_ENTRY, portMAX_DELAY);
-
- fs_archive.cursor_position = cur_position;
- fs_archive.cursor.sector = cur_sector;
- fs_archive.cursor.slot = cur_slot;
-
- printf("[entry] timestamp = % " PRId64 ", value = %u, crc = %u\r\n", entry.timestamp, entry.input_value, entry.crc);
- }
|