From a471f3583e4eb0fc8dfe7c26cd8d392a566bd85d Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 26 Jan 2022 18:45:51 +0100 Subject: [PATCH] drivers/sx127x: add support for WLR089/SAM R34 The device ID returned on WLR089 is 0x13 instead of 0x12, but it appears to work just like sx1276. Also check for the other device ID to make the driver work on this module. --- dist/tools/doccheck/exclude_patterns | 1 + drivers/sx127x/include/sx127x_registers.h | 1 + drivers/sx127x/sx127x_internal.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/tools/doccheck/exclude_patterns b/dist/tools/doccheck/exclude_patterns index 398900ddf1..bd2ff2310f 100644 --- a/dist/tools/doccheck/exclude_patterns +++ b/dist/tools/doccheck/exclude_patterns @@ -13357,6 +13357,7 @@ drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_RE drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_REG_MODEM_CONFIG2 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1272 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276 \(macro definition\) of file sx127x_registers\.h is not documented\. +drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276_WLR089 \(macro definition\) of file sx127x_registers\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member B_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_OFFSET_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\. diff --git a/drivers/sx127x/include/sx127x_registers.h b/drivers/sx127x/include/sx127x_registers.h index 82fe55e44e..03da694325 100644 --- a/drivers/sx127x/include/sx127x_registers.h +++ b/drivers/sx127x/include/sx127x_registers.h @@ -558,6 +558,7 @@ extern "C" { /* Version */ #define SX127X_REG_VERSION (0x42) #define VERSION_SX1276 (0x12) +#define VERSION_SX1276_WLR089 (0x13) #define VERSION_SX1272 (0x22) /* Additional settings */ diff --git a/drivers/sx127x/sx127x_internal.c b/drivers/sx127x/sx127x_internal.c index e5323feb5e..d3b86b40ae 100644 --- a/drivers/sx127x/sx127x_internal.c +++ b/drivers/sx127x/sx127x_internal.c @@ -53,7 +53,7 @@ int sx127x_check_version(const sx127x_t *dev) } DEBUG("[sx127x] SX1272 transceiver detected\n"); #else /* MODULE_SX1276) */ - if (version != VERSION_SX1276) { + if (version != VERSION_SX1276 && version != VERSION_SX1276_WLR089) { DEBUG("[sx127x] sx1276 test failed, invalid version number: %d\n", version); return -1;