-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17a7ecc
commit 1969ced
Showing
10 changed files
with
465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Module: Catena4916.h | ||
Function: | ||
class Catena4916: CatenaBase Platform to represent a Catena 4916 | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Dhinesh Kumar Pitchai, MCCI Corporation November 2022 | ||
*/ | ||
|
||
#ifndef _Catena4916_H_ /* prevent multiple includes */ | ||
#define _Catena4916_H_ | ||
|
||
#pragma once | ||
|
||
#ifndef _CATENA491x_H_ | ||
# include "Catena491x.h" | ||
#endif | ||
|
||
namespace McciCatena { | ||
|
||
class Catena4916 : public Catena491x | ||
{ | ||
public: | ||
using Super = Catena4916; | ||
|
||
// no specific constructor. | ||
Catena4916() {}; | ||
|
||
// uses default destructor | ||
|
||
// neither copyable nor movable | ||
Catena4916(const Catena4916&) = delete; | ||
Catena4916& operator=(const Catena4916&) = delete; | ||
Catena4916(const Catena4916&&) = delete; | ||
Catena4916& operator=(const Catena4916&&) = delete; | ||
|
||
virtual const char *CatenaName() const override { return "Catena 4916"; }; | ||
virtual float ReadVbat(void) const override; | ||
virtual float ReadVbus(void) const override; | ||
|
||
protected: | ||
// we are required to provide a table of platforms | ||
virtual void getPlatformTable( | ||
const CATENA_PLATFORM * const * &vPlatforms, | ||
size_t &nvPlatforms | ||
) override; | ||
|
||
private: | ||
// the known platforms | ||
static const CATENA_PLATFORM(* const vPlatforms[]); | ||
static const size_t nvPlatforms; | ||
}; | ||
|
||
} // namespace McciCatena | ||
|
||
/**** end of Catena4916.h ****/ | ||
#endif /* _Catena4916_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
Module: Catena491x.h | ||
Function: | ||
class Catena491x: CatenaBase Platform to represent a Catena 491x | ||
(such as the 4916). | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Dhinesh Kumar Pitchai, MCCI Corporation November 2022 | ||
*/ | ||
|
||
#ifndef _CATENA491X_H_ /* prevent multiple includes */ | ||
#define _CATENA491X_H_ | ||
|
||
#pragma once | ||
|
||
#ifndef _CATENASTM32L0_H_ | ||
# include "CatenaStm32L0.h" | ||
#endif | ||
|
||
namespace McciCatena { | ||
|
||
class Catena491x : public CatenaStm32L0 | ||
{ | ||
public: | ||
using Super = CatenaStm32L0; | ||
|
||
// no specific constructor. | ||
Catena491x() {}; | ||
|
||
// uses default destructor | ||
|
||
// neither copyable nor movable | ||
Catena491x(const Catena491x&) = delete; | ||
Catena491x& operator=(const Catena491x&) = delete; | ||
Catena491x(const Catena491x&&) = delete; | ||
Catena491x& operator=(const Catena491x&&) = delete; | ||
|
||
// LoRaWAN binding | ||
class LoRaWAN /* forward */; | ||
|
||
enum ANALOG_PINS | ||
{ | ||
APIN_VBAT_SENSE = A1, | ||
// APIN_VBUS_SENSE = A4, | ||
}; | ||
|
||
enum ANALOG_CHANNELS | ||
{ | ||
ANALOG_CHANNEL_A1 = 5, | ||
ANALOG_CHANNEL_A2 = 4, | ||
ANALOG_CHANNEL_A3 = 3, | ||
ANALOG_CHANNEL_A4 = 2, | ||
ANALOG_CHANNEL_VBAT = ANALOG_CHANNEL_A1, | ||
ANALOG_CHANNEL_VREF = 17, | ||
}; | ||
|
||
enum DIGITAL_PINS | ||
{ | ||
PIN_STATUS_LED = D13, | ||
PIN_SPI2_FLASH_SS = D19, | ||
PIN_SPI2_MOSI = D23, | ||
PIN_SPI2_MISO = D22, | ||
PIN_SPI2_SCK = D24, | ||
}; | ||
|
||
// methods | ||
virtual bool begin() override; | ||
|
||
protected: | ||
|
||
private: | ||
}; | ||
|
||
/* | ||
|| The LoRaWAN class for the Catena 455x. Assumes The Things Network | ||
*/ | ||
class Catena491x::LoRaWAN : public CatenaStm32L0::LoRaWAN | ||
{ | ||
public: | ||
using Super = CatenaStm32L0::LoRaWAN; | ||
|
||
/* | ||
|| the constructor. We don't do anything at this level, the | ||
|| Super constructor does most of the work. | ||
*/ | ||
LoRaWAN() {}; | ||
|
||
bool begin(Catena491x *pParent); | ||
|
||
protected: | ||
|
||
private: | ||
}; | ||
|
||
} // namespace McciCatena | ||
|
||
/**** end of Catena491x.h ****/ | ||
#endif /* _CATENA491X_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Module: Catena4916_ReadVoltage.cpp | ||
Function: | ||
Catena4916::ReadVbat() and Catena4916::ReadVbus() | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Pranau R, MCCI Corporation November 2022 | ||
*/ | ||
|
||
#ifdef ARDUINO_ARCH_STM32 | ||
|
||
#include "Catena4916.h" | ||
#include "Catena_Log.h" | ||
|
||
#include <Arduino.h> | ||
using namespace McciCatena; | ||
|
||
/****************************************************************************\ | ||
| | ||
| Manifest constants & typedefs. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Read-only data. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Variables. | ||
| | ||
\****************************************************************************/ | ||
|
||
float | ||
Catena4916::ReadVbat(void) const | ||
{ | ||
float volt = this->ReadAnalog(Catena491x::ANALOG_CHANNEL_VBAT, 1, 2); | ||
return volt / 1000; | ||
} | ||
|
||
float | ||
Catena4916::ReadVbus(void) const | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif // ARDUINO_ARCH_STM32 | ||
|
||
/**** end of Catena4916_ReadVoltage.cpp ****/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
Module: Catena4916_getPlatformTable.cpp | ||
Function: | ||
Catena4916::getPlatformTable() | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Pranau R, MCCI Corporation November 2022 | ||
*/ | ||
|
||
#ifdef ARDUINO_ARCH_STM32 | ||
|
||
#include "Catena4916.h" | ||
|
||
#include "Catena_Log.h" | ||
#include "Catena_Platforms.h" | ||
#include "Catena_Guids.h" | ||
|
||
/****************************************************************************\ | ||
| | ||
| Read-only data. | ||
| | ||
\****************************************************************************/ | ||
|
||
namespace McciCatena { | ||
|
||
const CATENA_PLATFORM gkPlatformCatena4916 = | ||
{ | ||
Guid: GUID_HW_CATENA_4916_BASE(WIRE), | ||
pParent: &gkPlatformCatena4916, | ||
PlatformFlags: | ||
CatenaBase::fHasLoRa | | ||
CatenaBase::fHasTtnNycLoRa | | ||
CatenaBase::fHasSHT3x | | ||
CatenaBase::fHasBme680 | | ||
CatenaBase::fHasADS131M04 | | ||
CatenaBase::fHasSAMM8Q | | ||
CatenaBase::fHasFRAM | | ||
CatenaBase::fHasFlash | ||
}; | ||
|
||
const CATENA_PLATFORM (* const Catena4916::vPlatforms[]) = | ||
{ | ||
// entry 0 is the default | ||
&gkPlatformCatena4916, | ||
}; | ||
|
||
const size_t Catena4916::nvPlatforms = sizeof(Catena4916::vPlatforms) / sizeof(Catena4916::vPlatforms[0]); | ||
|
||
/* | ||
Name: Catena4916::getPlatformTable() | ||
Function: | ||
Get the known platform table. | ||
Definition: | ||
public: virtual | ||
void Catena4916::getPlatformTable( | ||
const CATENA_PLATFORM * const * &vPlatforms, | ||
size_t &nvPlatforms | ||
) override; | ||
Description: | ||
This override for getPlatformTable() returns the vector of platform | ||
GUIDs for this Catena. | ||
Returns: | ||
vPlatforms is set to the base of the array of pointers to platform | ||
stuctures; and nvPlatforms is set to the number of entries in | ||
the table. | ||
*/ | ||
|
||
/* public virtual override */ | ||
void | ||
Catena4916::getPlatformTable( | ||
const CATENA_PLATFORM * const * &result_vPlatforms, | ||
size_t &result_nvPlatforms | ||
) | ||
{ | ||
result_vPlatforms = vPlatforms; | ||
result_nvPlatforms = nvPlatforms; | ||
} | ||
|
||
} /* namespace McciCatena */ | ||
|
||
#endif // ARDUINO_ARCH_STM32 |
Oops, something went wrong.