#include <biwak/stm32/gdisplay_ili9341.h>
#include <biwak/linux/gdisplay_qt.h>
#include <biwak/linux/boardgui.h>


class CIli9341Dimpl
{
   private:
      QLabel* m_displayLabel=nullptr;
      CGraphicDisplayQt* m_display=nullptr;
      static constexpr const int m_width=240;
      static constexpr const int m_height=320;
      
   public:
   CIli9341Dimpl()
   {
      CBoardGui *gui=CBoardGui::instance();
      m_displayLabel=gui->createDisplay();
      m_display=new CGraphicDisplayQt(m_displayLabel, m_width, m_height);
   }
   CIli9341Dimpl(QLabel* displayLabel, CGraphicDisplayQt* display)
      :m_displayLabel( displayLabel )
      ,m_display( display )
   {
      
   }
};


CGraphicDisplayIli9341::CGraphicDisplayIli9341(CSpi &_spi,
         EGpioPeripheral eGpioPeripheralCs, EGpioPin eGpioPinCs,
         EGpioPeripheral eGpioPeripheralDc, EGpioPin eGpioPinDc)
    //:CSpiSlave(_spi, eGpioPeripheralCs, eGpioPinCs)
    //,m_spi(_spi)
    //,m_outDc(eGpioPeripheralDc, eGpioPinDc)
   :CGraphicDisplayQt(
         CBoardGui::instance()
            ? CBoardGui::instance()->createDisplay()
            : nullptr
         , 240, 320 )
   ,CSpiSlave(_spi, eGpioPeripheralCs, eGpioPinCs)
   ,m_spi(_spi)
   ,m_outDc(eGpioPeripheralDc, eGpioPinDc)
{
   m_pDimpl=new CIli9341Dimpl(nullptr, nullptr);
}


CGraphicDisplayIli9341::~CGraphicDisplayIli9341()
{

}

#if 0
void CGraphicDisplayIli9341::pixelStreamStart() /* virtual */
{};


void CGraphicDisplayIli9341::pixelStreamStop() /* virtual */
{};
#endif

//---fin----------------------------------------------------------------------
