# LCD SPI - Custom SPI LCD Display

Generic HID supports a custom hybrid character/graphic LCD module that uses an SPI interface. The project to build this display can be found here.

The LCD SPI component will only work with this display. The display is built around a 320x240 TFT RGB LCD module. The display driver has 2 fonts (6x13 and 14x26), supports colour, and can draw rectangles. A sample output is shown here...

The display uses the SPI interface. There are 4 wires that must be wired correctly to the matching SPI pins on the microcontroller board. Pins SS/SCK/MOSI/MISO on the display must be connected to SS(PB0)/SCK(PB1)/MOSI(PB2)/MISO(PB3) on the microcontroller board. This isn't a generic SPI interface, but could be changed in the future.

### USB Interface

GenericHID implements an extended subset of the standard USB HID specification for character display modules. The following reports are implemented. This is included only if you wish to program your own device. This information can be retrieved from the HID descriptor reports. You just need to know the custom usage ids for the extended facilities.

    USAGEPAGE_ALPHANUMERIC_DISPLAY:USAGE_ALPHANUMERIC_DISPLAY

        // Output Report to display text
        USAGE_CHARACTER_REPORT
    	USAGE_COLUMN			// column number
    	USAGE_ROW			// row number
    	USAGE_CURSOR_PIXEL_POSITIONING	// Row/column is a pixel address or character address
    	USAGE_DISPLAY_DATA		// display text (one full row)

        // Feature Report to return display attributes
        USAGE_DISPLAY_ATTRIBUTES_REPORT
    	USAGE_ROWS			// number of rows
    	USAGE_COLUMNS			// number of columns

        // Output Report to change the display attributes
        USAGE_DISPLAY_CONTROL_REPORT
    	USAGE_CLEAR_DISPLAY		// Clear the display
    	USAGE_DISPLAY_BRIGHTNESS	// Set the display backlight brightness
    	USAGE_FOREGROUND_COLOUR(FF00)	// 16 bit foreground colour (R:5,G:6,B:5)
    	USAGE_BACKGROUND_COLOUR(FF01)	// 16 bit background colour (R:5,G:6,B:5)
    	USAGE_SELECT_FONT(FF02)		// select the font
    	USAGE_CHAR_ATTR_UNDERLINE	// enable underline (not implemented)

        // Output report to draw a rectangle
        USAGE_DRAW_RECT_REPORT(FF03)
    	USAGE_RECT_FILLED(FF04)		// filled or outline
    	USAGE_RECT_X(FF05)		// x coordinate
    	USAGE_RECT_Y(FF06)		// y coordinate
    	USAGE_RECT_WIDTH(FF07)		// width
    	USAGE_RECT_HEIGHT(FF08)		// height

## Properties

### Name

Components can be given an optional name. This is seen in the Test tab. Not all applications support the name. Hidcomp/hidconfig supports names.

### UsagePage/Usage

The UsagePage and Usage of the display. See Usages for more information.

Note- for an LCD display, this is fixed and cannot be changed.

### Current

Defines the amount of electrical current used by the LED in mA. This is used to estimate the USB power draw. See the section on Power for more information.

LCD displays use very little power to display the LCD text, typically 1-2mA. The LCD back light, however, are generally power hogs.