From cec03d893fa067de176d80f539ab21694f20c237 Mon Sep 17 00:00:00 2001 From: Ralf9 Date: Wed, 25 Dec 2019 16:21:37 +0100 Subject: [PATCH] cc1101.h - cc1101 FIFO Support es gibt die die neuen Routinen: getRXBYTES(), damit werden die Anzahl empfangener Bytes im FIFO gelesen sendFIFO, damit kann ein String mit Hex Bytes zum FIFO gesendet werden --- cc1101.h | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/cc1101.h b/cc1101.h index 1eadc53..f8701d4 100644 --- a/cc1101.h +++ b/cc1101.h @@ -41,13 +41,19 @@ namespace cc1101 { #define CC1100_FREQ2 0x0D // Frequency control word, high byte #define CC1100_FREQ1 0x0E // Frequency control word, middle byte #define CC1100_FREQ0 0x0F // Frequency control word, low byte - #define CC1100_PATABLE 0x3E // 8 byte memory #define CC1100_IOCFG2 0x00 // GDO2 output configuration #define CC1100_PKTCTRL0 0x08 // Packet config register + + // Multi byte memory locations + #define CC1100_PATABLE 0x3E // 8 byte memory + #define CC1100_TXFIFO 0x3F + #define CC1100_RXFIFO 0x3F // Status registers #define CC1100_RSSI 0x34 // Received signal strength indication #define CC1100_MARCSTATE 0x35 // Control state machine state + #define CC1100_TXBYTES 0x3A // Underflow and # of bytes in TXFIFO + #define CC1100_RXBYTES 0x3B // Overflow and # of bytes in RXFIFO // Strobe commands #define CC1101_SRES 0x30 // reset @@ -147,6 +153,17 @@ namespace cc1101 { return hex; // printf ("%d\n",$hex) ?? } + + uint8_t cmdstringPos2int(uint8_t pos) { + uint8_t val; + uint8_t hex; + + hex = (uint8_t)cmdstring.charAt(pos); + val = hex2int(hex) * 16; + hex = (uint8_t)cmdstring.charAt(pos+1); + val = hex2int(hex) + val; + return val; + } void printHex2(const byte hex) { // Todo: printf oder scanf nutzen if (hex < 16) { @@ -156,8 +173,6 @@ namespace cc1101 { //sprintf(hexstr, "%02X", hex); MSG_PRINT(hex, HEX); - - } @@ -222,7 +237,7 @@ namespace cc1101 { } cc1101_Deselect(); } - + void readCCreg(const uint8_t reg) { // read CC11001 register uint8_t var; @@ -334,8 +349,6 @@ void writeCCpatable(uint8_t var) { // write 8 byte to patable (kein pa } - - void ccFactoryReset() { for (uint8_t i = 0; i