|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.peripheral.external.M25P05
public class M25P05
Driver for the M25P05 flash memory chip as fitted to Sun SPOT external boards
Field Summary | |
---|---|
static int |
SPI_CONFIG
|
Constructor Summary | |
---|---|
M25P05(ISPI spi)
|
Method Summary | |
---|---|
void |
eraseChip()
Erase all data in the chip |
void |
eraseSectorAtAddress(int address)
Erase a sector |
int |
getLastSectorAvailableToJava()
Answer the last flash sector available to Java. |
int |
getNumberOfSectors()
Get the number of sectors in the device. |
int |
getNumberOfSectorsInRegion(int startAddress,
int length)
Find the number of sectors in a region of the flash memory. |
int |
getPageSize()
Get the page size for writing. |
int |
getSectorAddress(int sectorNum)
Get the address of a sector. |
int |
getSectorContainingAddress(int addr)
Find the sector associated with a given address in the flash. |
int |
getSectorSize(int sectorNum)
Get the size of a device sector |
int |
getSize()
Get the capacity of the device |
boolean |
isWriteProtected()
Check whether the device is write protected |
void |
read(int address,
int numOfBytes,
byte[] buffer,
int offset)
Read data from the M25P05 flash memory. |
boolean |
sectorErased(int address)
Check whether a sector is erased. |
void |
setWriteProtection(boolean b)
Set or clear the write protection |
boolean |
verify(int address,
int numOfBytes,
byte[] buffer)
Verify data in the M25P05 flash memory. |
void |
write(int address,
int numOfBytes,
byte[] buffer,
int offset)
Write data into the flash memory. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SPI_CONFIG
Constructor Detail |
---|
public M25P05(ISPI spi)
Method Detail |
---|
public void read(int address, int numOfBytes, byte[] buffer, int offset)
read
in interface IFlashMemoryDevice
address
- address in memory to start reading, in range 0 to 0xFFFFnumOfBytes
- number of bytes to read, in range 0 to (0x10000-address)buffer
- the hold the dataoffset
- offset into buffer for first byte readpublic void write(int address, int numOfBytes, byte[] buffer, int offset)
IFlashMemoryDevice
write
in interface IFlashMemoryDevice
address
- address in memory to start writing, no need to be page-alignednumOfBytes
- number of bytes to write, in range 0 to PAGE_SIZEbuffer
- the data to writeoffset
- the offset into the buffer of the first byte to writepublic boolean verify(int address, int numOfBytes, byte[] buffer)
verify
in interface IFlashMemoryDevice
address
- address in memory to start verifying, in range 0 to 0xFF00 but must be page-alignednumOfBytes
- number of bytes to write, in range 0 to PAGE_SIZEbuffer
- the data to verify against
public void eraseSectorAtAddress(int address)
eraseSectorAtAddress
in interface IFlashMemoryDevice
address
- an address within sector to erasepublic boolean sectorErased(int address)
sectorErased
in interface IFlashMemoryDevice
address
- an address within sector to check
public void eraseChip()
eraseChip
in interface IFlashMemoryDevice
public int getPageSize()
getPageSize
in interface IFlashMemoryDevice
public void setWriteProtection(boolean b)
b
- If b is true the device becomes write protected; if b is false the device becomes writable.public boolean isWriteProtected()
public int getSize()
getSize
in interface IFlashMemoryDevice
public int getSectorSize(int sectorNum)
getSectorSize
in interface IFlashMemoryDevice
sectorNum
- The sector whose size is to be returned
public int getNumberOfSectors()
IFlashMemoryDevice
getNumberOfSectors
in interface IFlashMemoryDevice
public int getLastSectorAvailableToJava()
IFlashMemoryDevice
getLastSectorAvailableToJava
in interface IFlashMemoryDevice
public int getSectorAddress(int sectorNum)
IFlashMemoryDevice
getSectorAddress
in interface IFlashMemoryDevice
sectorNum
- The sector whose address is to be returned
public int getSectorContainingAddress(int addr)
IFlashMemoryDevice
getSectorContainingAddress
in interface IFlashMemoryDevice
addr
- The address.
public int getNumberOfSectorsInRegion(int startAddress, int length)
IFlashMemoryDevice
getNumberOfSectorsInRegion
in interface IFlashMemoryDevice
startAddress
- The start of the region.length
- The size of the region.
|
SunSPOT API V4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |