Add voltmeter1

main
Michael Hayes 13 years ago
parent cd2e6f4460
commit 1320cad49c

@ -1,7 +1,10 @@
This directory contains a number of test applications contained in
their own sub-directories. Within each sub-directory are two
makefiles; one called Makefile and the other called Makefile.test. By
default when make is run it will read Makefile.
their own sub-directories. Each application has a numerical suffix.
As a rule, the larger the number the more difficult the program.
Within each sub-directory are two makefiles; one called Makefile and
the other called Makefile.test. By default when make is run it will
read Makefile.
make --- builds the application for the ATmega8
make program --- programs the application into the ATmega8 flash memory
@ -14,3 +17,8 @@ modules. This allows the application to be run and debugged on a PC.
make -f Makefile.test --- builds the application for the PC
make -f Makefile.test clean --- deletes the object and executable files
tone1 Play a continuous tone (if piezo tweeter connected)
tone2 Play a louder continuous tone (if piezo tweeter connected) by driving
PIO pins in anti-phase

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for bounce1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for bounce2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for bounce3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for bounce4 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for bounce5 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for chooser docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for demo1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for demo2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for fonttest1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for hello1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for hello2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for hello3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for hello4 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for hello5 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_grab1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_grab2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_grab3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_serial_test1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_serial_test2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_serial_test3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_uart_test1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_uart_test2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -16,7 +16,7 @@ all: ir_uart_test3.out
# Compile: create object files from C source files.
ir_uart_test3.o: ir_uart_test3.c ../../drivers/avr/ir_uart.h ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/navswitch.h ../../fonts/font5x7_1.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h ../../utils/uint8toa.h
ir_uart_test3.o: ir_uart_test3.c ../../drivers/avr/ir_uart.h ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/navswitch.h ../../fonts/font3x5_1.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h ../../utils/uint8toa.h
$(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for ir_uart_test3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -22,6 +22,8 @@ tinygl_font_set@tinygl.c:
tinygl_text_mode_set@tinygl.c:
tinygl_text_dir_set@tinygl.c:
navswitch_init@navswitch.c:
timer0_mode_set@timer0.c:
@ -52,11 +54,13 @@ timer_init@timer.c:
pacer_init@pacer.c: timer_init
uint8toa@uint8toa.c:
tinygl_draw_message@tinygl.c: strncpy strlen
tinygl_text@tinygl.c: tinygl_draw_message
show_char@ir_uart_test3.c: tinygl_text
show_byte@ir_uart_test3.c: uint8toa tinygl_text
timer_get@timer.c:
@ -90,6 +94,14 @@ display_update@display.c: ledmat_display_column
tinygl_update@tinygl.c: tinygl_text_advance display_update
usart1_read_ready_p@usart1.c:
ir_uart_read_ready_p@ir_uart.c: usart1_read_ready_p
usart1_getc@usart1.c: usart1_read_ready_p
ir_uart_getc@ir_uart.c: usart1_getc
pio_config_get@pio.c:
_delay_loop_1@navswitch.c:
@ -102,17 +114,9 @@ navswitch_push_event_p@navswitch.c:
usart1_write_ready_p@usart1.c:
usart1_putc@usart1.c: usart1_putc usart1_write_ready_p
usart1_putc@usart1.c: usart1_write_ready_p
ir_uart_putc@ir_uart.c: usart1_putc
usart1_read_ready_p@usart1.c:
ir_uart_read_ready_p@ir_uart.c: usart1_read_ready_p
usart1_getc@usart1.c: usart1_read_ready_p
ir_uart_getc@ir_uart.c: usart1_getc
main@ir_uart_test3.c: system_init tinygl_init tinygl_font_set tinygl_text_speed_set tinygl_text_mode_set navswitch_init ir_uart_init pacer_init show_char pacer_wait tinygl_update navswitch_update navswitch_push_event_p ir_uart_putc navswitch_push_event_p ir_uart_putc ir_uart_read_ready_p ir_uart_getc show_char
main@ir_uart_test3.c: system_init tinygl_init tinygl_font_set tinygl_text_speed_set tinygl_text_mode_set tinygl_text_dir_set navswitch_init ir_uart_init pacer_init show_byte pacer_wait tinygl_update ir_uart_read_ready_p ir_uart_getc show_byte navswitch_update navswitch_push_event_p ir_uart_putc ir_uart_getc navswitch_push_event_p ir_uart_putc ir_uart_getc

@ -14,32 +14,32 @@
../../drivers/navswitch.h:
../../drivers/avr/delay.h:
../../drivers/navswitch.c: ../../drivers/navswitch.h ../../drivers/avr/delay.h ../../drivers/avr/pio.h
../../drivers/navswitch.o: ../../drivers/navswitch.c
../../drivers/display.h:
../../utils/font.h:
../../utils/tinygl.h: ../../drivers/display.h ../../utils/font.h
../../utils/tinygl.c: ../../utils/tinygl.h ../../drivers/display.h ../../utils/font.h
../../utils/tinygl.o: ../../utils/tinygl.c
../../utils/pacer.h:
../../utils/uint8toa.h:
../../drivers/avr/ir_uart.h:
../../fonts/font5x7_1.h: ../../utils/font.h
../../fonts/font3x5_1.h: ../../utils/font.h
ir_uart_test3.c: ../../drivers/navswitch.h ../../utils/tinygl.h ../../utils/pacer.h ../../drivers/avr/ir_uart.h ../../fonts/font5x7_1.h
ir_uart_test3.c: ../../drivers/navswitch.h ../../utils/tinygl.h ../../utils/pacer.h ../../utils/uint8toa.h ../../drivers/avr/ir_uart.h ../../fonts/font3x5_1.h
ir_uart_test3.o: ir_uart_test3.c
../../utils/uint8toa.c:
../../utils/uint8toa.o: ../../utils/uint8toa.c
../../utils/tinygl.c: ../../utils/tinygl.h ../../drivers/display.h ../../utils/font.h
../../utils/tinygl.o: ../../utils/tinygl.c
../../utils/font.c: ../../utils/font.h
../../utils/font.o: ../../utils/font.c
@ -84,5 +84,11 @@ ir_uart_test3.o: ir_uart_test3.c
../../drivers/avr/usart1.o: ../../drivers/avr/usart1.c
ir_uart_test3.out: ../../drivers/avr/timer.o ../../drivers/ledmat.o ../../drivers/navswitch.o ../../utils/tinygl.o ir_uart_test3.o ../../utils/font.o ../../drivers/avr/pio.o ../../utils/pacer.o ../../drivers/display.o ../../drivers/avr/system.o ../../drivers/avr/prescale.o ../../drivers/avr/ir_uart.o ../../drivers/avr/timer0.o ../../drivers/avr/usart1.o
../../drivers/avr/delay.h:
../../drivers/navswitch.c: ../../drivers/navswitch.h ../../drivers/avr/delay.h ../../drivers/avr/pio.h
../../drivers/navswitch.o: ../../drivers/navswitch.c
ir_uart_test3.out: ../../drivers/avr/timer.o ../../drivers/ledmat.o ir_uart_test3.o ../../utils/uint8toa.o ../../utils/tinygl.o ../../utils/font.o ../../drivers/avr/pio.o ../../utils/pacer.o ../../drivers/display.o ../../drivers/avr/system.o ../../drivers/avr/prescale.o ../../drivers/avr/ir_uart.o ../../drivers/avr/timer0.o ../../drivers/avr/usart1.o ../../drivers/navswitch.o

@ -14,6 +14,8 @@ timer:
pacer: timer
uint8toa:
usart1:
prescale:
@ -22,5 +24,5 @@ timer0: prescale
ir_uart: usart1 timer0 pio
ir_uart_test3: navswitch tinygl pacer ir_uart
ir_uart_test3: navswitch tinygl pacer uint8toa ir_uart

@ -18,6 +18,8 @@
/* Define polling rate in Hz. */
#define LOOP_RATE 300
#define SWITCH_POLL_RATE 20
/* Define text update rate (characters per 10 s). */
#define MESSAGE_RATE 10
@ -61,8 +63,20 @@ int main (void)
tinygl_update ();
if (ir_uart_read_ready_p ())
{
uint8_t data;
data = ir_uart_getc ();
/* Note, if messages come in too fast, say due to IR
inteference from fluorescent lights, then the display
will not keep up and will appear to freeze. */
show_byte (data);
}
count++;
if (count > 20)
if (count > LOOP_RATE / SWITCH_POLL_RATE)
{
count = 0;
@ -82,18 +96,6 @@ int main (void)
ir_uart_getc ();
}
}
if (ir_uart_read_ready_p ())
{
uint8_t data;
data = ir_uart_getc ();
/* Note, if messages come in too fast, say due to IR
inteference from fluorescent lights, then the display
will not keep up and will appear to freeze. */
show_byte (data);
}
}
return 0;

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led0 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led4 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for pio1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for pio2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -16,6 +16,7 @@ int main (void)
while (1)
{
count++;
if (count > 10000)
{
pio_output_toggle (LED1_PIO);

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for pio3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -4,7 +4,7 @@
# Descr: Makefile for scribble1
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/test -I../../drivers -I../../fonts -I../../utils
CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/test -I../../drivers -I../../utils
DEL = rm
@ -14,7 +14,7 @@ all: scribble1
# Compile: create object files from C source files.
scribble1-test.o: scribble1.c ../../drivers/button.h ../../drivers/display.h ../../drivers/led.h ../../drivers/navswitch.h ../../drivers/test/system.h ../../fonts/font5x7_1.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h
scribble1-test.o: scribble1.c ../../drivers/button.h ../../drivers/display.h ../../drivers/led.h ../../drivers/navswitch.h ../../drivers/test/system.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@
button-test.o: ../../drivers/button.c ../../drivers/button.h ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for scribble1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for snake1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for space10 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -9,7 +9,6 @@
#include <string.h>
#include "system.h"
#include "display.h"
#include "tinygl.h"
#include "pacer.h"
#include "ir_serial.h"

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for space11 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -8,7 +8,6 @@
#include <string.h>
#include "system.h"
#include "display.h"
#include "tinygl.h"
#include "task.h"
#include "navswitch.h"

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for space12 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -1,14 +1,14 @@
/** @file space12.c
@author M. P. Hayes, UCECE
@date 20 April 2007
@brief A simple space invaders game with different difficulty levels.
@brief A simple space invaders game with different difficulty levels
and sound effects.
@defgroup space12 A simple space invaders game.
@defgroup space12 A simple space invaders game with sound effects.
*/
#include <string.h>
#include "system.h"
#include "display.h"
#include "tinygl.h"
#include "task.h"
#include "navswitch.h"
@ -39,8 +39,12 @@ enum {GAME_OVER_PERIOD = 2};
enum {BUTTON_HOLD_PERIOD = 1};
/* Connect piezo tweeter to outermost pins of UCFK4 P1 connector. */
#define PIEZO_PIO PIO_DEFINE (PORT_D, 6)
/* Connect piezo tweeter to first and third pin of UCFK4 P1 connector
for push-pull operation. For single-ended drive (with reduced
volume) connect the other piezo connection to ground or Vcc and do
not define PIEZO2_PIO. */
#define PIEZO1_PIO PIO_DEFINE (PORT_D, 4)
#define PIEZO2_PIO PIO_DEFINE (PORT_D, 6)
/** Define flasher modes. */
@ -100,13 +104,24 @@ static void tweeter_task_init (void)
{
tweeter = tweeter_init (&tweeter_info, TWEETER_TASK_RATE, scale_table);
pio_config_set (PIEZO_PIO, PIO_OUTPUT_LOW);
pio_config_set (PIEZO1_PIO, PIO_OUTPUT_LOW);
#ifdef PIEZO2_PIO
pio_config_set (PIEZO2_PIO, PIO_OUTPUT_LOW);
#endif
}
static void tweeter_task (__unused__ void *data)
{
pio_output_set (PIEZO_PIO, tweeter_update (tweeter));
bool state;
state = tweeter_update (tweeter);
pio_output_set (PIEZO1_PIO, state);
#ifdef PIEZO2_PIO
/* Push-pull piezo tweeter drive. */
pio_output_set (PIEZO2_PIO, !state);
#endif
}

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for space9 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -8,7 +8,6 @@
#include <string.h>
#include "system.h"
#include "display.h"
#include "tinygl.h"
#include "pacer.h"
#include "navswitch.h"

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for spacey_remote1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for squeak0 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for squeak1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for squeak2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for squeak3 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for squeak4 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for steer1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for stopwatch1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for task1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for task2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for tdmdemo1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for tdmdemo2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for updown1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -3,6 +3,9 @@
# Date: 11 Sep 2010
# Descr: Makefile for updown2 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
@ -11,7 +14,7 @@ file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --out $@
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@

@ -0,0 +1,70 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for voltmeter1
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers -I../../fonts -I../../drivers/avr -I../../utils
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: voltmeter1.out
# Compile: create object files from C source files.
voltmeter1.o: voltmeter1.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../drivers/display.h ../../fonts/font3x5_1.h ../../utils/font.h ../../utils/task.h ../../utils/tinygl.h adc.h
$(CC) -c $(CFLAGS) $< -o $@
adc.o: adc.c ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/avr/system.h adc.h
$(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
system.o: ../../drivers/avr/system.c ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
timer.o: ../../drivers/avr/timer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h
$(CC) -c $(CFLAGS) $< -o $@
display.o: ../../drivers/display.c ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/ledmat.h
$(CC) -c $(CFLAGS) $< -o $@
ledmat.o: ../../drivers/ledmat.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/ledmat.h
$(CC) -c $(CFLAGS) $< -o $@
font.o: ../../utils/font.c ../../drivers/avr/system.h ../../utils/font.h
$(CC) -c $(CFLAGS) $< -o $@
task.o: ../../utils/task.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/task.h
$(CC) -c $(CFLAGS) $< -o $@
tinygl.o: ../../utils/tinygl.c ../../drivers/avr/system.h ../../drivers/display.h ../../utils/font.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create output file (executable) from object files.
voltmeter1.out: voltmeter1.o adc.o pio.o system.o timer.o display.o ledmat.o font.o task.o tinygl.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: voltmeter1.out
$(OBJCOPY) -O ihex voltmeter1.out voltmeter1.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash voltmeter1.hex; dfu-programmer atmega32u2 start

@ -0,0 +1,64 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for voltmeter1
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers/test -I../../drivers -I../../fonts -I../../utils
DEL = rm
# Default target.
all: voltmeter1
# Compile: create object files from C source files.
voltmeter1-test.o: voltmeter1.c ../../drivers/display.h ../../drivers/test/system.h ../../drivers/test/timer.h ../../fonts/font3x5_1.h ../../utils/font.h ../../utils/task.h ../../utils/tinygl.h adc.h
$(CC) -c $(CFLAGS) $< -o $@
adc-test.o: adc.c ../../drivers/test/avrtest.h ../../drivers/test/delay.h ../../drivers/test/pio.h ../../drivers/test/system.h adc.h
$(CC) -c $(CFLAGS) $< -o $@
display-test.o: ../../drivers/display.c ../../drivers/display.h ../../drivers/ledmat.h ../../drivers/test/system.h
$(CC) -c $(CFLAGS) $< -o $@
ledmat-test.o: ../../drivers/ledmat.c ../../drivers/ledmat.h ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h
$(CC) -c $(CFLAGS) $< -o $@
mgetkey-test.o: ../../drivers/test/mgetkey.c ../../drivers/test/mgetkey.h
$(CC) -c $(CFLAGS) $< -o $@
pio-test.o: ../../drivers/test/pio.c ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h
$(CC) -c $(CFLAGS) $< -o $@
system-test.o: ../../drivers/test/system.c ../../drivers/test/avrtest.h ../../drivers/test/mgetkey.h ../../drivers/test/pio.h ../../drivers/test/system.h
$(CC) -c $(CFLAGS) $< -o $@
timer-test.o: ../../drivers/test/timer.c ../../drivers/test/system.h ../../drivers/test/timer.h
$(CC) -c $(CFLAGS) $< -o $@
font-test.o: ../../utils/font.c ../../drivers/test/system.h ../../utils/font.h
$(CC) -c $(CFLAGS) $< -o $@
task-test.o: ../../utils/task.c ../../drivers/test/system.h ../../drivers/test/timer.h ../../utils/task.h
$(CC) -c $(CFLAGS) $< -o $@
tinygl-test.o: ../../utils/tinygl.c ../../drivers/display.h ../../drivers/test/system.h ../../utils/font.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create executable file from object files.
voltmeter1: voltmeter1-test.o adc-test.o display-test.o ledmat-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o font-test.o task-test.o tinygl-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) voltmeter1 voltmeter1-test.o adc-test.o display-test.o ledmat-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o font-test.o task-test.o tinygl-test.o

@ -0,0 +1,104 @@
#include "avr/io.h"
#include "pio.h"
#include "delay.h"
#include "adc.h"
/**
This requires a capacitor connected from AIN0 (P1-3) to ground
(P1-1) and a resistor connected from AIN0 (P1-3) to PD5 (P1-7).
The unknown input voltage is applied to AIN3 (P1-6).
It operates by applying a fixed voltage from PD5 (5 V, assuming the
UCFK4 is powered from USB) to the capacitor and timing how long it
takes for the capacitor voltage to exceed the unknown voltage using
the comparator.
Here's the typical usage for two channels.:
adc_init ();
adc_enable (ADC_CHANNEL1);
adc_enable (ADC_CHANNEL2);
adc_measure (ADC_CHANNEL1);
wait until capacitor discharged
adc_measure (ADC_CHANNEL2);
Note adc_measure blocks until the voltage on the capacitor exceeds
the voltage being measured. adc_measure cannot be called again
until the capacitor is discharged. This could be greatly sped up
by using another PIO directly connected to the capacitor. Better
still, since PD1 shares the same pin as AIN0, it can be configured
as a low output to more rapidly discharge the capacitor.
From the IBIS file it appears that a PIO can sink/source 60 mA
(typ) at 25 deg. C. The datasheet says that the maximum PIO DC
current is 40 mA.
*/
#ifndef ADC_CHARGE_PIO
#define ADC_CHARGE_PIO PIO_DEFINE(PORT_D, 5)
#endif
#ifndef ADC_CAPACITANCE
#define ADC_CAPACITANCE 4.7e-9
#endif
#ifndef ADC_RESISTANCE
#define ADC_RESISTANCE 37e3
#endif
#define ADC_TIME_CONSTANT_US (ADC_CAPACITANCE * ADC_RESISTANCE * 1e6)
/* This is not defined in io32u2.h */
#ifndef ACMUX
#define ACMUX _SFR_MEM8(0x7D)
#endif
void adc_init(void)
{
pio_config_set(ADC_CHARGE_PIO, PIO_OUTPUT_LOW);
/* Disable digital input for AIN0. */
DIDR1 |= BIT(0);
/* By default the analog comparator is enabled but let's enable it. */
ACSR &= BIT(7);
}
void adc_enable(uint8_t adc_channel)
{
/* Disable digital input for selected channel. */
DIDR1 |= BIT(adc_channel);
}
void adc_disable(uint8_t adc_channel)
{
/* Enable digital input for selected channel. */
DIDR1 &= ~BIT(adc_channel);
}
uint8_t adc_measure(uint8_t adc_channel)
{
uint8_t count;
count = 0;
/* Select desired channel. */
ACMUX = adc_channel - 1;
pio_output_high (ADC_CHARGE_PIO);
while (! (ACSR & BIT(ACO)))
count++;
pio_output_low (ADC_CHARGE_PIO);
return count;
}

@ -0,0 +1,17 @@
#ifndef ADC_H
#define ADC_H
#include "system.h"
void adc_init(void);
void adc_enable(uint8_t adc_channel);
void adc_disable(uint8_t adc_channel);
uint8_t adc_measure(uint8_t adc_channel);
#endif

@ -0,0 +1,45 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for voltmeter1 docs
# The scripts used to make the graphs require the program dot; this
# is part of the graphviz package.
DEL = rm
all: file_dependencies.pdf module_dependencies.pdf makefile_dependencies.pdf build_dependencies.pdf callgraph.pdf
file_dependencies.pdf: files.d
../../../etc/graphdeps.py $< --out $@
module_dependencies.pdf: modules.d
../../../etc/graphdeps.py $< --modules --rotate --out $@
makefile_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@
build_dependencies.pdf: ../Makefile
../../../etc/graphdeps.py $< --out $@ --showops
callgraph.pdf: callgraph.d
../../../etc/graphdeps.py --calls --modules $< --out $@ --showops
files.d: ../Makefile
(cd ..; ../../etc/makemake.py --relpath --files . . ../../drivers ../../drivers/avr ../../utils ../../extra --exclude system.h > doc/files.d)
modules.d: ../Makefile
(cd ..; ../../etc/makemake.py --relpath --modules . . ../../drivers ../../drivers/avr ../../utils ../../extra --exclude system > doc/modules.d)
callgraph.d: ../Makefile
(cd ..; ../../etc/makemake.py --cc="avr-gcc" --cflags="-Os -mmcu=atmega32u2" --relpath --calls . . ../../drivers ../../drivers/avr ../../utils ../../extra --exclude system.h > doc/callgraph.d)
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) *.d *.pdf

@ -0,0 +1,16 @@
Running make in this directory will generate a number of PDF graphs.
In the callgraph, the arrows means "calls". In the dependency graphs,
the arrows means "requires" (or "depends upon").
callgraph.pdf This shows the callgraph, i.e., what functions each
function in the program calls.
module_dependencies.pdf This shows the dependencies between the modules.
file_dependencies.pdf This shows the dependencies between the files.
makefile_dependencies.pdf This shows the dependencies required by make when
building the program.
build_dependencies.pdf This is like makefile_dependencies.pdf but shows
the operations performed to generate the new file.
callgraph.d This shows the callgraph in text format.
files.d This shows the file dependencies in text format.
modules.d This shows the module dependencies in text format.

@ -0,0 +1,80 @@
system_clock_init@system.c:
system_watchdog_timer_init@system.c:
system_init@system.c: system_clock_init system_watchdog_timer_init
pio_config_set@pio.c:
ledmat_init@ledmat.c: pio_config_set pio_config_set
display_clear@display.c:
display_init@display.c: ledmat_init display_clear
tinygl_text_speed_set@tinygl.c:
tinygl_clear@tinygl.c: display_clear
tinygl_init@tinygl.c: display_init tinygl_text_speed_set tinygl_clear
tinygl_font_set@tinygl.c:
tinygl_text_mode_set@tinygl.c:
tinygl_text_dir_set@tinygl.c:
display_task_init@voltmeter1.c: tinygl_init tinygl_font_set tinygl_text_mode_set tinygl_text_dir_set
adc_init@adc.c: pio_config_set
adc_enable@adc.c:
adc_task_init@voltmeter1.c: adc_init adc_enable
timer_init@timer.c:
timer_get@timer.c:
timer_wait_until@timer.c: timer_get
task_schedule@task.c: timer_init timer_get timer_wait_until timer_get
tinygl_point@tinygl.c:
font_pixel_get@font.c:
tinygl_font_pixel_get@tinygl.c: font_pixel_get
display_pixel_set@display.c:
tinygl_draw_point@tinygl.c: display_pixel_set
tinygl_draw_char@tinygl.c: tinygl_point tinygl_font_pixel_get tinygl_draw_point tinygl_point tinygl_draw_point tinygl_point tinygl_font_pixel_get tinygl_draw_point tinygl_point tinygl_draw_point
tinygl_draw_string@tinygl.c: tinygl_draw_char
tinygl_text_advance@tinygl.c: tinygl_draw_string tinygl_draw_string
pio_output_high@pio.c:
pio_output_low@pio.c:
ledmat_display_column@ledmat.c: pio_output_high pio_output_low pio_output_high pio_output_low
display_update@display.c: ledmat_display_column
tinygl_update@tinygl.c: tinygl_text_advance display_update
display_task@voltmeter1.c: tinygl_update
adc_measure@adc.c: pio_output_high pio_output_low
tinygl_draw_message@tinygl.c: strncpy strlen
tinygl_text@tinygl.c: tinygl_draw_message
adc_task@voltmeter1.c: adc_measure tinygl_text
main@voltmeter1.c: system_init display_task_init adc_task_init task_schedule @display_task @adc_task

Binary file not shown.

@ -0,0 +1,62 @@
../../drivers/avr/timer.h:
../../drivers/avr/timer.c: ../../drivers/avr/timer.h
../../drivers/avr/timer.o: ../../drivers/avr/timer.c
../../drivers/avr/system.c:
../../drivers/avr/system.o: ../../drivers/avr/system.c
../../utils/task.h: ../../drivers/avr/timer.h
../../drivers/display.h:
../../utils/font.h:
../../utils/tinygl.h: ../../drivers/display.h ../../utils/font.h
adc.h:
../../fonts/font3x5_1.h: ../../utils/font.h
voltmeter1.c: ../../utils/task.h ../../utils/tinygl.h adc.h ../../fonts/font3x5_1.h
voltmeter1.o: voltmeter1.c
../../utils/font.c: ../../utils/font.h
../../utils/font.o: ../../utils/font.c
../../drivers/avr/pio.h:
../../drivers/avr/delay.h:
adc.c: ../../drivers/avr/pio.h ../../drivers/avr/delay.h adc.h
adc.o: adc.c
../../drivers/avr/pio.c: ../../drivers/avr/pio.h
../../drivers/avr/pio.o: ../../drivers/avr/pio.c
../../drivers/ledmat.h:
../../drivers/display.c: ../../drivers/ledmat.h ../../drivers/display.h
../../drivers/display.o: ../../drivers/display.c
../../drivers/ledmat.c: ../../drivers/avr/pio.h ../../drivers/ledmat.h
../../drivers/ledmat.o: ../../drivers/ledmat.c
../../utils/tinygl.c: ../../utils/tinygl.h ../../drivers/display.h ../../utils/font.h
../../utils/tinygl.o: ../../utils/tinygl.c
../../utils/task.c: ../../utils/task.h ../../drivers/avr/timer.h
../../utils/task.o: ../../utils/task.c
voltmeter1.out: ../../drivers/avr/timer.o ../../drivers/avr/system.o voltmeter1.o ../../utils/font.o adc.o ../../drivers/avr/pio.o ../../drivers/display.o ../../drivers/ledmat.o ../../utils/tinygl.o ../../utils/task.o

@ -0,0 +1,18 @@
timer:
task: timer
pio:
ledmat: pio
display: ledmat
font:
tinygl: display font
adc: pio
voltmeter1: task tinygl adc

@ -0,0 +1,76 @@
/** @file voltmeter1.c
@author M. P. Hayes, UCECE
@date 1 February 2013
@brief Simple message display program
@defgroup voltmeter1 Simple voltmeter
*/
#include "system.h"
#include "task.h"
#include "tinygl.h"
#include "adc.h"
#include "../fonts/font3x5_1.h"
/* Define polling rates in Hz. */
#define DISPLAY_TASK_RATE 250
#define ADC_TASK_RATE 1
#define ADC_AIN 3
static void adc_task_init (void)
{
adc_init ();
adc_enable (ADC_AIN);
}
static void adc_task (__unused__ void *data)
{
uint8_t count;
char str[3];
count = adc_measure (ADC_AIN);
str[0] = ((count / 10) % 10) + '0';
str[1] = (count % 10) + '0';
str[2] = 0;
tinygl_text (str);
}
static void display_task_init (void)
{
tinygl_init (DISPLAY_TASK_RATE);
tinygl_font_set (&font3x5_1);
tinygl_text_mode_set (TINYGL_TEXT_MODE_STEP);
tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE);
}
static void display_task (__unused__ void *data)
{
tinygl_update ();
}
int main (void)
{
task_t tasks[] =
{
{.func = display_task, .period = TASK_RATE / DISPLAY_TASK_RATE},
{.func = adc_task, .period = TASK_RATE / ADC_TASK_RATE},
};
system_init ();
display_task_init ();
adc_task_init ();
task_schedule (tasks, ARRAY_SIZE (tasks));
return 0;
}
Loading…
Cancel
Save