[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:
DrZlo13
2021-01-12 00:52:35 +10:00
committed by GitHub
parent 6928122650
commit f94633863c
12 changed files with 1729 additions and 260 deletions

View File

@@ -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;
}