void LastDayPositionPetition::accept(std::wstringstream & message) { CsvReader reader(false, message); reader.AddHeaderField(L"Last trade date"); reader.AddHeaderField(L"Open value"); reader.AddHeaderField(L"Close value"); reader.AddHeaderField(L"Volume"); reader >> getAttribs(); }
uint16_t getCharFirstPix(const EmxFont_t* aFont, uint8_t aIdx) { uint8_t att = getAttribs(aFont); if (att & FT_FIXED) return 0; const uint8_t* valueMap = (uint8_t*) pgm_read_word(&aFont->firstPixIdx); // DBR("vM", valueMap); uint8_t bits = (pgm_read_byte(&aFont->foBits) & 0xF0) >>4; // DBR("bi", bits); return getBitCodedNumber(valueMap, aIdx, bits); } // getCharFirstPix
uint16_t getCharOffset(const EmxFont_t* aFont, uint8_t aIdx) { uint8_t att = getAttribs(aFont); uint16_t offset; if (att & FT_FIXED) { // TBC! offset = ((pgm_read_byte(&aFont->wb.fixedWidth) * pgm_read_byte(&aFont->height)) + 7) / 8; } else { const uint8_t* valueMap = (uint8_t*) pgm_read_word(&aFont->offsetIdx); uint8_t bits = (pgm_read_byte(&aFont->foBits) & 0x0F); offset = getBitCodedNumber(valueMap, aIdx, bits); } return offset; } // getCharWidth;
uint8_t lcdBufPutc(char c, const EmxFont_t* aFont, uint8_t x, uint8_t y, uint8_t aColor) { // BEWARE: 'aFont' must point to PROGMEM /* NOTE: aColor reads 0b01234567 where bit . 0 if on, says: only read width in pixels and return . 1 if on, says: inverse the pixels . 23 are still unused . 4567 define the color. ST7565 only knows color '1' or '0' */ uint8_t startCh = pgm_read_byte(&aFont->startCh); // code of first character in font if (c < startCh || c > pgm_read_byte(&aFont->endCh)) return 0; uint8_t idx = (c-startCh); uint8_t width = getCharWidth(aFont, idx); uint8_t extraWidth; uint8_t att = getAttribs(aFont); if (att & FT_EXTRAWS) extraWidth = 1; else extraWidth = 0; if (aColor & LA_CHARWIDTHONLY) return width + extraWidth; uint8_t bytesToRead = getCharBytes(aFont, idx); uint16_t offset = getCharOffset(aFont, idx); uint16_t curPix = getCharFirstPix(aFont, idx); const uint8_t* fontPtr = (uint8_t*) pgm_read_word(&aFont->firstChar); fontPtr += offset; uint8_t reverse = aColor & LA_REVERSE; aColor ^= LA_REVERSE; if (reverse) { lcdBufFillRect(x, y, width, FONTHEIGHT((*aFont)), aColor); aColor = !aColor; } while(bytesToRead) { uint8_t data = pgm_read_byte(fontPtr); // if (reverse) // data = ~data; for (uint8_t bit=0x80; bit; bit >>= 1) { if (data & bit) { uint8_t px = x + (curPix%width); uint8_t py = y + (curPix/width); lcdBufSetPixel(px, py, aColor & 0x0F); } ++curPix; } --bytesToRead; ++fontPtr; // now pointing to next data byte } // while bytesToRead // enable lcd-update timer return width + extraWidth; } // lcdBufPutc(char c, const EmxFont_t* aFont, uint8_t x, uint8_t y)