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: AdaFruit_RGBLCDShield MCP23017 mbed RTclock
Fork of MCP_test by
Modules/TempModule.cpp
- Committer:
- vtraveller
- Date:
- 2014-08-11
- Revision:
- 14:8b359e1e68f3
- Parent:
- 13:9641bc42db92
- Child:
- 15:d1eaddb363be
File content as of revision 14:8b359e1e68f3:
#include "mbed.h" #include "TempModule.h" #include "extra_chars.h" TempModule::TempModule(Serial & in_cDisplay) : Module(in_cDisplay) , m_nTemp(28) { } TempModule::~TempModule() { } void TempModule::change ( size_t in_nIndex, bool in_bUp ) { enum ETemp { eTens = 0, eSingles = 1, }; switch (in_nIndex) { 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::getCursorOffset(size_t & inout_nIndex) { const int k_aCursor[] = { 6, 7 }; if ((int)inout_nIndex < 0) inout_nIndex = 0; if (inout_nIndex >= _countof(k_aCursor)) inout_nIndex = _countof(k_aCursor) - 1; return k_aCursor[inout_nIndex]; } void TempModule::show() { m_cDisplay.printf("Room: %i%cC ",m_nTemp,eDegree); }