summaryrefslogtreecommitdiff
path: root/software/avr.lib
diff options
context:
space:
mode:
Diffstat (limited to 'software/avr.lib')
-rw-r--r--software/avr.lib/cc1101.c55
-rw-r--r--software/avr.lib/cc1101.h4
2 files changed, 30 insertions, 29 deletions
diff --git a/software/avr.lib/cc1101.c b/software/avr.lib/cc1101.c
index f57395d..8bace9d 100644
--- a/software/avr.lib/cc1101.c
+++ b/software/avr.lib/cc1101.c
@@ -218,7 +218,7 @@ cc1101_state_t cc1101_get_state(void)
uint8_t cc1101_get_iocfg0(void)
{
- return cc1101_spi_read_register(CC1101_REG_RW_IOCFG0);
+ return cc1101_spi_read_register(CC1101_REG_RW_IOCFG0) & 0x7F;
}
void cc1101_set_iocfg0(uint8_t iocfg)
@@ -246,7 +246,7 @@ void cc1101_set_iocfg2(uint8_t iocfg)
uint8_t cc1101_get_fifothr(void)
{
- return cc1101_spi_read_register(CC1101_REG_RW_FIFOTHR);
+ return cc1101_spi_read_register(CC1101_REG_RW_FIFOTHR) & 0x7F;
}
void cc1101_set_fifothr(uint8_t fifothr)
@@ -277,9 +277,9 @@ void cc1101_set_pktlen(uint8_t len)
uint16_t cc1101_get_pktctrl(void)
{
- uint16_t p = cc1101_spi_read_register(CC1101_REG_RW_PKTCTRL1);
+ uint16_t p = cc1101_spi_read_register(CC1101_REG_RW_PKTCTRL1) & 0xEF;
p = p << 8;
- p |= cc1101_spi_read_register(CC1101_REG_RW_PKTCTRL0);
+ p |= cc1101_spi_read_register(CC1101_REG_RW_PKTCTRL0) & 0x77;
return p;
}
@@ -308,7 +308,7 @@ void cc1101_set_channr(uint8_t nr)
uint8_t cc1101_get_iffreq(void)
{
- return cc1101_spi_read_register(CC1101_REG_RW_FSCTRL1);
+ return cc1101_spi_read_register(CC1101_REG_RW_FSCTRL1) & 0x1F;
}
void cc1101_set_iffreq(uint8_t iffreq)
@@ -338,15 +338,6 @@ void cc1101_set_freq(uint32_t freq)
{
}
-uint8_t cc1101_get_deviatn(void)
-{
- return cc1101_spi_read_register(CC1101_REG_RW_DEVIATN);
-}
-
-void cc1101_set_deviatn(uint8_t dev)
-{
-}
-
uint64_t cc1101_get_modemcfg(void)
{
uint64_t m = cc1101_spi_read_register(CC1101_REG_RW_MDMCFG4);
@@ -355,12 +346,22 @@ uint64_t cc1101_get_modemcfg(void)
m = m << 8;
m |= cc1101_spi_read_register(CC1101_REG_RW_MDMCFG2);
m = m << 8;
- m |= cc1101_spi_read_register(CC1101_REG_RW_MDMCFG1);
+ m |= cc1101_spi_read_register(CC1101_REG_RW_MDMCFG1) & 0xF3;
m = m << 8;
m |= cc1101_spi_read_register(CC1101_REG_RW_MDMCFG0);
return m;
}
+uint8_t cc1101_get_deviatn(void)
+{
+ return cc1101_spi_read_register(CC1101_REG_RW_DEVIATN) & 0x77;
+}
+
+void cc1101_set_deviatn(uint8_t dev)
+{
+}
+
+
void cc1101_set_modemcfg(uint64_t cfg)
{
}
@@ -368,11 +369,11 @@ void cc1101_set_modemcfg(uint64_t cfg)
uint32_t cc1101_get_mcsm(void)
{
- uint32_t m = cc1101_spi_read_register(CC1101_REG_RW_MCSM2);
+ uint32_t m = cc1101_spi_read_register(CC1101_REG_RW_MCSM2) & 0x1F;
m = m << 8;
- m |= cc1101_spi_read_register(CC1101_REG_RW_MCSM1);
+ m |= cc1101_spi_read_register(CC1101_REG_RW_MCSM1) & 0x3F;
m = m << 8;
- m |= cc1101_spi_read_register(CC1101_REG_RW_MCSM0);
+ m |= cc1101_spi_read_register(CC1101_REG_RW_MCSM0) & 0x3F;
return m;
}
@@ -383,7 +384,7 @@ void cc1101_set_mcsm(uint32_t cfg)
uint8_t cc1101_get_foccfg(void)
{
- return cc1101_spi_read_register(CC1101_REG_RW_FOCCFG);
+ return cc1101_spi_read_register(CC1101_REG_RW_FOCCFG) & 0x3F;
}
void cc1101_set_foccfg(uint8_t cfg)
@@ -403,7 +404,7 @@ uint32_t cc1101_get_agcctrl(void)
{
uint32_t b = cc1101_spi_read_register(CC1101_REG_RW_AGCCTRL2);
b = b << 8;
- b |= cc1101_spi_read_register(CC1101_REG_RW_AGCCTRL1);
+ b |= cc1101_spi_read_register(CC1101_REG_RW_AGCCTRL1) & 0x7F;
b = b << 8;
b |= cc1101_spi_read_register(CC1101_REG_RW_AGCCTRL0);
return b;
@@ -427,7 +428,7 @@ void cc1101_set_worevt(uint16_t timeout)
uint8_t cc1101_get_worctrl(void)
{
- return cc1101_spi_read_register(CC1101_REG_RW_WORCTRL);
+ return cc1101_spi_read_register(CC1101_REG_RW_WORCTRL) & 0xFB;
}
void cc1101_set_worctrl(uint8_t ctrl)
@@ -439,7 +440,7 @@ uint16_t cc1101_get_frend(void)
{
uint16_t f = cc1101_spi_read_register(CC1101_REG_RW_FREND1);
f = f << 8;
- f |= cc1101_spi_read_register(CC1101_REG_RW_FREND0);
+ f |= cc1101_spi_read_register(CC1101_REG_RW_FREND0) & 0x37;
return f;
}
@@ -451,11 +452,11 @@ uint32_t cc1101_get_fscal(void)
{
uint32_t f = cc1101_spi_read_register(CC1101_REG_RW_FSCAL3);
f = f << 8;
- f = cc1101_spi_read_register(CC1101_REG_RW_FSCAL2);
+ f = cc1101_spi_read_register(CC1101_REG_RW_FSCAL2) & 0x3F;
f = f << 8;
- f |= cc1101_spi_read_register(CC1101_REG_RW_FSCAL1);
+ f |= cc1101_spi_read_register(CC1101_REG_RW_FSCAL1) & 0x3F;
f = f << 8;
- f |= cc1101_spi_read_register(CC1101_REG_RW_FSCAL0);
+ f |= cc1101_spi_read_register(CC1101_REG_RW_FSCAL0) & 0x7F;
return f;
}
@@ -465,9 +466,9 @@ void cc1101_set_fscal(uint32_t cal)
uint16_t cc1101_get_rcctrl(void)
{
- uint16_t r = cc1101_spi_read_register(CC1101_REG_RW_RCCTRL1);
+ uint16_t r = cc1101_spi_read_register(CC1101_REG_RW_RCCTRL1) & 0x7F;
r = r << 8;
- r |= cc1101_spi_read_register(CC1101_REG_RW_RCCTRL0);
+ r |= cc1101_spi_read_register(CC1101_REG_RW_RCCTRL0) & 0x7F;
return r;
}
diff --git a/software/avr.lib/cc1101.h b/software/avr.lib/cc1101.h
index af7c0b3..6b981b8 100644
--- a/software/avr.lib/cc1101.h
+++ b/software/avr.lib/cc1101.h
@@ -79,10 +79,10 @@ uint8_t cc1101_get_freq_offset(void);
void cc1101_set_freq_offset(uint8_t freqoff);
uint32_t cc1101_get_freq(void);
void cc1101_set_freq(uint32_t freq);
-uint8_t cc1101_get_deviatn(void);
-void cc1101_set_deviatn(uint8_t dev);
uint64_t cc1101_get_modemcfg(void);
void cc1101_set_modemcfg(uint64_t cfg);
+uint8_t cc1101_get_deviatn(void);
+void cc1101_set_deviatn(uint8_t dev);
uint32_t cc1101_get_mcsm(void);
void cc1101_set_mcsm(uint32_t cfg);