From a2859762b7c7dfd0f9aeffec6f87e7866e6fe1b5 Mon Sep 17 00:00:00 2001 From: Jon Langseth Date: Thu, 27 Jun 2013 18:23:17 +0200 Subject: [PATCH] Updated to reflect Hardware Rev 1 --- Makefile | 6 ++--- fbosd.c | 72 +++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 24 deletions(-) mode change 100755 => 100644 Makefile diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index ad0e941..783fdcd --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ # This modified template is placed in the public domain like the original. # +#AVRDUDE_PROGRAMMER = usbasp +AVRDUDE_PROGRAMMER = usbtiny +AVRDUDE_PORT = usb # Target name and MCU setup ------------------------------------------------- @@ -159,9 +162,6 @@ LDFLAGS = $(EXTMEMOPTS) $(LDMAP) $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) # Programming support using avrdude. Settings and variables. -AVRDUDE_PROGRAMMER = usbtiny -AVRDUDE_PORT = usb - AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep diff --git a/fbosd.c b/fbosd.c index aa1127a..c30ee9b 100644 --- a/fbosd.c +++ b/fbosd.c @@ -22,13 +22,34 @@ void Delay_ms(int cnt) while(cnt-->0) _delay_ms(1); } +void set_busy ( uint8_t busy) +{ + if ( busy ) + { + // Set busy signal + PORTB |= (1 << PB1); + + // TODO: Disable SPI communication here... + } + else + { + // Clear Busy signal + PORTB &= ~(uint8_t)(1 << PB1); + + // TODO: Enable SPI communication here... + } +} + void active_lines ( void ) { static uint8_t rept; _delay_us(4); + // Set Busy signal. Line rendering is time-critical. + set_busy(1); asm_render_line(); + set_busy(0); if( !rept ) { @@ -42,11 +63,14 @@ void active_lines ( void ) void blank_lines ( void ) { + // Do nothing on the "lead-in" lines if ( line < FIRST_LINE ) - { - PORTB ^= 0x004; return; - } + + // Clear Frame Ready signal + PORTD &= ~(uint8_t)(1 << PD5); + + // Activate rendering line_handler = active_lines; } @@ -60,6 +84,10 @@ ISR (INT1_vect) buffer_position = 0; line_handler = &blank_lines; EIMSK &= ~(uint8_t)(1<