CommonPIC32

Annotated examples/vga-cpu/vga.h

117:39834d788dcc
2018-11-10 Paul Boddie Introduced an abstraction for stored screen region details.
paul@87 1
/*
paul@87 2
 * Generate a VGA signal using a PIC32 microcontroller.
paul@87 3
 *
paul@87 4
 * Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
paul@87 5
 *
paul@87 6
 * This program is free software: you can redistribute it and/or modify
paul@87 7
 * it under the terms of the GNU General Public License as published by
paul@87 8
 * the Free Software Foundation, either version 3 of the License, or
paul@87 9
 * (at your option) any later version.
paul@87 10
 *
paul@87 11
 * This program is distributed in the hope that it will be useful,
paul@87 12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paul@87 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
paul@87 14
 * GNU General Public License for more details.
paul@87 15
 *
paul@87 16
 * You should have received a copy of the GNU General Public License
paul@87 17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
paul@87 18
 */
paul@87 19
paul@87 20
#ifndef __VGA_H__
paul@87 21
#define __VGA_H__
paul@87 22
paul@87 23
#include "vga_common.h"
paul@87 24
paul@87 25
#define LINE_LENGTH             160 /* pixels */
paul@104 26
#define LINE_COUNT              128 /* display lines per frame */
paul@104 27
#define FRAME_COUNT             2   /* double-buffered display */
paul@87 28
paul@87 29
/* 24MHz cycle measurements. */
paul@87 30
paul@87 31
#define HFREQ_LIMIT             643
paul@87 32
#define HSYNC_START             520
paul@87 33
#define HSYNC_LIMIT             64
paul@87 34
#define HSYNC_END               (HSYNC_START + HSYNC_LIMIT)
paul@87 35
paul@87 36
/* Framebuffer properties. */
paul@87 37
paul@87 38
#define SCREEN_SIZE             (LINE_LENGTH * LINE_COUNT)
paul@87 39
paul@93 40
/* A frame has an entire screen plus one line to allow horizontal scrolling,
paul@93 41
   since a horizontal scroll offset causes the final transfer line to exceed the
paul@93 42
   screen limit. */
paul@93 43
paul@99 44
#define FRAME_SIZE              (SCREEN_SIZE + LINE_LENGTH)
paul@93 45
paul@87 46
/* Transfer and pixel allocation properties. */
paul@87 47
paul@87 48
#define TRANSFER_CELL_SIZE      LINE_LENGTH
paul@87 49
#define CELL_SIZE               LINE_LENGTH
paul@87 50
paul@87 51
#endif /* __VGA_H__ */