SPI Flash Driver API¶
Header File¶
Source: include/spifs.h
#include <spifs.h>
Functions¶
-
int spifs_enable(int port, int gpio_cs, unsigned long speed_hz, int mode)¶
Enable SPI Flash and mount LFS filesystem
- Parameters
port – [in] SPI Port to use
gpio_cs – [in] GPIO number connected to SPI chip select
speed_hz – [in] SPI Speed in Hz (max 10MHz)
mode – [in] SPI mode
- Returns
0 on success, negative value on failure
-
int spifs_disable(void)¶
Disable SPI Flash and unmount LFS filesystem
- Returns
0 on success, negative value on failure
Enumerations¶
-
enum sfstat_e¶
SPI Flash status
Values:
-
enumerator SF_STAT_NOTENABLED¶
SPI Flash not enabled (Either not found or Initialization error)
-
enumerator SF_STAT_ENABLED¶
SPI Flash enabled but not mounted (Filesystem mount issue, Try spifs_enable() again
-
enumerator SF_STAT_MOUNTED¶
SPI Flash enabled and filesystem is mounted successfully
-
enumerator SF_STAT_NOTENABLED¶
