Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Picaso_4DGL-32PTU_Media.cpp
- Revision:
- 19:a259bc128867
- Parent:
- 18:829f3e2c064c
- Child:
- 20:88e137b9ea46
diff -r 829f3e2c064c -r a259bc128867 Picaso_4DGL-32PTU_Media.cpp --- a/Picaso_4DGL-32PTU_Media.cpp Thu Sep 15 12:40:48 2016 +0000 +++ b/Picaso_4DGL-32PTU_Media.cpp Thu Sep 15 13:31:53 2016 +0000 @@ -203,6 +203,35 @@ return success; } +//************************************************************************** +// Writes a byte to the current media address that was initially set with the +// “Set Sector Address” command. +// +// Note: Writing bytes or words to a media sector must start from the beginning +// of the sector. All writes will be incremental until the “Flush Media” command +// is executed, or the sector address rolls over to the next sector. +// When the “Flush Media” command is called, any remaining bytes in the sector +// will be padded with 0xFF, destroying the previous contents. +// An attempt to use the “Set Byte Address” command will result in the +// lower 9 bits being interpreted as zero. If the writing rolls over to the +// next sector, the “Flush Media” command is issued automatically internally. +//************************************************************************** +bool PICASO_4DGL :: media_WriteByte(short value) { + + char command[4] = ""; + + command[0] = (MEDIA_WRITE_BYTE >> (8*1)) & 0xff; + command[1] = (MEDIA_WRITE_BYTE >> (8*0)) & 0xff; + command[2] = (value >> (8*1)) & 0xff; + command[3] = (value >> (8*0)) & 0xff; + + writeCOMMAND(command, 4); + bool success = writeByteResponse(); +#ifdef DEBUGMODE + pc.printf("\n\r DEBUG: Write Byte: %i\n\r", success); +#endif + return success; +} @@ -233,3 +262,4 @@ +