SD native mode bitbanging (4-bit). No write support yet
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
WCHAR ff_convert(WCHAR w, UINT dir) {
|
||||
return w;
|
||||
}*/
|
||||
|
||||
void file_init() {
|
||||
file_res=f_mount(0, &fatfs);
|
||||
}
|
||||
@@ -44,6 +43,9 @@ void file_open_by_filinfo(FILINFO* fno) {
|
||||
|
||||
void file_open(uint8_t* filename, BYTE flags) {
|
||||
file_res = f_open(&file_handle, (TCHAR*)filename, flags);
|
||||
file_block_off = sizeof(file_buf);
|
||||
file_block_max = sizeof(file_buf);
|
||||
file_status = file_res ? FILE_ERR : FILE_OK;
|
||||
}
|
||||
|
||||
void file_close() {
|
||||
@@ -79,3 +81,12 @@ UINT file_writeblock(void* buf, uint32_t addr, uint16_t size) {
|
||||
file_res = f_write(&file_handle, buf, size, &bytes_written);
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
uint8_t file_getc() {
|
||||
if(file_block_off == file_block_max) {
|
||||
file_block_max = file_read();
|
||||
if(file_block_max == 0) file_status = FILE_EOF;
|
||||
file_block_off = 0;
|
||||
}
|
||||
return file_buf[file_block_off++];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user