_4Dsystems::uDRIVE_uSD_G1< SerialInterface > Class Template Reference
[uDRIVE-uSD-G1 Module]

4D Systems uDrive-uSD-G1 module. You can use any serial implementation (software, hardware). But it has to be a class/structure providing the following methods : More...

#include <uDRIVE_uSD_G1.h>

List of all members.

Public Member Functions

 uDRIVE_uSD_G1 ()
 ~uDRIVE_uSD_G1 ()
int8_t Initialize (SerialInterface *iSerial)
int8_t ReadSectorBlock (const uint32_t &iAddress, uint8_t *iData)
int8_t WriteSectorBlock (const uint32_t &iAddress, uint8_t *iData)
int8_t SetMemoryAddress (const uint32_t &iAddress)
int8_t ReadSingleByte (uint8_t &iByte)
int8_t WriteSingleByte (const uint8_t &iByte)
int8_t RequestDeviceInfo (DeviceInfo &iInfo)

Classes

union  DeviceInfo


Detailed Description

template<typename SerialInterface>
class _4Dsystems::uDRIVE_uSD_G1< SerialInterface >

4D Systems uDrive-uSD-G1 module. You can use any serial implementation (software, hardware). But it has to be a class/structure providing the following methods :

Here's a little example.

 int8_t  err;
 uint8_t buffer[512];
 
 Serial.begin(115200);
 Serial.flush();
 
 _4Dsystems::uDRIVE_uSD_G1<HardwareSerial> microDrive;
 
 err = microDrive.Initialize(&Serial);
 if(err == _4Dsystems::OK)
 {
     err = microDrive.ReadSectorBlock(0x00000000, buffer);
     if(err == _4Dsystems::OK)
     {
         // do something
     } 
 }

Definition at line 126 of file uDRIVE_uSD_G1.h.


Constructor & Destructor Documentation

template<typename SerialInterface>
_4Dsystems::uDRIVE_uSD_G1< SerialInterface >::uDRIVE_uSD_G1 (  )  [inline]

Constructor

Definition at line 180 of file uDRIVE_uSD_G1.h.

template<typename SerialInterface>
_4Dsystems::uDRIVE_uSD_G1< SerialInterface >::~uDRIVE_uSD_G1 (  )  [inline]

Destructor

Definition at line 185 of file uDRIVE_uSD_G1.h.


Member Function Documentation

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::Initialize ( SerialInterface *  iSerial  )  [inline]

Initialize module and memory card

Parameters:
iSerial serial interface
Returns:
  • OK if the module sent an ACK.
  • COMMAND_ERROR otherwise.

Definition at line 194 of file uDRIVE_uSD_G1.h.

References EXTENDED, INITIALIZE_DISK, INITIALIZE_MODULE, and _4Dsystems::OK.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::ReadSectorBlock ( const uint32_t &  iAddress,
uint8_t *  iData 
) [inline]

Read a sector (512 bytes) from the card memory.

Parameters:
iAddress 3 bytes sector address. Sector address range from 0 to 16,777,215 dependning on the card capacity. Each sector is 512 bytes long.
iData pointer to the memory where the sector will be stored. It must be large enough to store a complete sector.
Returns:
  • INVALID_DATA if iData is NULL.
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • OK if the sector was succesfully read.

Definition at line 235 of file uDRIVE_uSD_G1.h.

References EXTENDED, _4Dsystems::INVALID_DATA, _4Dsystems::OK, READ_SECTOR_BLOCK_DATA, and _4Dsystems::UNITIALIZED_ERROR.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::WriteSectorBlock ( const uint32_t &  iAddress,
uint8_t *  iData 
) [inline]

Download and write 512 bytes to a sector of the card memory.

Parameters:
iAddress 3 bytes sector address. Sector address range from 0 to 16,777,215 dependning on the card capacity. Each sector is 512 bytes long.
iData pointer to the data to be written. It must contains a least 512 bytes.
Returns:
  • INVALID_DATA if iData is NULL.
  • COMMAND_ERROR if the module was unable to process the command.
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • OK if the write operation was succesful.

Definition at line 277 of file uDRIVE_uSD_G1.h.

References EXTENDED, _4Dsystems::INVALID_DATA, _4Dsystems::UNITIALIZED_ERROR, and WRITE_SECTOR_BLOCK_DATA.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::SetMemoryAddress ( const uint32_t &  iAddress  )  [inline]

Set the memory address pointer for byte wise operations. This pointer is automatically incremented to the next memory address after a byte is read or written.

Parameters:
iAddress 4 bytes memory address.
Returns:
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • COMMAND_ERROR if the module was unable to process the command.
  • OK if the memory pointer was succesfully set.

Definition at line 319 of file uDRIVE_uSD_G1.h.

References EXTENDED, SET_MEMORY_ADDRESS, and _4Dsystems::UNITIALIZED_ERROR.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::ReadSingleByte ( uint8_t &  iByte  )  [inline]

Read a single byte. You must set the memory address location using SetMemoryAddress before using this method. The memory address location pointer is automatically incremented to the next address location.

Parameters:
iByte byte to read
Returns:
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • OK if the memory pointer was succesfully set.

Definition at line 348 of file uDRIVE_uSD_G1.h.

References EXTENDED, _4Dsystems::OK, READ_SINGLE_BYTE, and _4Dsystems::UNITIALIZED_ERROR.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::WriteSingleByte ( const uint8_t &  iByte  )  [inline]

Write a single byte. You must set the memory address location using SetMemoryAddress before using this method. The memory address location pointer is automatically incremented to the next address location.

Parameters:
iByte byte to write
Returns:
  • COMMAND_ERROR if the module was unable to process the command.
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • OK if the write operation was succesful.
Warning:
PmmC firmware rev1 has bug. The internal memory address location is not incremented to the next sector block (fixed in rev2 24/03/2008). So if you don't plan to upgrade the firmware, or has no mean to you should keep an counter and call SetMemoryAddress when you cross a sector boundary (ie when (baseAddress + counter) & 511 == 0).

Definition at line 392 of file uDRIVE_uSD_G1.h.

References EXTENDED, _4Dsystems::UNITIALIZED_ERROR, and WRITE_SINGLE_BYTE.

template<typename SerialInterface>
int8_t _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::RequestDeviceInfo ( DeviceInfo iInfo  )  [inline]

Request device informations.

Parameters:
iInfo Retreived device informations.
Returns:
  • UNITIALIZED_ERROR if the module wasn't initialized.
  • OK if the memory pointer was succesfully set.

Definition at line 448 of file uDRIVE_uSD_G1.h.

References _4Dsystems::uDRIVE_uSD_G1< SerialInterface >::DeviceInfo::_data, _4Dsystems::OK, _4Dsystems::UNITIALIZED_ERROR, and VERSION.


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

Generated on Mon Apr 7 22:10:19 2008 for uDRIVE_uSD_G1 by  doxygen 1.5.5