RT-Thread / RT-Thread/rt-thread

EEPROM的设备框架

Open
#6,110 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

从源码上看,rt-thread还没有一个EEPROM的设备框架,是否考虑新增这个。关于memory的设备目前已经有了设备类型RT_Device_Class_MTD和RT_Device_Class_Block,但从这两个设备的API看来,主要还是面向Flash型的设备。
软件包到是有一个AT24Cxx,可能已经支持市面上很多EEPROM(很多非ATmal的也可以使用),但API的命名上还是以AT24为,在实际的项目中,可能还是容易造成误解,所以建议增加一个EEPROM的设备框架。
`#ifndef RT_EEPROM_H
#define RT_EEPROM_H

#include <rtthread.h>
#include <rtdevice.h>

struct rt_eeprom_ops
{
rt_err_t (*init)(rt_device_t dev);
rt_err_t (*write)(rt_device_t dev, rt_uint32_t addr, void *data, rt_size_t size);
rt_err_t (*read)(rt_device_t dev, rt_uint32_t addr, void *data, rt_size_t size);
rt_err_t (*control)(rt_device_t dev, rt_uint32_t cmd, void *arg);
rt_err_t (*close)(rt_device_t dev);
};

struct rt_eeprom_dev
{
struct rt_device parent;
struct rt_eeprom_ops *ops;
};

typedef struct rt_eeprom_dev rt_eeprom_t;

rt_size_t rt_eeprom_write(rt_device_t dev, rt_uint32_t addr, void *data, rt_size_t size);
rt_size_t rt_eeprom_read(rt_device_t dev, rt_uint32_t addr, void *data, rt_size_t size);
rt_err_t rt_eeprom_device_register(rt_eeprom_t *dev, char *name, void *user_data);

#endif /* RT_EEPROM_H */`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing RT_Device_Class_MTD and RT_Device_Class_Block APIs, then inspect the AT24Cxx package mentioned in the issue. The issue does not name files or tests; completion would require an agreed EEPROM device abstraction and a clear integration path for supported EEPROM devices.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.