KSM edits to RA8875
Diff: RA8875.cpp
- Revision:
- 172:7abb03bf31be
- Parent:
- 157:1565f38ca44b
--- a/RA8875.cpp Sun Jan 13 19:02:36 2019 +0000 +++ b/RA8875.cpp Sun Jan 13 20:38:01 2019 +0000 @@ -99,8 +99,10 @@ "not enough ram", ///< could not allocate ram for scanline "touch cal. timeout", ///< calibration could not complete in time "external abort", ///< during an idle callback, the user code initiated an abort + "touch cal defaulted", ///< a user provided default calibration was installed }; + RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char *name) : GraphicsDisplay(name) @@ -163,7 +165,7 @@ //} -RetCode_t RA8875::init(int width, int height, int color_bpp, uint8_t poweron, bool keypadon, bool touchscreenon) +RetCode_t RA8875::init(dim_t width, dim_t height, uint8_t color_bpp, uint8_t poweron, bool keypadon, bool touchscreenon) { font = NULL; // no external font, use internal. pKeyMap = DefaultKeyMap; // set default key map @@ -580,15 +582,15 @@ } -RetCode_t RA8875::WriteCommandW(uint8_t command, uint16_t data) +RetCode_t RA8875::WriteCommandW(uint8_t command, uint16_t _data) { - WriteCommand(command, data & 0xFF); - WriteCommand(command+1, data >> 8); + WriteCommand(command, _data & 0xFF); + WriteCommand(command+1, _data >> 8); return noerror; } -RetCode_t RA8875::WriteCommand(unsigned char command, unsigned int data) +RetCode_t RA8875::WriteCommand(unsigned char command, unsigned int _data) { #ifdef PERF_METRICS if (commandsUsed[command] < 65535) @@ -597,31 +599,31 @@ _select(true); _spiwrite(0x80); // RS:1 (Cmd/Status), RW:0 (Write) _spiwrite(command); - if (data <= 0xFF) { // only if in the valid range + if (_data <= 0xFF) { // only if in the valid range _spiwrite(0x00); - _spiwrite(data); + _spiwrite((uint8_t)_data); } _select(false); return noerror; } -RetCode_t RA8875::WriteDataW(uint16_t data) +RetCode_t RA8875::WriteDataW(uint16_t _data) { _select(true); _spiwrite(0x00); // RS:0 (Data), RW:0 (Write) - _spiwrite(data & 0xFF); - _spiwrite(data >> 8); + _spiwrite(_data & 0xFF); + _spiwrite(_data >> 8); _select(false); return noerror; } -RetCode_t RA8875::WriteData(unsigned char data) +RetCode_t RA8875::WriteData(unsigned char _data) { _select(true); _spiwrite(0x00); // RS:0 (Data), RW:0 (Write) - _spiwrite(data); + _spiwrite(_data); _select(false); return noerror; } @@ -641,38 +643,38 @@ unsigned char RA8875::ReadData(void) { - unsigned char data; + unsigned char _data; _select(true); _spiwrite(0x40); // RS:0 (Data), RW:1 (Read) - data = _spiread(); + _data = _spiread(); _select(false); - return data; + return _data; } uint16_t RA8875::ReadDataW(void) { - uint16_t data; + uint16_t _data; _select(true); _spiwrite(0x40); // RS:0 (Data), RW:1 (Read) - data = _spiread(); - data |= (_spiread() << 8); + _data = _spiread(); + _data |= (_spiread() << 8); _select(false); - return data; + return _data; } unsigned char RA8875::ReadStatus(void) { - unsigned char data; + unsigned char _data; _select(true); _spiwrite(0xC0); // RS:1 (Cmd/Status), RW:1 (Read) (Read STSR) - data = _spiread(); + _data = _spiread(); _select(false); - return data; + return _data; } @@ -945,10 +947,10 @@ } -RetCode_t RA8875::SetTextFont(RA8875::font_t font) +RetCode_t RA8875::SetTextFont(RA8875::font_t _font) { - if (/*font >= RA8875::ISO8859_1 && */ font <= RA8875::ISO8859_4) { - WriteCommand(0x21, (unsigned int)(font)); + if (/*_font >= RA8875::ISO8859_1 && */ _font <= RA8875::ISO8859_4) { + WriteCommand(0x21, (unsigned int)(_font)); return noerror; } else { return bad_parameter; @@ -1114,7 +1116,7 @@ loc_t y; y = ReadCommand(0x2C) | (ReadCommand(0x2D) << 8); // current y location y += fontheight(); - if (y >= height()) // @TODO after bottom of active window, then scroll window? + if (y >= height()) /// @TODO presently wraps, might want to scroll instead y = 0; WriteCommandW(0x2C, y); } else { @@ -1329,7 +1331,7 @@ RetCode_t RA8875::booleanStream(loc_t x, loc_t y, dim_t w, dim_t h, const uint8_t * boolStream) { PERFORMANCE_RESET; - const uint8_t * rowStream; + const uint8_t * rowStream = boolStream; rect_t restore = windowrect; window(x, y, w * fontScaleX, h * fontScaleY); // Scale from font scale factors SetGraphicsCursor(x, y);