diff options
author | Christian Pointner <equinox@mur.at> | 2013-02-15 01:02:19 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2013-02-15 01:02:19 +0000 |
commit | 171dbe3c6f11d7970f06dfa88e5251c74a5da5a4 (patch) | |
tree | 159dcf35a0c4fe24bd3425fa2cd8d225e369010a /software | |
parent | added N (no mode) (diff) |
added bias pwm for RFPA 3800 power
git-svn-id: https://svn.spreadspace.org/mur.sat@672 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software')
-rw-r--r-- | software/hhd70dongle/c1101lib.c | 10 | ||||
-rw-r--r-- | software/hhd70dongle/hhd70.c | 48 | ||||
-rw-r--r-- | software/hhd70dongle/hhd70.h | 4 | ||||
-rw-r--r-- | software/hhd70dongle/hhd70dongle.c | 65 |
4 files changed, 95 insertions, 32 deletions
diff --git a/software/hhd70dongle/c1101lib.c b/software/hhd70dongle/c1101lib.c index d943048..d498ec2 100644 --- a/software/hhd70dongle/c1101lib.c +++ b/software/hhd70dongle/c1101lib.c @@ -491,11 +491,11 @@ char c1101_getMARCState(void) sb = c1101_spi_read_register(SPIC1101_ADDR_MARCSTATE); sb &= 0x1F; //debug start - char debug_sb[6]; - printf("c1101 MARCSate:\r\n"); - debug_sprint_int16hex(debug_sb, sb); - printf("%s", debug_sb); - printf("\r\n"); + /* char debug_sb[6]; */ + /* printf("c1101 MARCState:\r\n"); */ + /* debug_sprint_int16hex(debug_sb, sb); */ + /* printf("%s", debug_sb); */ + /* printf("\r\n"); */ //debug end return sb; } diff --git a/software/hhd70dongle/hhd70.c b/software/hhd70dongle/hhd70.c index e8c973b..2461c29 100644 --- a/software/hhd70dongle/hhd70.c +++ b/software/hhd70dongle/hhd70.c @@ -33,6 +33,29 @@ #include "hhd70.h" +#define BIAS_VAL OCR1BL + +static void hhd70_bias_init(void) +{ + DDRB |= (1<<PB6); + TCCR1B = 0; + TCNT1 = 0; + OCR1B = 0; + TCCR1A = (1<<COM1B1) | (1<<WGM10); + TCCR1B = (1<<WGM12); +} + +static inline void hhd70_bias_on(void) +{ + TCCR1B = (TCCR1B & 0xF8) | (1<<CS10); +} + +static inline void hhd70_bias_off(void) +{ + TCCR1B = (TCCR1B & 0xF8); + TCNT1 = 0; +} + void hhd70_init(void) { //configure Direction of SS / PB0 , MOSI and SCLK as Output to drive CS of CC1101 @@ -42,6 +65,7 @@ void hhd70_init(void) // SPSR = (0<<SPI2X) // f_osc/4 // SPSR = (1<<SPI2X) // f_osc/2 // SPSR = (1<<SPI2X); (4MHz vs. 8MHz) + hhd70_bias_init(); } void hhd70_config_GDO0_OOK_output(bool output_mode) @@ -111,16 +135,19 @@ char hhd70_spi_read_byte(void) void hhd70_palna_txmode(void) { SPI_PORT |= (1<<TE); + hhd70_bias_on(); } void hhd70_palna_rxmode(void) { SPI_PORT &= ~(1<<TE); + hhd70_bias_off(); } void hhd70_palna_off(void) { SPI_PORT |= (1<<TE); + hhd70_bias_off(); } int8_t hhd70_rx_data_available(void) @@ -128,3 +155,24 @@ int8_t hhd70_rx_data_available(void) //check if GDO2 pin has been pulled low by c1101 return (SPI_PINB_REG & (1 << GDO2)) == 0; } + +void hhd70_bias_set(uint8_t val) +{ + BIAS_VAL = val; +} + +uint8_t hhd70_bias_get(void) +{ + return BIAS_VAL; +} + +void hhd70_bias_inc(void) +{ + BIAS_VAL = (BIAS_VAL < 253) ? BIAS_VAL + 2 : 255; +} + +void hhd70_bias_dec(void) +{ + BIAS_VAL = (BIAS_VAL > 2) ? BIAS_VAL - 2 : 0; +} + diff --git a/software/hhd70dongle/hhd70.h b/software/hhd70dongle/hhd70.h index e8a4fa0..090c96a 100644 --- a/software/hhd70dongle/hhd70.h +++ b/software/hhd70dongle/hhd70.h @@ -66,5 +66,9 @@ int8_t hhd70_rx_data_available(void); void hhd70_config_GDO0_OOK_output(bool output_mode); void hhd70_set_OOK_GDO0_high(void); void hhd70_set_OOK_GDO0_low(void); +void hhd70_bias_set(uint8_t val); +uint8_t hhd70_bias_get(void); +void hhd70_bias_inc(void); +void hhd70_bias_dec(void); #endif diff --git a/software/hhd70dongle/hhd70dongle.c b/software/hhd70dongle/hhd70dongle.c index e3b0983..d094e6c 100644 --- a/software/hhd70dongle/hhd70dongle.c +++ b/software/hhd70dongle/hhd70dongle.c @@ -199,6 +199,7 @@ int main(void) //c1101 init now happens after pressing B, S or E hhd70_palna_rxmode(); + hhd70_bias_set(255); enable_tx_part=false; enable_rx_part=false; @@ -348,6 +349,16 @@ int main(void) uint16_t khz = (hz % 1000000)/1000; printf("Frequency is now: %d.%03d MHz\r\n", mhz, khz); } + else if ((char) recv_byte == 'p') + { + hhd70_bias_dec(); + printf("Bias Power is now: %d\r\n", hhd70_bias_get()); + } + else if ((char) recv_byte == 'P') + { + hhd70_bias_inc(); + printf("Bias Power is now: %d\r\n", hhd70_bias_get()); + } } CDC_Device_USBTask(&VirtualSerial_CDC_Interface); @@ -403,34 +414,34 @@ int main(void) if (enable_tx_part) { - write_buffer[0]='T'; - write_buffer[1]='e'; - write_buffer[2]='m'; - write_buffer[3]='p'; - write_buffer[4]='s'; - write_buffer[5]=':'; - adc_on(); - _delay_ms(250); - printf("temp c1101: "); - debug_sprint_int16hex(write_buffer+6, c1101_measureTemp()); - printf("%s", write_buffer+6); - printf("\r\n"); - _delay_ms(250); - printf("temp atmega: "); - debug_sprint_int16hex(write_buffer+10, adc_read(ADCMUX_ADC12)); - printf("%s", write_buffer+10); - printf("\r\n"); - adc_off(); - _delay_ms(250); - led_on(); - printf("TX Data: String\r\n"); + /* write_buffer[0]='T'; */ + /* write_buffer[1]='e'; */ + /* write_buffer[2]='m'; */ + /* write_buffer[3]='p'; */ + /* write_buffer[4]='s'; */ + /* write_buffer[5]=':'; */ + /* adc_on(); */ + /* _delay_ms(250); */ + /* printf("temp c1101: "); */ + /* debug_sprint_int16hex(write_buffer+6, c1101_measureTemp()); */ + /* printf("%s", write_buffer+6); */ + /* printf("\r\n"); */ + /* _delay_ms(250); */ + /* printf("temp atmega: "); */ + /* debug_sprint_int16hex(write_buffer+10, adc_read(ADCMUX_ADC12)); */ + /* printf("%s", write_buffer+10); */ + /* printf("\r\n"); */ + /* adc_off(); */ + /* _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); - led_off(); - _delay_ms(100); - led_on(); - printf("TX Data: Temps\r\n"); - c1101_transmitData_infPktMode((char*) write_buffer,14); - led_off(); + /* led_off(); */ + /* _delay_ms(100); */ + /* led_on(); */ + /* printf("TX Data: Temps\r\n"); */ + /* c1101_transmitData_infPktMode((char*) write_buffer,14); */ + /* led_off(); */ } /* if (enable_beacon_part) |