DRESULT disk_read( BYTE pdrv, // Physical drive nmuber to identify the drive BYTE *buff, // Data buffer to store read data DWORD sector, // Sector address in LBA UINT count ) // Number of sectors to read { return sd_disk_read( buff, sector, count ); }
STATIC mp_obj_t pyb_sd_readblocks(mp_obj_t self, mp_obj_t block_num, mp_obj_t buf) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE); DRESULT res = sd_disk_read(bufinfo.buf, mp_obj_get_int(block_num), bufinfo.len / SD_SECTOR_SIZE); return MP_OBJ_NEW_SMALL_INT(res != RES_OK); // return of 0 means success }