Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: alarm_slave iq_sx126x sx126x_simple_TX_shield_2020a sx126x_simple_RX_shield_2020a ... more
Revision 3:f6f2f8adcd22, committed 2018-07-03
- Comitter:
- Wayne Roberts
- Date:
- Tue Jul 03 15:38:55 2018 -0700
- Parent:
- 2:e6e159c8ab4d
- Child:
- 4:b941bceb401d
- Commit message:
- add getPacketType
Changed in this revision
| sx126x.cpp | Show annotated file Show diff for this revision Revisions of this file |
| sx12xx.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/sx126x.cpp Mon Jun 11 11:15:18 2018 -0700
+++ b/sx126x.cpp Tue Jul 03 15:38:55 2018 -0700
@@ -223,6 +223,13 @@
xfer(OPCODE_SET_PACKET_TYPE, 1, 0, &type);
}
+uint8_t SX126x::getPacketType()
+{
+ uint8_t buf[2];
+ xfer(OPCODE_GET_PACKET_TYPE, 0, 2, buf);
+ return buf[1];
+}
+
void SX126x::SetDIO2AsRfSwitchCtrl(uint8_t en)
{
xfer(OPCODE_SET_DIO2_AS_RFSWITCH, 1, 0, &en);
--- a/sx12xx.h Mon Jun 11 11:15:18 2018 -0700
+++ b/sx12xx.h Tue Jul 03 15:38:55 2018 -0700
@@ -44,7 +44,7 @@
#define OPCODE_GET_STATUS 0xc0
#define OPCODE_SET_TX_CONTINUOUS 0xd1
/***************************************************************/
-#define PACKET_TYPE_GFSK 1
+#define PACKET_TYPE_GFSK 0
#define PACKET_TYPE_LORA 1
#define HEADER_TYPE_VARIABLE_LENGTH 0
@@ -371,16 +371,17 @@
typedef union {
struct { //
- uint8_t TxDone : 1; // 0
- uint8_t RxDone : 1; // 1
- uint8_t PreambleDetected : 1; // 2
- uint8_t SyncWordValid : 1; // 3
- uint8_t HeaderValid : 1; // 4
- uint8_t HeaderErr : 1; // 5
- uint8_t CrCerr : 1; // 6
- uint8_t CadDone : 1; // 7
- uint8_t CadDetected : 1; // 8
- uint8_t Timeout : 1; // 9
+ uint16_t TxDone : 1; // 0
+ uint16_t RxDone : 1; // 1
+ uint16_t PreambleDetected : 1; // 2
+ uint16_t SyncWordValid : 1; // 3
+ uint16_t HeaderValid : 1; // 4
+ uint16_t HeaderErr : 1; // 5
+ uint16_t CrCerr : 1; // 6
+ uint16_t CadDone : 1; // 7
+ uint16_t CadDetected : 1; // 8
+ uint16_t Timeout : 1; // 9
+ uint16_t res : 6; // 10,11,12,13,14,15
} bits;
uint16_t word;
} IrqFlags_t;
@@ -409,6 +410,7 @@
void hw_reset(PinName nrst);
void xfer(uint8_t opcode, uint8_t writeLen, uint8_t readLen, uint8_t* buf);
void setPacketType(uint8_t);
+ uint8_t getPacketType(void);
uint8_t setMHz(float);
float getMHz(void);