35 #include <avr/pgmspace.h>
56 void printVoltage(
void);
59 void bluetoothTest(
void);
64 char PROGMEM voltageString[] =
"Battery Voltage";
65 char PROGMEM sensorString[] =
"Raw Sensor Data";
66 char PROGMEM ramString[] =
"Test external RAM";
67 char PROGMEM bluetoothString[] =
"Test Bluetooth Module";
79 printf(
"Initializing Hardware Test...\n");
103 printf(
"Hardware Test Initialized!\n");
127 void printVoltage(
void) {
131 void printRaw(
void) {
134 printf(
"Ax: %f Ay: %f Az: %f\n", v.
x, v.
y, v.
z);
136 printf(
"Gx: %f Gy: %f Gz: %f\n", v.
x, v.
y, v.
z);
138 printf(
"Mx: %f My: %f Mz: %f\n", v.
x, v.
y, v.
z);
141 #define CHECKSIZE 53248 // 52KB
147 printf(
"Allocating Test Memory...\n");
148 for (uint8_t i = 0; i <
MEMBANKS; i++) {
150 blocks[i] = (uint8_t *)malloc(CHECKSIZE);
151 if (blocks[i] == NULL) {
152 printf(
" Error: Couldn't allocate %liKB in Bank %i!\n", (CHECKSIZE / 1024), i);
154 printf(
" Bank %i ready!\n", i);
157 printf(
"Filling with data...\n");
158 for (uint8_t i = 0; i <
MEMBANKS; i++) {
160 for (uint16_t j = 0; j < CHECKSIZE; j++) {
161 blocks[i][j] = (j & 0xFF);
163 printf(
" Filled Bank %i!\n", i);
165 printf(
"Checking data...\n");
166 for (uint8_t i = 0; i <
MEMBANKS; i++) {
169 for (uint16_t j = 0; ((j < CHECKSIZE) && (!error)); j++) {
170 if (blocks[i][j] != (j & 0xFF)) {
171 printf(
" Error at %i in %i!\n", j, i);
176 printf(
" Bank %i okay!\n", i);
179 printf(
"Freeing memory...\n");
180 for (uint8_t i = 0; i <
MEMBANKS; i++) {
184 printf(
"Finished!\n");
189 void bluetoothTest(
void) {
190 printf(
"Please disconnect, wait 10s, then reconnect!\n");
191 printf(
"All data will be logged, then printed after 15s.\n");
197 printf(
"\n\nDone!\n");