Skip to content

Commit

Permalink
Added littlefs support for flash based file storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
terjeio committed Sep 11, 2022
1 parent b3c450d commit 9e2d0c6
Show file tree
Hide file tree
Showing 8 changed files with 6,963 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ add_executable(grblHAL
sdcard/sdcard.c
sdcard/ymodem.c
sdcard/fs_fatfs.c
sdcard/fs_littlefs.c
bluetooth/hc_05.c
motors/trinamic.c
littlefs/lfs.c
littlefs/lfs_util.c
littlefs_hal.c
)

pico_generate_pio_header(grblHAL ${CMAKE_CURRENT_LIST_DIR}/driverPIO.pio)

target_compile_definitions(grblHAL PUBLIC RP2040)
target_compile_definitions(grblHAL PUBLIC NEW_FATFS)
target_compile_definitions(grblHAL PUBLIC LITTLEFS_ENABLE=1)

if(ADD_WIFI)
target_compile_definitions(grblHAL PUBLIC WIFI_ENABLE=1)
Expand Down
13 changes: 10 additions & 3 deletions driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
#include "diskio.h"
#endif

#if LITTLEFS_ENABLE
#include "littlefs_hal.h"
#include "sdcard/fs_littlefs.h"
#endif

#if USB_SERIAL_CDC
#include "usb_serial.h"
#endif
Expand Down Expand Up @@ -1839,11 +1844,13 @@ static bool driver_setup (settings_t *settings)
gpio_init(MPG_MODE_PIN);
#endif

#if LITTLEFS_ENABLE && WEBUI_ENABLE
fs_littlefs_mount("/littlefs", pico_littlefs_hal());
#endif

IOInitDone = settings->version == 21;

hal.settings_changed(settings);
hal.spindle.set_state((spindle_state_t){0}, 0.0f);
hal.coolant.set_state((coolant_state_t){0});
stepperSetDirOutputs((axes_signals_t){0});

#if PPI_ENABLE
Expand Down Expand Up @@ -1904,7 +1911,7 @@ bool driver_init (void)
systick_hw->csr = M0PLUS_SYST_CSR_TICKINT_BITS|M0PLUS_SYST_CSR_ENABLE_BITS;

hal.info = "RP2040";
hal.driver_version = "220907";
hal.driver_version = "220911";
hal.driver_options = "SDK_" PICO_SDK_VERSION_STRING;
#ifdef BOARD_NAME
hal.board = BOARD_NAME;
Expand Down
Loading

0 comments on commit 9e2d0c6

Please sign in to comment.