summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2015-03-03 23:00:14 (GMT)
committerChristian Pointner <equinox@mur.at>2015-03-03 23:00:14 (GMT)
commit95c1c13f1a5c29ed8b5d7922a435fd5c56816b3d (patch)
tree481afdbdeb94a8d2eae8ee8d88bd7b75fdfac1ec
parent5a98f25f75c8c21faefee232ffae811d854d9acf (diff)
print not implemented warnings for send and beacon task
use printf_P(PSTR("__fmt__"... to save SRAM
-rw-r--r--software/hhd70dongle/hhd70dongle.c117
1 files changed, 63 insertions, 54 deletions
diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c
index 3f14d8a..ad73195 100644
--- a/software/hhd70dongle/hhd70dongle.c
+++ b/software/hhd70dongle/hhd70dongle.c
@@ -35,6 +35,7 @@
#include <avr/interrupt.h>
#include <avr/power.h>
#include <stdio.h>
+#include <avr/pgmspace.h>
#include "led.h"
#include "util.h"
@@ -129,57 +130,57 @@ static void print_status(void)
static void dump_register_normalized(void)
{
- printf("IOCFG0: 0x%02X\r\n", cc1101_get_iocfg0());
- printf("IOCFG1: 0x%02X\r\n", cc1101_get_iocfg1());
- printf("IOCFG2: 0x%02X\r\n", cc1101_get_iocfg2());
-
- printf("FIFOTHR: 0x%02X\r\n", cc1101_get_fifothr());
-
- printf("SYNC: 0x%04X\r\n", cc1101_get_sync());
- printf("PKTLEN: 0x%02X\r\n", cc1101_get_pktlen());
- printf("PKTCTRL: 0x%04X\r\n", cc1101_get_pktctrl());
- printf("ADDR: 0x%02X\r\n", cc1101_get_addr());
-
- printf("CHANNR: 0x%02X\r\n", cc1101_get_channr());
- printf("IFFREQ: 0x%02X\r\n", cc1101_get_iffreq());
- printf("FREQ_OFFSET: 0x%02X\r\n", cc1101_get_freq_offset());
- printf("FREQ: 0x%08lX\r\n", cc1101_get_freq());
- printf("MODEMCFG: 0x%08lX\r\n", cc1101_get_modemcfg());
- printf("DRATE_BW: 0x%04X\r\n", cc1101_get_drate_bw());
- printf("DEVIATN: 0x%02X\r\n", cc1101_get_deviatn());
-
- printf("MCSM: 0x%08lX\r\n", cc1101_get_mcsm());
-
- printf("FOCCFG: 0x%02X\r\n", cc1101_get_foccfg());
- printf("BSCFG: 0x%02X\r\n", cc1101_get_bscfg());
- printf("AGCCTRL: 0x%08lX\r\n", cc1101_get_agcctrl());
- printf("WOREVT: 0x%04X\r\n", cc1101_get_worevt());
- printf("WORCTRL: 0x%02X\r\n", cc1101_get_worctrl());
-
- printf("FREND: 0x%04X\r\n", cc1101_get_frend());
- printf("FSCAL: 0x%08lX\r\n", cc1101_get_fscal());
- printf("RCCTRL: 0x%04X\r\n", cc1101_get_rcctrl());
-
- printf("FSTEST: 0x%02X\r\n", cc1101_get_fstest());
- printf("PTEST: 0x%02X\r\n", cc1101_get_ptest());
- printf("AGCTEST: 0x%02X\r\n", cc1101_get_agctest());
- printf("TEST0: 0x%02X\r\n", cc1101_get_test0());
- printf("TEST1: 0x%02X\r\n", cc1101_get_test1());
- printf("TEST2: 0x%02X\r\n", cc1101_get_test2());
-
- printf("PARTNUM: 0x%02X\r\n", cc1101_get_partnum());
- printf("CHIP_VERSION: 0x%02X\r\n", cc1101_get_chip_version());
- printf("FREQ_OFFSET_EST: 0x%02X\r\n", cc1101_get_freq_offset_est());
- printf("LQI: 0x%02X\r\n", cc1101_get_lqi());
- printf("RSSI: 0x%02X\r\n", cc1101_get_rssi());
- printf("MARCSTATE: 0x%02X\r\n", cc1101_get_marcstate());
- printf("WORTIME: 0x%04X\r\n", cc1101_get_wortime());
- printf("PKT_STATUS: 0x%02X\r\n", cc1101_get_pkt_status());
- printf("VCO_VC_DAC: 0x%02X\r\n", cc1101_get_vco_vc_dac());
- printf("TX_BYTES: 0x%02X\r\n", cc1101_get_tx_bytes());
- printf("RX_BYTES: 0x%02X\r\n", cc1101_get_rx_bytes());
- printf("RCCTRL0: 0x%02X\r\n", cc1101_get_rcctrl0_status());
- printf("RCCTRL1: 0x%02X\r\n", cc1101_get_rcctrl1_status());
+ printf_P(PSTR("IOCFG0: 0x%02X\r\n"), cc1101_get_iocfg0());
+ printf_P(PSTR("IOCFG1: 0x%02X\r\n"), cc1101_get_iocfg1());
+ printf_P(PSTR("IOCFG2: 0x%02X\r\n"), cc1101_get_iocfg2());
+
+ printf_P(PSTR("FIFOTHR: 0x%02X\r\n"), cc1101_get_fifothr());
+
+ printf_P(PSTR("SYNC: 0x%04X\r\n"), cc1101_get_sync());
+ printf_P(PSTR("PKTLEN: 0x%02X\r\n"), cc1101_get_pktlen());
+ printf_P(PSTR("PKTCTRL: 0x%04X\r\n"), cc1101_get_pktctrl());
+ printf_P(PSTR("ADDR: 0x%02X\r\n"), cc1101_get_addr());
+
+ printf_P(PSTR("CHANNR: 0x%02X\r\n"), cc1101_get_channr());
+ printf_P(PSTR("IFFREQ: 0x%02X\r\n"), cc1101_get_iffreq());
+ printf_P(PSTR("FREQ_OFFSET: 0x%02X\r\n"), cc1101_get_freq_offset());
+ printf_P(PSTR("FREQ: 0x%08lX\r\n"), cc1101_get_freq());
+ printf_P(PSTR("MODEMCFG: 0x%08lX\r\n"), cc1101_get_modemcfg());
+ printf_P(PSTR("DRATE_BW: 0x%04X\r\n"), cc1101_get_drate_bw());
+ printf_P(PSTR("DEVIATN: 0x%02X\r\n"), cc1101_get_deviatn());
+
+ printf_P(PSTR("MCSM: 0x%08lX\r\n"), cc1101_get_mcsm());
+
+ printf_P(PSTR("FOCCFG: 0x%02X\r\n"), cc1101_get_foccfg());
+ printf_P(PSTR("BSCFG: 0x%02X\r\n"), cc1101_get_bscfg());
+ printf_P(PSTR("AGCCTRL: 0x%08lX\r\n"), cc1101_get_agcctrl());
+ printf_P(PSTR("WOREVT: 0x%04X\r\n"), cc1101_get_worevt());
+ printf_P(PSTR("WORCTRL: 0x%02X\r\n"), cc1101_get_worctrl());
+
+ printf_P(PSTR("FREND: 0x%04X\r\n"), cc1101_get_frend());
+ printf_P(PSTR("FSCAL: 0x%08lX\r\n"), cc1101_get_fscal());
+ printf_P(PSTR("RCCTRL: 0x%04X\r\n"), cc1101_get_rcctrl());
+
+ printf_P(PSTR("FSTEST: 0x%02X\r\n"), cc1101_get_fstest());
+ printf_P(PSTR("PTEST: 0x%02X\r\n"), cc1101_get_ptest());
+ printf_P(PSTR("AGCTEST: 0x%02X\r\n"), cc1101_get_agctest());
+ printf_P(PSTR("TEST0: 0x%02X\r\n"), cc1101_get_test0());
+ printf_P(PSTR("TEST1: 0x%02X\r\n"), cc1101_get_test1());
+ printf_P(PSTR("TEST2: 0x%02X\r\n"), cc1101_get_test2());
+
+ printf_P(PSTR("PARTNUM: 0x%02X\r\n"), cc1101_get_partnum());
+ printf_P(PSTR("CHIP_VERSION: 0x%02X\r\n"), cc1101_get_chip_version());
+ printf_P(PSTR("FREQ_OFFSET_EST: 0x%02X\r\n"), cc1101_get_freq_offset_est());
+ printf_P(PSTR("LQI: 0x%02X\r\n"), cc1101_get_lqi());
+ printf_P(PSTR("RSSI: 0x%02X\r\n"), cc1101_get_rssi());
+ printf_P(PSTR("MARCSTATE: 0x%02X\r\n"), cc1101_get_marcstate());
+ printf_P(PSTR("WORTIME: 0x%04X\r\n"), cc1101_get_wortime());
+ printf_P(PSTR("PKT_STATUS: 0x%02X\r\n"), cc1101_get_pkt_status());
+ printf_P(PSTR("VCO_VC_DAC: 0x%02X\r\n"), cc1101_get_vco_vc_dac());
+ printf_P(PSTR("TX_BYTES: 0x%02X\r\n"), cc1101_get_tx_bytes());
+ printf_P(PSTR("RX_BYTES: 0x%02X\r\n"), cc1101_get_rx_bytes());
+ printf_P(PSTR("RCCTRL0: 0x%02X\r\n"), cc1101_get_rcctrl0_status());
+ printf_P(PSTR("RCCTRL1: 0x%02X\r\n"), cc1101_get_rcctrl1_status());
}
uint8_t patable_data[CC1101_PATABLE_SIZE];
@@ -218,8 +219,9 @@ static void handle_cmd(uint8_t cmd)
case 'O': osc_off_hhd70(); current_task = none; break;
case 'C': cc1101_calibrate(); print_status(); current_task = none; break;
case 'X': cc1101_fasttxon(); print_status(); current_task = none; break;
- case 'R': cc1101_rx(); print_status(); current_task = receive; break;
- case 'T': cc1101_tx(); print_status(); current_task = send; break;
+ case 'R': current_task = receive; break;
+ case 'T': current_task = send; break;
+ case 'B': current_task = beacon; break;
case 'f': print_actual_freq(); break;
case 's': print_status(); break;
@@ -237,7 +239,10 @@ uint8_t tempdata[255];
static void do_receive_task(uint8_t first)
{
static uint8_t pos = 0;
- if(first) pos = 0;
+ if(first) {
+ pos = 0;
+ cc1101_rx();
+ }
cc1101_state_t s = cc1101_get_state();
switch(s) {
@@ -275,10 +280,14 @@ static void do_receive_task(uint8_t first)
static void do_send_task(uint8_t first)
{
+ printf("leaving send task: not implemented!\r\n");
+ current_task = none;
}
static void do_beacon_task(uint8_t first)
{
+ printf("leaving beacon task: not implemented!\r\n");
+ current_task = none;
}
static void handle_task(void)