summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Tittelbach <xro@realraum.at>2012-05-20 02:06:35 +0000
committerBernhard Tittelbach <xro@realraum.at>2012-05-20 02:06:35 +0000
commit9b1ebc560185d03c930deac98fd7a9a06aac58fc (patch)
tree90016b997d2da24b632d59c91a5c1267214fa47b
parentattempt to open several usb device ids (diff)
found a 'datasheet' for hhd70, thus exchanged RE/TE
git-svn-id: https://svn.spreadspace.org/mur.sat@445 7de4ea59-55d0-425e-a1af-a3118ea81d4c
-rw-r--r--software/hhd70dongle/c1101lib.c6
-rw-r--r--software/hhd70dongle/hhd70.c21
-rw-r--r--software/hhd70dongle/hhd70.h9
3 files changed, 15 insertions, 21 deletions
diff --git a/software/hhd70dongle/c1101lib.c b/software/hhd70dongle/c1101lib.c
index 02ec5fc..1c60727 100644
--- a/software/hhd70dongle/c1101lib.c
+++ b/software/hhd70dongle/c1101lib.c
@@ -384,8 +384,7 @@ void c1101_transmitData(char *buffer, unsigned int len)
//~ usb_rawhid_send(debug_sb,255);
//enable Power Amplifier
- hhd70_lna_disable();
- hhd70_pa_enable();
+ hhd70_palna_txmode();
//keep buffer filled
uint8_t c1101_state=0;
@@ -416,8 +415,7 @@ void c1101_transmitData(char *buffer, unsigned int len)
} while (len > 0);
//disable Power Amplifier
- hhd70_pa_disable();
- hhd70_lna_enable();
+ hhd70_palna_rxmode();
}
void c1101_recieveData(void)
diff --git a/software/hhd70dongle/hhd70.c b/software/hhd70dongle/hhd70.c
index 2d4ff93..359d754 100644
--- a/software/hhd70dongle/hhd70.c
+++ b/software/hhd70dongle/hhd70.c
@@ -36,10 +36,10 @@
void hhd70_init(void)
{
//configure Direction of SS / PB0 , MOSI and SCLK as Output to drive CS of CC1101
- SPI_PORT = (1<<CS);
SPI_DDR = (1<<MOSI)|(1<<SCK)|(1<<CS)|(1<<RE)|(1<<TE);
+ SPI_PORT = (1<<CS) | (1<<RE) | (1<<TE);
SPCR = (1<<SPE)|(1<<MSTR); // | (0<<DORD) //select MSB first: DORD == 0
- // SPSR = (0<<SPI2X) // f_osc/4
+ // SPSR = (0<<SPI2X) // f_osc/4
// SPSR = (1<<SPI2X) // f_osc/2
// SPSR = (1<<SPI2X); (4MHz vs. 8MHz)
}
@@ -89,24 +89,21 @@ char hhd70_spi_read_byte(void)
return hhd70_spi_exchange_byte(0);
}
-void hhd70_pa_enable(void)
-{
- SPI_PORT |= ~(1<<TE);
-}
-
-void hhd70_pa_disable(void)
+void hhd70_palna_txmode(void)
{
+ SPI_PORT |= (1<<RE);
SPI_PORT &= ~(1<<TE);
}
-void hhd70_lna_enable(void)
+void hhd70_palna_rxmode(void)
{
- SPI_PORT |= ~(1<<RE);
+ SPI_PORT |= (1<<TE);
+ SPI_PORT &= ~(1<<RE);
}
-void hhd70_lna_disable(void)
+void hhd70_palna_off(void)
{
- SPI_PORT &= ~(1<<RE);
+ SPI_PORT |= (1<<RE) | (1<<TE);
}
int8_t hhd70_rx_data_available(void)
diff --git a/software/hhd70dongle/hhd70.h b/software/hhd70dongle/hhd70.h
index 5153fd6..a3df36a 100644
--- a/software/hhd70dongle/hhd70.h
+++ b/software/hhd70dongle/hhd70.h
@@ -24,7 +24,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *;
* You should have received a copy of the GNU General Public License
* along with mur.sat. If not, see <http://www.gnu.org/licenses/>.
*
@@ -53,10 +53,9 @@ void hhd70_c1101_wait_chip_rdy(void);
void hhd70_spi_write_byte(char byte);
char hhd70_spi_read_byte(void);
char hhd70_spi_exchange_byte(char byte);
-void hhd70_pa_enable(void);
-void hhd70_pa_disable(void);
-void hhd70_lna_enable(void);
-void hhd70_lna_disable(void);
+void hhd70_palna_txmode(void);
+void hhd70_palna_rxmode(void);
+void hhd70_palna_off(void);
int8_t hhd70_rx_data_available(void);
#endif