#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "main.h"

#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320

typedef uint16_t Pixel_t;

#define PIXEL_RED(p)   (((p) >> 11) & 0x1F)
#define PIXEL_GREEN(p) (((p) >> 5)  & 0x3F)
#define PIXEL_BLUE(p)  ((p) & 0x1F)

#define MAKE_PIXEL(r,g,b) \
    (((r & 0x1F) << 11) | ((g & 0x3F) << 5) | (b & 0x1F))


extern volatile Pixel_t framebuffer[DISPLAY_HEIGHT * DISPLAY_WIDTH];
extern volatile uint32_t times_changed;


void DisplayTest(uint16_t color);


#endif