Phoenard
Functions | Variables
PHNDisplayHW Namespace Reference

Main display hardware functions are contained here. More...

Functions

void init ()
 Resets and then initializes the LCD screen registers for first use.
 
void writeData (uint16_t data)
 Writes a single word of data to the LCD display.
 
void writeCommand (uint8_t cmd)
 Writes a single command to the LCD display.
 
void writeRegister (uint8_t cmd, uint16_t arg)
 Writes a command, and an argument, to the LCD display, to set up a register.
 
uint16_t readData ()
 Reads a single word of data from the LCD display.
 
uint16_t readRegister (uint8_t cmd)
 Writes a command, then reads the response from the LCD display.
 
void setCursor (uint16_t x, uint16_t y, uint8_t direction)
 Sets up the register of the LCD to update the cursor coordinates.
 
void setCursor (uint16_t x, uint16_t y)
 Updates the cursor position, using a horizontal direction wrapping down.
 
void setViewport (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
 Sets the viewport for the display.
 
color_t color565 (uint8_t r, uint8_t g, uint8_t b)
 Converts RGB color into the 16-bit 565-color format used by the display.
 
color_t colorAverage (color_t colorA, color_t colorB)
 Calculates the average of two 16-bit 565 colors.
 
color_t colorLerp (color_t colorA, color_t colorB, float f)
 Performs linear interpolation between two 16-but 565 colors.
 
uint8_t color565Red (color_t color)
 Obtains the RED component of a 16-bit 565 color.
 
uint8_t color565Green (color_t color)
 Obtains the GREEN component of a 16-bit 565 color.
 
uint8_t color565Blue (color_t color)
 Obtains the BLUE component of a 16-bit 565 color.
 
void readTouch (uint16_t *analogX, uint16_t *analogY, uint16_t *analogZ1, uint16_t *analogZ2)
 Reads raw touchscreen input information.
 
void readTouch (uint16_t *touch_x, uint16_t *touch_y, float *pressure)
 Reads touchscreen input, performs calibration and returns the x/y coordinate and the pressure.
 

Variables

uint8_t last_entry_dir = 0xFF
 
const uint16_t WIDTH = 320
 The display width.
 
const uint16_t HEIGHT = 240
 The display height.
 
const uint32_t PIXELS = ((uint32_t) WIDTH * (uint32_t) HEIGHT)
 The total amount of pixels of the display.
 
const uint16_t WIDTH_SLIDER = (WIDTH + 32)
 The display width that takes the slider into account.
 
const float PRESSURE_MIN = 0.0F
 Minimum possible pressure value.
 
const float PRESSURE_MAX = 1.0F
 Maximum possible pressure value.
 
const float PRESSURE_THRESHOLD = 0.2F
 Pressure value above which a press should be detected.
 

Detailed Description

Main display hardware functions are contained here.