diff options
author | Christian Pointner <equinox@mur.at> | 2015-02-19 02:41:48 +0100 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2015-02-19 02:41:48 +0100 |
commit | d031f9e63d53cff9f8a50735a1c5ada9e3027637 (patch) | |
tree | b8f2132fc19905c06954bc07cc26602b8fe8d402 /software/hhd70dongle.old/hhd70dongle.c | |
parent | comm: improved hr routing for hhd70 (diff) |
hhd70dongle.old: reverted to older base
Diffstat (limited to 'software/hhd70dongle.old/hhd70dongle.c')
-rw-r--r-- | software/hhd70dongle.old/hhd70dongle.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/software/hhd70dongle.old/hhd70dongle.c b/software/hhd70dongle.old/hhd70dongle.c index f28886d..31f511d 100644 --- a/software/hhd70dongle.old/hhd70dongle.c +++ b/software/hhd70dongle.old/hhd70dongle.c @@ -43,7 +43,6 @@ #include "hhd70.h" #include "c1101lib.h" -#include "cc1101_defines.h" //todo: move to separte File: @@ -71,6 +70,7 @@ char write_buffer[64]; // buffer for writing usb signals bool enable_tx_part=false; bool enable_rx_part=false; bool enable_beacon_part=false; +bool beacon_state=false; void print_part_status(void) { @@ -96,12 +96,13 @@ void print_part_status(void) void beacon_enable(void) { - c1101_spi_strobe_command(CC1101_CMD_STX); + c1101_spi_strobe_command(SPIC1101_ADDR_STX); hhd70_palna_txmode(); } void beacon_on(void) { + beacon_state = true; hhd70_set_OOK_GDO0_high(); led_on(); } @@ -110,12 +111,13 @@ void beacon_off(void) { led_off(); hhd70_set_OOK_GDO0_low(); + beacon_state = false; } void beacon_disable(void) { hhd70_palna_rxmode(); - c1101_spi_strobe_command(CC1101_CMD_SIDLE); + c1101_spi_strobe_command(SPIC1101_ADDR_SIDLE); } int main(void) @@ -134,7 +136,7 @@ int main(void) printf("hhd70dongle ready\r\n"); _delay_ms(500); - c1101_spi_strobe_command(CC1101_CMD_SRES); // reset c1101 + c1101_spi_strobe_command(SPIC1101_ADDR_SRES); // reset c1101 //c1101 init now happens after pressing B, S or E hhd70_palna_rxmode(); @@ -171,7 +173,7 @@ int main(void) enable_tx_part=false; enable_rx_part=false; enable_beacon_part=false; - c1101_spi_strobe_command(CC1101_CMD_SRES); // reset c1101 + c1101_spi_strobe_command(SPIC1101_ADDR_SRES); // reset c1101 hhd70_palna_rxmode(); print_part_status(); led_off(); @@ -214,7 +216,7 @@ int main(void) } else if ((char) recv_byte == 'R') { - c1101_spi_dump_registers(); + c1101_spi_dump_registers_to_usb(); print_part_status(); } else if ((char) recv_byte == 'D' || (char) recv_byte == 'd') @@ -330,18 +332,28 @@ int main(void) else if ((char) recv_byte == ' ') { if (enable_beacon_part) { - hhd70_set_OOK_GDO0_toggle(); + /* hhd70_set_OOK_GDO0_toggle(); */ + if(beacon_state) { + beacon_state = false; + hhd70_set_OOK_GDO0_low(); + led_off(); + hhd70_palna_rxmode(); + } else { + beacon_state = true; + hhd70_set_OOK_GDO0_high(); + led_on(); + hhd70_palna_txmode(); + } } } } - usbio_task(); if (enable_rx_part) { - c1101_spi_strobe_command(CC1101_CMD_SRX); // enter RX - Mode + c1101_spi_strobe_command(SPIC1101_ADDR_SRX); // enter RX - Mode _delay_ms(1000); if (hhd70_rx_data_available()) @@ -349,7 +361,7 @@ int main(void) led_on(); printf("RX: GDO2 pin HIGH\r\n"); printf("c1101 rx bytes:"); - debug_sprint_int16hex(write_buffer, c1101_spi_read_register(CC1101_REG_RO_RXBYTES)); + debug_sprint_int16hex(write_buffer, c1101_spi_read_register(SPIC1101_ADDR_RXBYTES)); printf("%s", write_buffer); printf("\r\n"); c1101_recieveData(); @@ -357,15 +369,15 @@ int main(void) } printf("c1101 rssi: "); - debug_sprint_int16hex(write_buffer, c1101_spi_read_register(CC1101_REG_RO_RSSI)); + debug_sprint_int16hex(write_buffer, c1101_spi_read_register(SPIC1101_ADDR_RSSI)); printf("%s", write_buffer); printf("\r\n"); printf("c1101 tx bytes: "); - debug_sprint_int16hex(write_buffer, c1101_spi_read_register(CC1101_REG_RO_TXBYTES)); + debug_sprint_int16hex(write_buffer, c1101_spi_read_register(SPIC1101_ADDR_TXBYTES)); printf("%s", write_buffer); printf("\r\n"); printf("c1101 rx bytes: "); - int16_t num_rx_bytes = c1101_spi_read_register(CC1101_REG_RO_RXBYTES); + int16_t num_rx_bytes = c1101_spi_read_register(SPIC1101_ADDR_RXBYTES); debug_sprint_int16hex(write_buffer, num_rx_bytes); printf("%s", write_buffer); printf("\r\n"); @@ -409,7 +421,7 @@ int main(void) /* _delay_ms(250); */ /* led_on(); */ /* printf("TX Data: String\r\n"); */ - /* c1101_transmitData_infPktMode("OE6EOF test mur.sat GFSK r:9k6 fdev:11kHz 1234567890123456789012345678901234567890 End of Test",93); */ + c1101_transmitData_infPktMode("OE6EOF test mur.sat GFSK r:9k6 fdev:11kHz 1234567890123456789012345678901234567890 End of Test",93); /* led_off(); */ /* _delay_ms(100); */ /* led_on(); */ @@ -425,12 +437,12 @@ int main(void) led_on(); //c1101_transmitData_infPktMode(mursat_beacon,sizeof(mursat_beacon)); hhd70_palna_txmode(); - c1101_spi_strobe_command(CC1101_CMD_STX); + c1101_spi_strobe_command(SPIC1101_ADDR_STX); hhd70_set_OOK_GDO0_high(); _delay_ms(1000); led_off(); hhd70_set_OOK_GDO0_low(); - c1101_spi_strobe_command(CC1101_CMD_SIDLE); + c1101_spi_strobe_command(SPIC1101_ADDR_SIDLE); hhd70_palna_rxmode(); _delay_ms(200); }*/ |