chore: rewrite to modbus rtu

This commit is contained in:
2024-11-09 00:36:06 +06:00
parent 0a0084f98f
commit 68f47c9d53
14 changed files with 506 additions and 167 deletions

View File

@@ -1,7 +1,6 @@
#ifndef __SIMPLE_EEPROM_H
#define __SIMPLE_EEPROM_H
#include <stdbool.h>
#include <stdint.h>
#include "ch32v003fun.h"
@@ -130,10 +129,10 @@ eeprom_status_t eeprom_init(void) {
uint16_t *page = (uint16_t *)EEPROM_BASE;
// check empty/partial page
bool needs_erase = true;
int needs_erase = 1;
for (int i = 0; i < EEPROM_MAX_ENTRIES; i++) {
if (page[i] != 0xFFFF) {
needs_erase = false;
needs_erase = 0;
break;
}
}