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
Diff: Modules/TempModule.cpp
- Revision:
- 13:9641bc42db92
- Parent:
- 11:96146db429de
- Child:
- 14:8b359e1e68f3
--- a/Modules/TempModule.cpp Sun Aug 10 16:01:43 2014 +0000
+++ b/Modules/TempModule.cpp Mon Aug 11 19:11:43 2014 +0000
@@ -3,8 +3,8 @@
#include "extra_chars.h"
-TempModule::TempModule(Adafruit_RGBLCDShield & in_cLCD)
- : Module(in_cLCD)
+TempModule::TempModule(Serial & in_cDisplay)
+ : Module(in_cDisplay)
, m_nTemp(28)
{
}
@@ -15,8 +15,7 @@
void TempModule::change
(
- int in_nIndexX,
- int in_nCursorY,
+ size_t in_nIndex,
bool in_bUp
)
{
@@ -26,7 +25,7 @@
eSingles = 1,
};
- switch (in_nIndexX)
+ switch (in_nIndex)
{
case eTens: m_nTemp += (in_bUp ? 1 : -1) * 10; break;
case eSingles: m_nTemp += (in_bUp ? 1 : -1); break;
@@ -36,26 +35,17 @@
if (m_nTemp < -40) m_nTemp = -40;
}
-int TempModule::setCursor
-(
- int in_nIndex,
- int in_nCursorX,
- int in_nCursorY
-)
+int TempModule::getCursorOffset(size_t & inout_nIndex)
{
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;
+ if (inout_nIndex < 0) inout_nIndex = 0;
+ if (inout_nIndex >= _countof(k_aCursor)) inout_nIndex = _countof(k_aCursor) - 1;
- int nCursorX = k_aCursor[nIndex];
- m_cLCD.setCursor(in_nCursorX + nCursorX,in_nCursorY);
-
- return nIndex;
+ return k_aCursor[inout_nIndex];
}
void TempModule::show()
{
- m_cLCD.printf("Room: %i%cC ",m_nTemp,eDegree);
+ m_cDisplay.printf("Room: %i%cC ",m_nTemp,eDegree);
}
