Skip to content

Commit b584720

Browse files
added pinmap support for 4802
1 parent 86edfc7 commit b584720

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
@@ -35,6 +35,7 @@ const HalPinmap_t *GetPinmap_Catena4617();
3535
const HalPinmap_t *GetPinmap_Catena4618();
3636
const HalPinmap_t *GetPinmap_Catena4630();
3737
const HalPinmap_t *GetPinmap_Catena4801();
38+
const HalPinmap_t *GetPinmap_Catena4802();
3839
const HalPinmap_t* GetPinmap_ttgo_lora32_v1();
3940
const HalPinmap_t* GetPinmap_heltec_lora32();
4041
const HalPinmap_t* GetPinmap_Disco_L072cz_Lrwan1();

src/hal/getpinmap_catena4802.cpp

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
3+
Module: getconfig_catena4802.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+
Dhinesh Kumar Pitchai, MCCI November 2020
13+
14+
*/
15+
16+
#if defined(ARDUINO_MCCI_CATENA_4802) || \
17+
/* legacy names */ \
18+
defined(ARDUINO_CATENA_4802)
19+
20+
#include <arduino_lmic_hal_boards.h>
21+
#include <Arduino.h>
22+
23+
#include "../lmic/oslmic.h"
24+
25+
namespace Arduino_LMIC {
26+
27+
class HalConfiguration_Catena4802_t : public HalConfiguration_t
28+
{
29+
public:
30+
enum DIGITAL_PINS : uint8_t
31+
{
32+
PIN_SX1276_NSS = D7,
33+
PIN_SX1276_NRESET = D8,
34+
PIN_SX1276_DIO0 = D25,
35+
PIN_SX1276_DIO1 = D26,
36+
PIN_SX1276_DIO2 = D27,
37+
PIN_SX1276_ANT_SWITCH_RX = D29,
38+
PIN_SX1276_ANT_SWITCH_TX_BOOST = D30,
39+
PIN_SX1276_ANT_SWITCH_TX_RFO = D31,
40+
PIN_VDD_BOOST_ENABLE = A0,
41+
PIN_TCXO_VDD = D33,
42+
};
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(3);
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_Catena4802_t myConfig;
77+
78+
static const HalPinmap_t myPinmap =
79+
{
80+
.nss = HalConfiguration_Catena4802_t::PIN_SX1276_NSS, // chip select is D7
81+
.rxtx = HalConfiguration_Catena4802_t::PIN_SX1276_ANT_SWITCH_RX, // RXTX is D29
82+
.rst = HalConfiguration_Catena4802_t::PIN_SX1276_NRESET, // NRESET is D8
83+
84+
.dio = {HalConfiguration_Catena4802_t::PIN_SX1276_DIO0, // DIO0 (IRQ) is D25
85+
HalConfiguration_Catena4802_t::PIN_SX1276_DIO1, // DIO1 is D26
86+
HalConfiguration_Catena4802_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_Catena4802(void)
95+
{
96+
return &myPinmap;
97+
}
98+
99+
}; // namespace Arduino_LMIC
100+
101+
#endif /* defined(ARDUINO_CATENA_4611) || defined(ARDUINO_CATENA_4802) */

src/hal/getpinmap_thisboard.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const HalPinmap_t *GetPinmap_ThisBoard(void)
5555
return GetPinmap_Catena4630();
5656
#elif defined(ARDUINO_MCCI_CATENA_4801)
5757
return GetPinmap_Catena4801();
58+
#elif defined(ARDUINO_MCCI_CATENA_4802)
59+
return GetPinmap_Catena4802();
5860
#elif defined(ARDUINO_DISCO_L072CZ_LRWAN1)
5961
return GetPinmap_Disco_L072cz_Lrwan1();
6062
#elif defined(PINNOCHIO_SCOUT)

0 commit comments

Comments
 (0)