-
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.
Merge pull request #269 from mcci-catena/issue268
Fix #268: added platform support to Catena 4802
- Loading branch information
Showing
12 changed files
with
252 additions
and
8 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
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,62 @@ | ||
/* | ||
Module: Catena4802.h | ||
Function: | ||
class Catena4802: CatenaBase Platform to represent a Catena 4802. | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Dhinesh Kumar Pitchai, MCCI Corporation November 2020 | ||
*/ | ||
|
||
#ifndef _Catena4802_H_ /* prevent multiple includes */ | ||
#define _Catena4802_H_ | ||
|
||
#pragma once | ||
|
||
#ifndef _CATENA480X_H_ | ||
# include "Catena480x.h" | ||
#endif | ||
|
||
namespace McciCatena { | ||
|
||
class Catena4802 : public Catena480x | ||
{ | ||
public: | ||
using Super = Catena480x; | ||
|
||
// no specific constructor. | ||
Catena4802() {}; | ||
|
||
// uses default destructor | ||
|
||
// neither copyable nor movable | ||
Catena4802(const Catena4802&) = delete; | ||
Catena4802& operator=(const Catena4802&) = delete; | ||
Catena4802(const Catena4802&&) = delete; | ||
Catena4802& operator=(const Catena4802&&) = delete; | ||
|
||
virtual const char *CatenaName() const override { return "Catena 4802"; }; | ||
float ReadVin(void) const; | ||
|
||
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 Catena4802.h ****/ | ||
#endif /* _Catena4802_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
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,57 @@ | ||
/* | ||
Module: Catena4802_ReadVoltage.cpp | ||
Function: | ||
Catena4802::ReadVin() | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Dhinesh Kumar Pitchai, MCCI Corporation November 2020 | ||
Revision history: | ||
See https://github.com/mcci-catena/Catena-Arduino-Platform | ||
*/ | ||
|
||
#ifdef ARDUINO_ARCH_STM32 | ||
|
||
#include "Catena4802.h" | ||
|
||
#include <Arduino.h> | ||
using namespace McciCatena; | ||
|
||
/****************************************************************************\ | ||
| | ||
| Manifest constants & typedefs. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Read-only data. | ||
| | ||
\****************************************************************************/ | ||
|
||
|
||
|
||
/****************************************************************************\ | ||
| | ||
| Variables. | ||
| | ||
\****************************************************************************/ | ||
|
||
float | ||
Catena4802::ReadVin(void) const | ||
{ | ||
float volt = this->ReadAnalog(Catena480x::ANALOG_CHANNEL_VBAT, 1, 3); | ||
return volt / 1000; | ||
} | ||
|
||
#endif // ARDUINO_ARCH_STM32 | ||
|
||
/**** end of Catena4802_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,86 @@ | ||
/* | ||
Module: Catena4802_getPlatformTable.cpp | ||
Function: | ||
Catena4802::getPlatformTable() | ||
Copyright notice: | ||
See accompanying LICENSE file. | ||
Author: | ||
Dhinesh Kumar Pitchai, MCCI Corporation November 2020 | ||
*/ | ||
|
||
#ifdef ARDUINO_ARCH_STM32 | ||
|
||
#include "Catena4802.h" | ||
|
||
#include "Catena_Log.h" | ||
#include "Catena_Platforms.h" | ||
#include "Catena_Guids.h" | ||
|
||
namespace McciCatena { | ||
|
||
const CATENA_PLATFORM gkPlatformCatena4802 = | ||
{ | ||
Guid: GUID_HW_CATENA_4802_BASE(WIRE), | ||
pParent: &gkPlatformCatena4802, | ||
PlatformFlags: | ||
CatenaBase::fHasLoRa | | ||
CatenaBase::fHasTtnNycLoRa | | ||
CatenaBase::fHasFRAM | | ||
CatenaBase::fHasFlash | | ||
CatenaBase::fHasRS485 | | ||
CatenaBase::fHasSHT3x | | ||
CatenaBase::fHasI2cLevelShifter | ||
}; | ||
|
||
const CATENA_PLATFORM (* const Catena4802::vPlatforms[]) = | ||
{ | ||
// entry 0 is the default | ||
&gkPlatformCatena4802, | ||
}; | ||
|
||
const size_t Catena4802::nvPlatforms = sizeof(Catena4802::vPlatforms) / sizeof(Catena4802::vPlatforms[0]); | ||
|
||
/* | ||
Name: Catena4802::getPlatformTable() | ||
Function: | ||
Get the known platform table. | ||
Definition: | ||
public: virtual | ||
void Catena4802::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 | ||
Catena4802::getPlatformTable( | ||
const CATENA_PLATFORM * const * &result_vPlatforms, | ||
size_t &result_nvPlatforms | ||
) | ||
{ | ||
result_vPlatforms = vPlatforms; | ||
result_nvPlatforms = nvPlatforms; | ||
} | ||
|
||
} /* namespace McciCatena */ | ||
|
||
#endif // ARDUINO_ARCH_STM32 |