Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Arduino SdFat Library
  2. * Copyright (C) 2012 by William Greiman
  3. *
  4. * This file is part of the Arduino SdFat Library
  5. *
  6. * This Library is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This Library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with the Arduino SdFat Library. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef SdVolume_h
  21. #include "SdSpiCard.h"
  22. #include "utility/FatLib.h"
  23. #define SdVolume_h
  24. #ifndef USE_SD_VOLUME
  25. #error SdVolume is deperacated. Remove this line to continue using this class.
  26. #endif // USE_SD_VOLUME
  27. //==============================================================================
  28. /**
  29. * \class SdVolume
  30. * \brief SdVolume used in Quick start. Soon to be removed.
  31. */
  32. class SdVolume : public FatVolume {
  33. public:
  34. /** Initialize a FAT volume. Try partition one first then try super
  35. * floppy format.
  36. *
  37. * \param[in] dev The Sd2Card where the volume is located.
  38. *
  39. * \return true for success else false.
  40. */
  41. bool init(Sd2Card* dev) {return init(dev, 1) ? true : init(dev, 0);}
  42. /** Initialize a FAT volume.
  43. *
  44. * \param[in] dev The Sd2Card where the volume is located.
  45. * \param[in] part the partition to use. Zero for super floppy or 1-4.
  46. * \return true for success else false.
  47. */
  48. bool init(Sd2Card* dev, uint8_t part) {
  49. m_sdCard = dev;
  50. return FatVolume::init(part);
  51. }
  52. private:
  53. // friend class FatFile;
  54. bool readBlock(uint32_t block, uint8_t* dst) {
  55. return m_sdCard->readBlock(block, dst);
  56. }
  57. bool writeBlock(uint32_t block, const uint8_t* src) {
  58. return m_sdCard->writeBlock(block, src);
  59. }
  60. bool readBlocks(uint32_t block, uint8_t* dst, size_t n) {
  61. return m_sdCard->readBlocks(block, dst, n);
  62. }
  63. bool writeBlocks(uint32_t block, const uint8_t* src, size_t n) {
  64. return m_sdCard->writeBlocks(block, src, n);
  65. }
  66. Sd2Card* m_sdCard; // Sd2Card object for cache
  67. };
  68. #endif // SdVolume_h