PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Propeller GCC Demos
sidetv
TvDemo.c
1
/*
2
# #########################################################
3
# This file demonstrates starting and running a PASM TV
4
# driver from C.
5
#
6
# Copyright (c) 2011 Steve Denson
7
# MIT Licensed
8
# #########################################################
9
*/
10
11
#include <stdio.h>
12
#include <cog.h>
13
#include <propeller.h>
14
#include "TvText.h"
15
16
#define USE_STDIO
17
18
#ifdef USE_STDIO
19
extern
_Driver TvDriver;
20
extern
_Driver _SimpleSerialDriver;
21
22
/* This is a list of all drivers we can use in the
23
* program. The default _InitIO function opens stdin,
24
* stdout, and stderr based on the first driver in
25
* the list (the serial driver, for us)
26
*/
27
_Driver *_driverlist[] = {
28
&_SimpleSerialDriver,
29
&TvDriver,
30
NULL
31
};
32
33
#endif
34
35
/*
36
* main program
37
*/
38
39
int
main
(
int
argc,
char
* argv[])
40
{
41
#ifdef USE_STDIO
42
FILE *tvf;
43
44
/* start of printing just to serial port (the default) */
45
printf(
"hello, serial world!\r\n"
);
46
47
/* start up the tvText program on pin 12 */
48
tvf = fopen(
"TV:12"
,
"w"
);
49
50
/* print to both serial and TV */
51
printf(
"Hello, world!\r\n"
);
52
fprintf(tvf,
"Hello, world\r\n"
);
53
54
/* print just to TV */
55
fprintf(tvf,
"Hello TV only!\r\n"
);
56
fprintf(tvf,
"TV line 2!\r\n"
);
57
58
/* print back to serial only */
59
printf(
"goodbye, world!\r\n"
);
60
while
(1);
61
#else
62
printf(
"hello, world!"
);
63
tvText_start(12);
64
tvText_str(
"Hello TV!"
);
65
printf(
"\r\ngoodbye, world!\r\n"
);
66
while
(1);
67
#endif
68
}
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:10 for PropWare by
1.8.12