KSM edits to RA8875
Diff: RA8875.cpp
- Revision:
- 124:1690a7ae871c
- Parent:
- 123:2f45e80fec5f
- Child:
- 125:7a0b70f56550
--- a/RA8875.cpp Mon Jul 25 10:55:58 2016 +0000 +++ b/RA8875.cpp Sun Jul 31 20:59:01 2016 +0000 @@ -91,18 +91,50 @@ "not enough ram", ///< could not allocate ram for scanline }; -RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char *name) +RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, + const char *name) : GraphicsDisplay(name) , spi(mosi, miso, sclk) , cs(csel) , res(reset) { + useTouchPanel = TP_NONE; + m_irq = NULL; + m_i2c = NULL; c_callback = NULL; obj_callback = NULL; method_callback = NULL; idle_callback = NULL; } + +RA8875::RA8875(PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, + PinName sda, PinName scl, PinName irq, const char * name) + : GraphicsDisplay(name) + , spi(mosi, miso, sclk) + , cs(csel) + , res(reset) +{ + useTouchPanel = TP_CAP; + m_irq = new InterruptIn(irq); + m_i2c = new I2C(sda, scl); + c_callback = NULL; + obj_callback = NULL; + method_callback = NULL; + idle_callback = NULL; + + // Cap touch panel config + m_addr = (FT5206_I2C_ADDRESS << 1); + m_i2c->frequency(FT5206_I2C_FREQUENCY); + + // Interrupt + m_irq->mode(PullUp); + m_irq->enable_irq(); + m_irq->fall(this, &RA8875::TouchPanelISR); + TouchPanelInit(); +} + + //RA8875::~RA8875() //{ //} @@ -168,8 +200,11 @@ Backlight_u8(255); if (keypadon) KeypadInit(); - if (touchscreenon) + if (touchscreenon) { + if (useTouchPanel == TP_NONE) + useTouchPanel = TP_RES; TouchPanelInit(); + } #ifdef PERF_METRICS performance.start(); ClearPerformance();