Use defines in header for SD card buffers

multi_trace
DiSlord 5 years ago committed by erikkaashoek
parent a647621233
commit 3abd42e62c

@ -762,10 +762,6 @@ void send_buffer(uint8_t * buf, int s)
#ifndef __USE_SD_CARD__
#error "Need enable SD card support __USE_SD_CARD__ in nanovna.h, for use ENABLE_SD_CARD_CMD"
#endif
// Fat file system work area (at the end of spi_buffer)
static FATFS *fs_volume = (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS));
// FatFS file object (at the end of spi_buffer)
static FIL *fs_file = ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL));
static FRESULT cmd_sd_card_mount(void){
const FRESULT res = f_mount(fs_volume, "", 1);

@ -1322,6 +1322,17 @@ void rtc_set_time(uint32_t dr, uint32_t tr);
#include "../FatFs/ff.h"
#include "../FatFs/diskio.h"
bool SD_Inserted(void);
// Buffers for SD card use spi_buffer
#if SPI_BUFFER_SIZE < 2048
#error "SPI_BUFFER_SIZE for SD card support need size >= 2048"
#else
// Fat file system work area (at the end of spi_buffer)
#define fs_volume (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS))
// FatFS file object (at the end of spi_buffer)
#define fs_file ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL))
// Filename object (at the end of spi_buffer)
#define fs_filename ( char*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL) - FF_LFN_BUF - 4)
#endif
void testLog(void); // debug log
#endif

13
ui.c

@ -71,19 +71,6 @@ volatile uint8_t operation_requested = OP_NONE;
int8_t previous_marker = MARKER_INVALID;
#ifdef __USE_SD_CARD__
#if SPI_BUFFER_SIZE < 2048
#error "SPI_BUFFER_SIZE for SD card support need size >= 2048"
#else
// Fat file system work area (at the end of spi_buffer)
static FATFS *fs_volume = (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS));
// FatFS file object (at the end of spi_buffer)
static FIL *fs_file = ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL));
// Filename object (at the end of spi_buffer)
static char *fs_filename = ( char*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL) - FF_LFN_BUF - 4);
#endif
#endif
enum {
UI_NORMAL, UI_MENU, UI_KEYPAD
};

Loading…
Cancel
Save

Powered by TurnKey Linux.