Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SX1276Lib AdaFruit_RGBLCD MCP23017 mbed
Fork of AdaFruit_RGBLCD by
Modules/TempModule.cpp
- Committer:
- vtraveller
- Date:
- 2014-08-10
- Revision:
- 11:96146db429de
- Parent:
- 10:3fcab08717fc
- Child:
- 13:9641bc42db92
File content as of revision 11:96146db429de:
#include "mbed.h"
#include "TempModule.h"
#include "extra_chars.h"
TempModule::TempModule(Adafruit_RGBLCDShield & in_cLCD)
: Module(in_cLCD)
, m_nTemp(28)
{
}
TempModule::~TempModule()
{
}
void TempModule::change
(
int in_nIndexX,
int in_nCursorY,
bool in_bUp
)
{
enum ETemp
{
eTens = 0,
eSingles = 1,
};
switch (in_nIndexX)
{
case eTens: m_nTemp += (in_bUp ? 1 : -1) * 10; break;
case eSingles: m_nTemp += (in_bUp ? 1 : -1); break;
}
if (m_nTemp > 40) m_nTemp = 40;
if (m_nTemp < -40) m_nTemp = -40;
}
int TempModule::setCursor
(
int in_nIndex,
int in_nCursorX,
int in_nCursorY
)
{
const int k_aCursor[] = { 6, 7 };
int nIndex = in_nIndex;
if (nIndex < 0) nIndex = 0;
if (nIndex >= _countof(k_aCursor)) nIndex = _countof(k_aCursor) - 1;
int nCursorX = k_aCursor[nIndex];
m_cLCD.setCursor(in_nCursorX + nCursorX,in_nCursorY);
return nIndex;
}
void TempModule::show()
{
m_cLCD.printf("Room: %i%cC ",m_nTemp,eDegree);
}
