-
Notifications
You must be signed in to change notification settings - Fork 137
Write functions
-
All write commands take a last boolean argument 'errorCheck'. This argument defaults to
TRUE
, and does not need to be specified when calling a function.For example:
//Calling flash.writeByte(addressToWriteTo, dataToWrite); //or flash.writeByte(addressToWriteTo, dataToWrite, TRUE);
yields the same results.
-
However, when this argument is set to
NOERRCHK
, it does not check to see that the data has been properly written. This will speed up the writing process enormously at the risk of data corruption not being caught//Calling flash.writeByteArray(addressToWriteTo, bufferToWriteFrom, bufferSize, NOERRCHK); //instead of flash.writeByteArray(addressToWriteTo, bufferToWriteFrom, bufferSize);
will result in faster write speeds for the data array, but, any errors that occur will not be caught by the library.
This is useful only when speed is more important than catching erroneous writes.
Writes any type of variable / struct (any sized value) to a specific address. Takes the address where the data is to be written to and the variable / struct to write the data back to, as arguments.
Note: This function can be used to replace any of the write functions below (except writeByteArray()
and writeCharArray()
). However, if used for anything other than structs, this function runs slower than the data type-specific ones below.
Writes a byte (unsigned 8 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a char (signed 8 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a word (unsigned 16 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a short (signed 16 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes an unsigned long (unsigned 32 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a long (signed 32 bit value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a float (decimal value) to a specific address. Takes the address where the data is to be written to, as an argument. It returns a boolean value to indicate a successful/unsuccessful write.
Writes a string (String Object) to a specific address to an outputStr variable. Takes the address where the data is to be written to, and a String object to save the data to, as arguments. It returns a boolean value to indicate a successful/unsuccessful write.
Writes an array of bytes (unsigned 8-bit values) starting to a specific address. Takes the address and a data_buffer - i.e. an array of bytes to be write to the flash memory - and size of the array as arguments. uint8_t data_buffer[n];
The data buffer must be an array of n bytes. 'n' is limited by the amount of free RAM available on the microcontroller. It returns a boolean value to indicate a successful/unsuccessful write.
Writes an array of chars (signed 8-bit values) starting to a specific address. Takes the address and a data_buffer - i.e. an array of chars to be write to the flash memory - and size of the array as arguments. char data_buffer[n];
The data buffer must be an array of n chars. 'n' is limited by the amount of free RAM available on the Arduino board. It returns a boolean value to indicate a successful/unsuccessful write.
SPIFlash Library for Arduino
© Prajwal Bhattaram under the GNU GPLv3 License
Wiki status: Up to date: 08.03.2018