Skip to content

Commit

Permalink
Broken VGA files - working on cleaning Spin2Cpp output
Browse files Browse the repository at this point in the history
  • Loading branch information
David Zemon authored and DavidZemon committed Jul 6, 2016
1 parent e156f99 commit 0fa68c6
Show file tree
Hide file tree
Showing 8 changed files with 1,065 additions and 0 deletions.
1 change: 1 addition & 0 deletions Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ add_subdirectory(PropWare_UARTTX)
add_subdirectory(PropWare_Utility)
add_subdirectory(PropWare_WatchDog)
add_subdirectory(PropWare_WS2812)
add_subdirectory(PropWare_VGAText)
add_subdirectory(Simple_FdSerial)
add_subdirectory(Simple_libadcACpropab)
add_subdirectory(Simple_MeasureVolts)
Expand Down
11 changes: 11 additions & 0 deletions Examples/PropWare_VGAText/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 3.0.0)
find_package(PropWare REQUIRED)

set(MODEL cmm)
set(COMMON_FLAGS "-Os")
set(C_FLAGS )
set(CXX_FLAGS )

project(VGAText_Demo)

create_simple_executable(${PROJECT_NAME} ${PROJECT_NAME})
20 changes: 20 additions & 0 deletions Examples/PropWare_VGAText/VGAText_Demo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <PropWare/hmi/output/video/vgatext.h>

int main() {
PropWare::VGAText Text;
int i;

Text.start(8);
Text.str("\r VGA Text Demo...\r\r\x0C\x05 OBJ and VAR require only 5.0KB \x0C\x01");
for (i = 0; i < 14; i++) {
Text.out(' ');
}
for (i = 0x0E; i <= 0xFF; i++) {
Text.out(i);
}
Text.str("\x0C\x06 Uses internal ROM font \x0C\x02");
for (;;) {
Text.str("\x0A\x0C\x0B\x0E");
Text.hex(i++, 8);
}
}
4 changes: 4 additions & 0 deletions PropWare/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ set(PROPWARE_SOURCES
${CMAKE_CURRENT_LIST_DIR}/hmi/output/synchronousprinter.cpp
${CMAKE_CURRENT_LIST_DIR}/hmi/output/synchronousprinter.h
${CMAKE_CURRENT_LIST_DIR}/hmi/output/ws2812.h
${CMAKE_CURRENT_LIST_DIR}/hmi/output/video/vgatext.cpp
${CMAKE_CURRENT_LIST_DIR}/hmi/output/video/vgatext.h
${CMAKE_CURRENT_LIST_DIR}/hmi/output/video/vga.h
${CMAKE_CURRENT_LIST_DIR}/hmi/output/video/vga_driver.S
${CMAKE_CURRENT_LIST_DIR}/memory/blockstorage.h
${CMAKE_CURRENT_LIST_DIR}/memory/eeprom.h
${CMAKE_CURRENT_LIST_DIR}/memory/sd.h
Expand Down
99 changes: 99 additions & 0 deletions PropWare/hmi/output/video/vga.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* ***************************************
* * VGA Driver v1.1 *
* * Author: Chip Gracey *
* * Copyright (c) 2006 Parallax, Inc. *
* * See end of file for terms of use. *
* ***************************************
* v1.0 - 01 May 2006 - original version
* v1.1 - 15 May 2006 - pixel tile size can now be 16 x 32 to enable more efficient
* character displays utilizing the internal font - see 'vga_mode'
*/

#pragma once

#include <stdint.h>
#include <propeller.h>

extern "C" {
extern int _VGADriverStartCog (void *arg);
}

namespace PropWare {

class VGA {
public:
/*
* VGA parameters - 21 contiguous longs
*/
struct {
uint32_t vga_status; // 0/1/2 = off/visible/invisible read-only
uint32_t vga_enable; // 0/non-0 = off/on write-only
uint32_t vga_pins; // %pppttt = pins write-only
uint32_t vga_mode; // %tihv = tile,interlace,hpol,vpol write-only
uint32_t vga_screen; // pointer to screen (words) write-only
uint32_t vga_colors; // pointer to colors (longs) write-only
uint32_t vga_ht; // horizontal tiles write-only
uint32_t vga_vt; // vertical tiles write-only
uint32_t vga_hx; // horizontal tile expansion write-only
uint32_t vga_vx; // vertical tile expansion write-only
uint32_t vga_ho; // horizontal offset write-only
uint32_t vga_vo; // vertical offset write-only
uint32_t vga_hd; // horizontal display ticks write-only
uint32_t vga_hf; // horizontal front porch ticks write-only
uint32_t vga_hs; // horizontal sync ticks write-only
uint32_t vga_hb; // horizontal back porch ticks write-only
uint32_t vga_vd; // vertical display lines write-only
uint32_t vga_vf; // vertical front porch lines write-only
uint32_t vga_vs; // vertical sync lines write-only
uint32_t vga_vb; // vertical back porch lines write-only
uint32_t vga_rate; // tick rate (Hz) write-only
} params;

/*
* Start VGA driver - starts a cog
* returns false if no cog available
*
* vgaptr = pointer to VGA parameters
*/
int32_t start() {
int32_t okay = 0;
stop();
okay = (cog = _VGADriverStartCog(&params) + 1);
return okay;
}

/*
* Stop VGA driver - frees a cog
*/
int32_t stop() {
#define PostEffect__(X, Y) __extension__({ int32_t tmp__ = (X); (X) = (Y); tmp__; })
if (cog) {
cogstop((PostEffect__(cog, 0) - 1));
}
return 0;
}

private:
int32_t cog;
};

}

/*
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ TERMS OF USE: MIT 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. │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
Loading

0 comments on commit 0fa68c6

Please sign in to comment.