Merge branch 'master' of eng-git.canterbury.ac.nz:mph/ucfk4
This commit is contained in:
+3
-9
@@ -5,7 +5,7 @@
|
||||
|
||||
# Definitions.
|
||||
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../../utils
|
||||
OBJCOPY = avr-objcopy
|
||||
SIZE = avr-size
|
||||
DEL = rm
|
||||
@@ -16,7 +16,7 @@ all: beep1.out
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
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
|
||||
beep1.o: beep1.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
|
||||
@@ -28,12 +28,6 @@ system.o: ../../drivers/avr/system.c ../../drivers/avr/system.h
|
||||
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 $@
|
||||
|
||||
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
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
@@ -41,7 +35,7 @@ pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.
|
||||
|
||||
|
||||
# Link: create output file (executable) from object files.
|
||||
beep1.out: beep1.o pio.o system.o timer.o button.o led.o pacer.o
|
||||
beep1.out: beep1.o pio.o system.o timer.o pacer.o
|
||||
$(CC) $(CFLAGS) $^ -o $@ -lm
|
||||
$(SIZE) $@
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for squeak1 docs
|
||||
# Descr: Makefile for beep1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
+2
-5
@@ -16,7 +16,7 @@ all: beep2.out
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
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
|
||||
beep2.o: beep2.c ../../drivers/avr/pio.h ../../drivers/avr/system.h ../../drivers/button.h ../../utils/pacer.h
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
pio.o: ../../drivers/avr/pio.c ../../drivers/avr/pio.h ../../drivers/avr/system.h
|
||||
@@ -31,9 +31,6 @@ 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
|
||||
$(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
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
@@ -41,7 +38,7 @@ pacer.o: ../../utils/pacer.c ../../drivers/avr/system.h ../../drivers/avr/timer.
|
||||
|
||||
|
||||
# Link: create output file (executable) from object files.
|
||||
beep2.out: beep2.o pio.o system.o timer.o button.o led.o pacer.o
|
||||
beep2.out: beep2.o pio.o system.o timer.o button.o pacer.o
|
||||
$(CC) $(CFLAGS) $^ -o $@ -lm
|
||||
$(SIZE) $@
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for squeak1 docs
|
||||
# Descr: Makefile for beep2 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for ir_uart_test1 docs
|
||||
# Descr: Makefile for ir_spam1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for ir_uart_test3 docs
|
||||
# Descr: Makefile for ir_uart_demo1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# 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
|
||||
$(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
|
||||
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
|
||||
|
||||
@@ -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
|
||||
$(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
|
||||
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
|
||||
|
||||
@@ -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
|
||||
$(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
|
||||
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
|
||||
|
||||
@@ -116,7 +116,11 @@ [email protected]:
|
||||
|
||||
usart1_putc@usart1.c: usart1_write_ready_p
|
||||
|
||||
ir_uart_putc@ir_uart.c: usart1_putc
|
||||
usart1_write_finished_p@usart1.c:
|
||||
|
||||
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_write_finished_p@ir_uart.c: usart1_write_finished_p
|
||||
|
||||
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,7 +26,9 @@
|
||||
|
||||
../../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.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
|
||||
|
||||
@@ -80,8 +82,6 @@ ir_uart_test3.o: ir_uart_test3.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.o: ../../drivers/navswitch.c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for ir_uart_test3 docs
|
||||
# Descr: Makefile for ir_uart_test4 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for squeak4 docs
|
||||
# Descr: Makefile for jukebox1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for led5 docs
|
||||
# Descr: Makefile for ledpwm1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for ir_uart_test3 docs
|
||||
# Descr: Makefile for race1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for led5 docs
|
||||
# Descr: Makefile for random1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for led5 docs
|
||||
# Descr: Makefile for random2 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
# Definitions.
|
||||
CC = avr-gcc
|
||||
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../fonts -I../../drivers -I../../utils
|
||||
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I../../drivers/avr -I../../drivers -I../../utils
|
||||
OBJCOPY = avr-objcopy
|
||||
SIZE = avr-size
|
||||
DEL = rm
|
||||
@@ -16,7 +16,7 @@ all: snake1.out
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
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
|
||||
snake1.o: snake1.c ../../drivers/avr/system.h ../../drivers/display.h ../../drivers/navswitch.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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Descr: Makefile for snake1
|
||||
|
||||
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: snake1
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
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
|
||||
snake1-test.o: snake1.c ../../drivers/display.h ../../drivers/navswitch.h ../../drivers/test/system.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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for led5 docs
|
||||
# Descr: Makefile for stars1 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# File: Makefile
|
||||
# Author: M. P. Hayes, UCECE
|
||||
# Date: 11 Sep 2010
|
||||
# Descr: Makefile for led5 docs
|
||||
# Descr: Makefile for stars2 docs
|
||||
|
||||
# The scripts used to make the graphs require the program dot; this
|
||||
# is part of the graphviz package.
|
||||
|
||||
+20
-2
@@ -7,6 +7,7 @@
|
||||
#include "usart1.h"
|
||||
#include "timer0.h"
|
||||
#include "pio.h"
|
||||
#include "delay.h"
|
||||
|
||||
|
||||
/* Return non-zero if there is a character ready to be read. */
|
||||
@@ -51,8 +52,25 @@ ir_uart_putc (char ch)
|
||||
|
||||
/* Gobble echoed character. The echoing is due to an electrical
|
||||
common-path interference problem caused by a poor PCB layout of the
|
||||
track powering the IR receiver. */
|
||||
ir_uart_getc ();
|
||||
track powering the IR receiver. Unfortunately, it does not always
|
||||
occur with some combination of UCFK4 boards and laptops. Perhaps
|
||||
some laptops are more miserly with their current allocation and
|
||||
some IR LEDs do not draw as much current? So as a workaround
|
||||
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;
|
||||
|
||||
/* Play safe and wait for receive complete flag to be set. */
|
||||
DELAY_US (1);
|
||||
|
||||
if (ir_uart_read_ready_p ())
|
||||
ir_uart_getc ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
/* Data typedefs. */
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint8_t bool;
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
/** Useful macros. */
|
||||
|
||||
Reference in New Issue
Block a user