void throb::decodeThrob (int16_t tone1, int16_t tone2) { int16_t i; if (shift == true) { if (tone1 == 0 && tone2 == 8) showChar ('?'); if (tone1 == 1 && tone2 == 7) showChar ('@'); if (tone1 == 2 && tone2 == 6) showChar ('='); if (tone1 == 4 && tone2 == 4) showChar ('\n'); shift = false; return; } // // no shift if (tone1 == 3 && tone2 == 5) { shift = true; return; } // // nothing special here, Look up in table for (i = 0; i < charsformode (throbMode); i++) { if (throbTonePairs[i][0] == tone1 + 1 && throbTonePairs[i][1] == tone2 + 1) { showChar (ThrobCharSet[i]); return; } } }
void displayNumberOnLCD(char identifier, char identifier2, int16_t displayNum) { //display 2 digit identifier showChar(identifier, pos1); showChar(identifier2, pos2); //seperate number into 3 digits and display showChar((((displayNum /100) % 10) + 48), pos4); showChar((((displayNum /10) % 10) + 48), pos5); showChar(((displayNum % 10) + 48), pos6); }
void LCD_LAUNCHPAD::displayText(char *s, char pos) { int length = strlen(s); int i; for (i=0; i<pos; i++) { showChar(' ', i); } for (i=pos; i<length; i++) { showChar(s[i-pos], i); } }
void LCD_LAUNCHPAD::displayText(String s, char pos) { int length = s.length(); int i; for (i=0; i<pos; i++) { showChar(' ', i); } for (i=pos; i<length; i++) { showChar(s.charAt(i-pos), i); } }
void showString(char* str) { printf("\n***%s*** is %lu long and is located at %p\n", str, strlen(str), str); for(int index=0; index<15; index++) { printf("%3dth char: ", index); showChar(str[index]); } printf("\n\n"); }
/* * Scrolls input string across LCD screen from left to right */ void LCD_LAUNCHPAD::displayScrollText(char *s, unsigned int wait) { int length = strlen(s); int i; int x = 5; char buffer[] = " "; for (i=0; i<length+7; i++) { int t; for (t=0; t<6; t++) buffer[t] = ' '; int j; for (j=0; j<length; j++) { if (((x+j) >= 0) && ((x+j) < 6)) buffer[x+j] = s[j]; } x--; showChar(buffer[0], 0); showChar(buffer[1], 1); showChar(buffer[2], 2); showChar(buffer[3], 3); showChar(buffer[4], 4); showChar(buffer[5], 5); delay(wait); } }
void throb::decodeThrobx (int16_t tone1, int16_t tone2) { int16_t i; for (i = 0; i < charsformode (throbMode); i++) { if (ThrobXTonePairs[i][0] == tone1 + 1 && ThrobXTonePairs[i][1] == tone2 + 1) { if (i == spacesym || i == idlesym) { if (lastchar != '\0' && lastchar != ' ') { showChar (ThrobXCharSet[1]); lastchar = ' '; } else { lastchar = '\0'; } flip_syms(); } else { showChar (ThrobXCharSet[i]); lastchar = ThrobXCharSet[i]; } } } }
void displayTemp() { clearLCD(); // Pick C or F depending on tempUnit state int deg; if (*tempUnit == 0) { showChar('C',pos6); deg = *degC; } else { showChar('F',pos6); deg = *degF; } // Handle negative values if (deg < 0) { deg *= -1; // Negative sign LCDMEM[pos1+1] |= 0x04; } // Handles displaying up to 999.9 degrees if (deg>=1000) showChar((deg/1000)%10 + '0',pos2); if (deg>=100) showChar((deg/100)%10 + '0',pos3); if (deg>=10) showChar((deg/10)%10 + '0',pos4); if (deg>=1) showChar((deg/1)%10 + '0',pos5); // Decimal point LCDMEM[pos4+1] |= 0x01; // Degree symbol LCDMEM[pos5+1] |= 0x04; }
// --------------------------------------------------------------------------- // TestParser: Private helpers // --------------------------------------------------------------------------- void TestParser::showChars( const XMLCh* const chars , const unsigned int length) { static const XMLByte FirstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; const bool doCan = ((fOutputType == OutputType_SunCanon) || (fOutputType == OutputType_JCCanon)); unsigned int index = 0; while (index < length) { // // Convert the char to UTF-8 format. This will generate multiple // short chars to display. For each one, call the showChar() // method to display it. // XMLUInt32 tmpVal = chars[index++]; if ((tmpVal >= 0xD800) && (tmpVal <= 0xDBFF)) { if (index == length) { XERCES_STD_QUALIFIER cout << "Missing trailing surrogate\n" << XERCES_STD_QUALIFIER endl; break; } tmpVal = ((tmpVal - 0xD800) << 10) + ((chars[index] - 0xDC00) + 0x10000); index++; } // Figure out how many bytes we'll kick out unsigned int outBytes; if (tmpVal < 0x80) outBytes = 1; else if (tmpVal < 0x800) outBytes = 2; else if (tmpVal < 0x10000) outBytes = 3; else if (tmpVal < 0x200000) outBytes = 4; else if (tmpVal < 0x4000000) outBytes = 5; else { outBytes = 6; if (tmpVal & 0x80000000) { outBytes = 2; tmpVal = 0xFFFD; } } // Get the chars into a temp buffer in the right order char tmpOutChars[6]; unsigned int outIndex = outBytes; switch(outBytes) { case 6 : tmpOutChars[--outIndex] = char((tmpVal | 0x80) & 0xBF); tmpVal >>= 6; case 5 : tmpOutChars[--outIndex] = char((tmpVal | 0x80) & 0xBF); tmpVal >>= 6; case 4 : tmpOutChars[--outIndex] = char((tmpVal | 0x80) & 0xBF); tmpVal >>= 6; case 3 : tmpOutChars[--outIndex] = char((tmpVal | 0x80) & 0xBF); tmpVal >>= 6; case 2 : tmpOutChars[--outIndex] = char((tmpVal | 0x80) & 0xBF); tmpVal >>= 6; case 1 : tmpOutChars[--outIndex] = char(tmpVal | FirstByteMark[outBytes]); } // And spit them out for (outIndex = 0; outIndex < outBytes; outIndex++) showChar(tmpOutChars[outIndex], doCan); } }
void CharNode::prettyPrint(ostream & os, int indent) const { showChar(os, value); }