[FL-520] Filesystem Api and App (#280)
* update fatfs integer types * fix sector size to 512 * fix sector size calculation * common fs api * fs api realization (sd card + fat fs) * better sector size definition * more api realization fns * add error description api, add common api * fix api flag naming, run app * add fs_info call * disable fatfs strfuncs, enable fatfs chmod * rework filesystem app * sd detect cycle, sd menu, sd eject feature * fix sd detect cycle * sd card format routine * ui improvements, sd info routine * properly unmount card * separate mode flags * add api folder, move app, rename app * fix api naming * update st-card-test to use api * update path to app * fixed potential problem of using sizeof union * updated api documentation, new time/date fns * update codeowners * changed app requirements * changed app order * sd insert/remove log
This commit is contained in:
		| @@ -47,7 +47,7 @@ | ||||
| /   2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. | ||||
| /   3: f_lseek() function is removed in addition to 2. */ | ||||
|  | ||||
| #define _USE_STRFUNC         2      /* 0:Disable or 1-2:Enable */ | ||||
| #define _USE_STRFUNC         0      /* 0:Disable or 1-2:Enable */ | ||||
| /* This option switches string functions, f_gets(), f_putc(), f_puts() and | ||||
| /  f_printf(). | ||||
| / | ||||
| @@ -68,7 +68,7 @@ | ||||
| #define	_USE_EXPAND		0 | ||||
| /* This option switches f_expand function. (0:Disable or 1:Enable) */ | ||||
|  | ||||
| #define _USE_CHMOD		0 | ||||
| #define _USE_CHMOD		1 | ||||
| /* This option switches attribute manipulation functions, f_chmod() and f_utime(). | ||||
| /  (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */ | ||||
|  | ||||
| @@ -177,7 +177,7 @@ | ||||
| /  arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() | ||||
| /  funciton will be available. */ | ||||
| #define _MIN_SS    512  /* 512, 1024, 2048 or 4096 */ | ||||
| #define _MAX_SS    4096  /* 512, 1024, 2048 or 4096 */ | ||||
| #define _MAX_SS    512  /* 512, 1024, 2048 or 4096 */ | ||||
| /* These options configure the range of sector size to be supported. (512, 1024, | ||||
| /  2048 or 4096) Always set both 512 for most systems, all type of memory cards and | ||||
| /  harddisk. But a larger value may be required for on-board flash memory and some | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| #include "api-hal-gpio.h" | ||||
| #include "api-hal-resources.h" | ||||
| #include "spi.h" | ||||
|  | ||||
| // init GPIO | ||||
| void hal_gpio_init( | ||||
| @@ -20,20 +21,27 @@ void hal_gpio_init( | ||||
|  | ||||
| bool hal_gpio_read_sd_detect(void) { | ||||
|     bool result = false; | ||||
|      | ||||
|  | ||||
|     // TODO open record | ||||
|     const GpioPin* sd_cs_record = &sd_cs_gpio; | ||||
|  | ||||
|     // TODO: SPI manager | ||||
|     api_hal_spi_lock(&SPI_SD_HANDLE); | ||||
|  | ||||
|     // configure pin as input | ||||
|     gpio_init_ex(sd_cs_record, GpioModeInput, GpioPullUp, GpioSpeedVeryHigh); | ||||
|     delay(50); | ||||
|     delay(1); | ||||
|  | ||||
|     // if gpio_read == 0 return true else return false | ||||
|     result = !gpio_read(sd_cs_record); | ||||
|  | ||||
|     // configure pin back | ||||
|     gpio_init_ex(sd_cs_record, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh); | ||||
|     delay(50); | ||||
|     gpio_write(sd_cs_record, 1); | ||||
|     delay(1); | ||||
|  | ||||
|     // TODO: SPI manager | ||||
|     api_hal_spi_unlock(&SPI_SD_HANDLE); | ||||
|  | ||||
|     return result; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user