From 7acacfb675105fbe747152266cf3b08682bf2708 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 9 Jan 2017 09:03:44 -0600 Subject: [PATCH 1/8] Read register command (#32) * Add Read Register command * Add Read Register command documentation. * Remove startup LED blink. * Remove startup LED blink. * Revert "Remove startup LED blink." This reverts commit 6a9092bb39084f4ce37c11837a08d508f66d1286. * Revert "Remove startup LED blink." This reverts commit 079ab916d3833276bc35712f69b22c1bdc4d3a91. --- Readme.md | 5 +++ commands.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 20ff919..2379d66 100644 --- a/Readme.md +++ b/Readme.md @@ -174,6 +174,11 @@ Use this command to manually control the LEDs on the device. Follow this command with the LED you want to configure (0 for green, 1 for blue) and the mode (0 for off, 1 for on, 2 for auto). +### Read Register: 9 + +Use this command to read the current value of one of the major registers. See Major Registers section +for a list of available registers and their functions. + ## Frequency Channel Selection Each channel number corresponds to a different specific frequency. Channels start with 916.5 MHz at diff --git a/commands.c b/commands.c index ecc50cf..fd13304 100644 --- a/commands.c +++ b/commands.c @@ -18,7 +18,8 @@ CommandHandler handlers[] = { /* 5 */ cmd_send_and_listen, /* 6 */ cmd_update_register, /* 7 */ cmd_reset, - /* 8 */ cmd_led + /* 8 */ cmd_led, + /* 9 */ cmd_read_register }; void cmd_get_packet() { @@ -102,6 +103,120 @@ void cmd_send_and_listen() { } } +void cmd_read_register() { + uint8_t addr; + uint8_t value; + addr = serial_rx_byte(); + switch(addr) { + case 0x00: + value = SYNC1; + break; + case 0x01: + value = SYNC0; + break; + case 0x02: + value = PKTLEN; + break; + case 0x03: + value = PKTCTRL1; + break; + case 0x04: + value = PKTCTRL0; + break; + case 0x05: + value = ADDR; + break; + case 0x06: + value = CHANNR; + break; + case 0x07: + value = FSCTRL1; + break; + case 0x08: + value = FSCTRL0; + break; + case 0x09: + value = FREQ2; + break; + case 0x0A: + value = FREQ1; + break; + case 0x0B: + value = FREQ0; + break; + case 0x0C: + value = MDMCFG4; + break; + case 0x0D: + value = MDMCFG3; + break; + case 0x0E: + value = MDMCFG2; + break; + case 0x0F: + value = MDMCFG1; + break; + case 0x10: + value = MDMCFG0; + break; + case 0x11: + value = DEVIATN; + break; + case 0x12: + value = MCSM2; + break; + case 0x13: + value = MCSM1; + break; + case 0x14: + value = MCSM0; + break; + case 0x15: + value = FOCCFG; + break; + case 0x16: + value = BSCFG; + break; + case 0x17: + value = AGCCTRL2; + break; + case 0x18: + value = AGCCTRL1; + break; + case 0x19: + value = AGCCTRL0; + break; + case 0x1A: + value = FREND1; + break; + case 0x1B: + value = FREND0; + break; + case 0x1C: + value = FSCAL3; + break; + case 0x1D: + value = FSCAL2; + break; + case 0x1E: + value = FSCAL1; + break; + case 0x1F: + value = FSCAL0; + break; + case 0x20: + value = PA_TABLE1; + break; + case 0x21: + value = PA_TABLE0; + break; + default: + value = 0x5A; + } + serial_tx_byte(value); + serial_tx_byte(0); +} + void cmd_update_register() { uint8_t addr; uint8_t value; From 690005adaf53e7e23e92c5b2553237ac14ef6b6c Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 9 Jan 2017 09:05:59 -0600 Subject: [PATCH 2/8] bump version --- commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands.c b/commands.c index fd13304..9f8abb6 100644 --- a/commands.c +++ b/commands.c @@ -40,7 +40,7 @@ void cmd_get_state() { } void cmd_get_version() { - serial_tx_str("subg_rfspy 0.9"); + serial_tx_str("subg_rfspy 1.0"); } void do_cmd(uint8_t cmd) { From 409cc1bbd8053d75532ef7522e528743b6431d6b Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 9 Jan 2017 09:16:48 -0600 Subject: [PATCH 3/8] Update circle.yml with fixed ghr version so we can build on go 1.6 --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index b687732..7e55920 100644 --- a/circle.yml +++ b/circle.yml @@ -1,7 +1,7 @@ machine: pre: - sudo apt-get install -y sdcc - - go get github.com/tcnksm/ghr + - go get github.com/tcnksm/ghr@0.4.0 test: override: - ./build-all.sh From eda58d8c0a5afcea81f2ed6521c934ec402edd72 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Mon, 9 Jan 2017 09:35:33 -0600 Subject: [PATCH 4/8] go get cannot use the 0.4.0 tag of ghr, so I made a fork that is pinned to 0.4.0 --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 7e55920..62bc343 100644 --- a/circle.yml +++ b/circle.yml @@ -1,7 +1,7 @@ machine: pre: - sudo apt-get install -y sdcc - - go get github.com/tcnksm/ghr@0.4.0 + - go get github.com/ps2/ghr test: override: - ./build-all.sh From af1b5630b3244ad03837aaa479b48d8f0e307d76 Mon Sep 17 00:00:00 2001 From: Oskar Pearson Date: Sun, 5 Jun 2016 00:00:15 +0100 Subject: [PATCH 5/8] Added suggestion about running 'export RFSPY_RTSCTS=0' --- tools/serial_rf_spy.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/serial_rf_spy.py b/tools/serial_rf_spy.py index 8326bcc..4e4b975 100755 --- a/tools/serial_rf_spy.py +++ b/tools/serial_rf_spy.py @@ -53,14 +53,13 @@ def sync(self): data = self.get_response(1) if data == "OK": print "RileyLink " + data - break - print "retry", len(data), str(data).encode('hex') - + break + print "retry", len(data), str(data).encode('hex'), "(Do you need to run 'export RFSPY_RTSCTS=0' first?)" + while 1: self.send_command(self.CMD_GET_VERSION) data = self.get_response(1) if len(data) >= 3: print "Version: " + data - break - print "retry", len(data), str(data).encode('hex') - + break + print "retry", len(data), str(data).encode('hex'), "(Do you need to run 'export RFSPY_RTSCTS=0' first?)" From c9f9c0ecfe6b393e8933ddc36c22e324ec55542b Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Sat, 21 Oct 2017 05:01:03 -0700 Subject: [PATCH 6/8] Use standard ghr --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 62bc343..d599f68 100644 --- a/circle.yml +++ b/circle.yml @@ -1,7 +1,7 @@ machine: pre: - sudo apt-get install -y sdcc - - go get github.com/ps2/ghr + - go get -u github.com/tcnksm/ghr test: override: - ./build-all.sh From a2649c170c304c00fc7adb7279e7e8a7616c6357 Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Sat, 21 Oct 2017 05:05:29 -0700 Subject: [PATCH 7/8] Update to match ghr docs --- circle.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index d599f68..cea9b9e 100644 --- a/circle.yml +++ b/circle.yml @@ -1,11 +1,12 @@ -machine: - pre: - - sudo apt-get install -y sdcc - - go get -u github.com/tcnksm/ghr test: override: - ./build-all.sh +dependencies: + pre: + - sudo apt-get install -y sdcc + - go get github.com/tcnksm/ghr + deployment: release: branch: master From 09a7a21dcb726aa47ac4761ffef225dc82fbe73c Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Sat, 21 Oct 2017 05:20:04 -0700 Subject: [PATCH 8/8] trigger build --- Readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 2379d66..ea72e6c 100644 --- a/Readme.md +++ b/Readme.md @@ -355,4 +355,5 @@ Power amplifier output power setting 1. ### PA_TABLE0 (0xDF2E) -Power amplifier output power setting 0. \ No newline at end of file +Power amplifier output power setting 0. +