Update repo

This commit is contained in:
hangpersonal committed 2026-09-05 12:09:21 -07:00
1 parent ef5f9a563e
commit dfe8ec02bd
12 files changed
+723 -341

No files matched your search

@@ -0,0 +1,60 @@
#ifndef AT24CM02_H_
#define AT24CM02_H_
#include <stdint.h>
#include "FreeRTOS.h"
#ifdef __cplusplus
extern "C" {
#endif
#define AT24CM02_CAPACITY_BYTES 262144UL
#define AT24CM02_PAGE_SIZE_BYTES 256U
#define AT24CM02_PAGE_COUNT 1024U
#define AT24CM02_DEFAULT_ADDRESS 0x50U
typedef enum
{
EEPROM_STATUS_SUCCESS = 0,
EEPROM_STATUS_NOT_INITIALIZED,
EEPROM_STATUS_INVALID_ARGUMENT,
EEPROM_STATUS_OUT_OF_RANGE,
EEPROM_STATUS_NO_MEMORY,
EEPROM_STATUS_MUTEX_TIMEOUT,
EEPROM_STATUS_BUS_BUSY,
EEPROM_STATUS_TIMEOUT,
EEPROM_STATUS_NO_ACK,
EEPROM_STATUS_ARBITRATION_LOST
} EEPROM_Status;
// Configure GPIO91/GPIO92 and I2CA for 400-kHz operation. Call this once
// after Device_init() and Device_initGPIO(), before starting the scheduler.
EEPROM_Status EEPROM_init(void);
// Read or write an arbitrary byte range. A write that crosses a 256-byte page
// boundary is automatically split into multiple page-write transactions.
EEPROM_Status EEPROM_read(uint16_t *data, uint32_t address,
uint16_t deviceAddress, uint32_t byteCount,
TickType_t timeoutTicks);
EEPROM_Status EEPROM_write(const uint16_t *data, uint32_t address,
uint16_t deviceAddress, uint32_t byteCount,
TickType_t timeoutTicks);
// Page numbers are one-based (1 through 1024), matching the original driver.
EEPROM_Status EEPROM_pageNumberToAddress(uint16_t pageNumber,
uint32_t *pageAddress);
EEPROM_Status EEPROM_readPage(uint16_t *data, uint16_t deviceAddress,
uint16_t pageNumber, uint16_t byteCount,
TickType_t timeoutTicks);
EEPROM_Status EEPROM_writePage(const uint16_t *data, uint16_t deviceAddress,
uint16_t pageNumber, uint16_t byteCount,
TickType_t timeoutTicks);
const char *EEPROM_statusString(EEPROM_Status status);
#ifdef __cplusplus
}
#endif
#endif // AT24CM02_H_
@@ -0,0 +1,12 @@
/*****************************************************************************/
/* Must include stdio.h before this file for the definition of fpos_t */
/*****************************************************************************/
#include <stdio.h>
int UART_open(const char *path, unsigned flags, int llv_fd);
int UART_close(int dev_fd);
int UART_read(int dev_fd, char *buf, unsigned count);
int UART_write(int dev_fd, const char *buf, unsigned count);
fpos_t UART_lseek(int dev_fd, fpos_t offset, int origin);
int UART_unlink(const char *path);
int UART_rename(const char *old_name, const char *new_name);