sdio - sdio#

Adapted Air601 Air101/Air103

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

Example

-- The function of mounting the tf card to the file system in this sdio library has been replaced by the sdio mode of fatfs.
-- This sdio library only retains functions that directly read and write TF cards.
-- For example using sdio 0 to mount the TF card
fatfs.mount(fatfs.SDIO, "/sd", 0)

-- After the mount is completed, just use the relevant functions of the io library to operate it.
local f = io.open("/sd/abc.txt")

sdio.init(id)#

Initialization sdio

Parameters

Incoming Value Type

Explanation

int

The channel ID, which is related to the specific device, usually starts from 0, the default 0

Return Value

return value type

explanation

boolean

Open Results

Examples

None


sdio.sd_read(id, offset, len)#

direct reading and writing of data on sd card

Parameters

Incoming Value Type

Explanation

int

sdio Bus id

int

Offset, must be a multiple of 512

int

Length, must be a multiple of 512

Return Value

return value type

explanation

string

If the read is successful, return string, otherwise return nil

Examples

-- initialize sdio and read sd card data directly
sdio.init(0)
local t = sdio.sd_read(0, 0, 1024)
if t then
    --- xxx
end

sdio.sd_write(id, data, offset)#

write sd card directly

Parameters

Incoming Value Type

Explanation

int

sdio Bus id

string

The length of the data to be written must be a multiple of 512.

int

Offset, must be a multiple of 512

Return Value

return value type

explanation

bool

If the read is successful, return true, otherwise return false

Examples

-- initialize sdio and read sd card data directly
sdio.init(0)
local t = sdio.sd_write(0, data, 0)
if t then
    --- xxx
end