My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Sd2Card_sdio.h 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "../inc/MarlinConfig.h"
  24. #include "SdInfo.h"
  25. #include "disk_io_driver.h"
  26. bool SDIO_Init();
  27. bool SDIO_ReadBlock(uint32_t block, uint8_t *dst);
  28. bool SDIO_WriteBlock(uint32_t block, const uint8_t *src);
  29. bool SDIO_IsReady();
  30. uint32_t SDIO_GetCardSize();
  31. class DiskIODriver_SDIO : public DiskIODriver {
  32. public:
  33. bool init(const uint8_t sckRateID=0, const pin_t chipSelectPin=0) override { return SDIO_Init(); }
  34. bool readCSD(csd_t *csd) override { return false; }
  35. bool readStart(const uint32_t block) override { curBlock = block; return true; }
  36. bool readData(uint8_t *dst) override { return readBlock(curBlock++, dst); }
  37. bool readStop() override { curBlock = -1; return true; }
  38. bool writeStart(const uint32_t block, const uint32_t) override { curBlock = block; return true; }
  39. bool writeData(const uint8_t *src) override { return writeBlock(curBlock++, src); }
  40. bool writeStop() override { curBlock = -1; return true; }
  41. bool readBlock(uint32_t block, uint8_t *dst) override { return SDIO_ReadBlock(block, dst); }
  42. bool writeBlock(uint32_t block, const uint8_t *src) override { return SDIO_WriteBlock(block, src); }
  43. uint32_t cardSize() override { return SDIO_GetCardSize(); }
  44. bool isReady() override { return SDIO_IsReady(); }
  45. void idle() override {}
  46. private:
  47. uint32_t curBlock;
  48. };