#include <Card.h>

Inheritance diagram for Storage::SD::Card:
Collaboration diagram for Storage::SD::Card:

Public Member Functions

 Card (const String &name, SPIBase &spi)
 
 ~Card ()
 
bool begin (uint8_t chipSelect, uint32_t freq=0)
 Initialise the card. More...
 
void end ()
 
String getName () const override
 Obtain unique device name. More...
 
uint32_t getId () const
 Obtain device ID. More...
 
Type getType () const
 Obtain device type. More...
 
size_t getBlockSize () const override
 Obtain smallest allocation unit for erase operations. More...
 
- Public Member Functions inherited from Storage::Disk::BlockDevice
bool read (storage_size_t address, void *dst, size_t size) override
 Read data from the storage device. More...
 
bool write (storage_size_t address, const void *src, size_t size) override
 Write data to the storage device. More...
 
bool erase_range (storage_size_t address, storage_size_t size) override
 Erase a region of storage in preparation for writing. More...
 
storage_size_t getSize () const override
 Obtain addressable size of this device. More...
 
storage_size_t getSectorCount () const override
 Obtain total number of sectors on this device. More...
 
bool sync () override
 Flush any pending writes to the physical media. More...
 
bool allocateBuffers (unsigned numBuffers)
 Set number of sector buffers to use. More...
 
- Public Member Functions inherited from Storage::Device
 Device ()
 
 ~Device ()
 
bool operator== (const String &name) const
 
const PartitionTablepartitions () const
 Provide read-only access to partition table. More...
 
PartitionTableeditablePartitions ()
 Provide full access to partition table. More...
 
bool loadPartitions (uint32_t tableOffset)
 Load partition table entries @tableOffset Location of partition table to read. More...
 
bool loadPartitions (Device &source, uint32_t tableOffset)
 Load partition table entries from another table. More...
 
virtual uint16_t getSectorSize () const
 Get sector size, the unit of allocation for block-access devices. More...
 
size_t printTo (Print &p) const
 
- Public Member Functions inherited from LinkedObjectTemplate< Device >
Device * getNext () const
 
bool insertAfter (Device *object)
 
Iterator begin () const
 
Iterator end () const
 
Iterator cbegin () const
 
Iterator cend () const
 
- Public Member Functions inherited from LinkedObject
virtual ~LinkedObject ()
 
virtual LinkedObjectnext () const
 
bool insertAfter (LinkedObject *object)
 
bool operator== (const LinkedObject &other) const
 
bool operator!= (const LinkedObject &other) const
 

Public Attributes

const CIDcid {mCID}
 
const CSDcsd {mCSD}
 
- Public Attributes inherited from Storage::Disk::BlockDevice
Stat stat
 

Protected Member Functions

bool raw_sector_read (storage_size_t address, void *dst, size_t size) override
 
bool raw_sector_write (storage_size_t address, const void *src, size_t size) override
 
bool raw_sector_erase_range (storage_size_t address, size_t size) override
 
bool raw_sync () override
 
- Protected Member Functions inherited from Storage::Disk::BlockDevice
bool flushBuffer (Buffer &buf)
 
bool flushBuffers ()
 

Additional Inherited Members

- Public Types inherited from Storage::Device
enum class  Type : uint8_t { partitionType = uint8_t(Partition::Type::storage) , XX }
 Storage type. More...
 
using List = LinkedObjectListTemplate< Device >
 
using OwnedList = OwnedLinkedObjectListTemplate< Device >
 
- Public Types inherited from LinkedObjectTemplate< Device >
using Iterator = IteratorTemplate< Device, Device *, Device & >
 
using ConstIterator = IteratorTemplate< const Device, const Device *, const Device & >
 
- Static Public Attributes inherited from Storage::Device
static constexpr uint16_t defaultSectorSize {512}
 
- Protected Attributes inherited from Storage::Disk::BlockDevice
std::unique_ptr< BufferListbuffers
 
uint64_t sectorCount {0}
 
uint16_t sectorSize {defaultSectorSize}
 
uint8_t sectorSizeShift {getSizeBits(defaultSectorSize)}
 
- Protected Attributes inherited from Storage::Device
PartitionTable mPartitions
 

Constructor & Destructor Documentation

◆ Card()

Storage::SD::Card::Card ( const String name,
SPIBase spi 
)
inline

◆ ~Card()

Storage::SD::Card::~Card ( )
inline

Member Function Documentation

◆ begin()

bool Storage::SD::Card::begin ( uint8_t  chipSelect,
uint32_t  freq = 0 
)

Initialise the card.

Parameters
chipSelect
freqSPI frequency in Hz, use 0 for maximum supported frequency

◆ end()

void Storage::SD::Card::end ( )

◆ getBlockSize()

size_t Storage::SD::Card::getBlockSize ( ) const
inlineoverridevirtual

Obtain smallest allocation unit for erase operations.

Reimplemented from Storage::Disk::BlockDevice.

◆ getId()

uint32_t Storage::SD::Card::getId ( ) const
inlinevirtual

Obtain device ID.

Return values
uint32_ttypically flash chip ID

Reimplemented from Storage::Device.

◆ getName()

String Storage::SD::Card::getName ( ) const
inlineoverridevirtual

Obtain unique device name.

Implements Storage::Device.

◆ getType()

Type Storage::SD::Card::getType ( ) const
inlinevirtual

Obtain device type.

Implements Storage::Device.

◆ raw_sector_erase_range()

bool Storage::SD::Card::raw_sector_erase_range ( storage_size_t  address,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sector_read()

bool Storage::SD::Card::raw_sector_read ( storage_size_t  address,
void *  dst,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sector_write()

bool Storage::SD::Card::raw_sector_write ( storage_size_t  address,
const void *  src,
size_t  size 
)
overrideprotectedvirtual

◆ raw_sync()

bool Storage::SD::Card::raw_sync ( )
overrideprotectedvirtual

Member Data Documentation

◆ cid

const CID& Storage::SD::Card::cid {mCID}

◆ csd

const CSD& Storage::SD::Card::csd {mCSD}

The documentation for this class was generated from the following file: