Skip to content

Commit d6a06bc

Browse files
committed
fix #1004: added model4933 pinmapping
1 parent be3af89 commit d6a06bc

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

src/arduino_lmic_hal_boards.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const HalPinmap_t *GetPinmap_Catena4802();
3939
const HalPinmap_t *GetPinmap_Catena4916();
4040
const HalPinmap_t *GetPinmap_Catena4917();
4141
const HalPinmap_t *GetPinmap_Catena4931();
42+
const HalPinmap_t *GetPinmap_Catena4933();
4243
const HalPinmap_t* GetPinmap_ttgo_lora32_v1();
4344
const HalPinmap_t *GetPinmap_ttgo_lora32_v21();
4445
const HalPinmap_t* GetPinmap_heltec_lora32();

src/hal/getpinmap_catena4933.cpp

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
3+
Module: getpinmap_catena4933.cpp
4+
5+
Function:
6+
Arduino-LMIC C++ HAL pinmaps for various boards
7+
8+
Copyright & License:
9+
See accompanying LICENSE file.
10+
11+
Author:
12+
Pranau R, MCCI October 2023
13+
14+
*/
15+
16+
#if defined(ARDUINO_MCCI_MODEL_4933)
17+
18+
#include <arduino_lmic_hal_boards.h>
19+
#include <Arduino.h>
20+
21+
#include "../lmic/oslmic.h"
22+
23+
namespace Arduino_LMIC {
24+
25+
class HalConfiguration_Catena4933_t : public HalConfiguration_t
26+
{
27+
public:
28+
enum DIGITAL_PINS : uint8_t
29+
{
30+
PIN_SX1276_NSS = D7,
31+
PIN_SX1276_NRESET = D8,
32+
PIN_SX1276_DIO0 = D25,
33+
PIN_SX1276_DIO1 = D26,
34+
PIN_SX1276_DIO2 = D27,
35+
PIN_SX1276_ANT_SWITCH_RX = D29,
36+
PIN_SX1276_ANT_SWITCH_TX_BOOST = D30,
37+
PIN_SX1276_ANT_SWITCH_TX_RFO = D31,
38+
PIN_VDD_BOOST_ENABLE = D12,
39+
PIN_TCXO_VDD = D33,
40+
};
41+
42+
static constexpr ostime_t TCXO_DELAY_MS = 5;
43+
44+
virtual void begin(void) override
45+
{
46+
digitalWrite(PIN_TCXO_VDD, 0);
47+
pinMode(PIN_TCXO_VDD, OUTPUT);
48+
}
49+
50+
virtual void end(void) override
51+
{
52+
digitalWrite(PIN_TCXO_VDD, 0);
53+
pinMode(PIN_TCXO_VDD, INPUT);
54+
}
55+
56+
virtual bool queryUsingTcxo(void) override { return true; };
57+
58+
virtual ostime_t setModuleActive(bool state) override
59+
{
60+
ostime_t result;
61+
const int oldState = digitalRead(PIN_TCXO_VDD);
62+
63+
// if turning on, we need to delay.
64+
result = 0;
65+
if (state && ! oldState)
66+
result = ms2osticksCeil(TCXO_DELAY_MS);
67+
68+
if (state != oldState)
69+
digitalWrite(PIN_TCXO_VDD, state);
70+
71+
return result;
72+
}
73+
};
74+
75+
// save some typing by bringing the pin numbers into scope
76+
static HalConfiguration_Catena4933_t myConfig;
77+
78+
static const HalPinmap_t myPinmap =
79+
{
80+
.nss = HalConfiguration_Catena4933_t::PIN_SX1276_NSS, // chip select is D7
81+
.rxtx = HalConfiguration_Catena4933_t::PIN_SX1276_ANT_SWITCH_RX, // RXTX is D29
82+
.rst = HalConfiguration_Catena4933_t::PIN_SX1276_NRESET, // NRESET is D8
83+
84+
.dio = {HalConfiguration_Catena4933_t::PIN_SX1276_DIO0, // DIO0 (IRQ) is D25
85+
HalConfiguration_Catena4933_t::PIN_SX1276_DIO1, // DIO1 is D26
86+
HalConfiguration_Catena4933_t::PIN_SX1276_DIO2, // DIO2 is D27
87+
},
88+
.rxtx_rx_active = 1,
89+
.rssi_cal = 10,
90+
.spi_freq = 8000000, /* 8MHz */
91+
.pConfig = &myConfig
92+
};
93+
94+
const HalPinmap_t *GetPinmap_Catena4933(void)
95+
{
96+
return &myPinmap;
97+
}
98+
99+
}; // namespace Arduino_LMIC
100+
101+
#endif /* defined(ARDUINO_MCCI_MODEL_4933)*/

src/hal/getpinmap_thisboard.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const HalPinmap_t *GetPinmap_ThisBoard(void)
6565
return GetPinmap_Catena4917();
6666
#elif defined(ARDUINO_MCCI_MODEL_4931)
6767
return GetPinmap_Catena4931();
68+
#elif defined(ARDUINO_MCCI_MODEL_4933)
69+
return GetPinmap_Catena4933();
6870
#elif defined(ARDUINO_DISCO_L072CZ_LRWAN1)
6971
return GetPinmap_Disco_L072cz_Lrwan1();
7072
#elif defined(PINNOCHIO_SCOUT)

0 commit comments

Comments
 (0)