本文整理汇总了C++中ShiftRegLCD类的典型用法代码示例。如果您正苦于以下问题:C++ ShiftRegLCD类的具体用法?C++ ShiftRegLCD怎么用?C++ ShiftRegLCD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ShiftRegLCD类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lcdPrintBigNum
static void lcdPrintBigNum(float val)
{
// good up to 3276.8
int16_t ival = val * 10;
uint16_t uval;
boolean isNeg;
if (ival < 0)
{
isNeg = true;
uval = -ival;
}
else
{
isNeg = false;
uval = ival;
}
int8_t x = 16;
do
{
if (uval != 0 || x >= 9)
{
const char PROGMEM *numData = NUMS + ((uval % 10) * 6);
x -= C_WIDTH;
lcd.setCursor(x, 0);
lcd.write_P(numData, C_WIDTH);
numData += C_WIDTH;
lcd.setCursor(x, 1);
lcd.write_P(numData, C_WIDTH);
uval /= 10;
} /* if val */
--x;
lcd.setCursor(x, 0);
lcd.write(C_BLK);
lcd.setCursor(x, 1);
if (x == 12)
lcd.write('.');
else if (uval == 0 && x < 9 && isNeg)
{
lcd.write(C_CT);
isNeg = false;
}
else
lcd.write(C_BLK);
} while (x != 0);
}
示例2: ledExecutor
static void ledExecutor(unsigned char led, unsigned char on)
{
switch (led)
{
case 0:
digitalWrite(PIN_WIRELESS_LED, on);
break;
default:
lcd.digitalWrite(led - 1, on);
break;
}
}
示例3: setup
void setup() {
srlcd.print("ready.");
// ensure the receiver pin is set for input
DDRB &= ~_BV(PINB0);
// disable PWM (default)
TCCR1A = 0x00;
// set prescaler to 1/8. TCNT1 increments every 0.5 micro seconds
// falling edge used as trigger
TCCR1B = 0x02;
// enable input capture interrupt for timer 1
TIMSK1 = _BV(ICIE1);
}
示例4: storeLcdParam
void storeLcdParam(unsigned char idx, int val)
{
switch (idx)
{
case 0:
storeLcdBacklight(val);
break;
case 1:
g_HomeDisplayMode = val;
config_store_byte(homeDisplayMode, g_HomeDisplayMode);
// If we're in home, clear in case we're switching from 4 to 2
if (isMenuHomeState())
lcd.clear();
case 2:
case 3:
case 4:
case 5:
storeLedConf(idx - 2, val);
break;
}
}
示例5: lcdprint_P
void lcdprint_P(const char PROGMEM *p, const boolean doClear)
{
if (doClear)
lcd.clear();
while (unsigned char c = pgm_read_byte(p++)) lcd.write(c);
}
示例6: updateDisplay
void updateDisplay(void)
{
// Updates to the temperature can come at any time, only update
// if we're in a state that displays them
state_t state = Menus.getState();
if (!isMenuHomeState())
return;
char buffer[17];
unsigned char probeIdxLow, probeIdxHigh;
// Fixed pit area
lcd.setCursor(0, 0);
if (state == ST_HOME_ALARM)
{
toneEnable(true);
if (ALARM_ID_TO_IDX(g_AlarmId) == ALARM_IDX_LOW)
lcdprint_P(PSTR("** ALARM LOW **"), false);
else
lcdprint_P(PSTR("** ALARM HIGH **"), false);
probeIdxLow = probeIdxHigh = ALARM_ID_TO_PROBE(g_AlarmId);
} /* if ST_HOME_ALARM */
else
{
toneEnable(false);
/* Big Number probes overwrite the whole display if it has a temperature */
if (g_HomeDisplayMode >= TEMP_PIT && g_HomeDisplayMode <= TEMP_AMB)
{
TempProbe *probe = pid.Probes[g_HomeDisplayMode];
if (probe->hasTemperature())
{
lcdPrintBigNum(probe->Temperature);
return;
}
}
/* Default Pit / Fan Speed first line */
int pitTemp;
if (pid.Probes[TEMP_CTRL]->hasTemperature())
pitTemp = pid.Probes[TEMP_CTRL]->Temperature;
else
pitTemp = 0;
if (!pid.getManualOutputMode() && !pid.Probes[TEMP_CTRL]->hasTemperature())
memcpy_P(buffer, LCD_LINE1_UNPLUGGED, sizeof(LCD_LINE1_UNPLUGGED));
else if (pid.LidOpenResumeCountdown > 0)
snprintf_P(buffer, sizeof(buffer), PSTR("Pit:%3d"DEGREE"%c Lid%3u"),
pitTemp, pid.getUnits(), pid.LidOpenResumeCountdown);
else
{
char c1,c2;
if (pid.getManualOutputMode())
{
c1 = '^'; // LCD_ARROWUP
c2 = '^'; // LCD_ARROWDN
}
else
{
c1 = '[';
c2 = ']';
}
snprintf_P(buffer, sizeof(buffer), PSTR("Pit:%3d"DEGREE"%c %c%3u%%%c"),
pitTemp, pid.getUnits(), c1, pid.getPidOutput(), c2);
}
lcd.print(buffer);
// Display mode 0xff is 2-line, which only has space for 1 non-pit value
if (g_HomeDisplayMode == 0xff)
probeIdxLow = probeIdxHigh = state - ST_HOME_FOOD1 + TEMP_FOOD1;
else
{
// Display mode 0xfe is 4 line home, display 3 other temps there
probeIdxLow = TEMP_FOOD1;
probeIdxHigh = TEMP_AMB;
}
} /* if !ST_HOME_ALARM */
// Rotating probe display
for (unsigned char probeIndex=probeIdxLow; probeIndex<=probeIdxHigh; ++probeIndex)
{
if (probeIndex < TEMP_COUNT && pid.Probes[probeIndex]->hasTemperature())
{
loadProbeName(probeIndex);
snprintf_P(buffer, sizeof(buffer), PSTR("%-12s%3d"DEGREE), editString,
(int)pid.Probes[probeIndex]->Temperature);
}
else
{
// If probeIndex is outside the range (in the case of ST_HOME_NOPROBES)
// just fill the bottom line with spaces
memset(buffer, ' ', sizeof(buffer));
buffer[sizeof(buffer) - 1] = '\0';
}
lcd.setCursor(0, probeIndex - probeIdxLow + 1);
lcd.print(buffer);
}
}
示例7: lcdDefineChars
static void lcdDefineChars(void)
{
for (unsigned char i=0; i<8; ++i)
lcd.createChar_P(i, BIG_CHAR_PARTS + (i * 8));
}