mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-21 15:25:29 +03:00
SPRACINGF3EVO board support (#266)
* Initial SPRACINGF3EVO support * General SD-Card support; enable SD-Card for EVO
This commit is contained in:
parent
8817a2fb80
commit
688e75c82d
26 changed files with 1376 additions and 128 deletions
|
@ -46,6 +46,7 @@
|
|||
#include "drivers/gpio.h"
|
||||
#include "drivers/timer.h"
|
||||
#include "drivers/pwm_rx.h"
|
||||
#include "drivers/sdcard.h"
|
||||
|
||||
#include "drivers/buf_writer.h"
|
||||
|
||||
|
@ -57,6 +58,7 @@
|
|||
#include "io/ledstrip.h"
|
||||
#include "io/flashfs.h"
|
||||
#include "io/beeper.h"
|
||||
#include "io/asyncfatfs/asyncfatfs.h"
|
||||
|
||||
#include "rx/rx.h"
|
||||
#include "rx/spektrum.h"
|
||||
|
@ -159,6 +161,10 @@ static void cliFlashRead(char *cmdline);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDCARD
|
||||
static void cliSdInfo(char *cmdline);
|
||||
#endif
|
||||
|
||||
#ifdef BEEPER
|
||||
static void cliBeeper(char *cmdline);
|
||||
#endif
|
||||
|
@ -211,7 +217,7 @@ static const char * const accNames[] = { "None", "", "ADXL345", "MPU6050", "MMA8
|
|||
// sync with baroSensor_e
|
||||
static const char * const baroNames[] = { "", "None", "BMP085", "MS5611", "BMP280", "FAKE"};
|
||||
// sync with magSensor_e
|
||||
static const char * const magNames[] = { "None", "", "HMC5883", "AK8975", "MAG_GPS", "MAG_MAG3110", "FAKE"};
|
||||
static const char * const magNames[] = { "None", "", "HMC5883", "AK8975", "MAG_GPS", "MAG_MAG3110", "MAG_AK8963", "FAKE"};
|
||||
// sycn with rangefinderType_e
|
||||
static const char * const rangefinderNames[] = { "None", "HCSR04", "SRF10"};
|
||||
|
||||
|
@ -306,6 +312,9 @@ const clicmd_t cmdTable[] = {
|
|||
"\treset\r\n"
|
||||
"\tload <mixer>\r\n"
|
||||
"\treverse <servo> <source> r|n", cliServoMix),
|
||||
#endif
|
||||
#ifdef USE_SDCARD
|
||||
CLI_COMMAND_DEF("sd_info", "sdcard info", NULL, cliSdInfo),
|
||||
#endif
|
||||
CLI_COMMAND_DEF("status", "show status", NULL, cliStatus),
|
||||
#ifndef SKIP_TASK_STATISTICS
|
||||
|
@ -365,7 +374,7 @@ static const char * const lookupTableGimbalMode[] = {
|
|||
|
||||
#ifdef BLACKBOX
|
||||
static const char * const lookupTableBlackboxDevice[] = {
|
||||
"SERIAL", "SPIFLASH"
|
||||
"SERIAL", "SPIFLASH", "SDCARD"
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -1637,6 +1646,77 @@ static void cliServoMix(char *cmdline)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDCARD
|
||||
static void cliWriteBytes(const uint8_t *buffer, int count)
|
||||
{
|
||||
while (count > 0) {
|
||||
cliWrite(*buffer);
|
||||
buffer++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
static void cliSdInfo(char *cmdline)
|
||||
{
|
||||
UNUSED(cmdline);
|
||||
|
||||
cliPrint("SD card: ");
|
||||
|
||||
if (!sdcard_isInserted()) {
|
||||
cliPrint("None inserted\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sdcard_isInitialized()) {
|
||||
cliPrint("Startup failed\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
const sdcardMetadata_t *metadata = sdcard_getMetadata();
|
||||
|
||||
cliPrintf("Manufacturer 0x%x, %ukB, %02d/%04d, v%d.%d, '",
|
||||
metadata->manufacturerID,
|
||||
metadata->numBlocks / 2, /* One block is half a kB */
|
||||
metadata->productionMonth,
|
||||
metadata->productionYear,
|
||||
metadata->productRevisionMajor,
|
||||
metadata->productRevisionMinor
|
||||
);
|
||||
|
||||
cliWriteBytes((uint8_t*)metadata->productName, sizeof(metadata->productName));
|
||||
|
||||
cliPrint("'\r\n" "Filesystem: ");
|
||||
|
||||
switch (afatfs_getFilesystemState()) {
|
||||
case AFATFS_FILESYSTEM_STATE_READY:
|
||||
cliPrint("Ready");
|
||||
break;
|
||||
case AFATFS_FILESYSTEM_STATE_INITIALIZATION:
|
||||
cliPrint("Initializing");
|
||||
break;
|
||||
case AFATFS_FILESYSTEM_STATE_UNKNOWN:
|
||||
case AFATFS_FILESYSTEM_STATE_FATAL:
|
||||
cliPrint("Fatal");
|
||||
|
||||
switch (afatfs_getLastError()) {
|
||||
case AFATFS_ERROR_BAD_MBR:
|
||||
cliPrint(" - no FAT MBR partitions");
|
||||
break;
|
||||
case AFATFS_ERROR_BAD_FILESYSTEM_HEADER:
|
||||
cliPrint(" - bad FAT header");
|
||||
break;
|
||||
case AFATFS_ERROR_GENERIC:
|
||||
case AFATFS_ERROR_NONE:
|
||||
; // Nothing more detailed to print
|
||||
break;
|
||||
}
|
||||
|
||||
cliPrint("\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_FLASHFS
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue