#ifndef HOST_VERSION
bootloader();
#else
- printf("not implemented\n");
+ printf_P(PSTR("not implemented\n"));
#endif
}
(void)parsed_result;
(void)data;
#ifdef HOST_VERSION
- printf("not implemented\n");
+ printf_P(PSTR("not implemented\n"));
#else
- printf("res stack: %d\r\n", min_stack_space_available());
+ printf_P(PSTR("res stack: %d\r\n"), min_stack_space_available());
#endif
}
#include "sd_raw_config.h"
#include "sd_log.h"
-#define debug_printf(args...) do { } while (0)
-/* #define debug_printf(args...) printf(args) */
+#define debug_printf(fmt, a...) do { } while (0)
+/* #define debug_printf(fmt, ...) printf_P(PSTR(fmt), ##__VA_ARGS__) */
#define GPS_UART 0
continue;
if (rxframe.data[0] == 0x83)
- printf("ACK\n");
+ printf_P(PSTR("ACK\n"));
else if (rxframe.data[0] == 0x84)
- printf("NACK\n");
+ printf_P(PSTR("NACK\n"));
else
- printf("ZARB\n");
+ printf_P(PSTR("ZARB\n"));
break;
}
/* display current GPS position stored in the global variable */
static void display_gps(void)
{
- printf("id %.2X mode %.2X svnum %.2X gpsw %.4X tow %.10"PRIu32"\t",
+ printf_P(PSTR("id %.2X mode %.2X svnum %.2X gpsw %.4X "
+ "tow %.10"PRIu32"\t"),
gps_pos.msg_id,
gps_pos.mode,
gps_pos.sv_num,
gps_pos.gps_week,
gps_pos.tow);
- printf("lat %.8"PRIx32" long %.8"PRIx32" alt %.8"PRIx32"\n",
+ printf_P(PSTR("lat %.8"PRIx32" long %.8"PRIx32" alt %.8"PRIx32"\n"),
gps_pos.latitude,
gps_pos.longitude,
gps_pos.altitude);
- printf("gdop %3.3f pdop %3.3f hdop %3.3f vdop %3.3f tdop %3.3f\n",
+ printf_P(PSTR("gdop %3.3f pdop %3.3f hdop %3.3f vdop %3.3f "
+ "tdop %3.3f\n"),
(double)gps_pos.gdop/100.,
(double)gps_pos.pdop/100.,
(double)gps_pos.hdop/100.,
(double)gps_pos.vdop/100.,
(double)gps_pos.tdop/100.);
- printf("lat %3.5f long %3.5f alt %3.5f sea_alt %3.5f\n",
+ printf_P(PSTR("lat %3.5f long %3.5f alt %3.5f sea_alt %3.5f\n"),
(double)gps_pos.latitude/10000000.,
(double)gps_pos.longitude/10000000.,
(double)gps_pos.altitude/100.,
(double)gps_pos.sea_altitude/100.);
- printf("vx %3.3f vy %3.3f vz %3.3f\n",
+ printf_P(PSTR("vx %3.3f vy %3.3f vz %3.3f\n"),
(double)gps_pos.ecef_vx/100.,
(double)gps_pos.ecef_vy/100.,
(double)gps_pos.ecef_vz/100.);
static void venus634_configure(void)
{
/* ask the GPS to reset */
- printf("init...");
+ printf_P(PSTR("init..."));
venus634_restart();
wait_ack(M_RESTART);
* properly */
wait_ms(500);
- printf("binmode...");
+ printf_P(PSTR("binmode..."));
venus634_msg_type();
wait_ack(M_OUTPUT);
- printf("waas...");
+ printf_P(PSTR("waas..."));
venus634_waas();
wait_ack(M_WAAS);
- printf("rate...");
+ printf_P(PSTR("rate..."));
venus634_rate();
wait_ack(M_RATE);
- printf("GPS configuration done !\n");
+ printf_P(PSTR("GPS configuration done !\n"));
}
/*
}
}
else
- printf("%s", buf);
+ printf_P(PSTR("%s"), buf);
}
#include <stdio.h>
#include <string.h>
+#include <aversive/pgmspace.h>
#include <aversive/wait.h>
#include "i2cm_sw.h"
err = i2cm_send(i2c_addr, ®_addr, 1);
if (err) {
- printf("read reg len: i2c error send\r\n");
+ printf_P(PSTR("read reg len: i2c error send\r\n"));
return err;
}
err = i2cm_recv(i2c_addr, len);
if (err) {
- printf("read reg len: i2c error recv\r\n");
+ printf_P(PSTR("read reg len: i2c error recv\r\n"));
return err;
}
err = i2cm_get_recv_buffer(values, len);
if (err != len) {
- printf("read reg len: i2c error get recv\r\n");
+ printf_P(PSTR("read reg len: i2c error get recv\r\n"));
return 0xFF;
}
err = i2cm_send(address, (unsigned char*)buffer, 2);
if (err)
- printf("send_mpu6050_cmd(reg=%x): error %.2X\r\n", reg, err);
+ printf_P(PSTR("send_mpu6050_cmd(reg=%x): error %.2X\r\n"),
+ reg, err);
err = read_reg(address, reg, &check);
if (err)
return err;
if (check != val) {
- printf("reg %x: %x != %x\r\n", reg, check, val);
+ printf_P(PSTR("reg %x: %x != %x\r\n"), reg, check, val);
return 0xff;
}
s_gy += g_values[1];
s_gz += g_values[2];
}
- printf("%"PRId32" %"PRId32" %"PRId32" (%"PRIu16") \r\n", s_gx, s_gy, s_gz, i);
+ printf_P(PSTR("%"PRId32" %"PRId32" %"PRId32" (%"PRIu16") \r\n"),
+ s_gx, s_gy, s_gz, i);
s_gx /= i;
s_gy /= i;
s_gz /= i;
drift_g[0] = s_gx;
drift_g[1] = s_gy;
drift_g[2] = s_gz;
- printf("gyro drift:\r\n");
- printf("%d %d %d\r\n",
+ printf_P(PSTR("gyro drift:\r\n"));
+ printf_P(PSTR("%d %d %d\r\n"),
drift_g[0],
drift_g[1],
drift_g[2]);
/* XXX doesn't work, no answer from magneto */
/* for (i = 0; i < 127; i++) { */
- /* printf("i=%d\r\n", i); */
+ /* printf_P(PSTR("i=%d\r\n"), i); */
/* err = send_mpu6050_cmd(i, 0x0A, 0x00); //PowerDownMode */
/* if (err == 0) */
- /* printf("COIN\r\n"); */
+ /* printf_P(PSTR("COIN\r\n")); */
/* } */
send_mpu6050_cmd(MPU6050_MAGNETO_ADDRESS, 0x0A, 0x00); //PowerDownMode
send_mpu6050_cmd(MPU6050_MAGNETO_ADDRESS, 0x0A, 0x0F); //SelfTest
setup_mpu9150_magneto();
- printf("MPU6050 Setup Complete\r\n");
+ printf_P(PSTR("MPU6050 Setup Complete\r\n"));
mpu6050_compute_drift();
- printf("MPU6050 drift computed\r\n");
+ printf_P(PSTR("MPU6050 drift computed\r\n"));
return 0;
}
return -1;
}
- printf("choose log file name\n");
+ printf_P(PSTR("choose log file name\n"));
while (1) {
snprintf(name, sizeof(name), "log%.4d", i++);
if (!find_file_in_dir(fs, dd, name, &file_entry))
break;
}
- printf("create log file %s\n", name);
+ printf_P(PSTR("create log file %s\n"), name);
if (!fat_create_file(dd, name, &file_entry)) {
printf_P(PSTR("error creating file: "));
}
#ifndef HOST_VERSION
bootloader();
#else
- printf("not implemented\n");
+ printf_P(PSTR("not implemented\n"));
#endif
}
(void)parsed_result;
(void)data;
#ifdef HOST_VERSION
- printf("not implemented\n");
+ printf_P(PSTR("not implemented\n"));
#else
- printf("res stack: %d\r\n", min_stack_space_available());
+ printf_P(PSTR("res stack: %d\r\n"), min_stack_space_available());
#endif
}
/* register default channel with a callback */
if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL,
xbeeapp_rx, NULL) < 0) {
- fprintf(stderr, "cannot register default channel\n");
+ printf_P(PSTR("cannot register default channel\n"));
return -1;
}