Ardupilot2/libraries/AP_HAL/examples/Storage/Storage.cpp
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00

46 lines
812 B
C++

/*
simple test of Storage API
*/
#include <AP_HAL/AP_HAL.h>
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
AP_HAL::Storage *st;
void setup(void)
{
/*
init Storage API
*/
hal.console->printf_P("Starting AP_HAL::Storage test\r\n");
st->init(NULL);
/*
Calculate XOR of the full conent of memory
Do it by block of 8 bytes
*/
unsigned int i, j;
unsigned char buff[8], XOR_res = 0;
for(i = 0; i < HAL_STORAGE_SIZE; i += 8)
{
st->read_block((void *) buff, i, 8);
for(j = 0; j < 8; j++)
XOR_res ^= buff[j];
}
/*
print XORed result
*/
hal.console->printf_P("XORed ememory: %u\r\n", (unsigned) XOR_res);
}
// In main loop do nothing
void loop(void)
{
hal.scheduler->delay(1000);
}
AP_HAL_MAIN();