Compare commits

..

No commits in common. 'eedd02117fab72850f398b036652e15cf09d88f6' and 'bbca075a7dc3c472549ab0ae4e898231ae3dea68' have entirely different histories.

@ -5,7 +5,7 @@
# Definitions. # Definitions.
CC = avr-gcc CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../utils CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../drivers -I../../utils
OBJCOPY = avr-objcopy OBJCOPY = avr-objcopy
SIZE = avr-size SIZE = avr-size
DEL = rm DEL = rm
@ -16,7 +16,7 @@ all: beep1.out
# Compile: create object files from C source files. # Compile: create object files from C source files.
beep1.o: beep1.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../utils/pacer.h beep1.o: beep1.c ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h ../../drivers/led.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
@ -28,6 +28,12 @@ system.o: ../../drivers/avr/system.c ../../drivers/avr/system.h
timer.o: ../../drivers/avr/timer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h timer.o: ../../drivers/avr/timer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
button.o: ../../drivers/button.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h
$(CC) -c $(CFLAGS) $< -o $@
led.o: ../../drivers/led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/led.h
$(CC) -c $(CFLAGS) $< -o $@
pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.h pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
@ -35,7 +41,7 @@ pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.
# Link: create output file (executable) from object files. # Link: create output file (executable) from object files.
beep1.out: beep1.o pio.o system.o timer.o pacer.o beep1.out: beep1.o pio.o system.o timer.o button.o led.o pacer.o
$(CC) $(CFLAGS) $^ -o $@ -lm $(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@ $(SIZE) $@

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for beep1 docs # Descr: Makefile for squeak1 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -16,7 +16,7 @@ all: beep2.out
# Compile: create object files from C source files. # Compile: create object files from C source files.
beep2.o: beep2.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h ../../utils/pacer.h beep2.o: beep2.c ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h ../../drivers/led.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
@ -31,6 +31,9 @@ timer.o: ../../drivers/avr/timer.c ../../drivers/avr/system.h ../../drivers/avr/
button.o: ../../drivers/button.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h button.o: ../../drivers/button.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
led.o: ../../drivers/led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/led.h
$(CC) -c $(CFLAGS) $< -o $@
pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.h pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
@ -38,7 +41,7 @@ pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.
# Link: create output file (executable) from object files. # Link: create output file (executable) from object files.
beep2.out: beep2.o pio.o system.o timer.o button.o pacer.o beep2.out: beep2.o pio.o system.o timer.o button.o led.o pacer.o
$(CC) $(CFLAGS) $^ -o $@ -lm $(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@ $(SIZE) $@

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for beep2 docs # Descr: Makefile for squeak1 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for ir_spam1 docs # Descr: Makefile for ir_uart_test1 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -40,7 +40,7 @@ int main (void)
ticks = 0; ticks = 0;
ir_uart_putc ('2'); ir_uart_putc ('2');
} }
x
tinygl_update (); tinygl_update ();
} }

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for ir_uart_demo1 docs # Descr: Makefile for ir_uart_test3 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -19,7 +19,7 @@ all: ir_uart_test1.out
ir_uart_test1.o: ir_uart_test1.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 ir_uart_test1.o: ir_uart_test1.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
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/delay.h ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h 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
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h

@ -19,7 +19,7 @@ all: ir_uart_test2.out
ir_uart_test2.o: ir_uart_test2.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 ir_uart_test2.o: ir_uart_test2.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
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/delay.h ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h 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
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h

@ -19,7 +19,7 @@ all: ir_uart_test3.out
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 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 $@ $(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/delay.h ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h 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
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h

@ -116,11 +116,7 @@ usart1_write_ready_p@usart1.c:
usart1_putc@usart1.c: usart1_write_ready_p usart1_putc@usart1.c: usart1_write_ready_p
usart1_write_finished_p@usart1.c: ir_uart_putc@ir_uart.c: usart1_putc
ir_uart_write_finished_p@ir_uart.c: usart1_write_finished_p 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
ir_uart_putc@ir_uart.c: usart1_putc ir_uart_write_finished_p _delay_loop_1 ir_uart_read_ready_p ir_uart_getc
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 navswitch_push_event_p ir_uart_putc

@ -26,9 +26,7 @@
../../drivers/avr/pio.h: ../../drivers/avr/pio.h:
../../drivers/avr/delay.h: ../../drivers/avr/ir_uart.c: ../../drivers/avr/ir_uart.h ../../drivers/avr/usart1.h ../../drivers/avr/timer0.h ../../drivers/avr/pio.h
../../drivers/avr/ir_uart.c: ../../drivers/avr/ir_uart.h ../../drivers/avr/usart1.h ../../drivers/avr/timer0.h ../../drivers/avr/pio.h ../../drivers/avr/delay.h
../../drivers/avr/ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/ir_uart.o: ../../drivers/avr/ir_uart.c
@ -82,6 +80,8 @@ ir_uart_test3.o: ir_uart_test3.c
../../drivers/avr/prescale.o: ../../drivers/avr/prescale.c ../../drivers/avr/prescale.o: ../../drivers/avr/prescale.c
../../drivers/avr/delay.h:
../../drivers/navswitch.c: ../../drivers/navswitch.h ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/navswitch.c: ../../drivers/navswitch.h ../../drivers/avr/delay.h ../../drivers/avr/pio.h
../../drivers/navswitch.o: ../../drivers/navswitch.c ../../drivers/navswitch.o: ../../drivers/navswitch.c

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for ir_uart_test4 docs # Descr: Makefile for ir_uart_test3 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,86 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for ir_uart_test6
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../fonts -I../../drivers -I../../utils
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: ir_uart_test6.out
# Compile: create object files from C source files.
ir_uart_test6.o: ir_uart_test6.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
$(CC) -c $(CFLAGS) $< -o $@
ir_uart.o: ../../drivers/avr/ir_uart.c ../../drivers/avr/delay.h ../../drivers/avr/ir_uart.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h ../../drivers/avr/usart1.h
$(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
$(CC) -c $(CFLAGS) $< -o $@
prescale.o: ../../drivers/avr/prescale.c ../../drivers/avr/prescale.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 $@
timer0.o: ../../drivers/avr/timer0.c ../../drivers/avr/bits.h ../../drivers/avr/prescale.h ../../drivers/avr/system.h ../../drivers/avr/timer0.h
$(CC) -c $(CFLAGS) $< -o $@
usart1.o: ../../drivers/avr/usart1.c ../../drivers/avr/system.h ../../drivers/avr/usart1.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 $@
navswitch.o: ../../drivers/navswitch.c ../../drivers/avr/delay.h ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/navswitch.h
$(CC) -c $(CFLAGS) $< -o $@
font.o: ../../utils/font.c ../../drivers/avr/system.h ../../utils/font.h
$(CC) -c $(CFLAGS) $< -o $@
pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.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.
ir_uart_test6.out: ir_uart_test6.o ir_uart.o pio.o prescale.o system.o timer.o timer0.o usart1.o display.o ledmat.o navswitch.o font.o pacer.o tinygl.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Create hex file for programming from executable file.
ir_uart_test6.hex: ir_uart_test6.out
$(OBJCOPY) -O ihex ir_uart_test6.out ir_uart_test6.hex
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: ir_uart_test6.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash ir_uart_test6.hex; dfu-programmer atmega32u2 start

@ -1,67 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ir_uart_test6
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/test -I../../drivers -I../../fonts -I../../utils
DEL = rm
# Default target.
all: ir_uart_test6
# Compile: create object files from C source files.
ir_uart_test6-test.o: ir_uart_test6.c ../../drivers/display.h ../../drivers/navswitch.h ../../drivers/test/ir_uart.h ../../drivers/test/system.h ../../fonts/font5x7_1.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.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 $@
navswitch-test.o: ../../drivers/navswitch.c ../../drivers/navswitch.h ../../drivers/test/avrtest.h ../../drivers/test/delay.h ../../drivers/test/pio.h ../../drivers/test/system.h
$(CC) -c $(CFLAGS) $< -o $@
ir_uart-test.o: ../../drivers/test/ir_uart.c ../../drivers/test/ir_uart.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 $@
pacer-test.o: ../../utils/pacer.c ../../drivers/test/system.h ../../drivers/test/timer.h ../../utils/pacer.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.
ir_uart_test6: ir_uart_test6-test.o display-test.o ledmat-test.o navswitch-test.o ir_uart-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o font-test.o pacer-test.o tinygl-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) ir_uart_test6 ir_uart_test6-test.o display-test.o ledmat-test.o navswitch-test.o ir_uart-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o font-test.o pacer-test.o tinygl-test.o

@ -1,45 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# 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
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

@ -1,16 +0,0 @@
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.

@ -1,73 +0,0 @@
/** @file ir_uart_test6.c
@author M. P. Hayes, UCECE
@date 24 August 2009
@brief Test program for IR serial communications.
This demonstrates the diffference between ir_uart_putc and
ir_uart_putc_nocheck.
@defgroup ir_uart_test6 Test program for IR serial communications.
*/
#include "system.h"
#include "navswitch.h"
#include "tinygl.h"
#include "pacer.h"
#include "ir_uart.h"
#include "../fonts/font5x7_1.h"
/* Define polling rate in Hz. */
#define LOOP_RATE 300
/* Define text update rate (characters per 10 s). */
#define MESSAGE_RATE 10
int main (void)
{
system_init ();
tinygl_init (LOOP_RATE);
tinygl_font_set (&font5x7_1);
tinygl_text_speed_set (MESSAGE_RATE);
tinygl_text_mode_set (TINYGL_TEXT_MODE_STEP);
navswitch_init ();
ir_uart_init ();
pacer_init (LOOP_RATE);
tinygl_draw_char ('*', tinygl_point (0, 0));
/* Paced loop. */
while (1)
{
/* Wait for next tick. */
pacer_wait ();
tinygl_update ();
navswitch_update ();
if (navswitch_push_event_p (NAVSWITCH_WEST))
ir_uart_putc ('W');
if (navswitch_push_event_p (NAVSWITCH_EAST))
ir_uart_putc ('E');
if (navswitch_push_event_p (NAVSWITCH_NORTH))
ir_uart_putc_nocheck ('N');
if (navswitch_push_event_p (NAVSWITCH_SOUTH))
ir_uart_putc_nocheck ('S');
if (ir_uart_read_ready_p ())
{
uint8_t data;
data = ir_uart_getc ();
tinygl_draw_char (data, tinygl_point (0, 0));
}
}
return 0;
}

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for jukebox1 docs # Descr: Makefile for squeak4 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for ledpwm1 docs # Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

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

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

@ -1,45 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for race1 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

@ -1,16 +0,0 @@
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.

@ -1,108 +0,0 @@
/** @file race1.c
@author M. P. Hayes, UCECE
@date 7 October 2013
@brief Test program for IR UART communications showing possible
race condition.
@note Not tested yet...
*/
#include "system.h"
#include "navswitch.h"
#include "tinygl.h"
#include "task.h"
#include "ir_uart.h"
#include "../fonts/font5x7_1.h"
#define DISPLAY_TASK_RATE 200
#define IR_UART_TX_TASK_RATE 20
#define IR_UART_RX_TASK_RATE 20
#define NAVSWITCH_TASK_RATE 20
typedef enum state {STATE_UNKNOWN, STATE_FIRST, STATE_SECOND} state_t;
static state_t this_state = STATE_UNKNOWN;
static state_t other_state = STATE_UNKNOWN;
static void display_task (__unused__ void *data)
{
tinygl_update ();
}
static void ir_uart_tx_task (__unused__ void *data)
{
/* Send our state. */
ir_uart_putc ('A' + this_state);
}
static void ir_uart_rx_task (__unused__ void *data)
{
state_t newstate;
if (!ir_uart_read_ready_p ())
return;
newstate = ir_uart_getc () - 'A';
/* Check for corrupted message. */
if (newstate > STATE_SECOND)
return;
/* See if other devices state has changed. */
if (other_state != newstate)
{
other_state = newstate;
if (this_state == STATE_UNKNOWN && other_state == STATE_FIRST)
{
this_state = STATE_SECOND;
tinygl_text ("2");
}
else
{
/* So what should we do if there is a disagreement?
What if both devices think they were first? */
}
}
}
static void navswitch_task (__unused__ void *data)
{
navswitch_update ();
if (navswitch_push_event_p (NAVSWITCH_PUSH))
{
if (this_state == STATE_UNKNOWN)
{
this_state = STATE_FIRST;
tinygl_text ("1");
}
}
}
int main (void)
{
task_t tasks[] =
{
{.func = display_task, .period = TASK_RATE / DISPLAY_TASK_RATE},
{.func = ir_uart_rx_task, .period = TASK_RATE / IR_UART_RX_TASK_RATE},
{.func = ir_uart_tx_task, .period = TASK_RATE / IR_UART_TX_TASK_RATE},
{.func = navswitch_task, .period = TASK_RATE / NAVSWITCH_TASK_RATE},
};
system_init ();
ir_uart_init ();
tinygl_init (DISPLAY_TASK_RATE);
tinygl_font_set (&font5x7_1);
tinygl_text ("*");
task_schedule (tasks, 4);
return 0;
}

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for random1 docs # Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for random2 docs # Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -5,7 +5,7 @@
# Definitions. # Definitions.
CC = avr-gcc CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../drivers -I../../utils CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../fonts -I../../drivers -I../../utils
OBJCOPY = avr-objcopy OBJCOPY = avr-objcopy
SIZE = avr-size SIZE = avr-size
DEL = rm DEL = rm
@ -16,7 +16,7 @@ all: snake1.out
# Compile: create object files from C source files. # Compile: create object files from C source files.
snake1.o: snake1.c ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/navswitch.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h snake1.o: snake1.c ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/navswitch.h ../../fonts/font5x7_1.h ../../utils/font.h ../../utils/pacer.h ../../utils/tinygl.h
$(CC) -c $(CFLAGS) $< -o $@ $(CC) -c $(CFLAGS) $< -o $@
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h

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

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for stars1 docs # Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,7 +1,7 @@
# File: Makefile # File: Makefile
# Author: M. P. Hayes, UCECE # Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010 # Date: 11 Sep 2010
# Descr: Makefile for stars2 docs # Descr: Makefile for led5 docs
# The scripts used to make the graphs require the program dot; this # The scripts used to make the graphs require the program dot; this
# is part of the graphviz package. # is part of the graphviz package.

@ -1,16 +0,0 @@
Use this directory for your final game and its module(s). Only the
files in this directory will be marked.
Ensure you use the git add command to add your files to the git
repository. For example,
git add module.c
Then use the git commit command to add the file contents
git commit -m "Added file" module.c
The use the git push command to copy the changes to the remote git server
git push

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

@ -1,43 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for game
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I. -I../../utils -I../../drivers -I../../drivers/test
DEL = rm
# Default target.
all: game
# Compile: create object files from C source files.
game-test.o: game.c ../../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
$(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 $@
# Link: create executable file from object files.
game: game-test.o mgetkey-test.o pio-test.o system-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) game game-test.o mgetkey-test.o pio-test.o system-test.o

@ -1,14 +0,0 @@
#include "system.h"
int main (void)
{
system_init ();
while (1)
{
}
}

@ -7,7 +7,6 @@
#include "usart1.h" #include "usart1.h"
#include "timer0.h" #include "timer0.h"
#include "pio.h" #include "pio.h"
#include "delay.h"
/* Return non-zero if there is a character ready to be read. */ /* Return non-zero if there is a character ready to be read. */
@ -43,52 +42,19 @@ ir_uart_write_finished_p (void)
} }
/** Write character to IR_UART. This blocks until the character can /* Write character to IR_UART. This returns zero if
be written into the transmit buffer. It does not check to see the character could not be written. */
if there is any echoed character (see ir_uart_putc). */ int8_t
void
ir_uart_putc_nocheck (char ch)
{
usart1_putc (ch);
}
/** Write character to IR_UART. This blocks until the character is
written. It then checks if data has been received and if so, reads
the data and throws it away on the assumption that it is electrical
or optical echoing. */
void
ir_uart_putc (char ch) ir_uart_putc (char ch)
{ {
/* At 2400 baud with one start bit, 8 data bits, and no parity,
this will take 3.75 ms to transmit. Note, the maximum bit rate
for the IR receiver is 4000 bps. */
usart1_putc (ch); usart1_putc (ch);
/* Gobble echoed character. The echoing is due to an electrical /* Gobble echoed character. The echoing is due to an electrical
common-path interference problem caused by a poor PCB layout of the common-path interference problem caused by a poor PCB layout of the
track powering the IR receiver. Unfortunately, it does not always track powering the IR receiver. */
occur with some combination of UCFK4 boards and laptops. Perhaps ir_uart_getc ();
some laptops are more miserly with their current allocation and
some IR LEDs do not draw as much current? So as a workaround return 1;
we need to wait until the transmission has finished and then check
if something was immediately received.
Having said all this, it is possible to get an optical reflection
of the transmitted signal. The following code should handle this
as well. */
while (! ir_uart_write_finished_p ())
continue;
/* The IR receiver has a delay of about 150 microseconds. So need
to wait for UART to have received the data and set its receive
complete bit. */
DELAY_US (150);
/* Check is something was inadvertently read. */
if (ir_uart_read_ready_p ())
ir_uart_getc ();
} }

@ -77,18 +77,9 @@ bool
ir_uart_write_finished_p (void); ir_uart_write_finished_p (void);
/** Write character to IR_UART. This blocks until the character can /* Write character to IR_UART. This returns zero if
be written into the transmit buffer. It does not check to see the character could not be written. */
if there is any echoed character (see ir_uart_putc). */ int8_t
void
ir_uart_putc_nocheck (char ch);
/* Write character to IR_UART. This blocks until the character is
written. It then checks if data has been received and if so, reads
the data and throws it away on the assumption that it is electrical
or optical echoing. */
void
ir_uart_putc (char ch); ir_uart_putc (char ch);

@ -8,7 +8,8 @@
/* Data typedefs. */ /* Data typedefs. */
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
typedef uint8_t bool;
/** Useful macros. */ /** Useful macros. */

@ -64,17 +64,13 @@ usart1_write_finished_p (void)
/** Write character to USART1. This blocks until the character can be /** Write character to USART1. This blocks until the character can be
written into the transmit register. */ written into transmit register. */
void void
usart1_putc (char ch) usart1_putc (char ch)
{ {
while (!usart1_write_ready_p ()) while (!usart1_write_ready_p ())
continue; continue;
/* Write a 1 to the TXC1 bit to clear it! It will be set when the
data is shifted out of the transmit shift register. */
UCSR1A |= BIT (TXC1);
UDR1 = ch; UDR1 = ch;
} }

@ -44,7 +44,7 @@ usart1_write_finished_p (void);
/** Write character to USART1. This blocks until the character can be /** Write character to USART1. This blocks until the character can be
written into the transmit register. */ written into transmit register. */
void void
usart1_putc (char ch); usart1_putc (char ch);

@ -1,20 +0,0 @@
Lab1 programs
lab1-ex1 Flash LED by writing to port registers
lab1-ex2 Flash LED, using helper functions to write to port registers directly
lab1-ex3 Flash LED, using helper functions in module led1.c to write to port registers directly
lab1-ex4 Flash LED, using helper functions in module led1.c to write to port registers using pio abstraction
lab1-ex5 Flash LED, using led device driver
Lab2 programs
lab2-ex1 Implement paced loop by writing to timer/counter1 registers directly
lab2-ex2 Implement paced loop, using helper functions in mypacer.c by writing to timer/counter1 registers directly
lab2-ex3 Implement paced loop using pacer.c
lab2-ex4 Flash LED in LED matrix
lab2-ex5 Output pattern by multiplexing LED matrix
Lab3 programs
lab3-ex1 Reimplement stopwatch program using paced loop.
lab3-ex2 Hello world!
lab3-ex3 Using the navswitch
lab3-ex4 Using the navswitch and IR communications.

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

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex1 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,20 +0,0 @@
#include <avr/io.h>
#include "system.h"
int main (void)
{
system_init ();
/* Initialise port to drive LED 1. */
/* TODO. */
while (1)
{
/* Turn LED 1 on. */
/* TODO. */
}
}

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

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex2 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,64 +0,0 @@
#include <avr/io.h>
#include "system.h"
static void led_init (void)
{
/* Initialise port to drive LED 1. */
/* TODO. */
}
static void led_on (void)
{
/* Set port to turn LED 1 on. */
/* TODO. */
}
static void led_off (void)
{
/* Set port to turn LED 1 off. */
/* TODO. */
}
static void button_init (void)
{
/* Initialise port to read button 1. */
/* TODO. */
}
static int button_pressed_p (void)
{
/* Return non-zero if button pressed_p. */
/* TODO. */
}
int main (void)
{
system_init ();
led_init ();
button_init ();
while (1)
{
if (button_pressed_p ())
{
led_on ();
}
else
{
led_off ();
}
}
}

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

@ -1,46 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for lab1-lab1-ex3
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wlab1-extra -g -I. -I../../drivers/test
DEL = rm
# Default target.
all: lab1-lab1-ex3
# Compile: create object files from C source files.
lab1-lab1-ex3-test.o: lab1-lab1-ex3.c ../../drivers/test/system.h io.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 $@
io-test.o: io.c io.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create lab1-executable file from object files.
lab1-lab1-ex3: lab1-lab1-ex3-test.o mgetkey-test.o pio-test.o system-test.o io-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) lab1-lab1-ex3 lab1-lab1-ex3-test.o mgetkey-test.o pio-test.o system-test.o io-test.o

@ -1,17 +0,0 @@
#include <avr/io.h>
#include "button.h"
/** Return non-zero if button pressed. */
int button_pressed_p (void)
{
/* TODO. */
}
/** Initialise button1. */
void button_init (void)
{
/* TODO. */
}

@ -1,11 +0,0 @@
#ifndef BUTTON_H
#define BUTTON_H
/** Return non-zero if button pressed. */
int button_pressed_p (void);
/** Initialise button1. */
void button_init (void);
#endif

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex3 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,24 +0,0 @@
#include "button.h"
#include "led.h"
#include "system.h"
int main (void)
{
system_init ();
led_init ();
button_init ();
while (1)
{
if (button_pressed_p ())
{
led_on ();
}
else
{
led_off ();
}
}
}

@ -1,23 +0,0 @@
#include <avr/io.h>
#include "led.h"
/** Turn LED1 on. */
void led_on (void)
{
/* TODO! */
}
/** Turn LED1 off. */
void led_off (void)
{
/* TODO! */
}
/** Initialise LED1. */
void led_init (void)
{
/* TODO! */
}

@ -1,14 +0,0 @@
#ifndef LED_H
#define LED_H
/** Turn LED1 on. */
void led_on (void);
/** Turn LED1 off. */
void led_off (void);
/** Initialise LED1. */
void led_init (void);
#endif

@ -1,54 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab1-ex4
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers/avr
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab1-ex4.out
# Compile: create object files from C source files.
lab1-ex4.o: lab1-ex4.c ../../drivers/avr/system.h button.h led.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 $@
button.o: button.c ../../drivers/avr/pio.h ../../drivers/avr/system.h button.h
$(CC) -c $(CFLAGS) $< -o $@
led.o: led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h led.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab1-ex4.out: lab1-ex4.o pio.o system.o button.o led.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab1-ex4.out
$(OBJCOPY) -O ihex lab1-ex4.out lab1-ex4.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab1-ex4.hex; dfu-programmer atmega32u2 start

@ -1,49 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for lab1-ex4
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wlab1-extra -g -I. -I../../drivers/test
DEL = rm
# Default target.
all: lab1-ex4
# Compile: create object files from C source files.
lab1-ex4-test.o: lab1-ex4.c ../../drivers/test/system.h button.h led.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 $@
button-test.o: button.c ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h button.h
$(CC) -c $(CFLAGS) $< -o $@
led-test.o: led.c ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h led.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create lab1-executable file from object files.
lab1-ex4: lab1-ex4-test.o mgetkey-test.o pio-test.o system-test.o button-test.o led-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) lab1-ex4 lab1-ex4-test.o mgetkey-test.o pio-test.o system-test.o button-test.o led-test.o

@ -1,16 +0,0 @@
#include "pio.h"
#include "button.h"
/** Return non-zero if button pressed. */
int button_pressed_p (void)
{
/* TODO. */
}
/** Initialise button1. */
void button_init (void)
{
/* TODO. */
}

@ -1,11 +0,0 @@
#ifndef BUTTON_H
#define BUTTON_H
/** Return non-zero if button pressed. */
int button_pressed_p (void);
/** Initialise button1. */
void button_init (void);
#endif

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex4 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,24 +0,0 @@
#include "button.h"
#include "led.h"
#include "system.h"
int main (void)
{
system_init ();
led_init ();
button_init ();
while (1)
{
if (button_pressed_p ())
{
led_on ();
}
else
{
led_off ();
}
}
}

@ -1,23 +0,0 @@
#include "pio.h"
#include "led.h"
/** Turn LED1 on. */
void led_on (void)
{
/* TODO! */
}
/** Turn LED1 off. */
void led_off (void)
{
/* TODO! */
}
/** Initialise LED1. */
void led_init (void)
{
/* TODO! */
}

@ -1,14 +0,0 @@
#ifndef LED_H
#define LED_H
/** Turn LED1 on. */
void led_on (void);
/** Turn LED1 off. */
void led_off (void);
/** Initialise LED1. */
void led_init (void);
#endif

@ -1,48 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab1-ex5
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab1-ex5.out
# Compile: create object files from C source files.
lab1-ex5.o: lab1-ex5.c ../../drivers/avr/pio.h ../../drivers/avr/system.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 $@
# Link: create ELF output file from object files.
lab1-ex5.out: lab1-ex5.o pio.o system.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab1-ex5.out
$(OBJCOPY) -O ihex lab1-ex5.out lab1-ex5.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab1-ex5.hex; dfu-programmer atmega32u2 start

@ -1,43 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for lab1-ex5
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wlab1-extra -g -I../../drivers/test
DEL = rm
# Default target.
all: lab1-ex5
# Compile: create object files from C source files.
lab1-ex5-test.o: lab1-ex5.c ../../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 $@
# Link: create lab1-executable file from object files.
lab1-ex5: lab1-ex5-test.o mgetkey-test.o pio-test.o system-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) lab1-ex5 lab1-ex5-test.o mgetkey-test.o pio-test.o system-test.o

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex5 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,16 +0,0 @@
#include "pio.h"
#include "system.h"
int main (void)
{
system_init ();
while (1)
{
/* TODO. Use PIO module to turn on LEDs in
LED matrix. */
}
}

@ -1,51 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab2-ex1
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../drivers
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab2-ex1.out
# Compile: create object files from C source files.
lab2-ex1.o: lab2-ex1.c ../../drivers/avr/system.h ../../drivers/led.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 $@
led.o: ../../drivers/led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/led.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab2-ex1.out: lab2-ex1.o pio.o system.o led.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab2-ex1.out
$(OBJCOPY) -O ihex lab2-ex1.out lab2-ex1.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab2-ex1.hex; dfu-programmer atmega32u2 start

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex1 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,28 +0,0 @@
#include <avr/io.h>
#include "system.h"
#include "led.h"
int main (void)
{
system_init ();
led_init ();
/* TODO: Initialise timer/counter1. */
while (1)
{
/* Turn LED on. */
led_set (LED1, 1);
/* TODO: wait for 500 milliseconds. */
/* Turn LED off. */
led_set (LED1, 0);
/* TODO: wait for 500 milliseconds. */
}
}

@ -1,54 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab2-ex2
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers/avr -I../../drivers
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab2-ex2.out
# Compile: create object files from C source files.
lab2-ex2.o: lab2-ex2.c ../../drivers/avr/system.h ../../drivers/led.h timer.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 $@
led.o: ../../drivers/led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/led.h
$(CC) -c $(CFLAGS) $< -o $@
timer.o: timer.c ../../drivers/avr/system.h timer.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab2-ex2.out: lab2-ex2.o pio.o system.o led.o timer.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab2-ex2.out
$(OBJCOPY) -O ihex lab2-ex2.out lab2-ex2.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab2-ex2.hex; dfu-programmer atmega32u2 start

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex2 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,28 +0,0 @@
#include "system.h"
#include "led.h"
#include "timer.h"
int main (void)
{
system_init ();
led_init ();
/* Initialise timer. */
timer_init ();
while (1)
{
/* Turn LED on. */
led_set (LED1, 1);
/* Wait 500ms. */
timer_delay_ms (500);
/* Turn LED off. */
led_set (LED1, 0);
/* Wait 500ms. */
timer_delay_ms (500);
}
}

@ -1,19 +0,0 @@
#include <avr/io.h>
#include "timer.h"
/* Initialise timer. */
void timer_init (void)
{
/* TODO */
}
/* Wait for the specified length of time. */
void timer_delay_ms (uint16_t milliseconds)
{
/* TODO: Calculate the timer/counter value needed
for the given number of milliseconds. */
/* TODO: Wait for the timer/couter to reach the
value calculated above. */
}

@ -1,13 +0,0 @@
#ifndef TIMER_H
#define TIMER_H
#include "system.h"
/* Initialise timer. */
void timer_init (void);
/* Wait for the specified length of time. */
void timer_delay_ms (uint16_t milliseconds);
#endif

@ -1,54 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab2-ex3
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers/avr -I../../drivers
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab2-ex3.out
# Compile: create object files from C source files.
lab2-ex3.o: lab2-ex3.c ../../drivers/avr/system.h ../../drivers/led.h pacer.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 $@
led.o: ../../drivers/led.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/led.h
$(CC) -c $(CFLAGS) $< -o $@
pacer.o: pacer.c ../../drivers/avr/system.h pacer.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab2-ex3.out: lab2-ex3.o pio.o system.o led.o pacer.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab2-ex3.out
$(OBJCOPY) -O ihex lab2-ex3.out lab2-ex3.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab2-ex3.hex; dfu-programmer atmega32u2 start

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex3 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,25 +0,0 @@
#include "system.h"
#include "led.h"
#include "pacer.h"
int main (void)
{
uint8_t state = 0;
system_init ();
led_init ();
/* Set up pacer with a frequency of 2 Hz. */
pacer_init (2);
while (1)
{
/* Pace the loop. */
pacer_wait ();
/* Toggle LED. */
led_set (LED1, state);
state = !state;
}
}

@ -1,22 +0,0 @@
#include <avr/io.h>
#include "pacer.h"
static uint16_t pacer_period;
/* Initialise the pacer module. */
void pacer_init (uint16_t pacer_frequency)
{
/* TODO: initialise timer/counter peripheral the
same way as in lab2/lab2-ex2/timer.c but also calculate
the timer/counter value from the pacer frequency */
}
/* Pace a while loop. */
void pacer_wait (void)
{
/* TODO: Implement the same way as the timer_delay () function
lab2-except reset TCNT1 after the while loop. */
}

@ -1,13 +0,0 @@
#ifndef PACER_H
#define PACER_H
#include "system.h"
/* Initialise the pacer module. */
void pacer_init (uint16_t pacer_frequency);
/* Pace a while loop. */
void pacer_wait (void);
#endif //PACER_H

@ -1,51 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab2-ex4
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../drivers/avr
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab2-ex4.out
# Compile: create object files from C source files.
lab2-ex4.o: lab2-ex4.c ../../drivers/avr/pio.h ../../drivers/avr/system.h pacer.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 $@
pacer.o: pacer.c ../../drivers/avr/system.h pacer.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab2-ex4.out: lab2-ex4.o pio.o system.o pacer.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab2-ex4.out
$(OBJCOPY) -O ihex lab2-ex4.out lab2-ex4.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab2-ex4.hex; dfu-programmer atmega32u2 start

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex4 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,26 +0,0 @@
#include "system.h"
#include "pio.h"
/* Include the pacer module from the previous lab.
You must have completed this before starting this lab2-exercise. */
#include "pacer.h"
int main (void)
{
system_init ();
/* TODO: Initialise the pins of the LED matrix. */
/* Set up pacer with a frequency of 50 Hz. */
pacer_init (50);
while (1)
{
/* Pace the loop. */
pacer_wait ();
/* TODO: Drive the LED matrix using the pio functions,
displaying only three corner LEDs. */
}
}

@ -1,22 +0,0 @@
#include <avr/io.h>
#include "pacer.h"
static uint16_t pacer_period;
/* Initialise the pacer module. */
void pacer_init (uint16_t pacer_frequency)
{
/* TODO: initialise timer/counter peripheral the
same way as in lab2/lab2-ex2/timer.c but also calculate
the timer/counter value from the pacer frequency */
}
/* Pace a while loop. */
void pacer_wait (void)
{
/* TODO: Implement the same way as the timer_delay () function
lab2-except reset TCNT1 after the while loop. */
}

@ -1,13 +0,0 @@
#ifndef PACER_H
#define PACER_H
#include "system.h"
/* Initialise the pacer module. */
void pacer_init (uint16_t pacer_frequency);
/* Pace a while loop. */
void pacer_wait (void);
#endif //PACER_H

@ -1,54 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 12 Sep 2010
# Descr: Makefile for lab2-ex5
# Definitions.
CC = avr-gcc
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../utils
OBJCOPY = avr-objcopy
SIZE = avr-size
DEL = rm
# Default target.
all: lab2-ex5.out
# Compile: create object files from C source files.
lab2-ex5.o: lab2-ex5.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../utils/pacer.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 $@
pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create ELF output file from object files.
lab2-ex5.out: lab2-ex5.o pio.o system.o timer.o pacer.o
$(CC) $(CFLAGS) $^ -o $@ -lm
$(SIZE) $@
# Target: clean project.
.PHONY: clean
clean:
-$(DEL) *.o *.out *.hex
# Target: program project.
.PHONY: program
program: lab2-ex5.out
$(OBJCOPY) -O ihex lab2-ex5.out lab2-ex5.hex
dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash lab2-ex5.hex; dfu-programmer atmega32u2 start

@ -1,49 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for lab2-ex5
CC = gcc
CFLAGS = -Wall -Wstrict-prototypes -Wlab2-extra -g -I../../drivers/test -I../../utils
DEL = rm
# Default target.
all: lab2-ex5
# Compile: create object files from C source files.
lab2-ex5-test.o: lab2-ex5.c ../../drivers/test/avrtest.h ../../drivers/test/pio.h ../../drivers/test/system.h ../../utils/pacer.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 $@
pacer-test.o: ../../utils/pacer.c ../../drivers/test/system.h ../../drivers/test/timer.h ../../utils/pacer.h
$(CC) -c $(CFLAGS) $< -o $@
# Link: create lab2-executable file from object files.
lab2-ex5: lab2-ex5-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o pacer-test.o
$(CC) $(CFLAGS) $^ -o $@ -lrt
# Clean: delete derived files.
.PHONY: clean
clean:
-$(DEL) lab2-ex5 lab2-ex5-test.o mgetkey-test.o pio-test.o system-test.o timer-test.o pacer-test.o

@ -1,42 +0,0 @@
# File: Makefile
# Author: M. P. Hayes, UCECE
# Date: 11 Sep 2010
# Descr: Makefile for ex5 docs
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 --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

@ -1,16 +0,0 @@
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.

@ -1,61 +0,0 @@
#include "system.h"
#include "pio.h"
#include "pacer.h"
/** Define PIO pins driving LED matrix rows. */
static const pio_t rows[] =
{
LEDMAT_ROW1_PIO, LEDMAT_ROW2_PIO, LEDMAT_ROW3_PIO,
LEDMAT_ROW4_PIO, LEDMAT_ROW5_PIO, LEDMAT_ROW6_PIO,
LEDMAT_ROW7_PIO
};
/** Define PIO pins driving LED matrix columns. */
static const pio_t cols[] =
{
LEDMAT_COL1_PIO, LEDMAT_COL2_PIO, LEDMAT_COL3_PIO,
LEDMAT_COL4_PIO, LEDMAT_COL5_PIO
};
static const uint8_t bitmap[] =
{
0x30, 0x46, 0x40, 0x46, 0x30
};
static void display_column (uint8_t row_pattern, uint8_t current_column)
{
/* TODO */
}
int main (void)
{
uint8_t current_column = 0;
system_init ();
pacer_init (500);
/* TODO: Initialise LED matrix pins. */
while (1)
{
pacer_wait ();
display_column (bitmap[current_column], current_column);
current_column++;
if (current_column > (LEDMAT_COLS_NUM - 1))
{
current_column = 0;
}
}
}

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

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save