初始提交卡包 USB 工程
纳入固件源码、屏幕组件、nand_xfer 工具和文档。忽略本机构建产物、sdkconfig,以及含本机路径的依赖锁。 Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class AudioSourceFile {
|
||||
public:
|
||||
FILE* fp;
|
||||
|
||||
AudioSourceFile(const char* path) {
|
||||
fp = fopen(path, "rb");
|
||||
}
|
||||
|
||||
int read(uint8_t* buf, int len) {
|
||||
if (!fp) return 0;
|
||||
return fread(buf, 1, len, fp);
|
||||
}
|
||||
|
||||
void seek(int offset) {
|
||||
if (fp) fseek(fp, offset, SEEK_SET);
|
||||
}
|
||||
|
||||
bool isOpen() {
|
||||
return fp != nullptr;
|
||||
}
|
||||
|
||||
~AudioSourceFile() {
|
||||
if (fp) fclose(fp);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user