Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

v1.0 #33

Merged
merged 10 commits into from
Oct 21, 2017
Merged

v1.0 #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -350,4 +355,5 @@ Power amplifier output power setting 1.

### PA_TABLE0 (0xDF2E)

Power amplifier output power setting 0.
Power amplifier output power setting 0.

9 changes: 5 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
machine:
pre:
- sudo apt-get install -y sdcc
- go get 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
Expand Down
119 changes: 117 additions & 2 deletions commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -39,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) {
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions tools/serial_rf_spy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?)"