Base LCDPanel based, required for all LCDPanel drivers

LCDPanel_SPI.h

Committer:
silviogissi
Date:
2012-03-11
Revision:
2:ab4040a7e8c9

File content as of revision 2:ab4040a7e8c9:

/* LCDPanel SPI base library for LCD/TFT Panels
 * Copyright (c) 2012, Silvio Gissi
 * 
 * License:
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 * Author: Silvio Gissi
 * Version: 0.1 Alfa
 * 
*/

#ifndef LCDPANEL_SPI_H
#define LCDPANEL_SPI_H

#include "mbed.h"
#include "LCDPanel.h"

class LCDPanel_SPI : public LCDPanel {

  public:
   /** LCDPanel SPI
    *
    * @param width LCDPanel width
    * @param height LCDPanel height
    * @param cs Chip Select (DigitalOut)
    * @param spi_data SPI data pin (MOSI) (DigitalOut)
    * @param spi_clock SPI clock pin (SCLK) (DigitalOut)
    * @param rst Reset (DigitalOut)
    * @param spi_bits Number of bits to be sent on each SPI write
    * @param spi_freq SPI frequency
    */
   LCDPanel_SPI(unsigned int width, unsigned int height, PinName cs,
        PinName spi_data, PinName spi_clock, PinName rst,
        unsigned int spi_bits, unsigned int spi_freq
   );
    
  protected:
    DigitalOut _rst;
    SPI _spi;
    virtual void command(unsigned int command, unsigned int size=0, ...);
    virtual void data(unsigned int size, ...);
    virtual void pixel(uint16_t color);
};

#endif // LCDPANEL_SPI_H