20,6 → 20,8 |
* * |
*****************************************************************************/ |
|
//Waddehaddedudennda |
|
#include <avr/io.h> |
#include <avr/interrupt.h> |
#include <avr/pgmspace.h> |
37,7 → 39,7 |
|
|
//***************************************************************************** |
// |
// |
#if 0 |
ISR (USART_RXC_vect) |
{ |
45,11 → 47,11 |
uint8_t rh; |
uint8_t rl; |
static uint8_t jbp; |
|
|
stat = UCSRA; |
rh = UCSRB; |
rl = UDR; |
|
|
if (stat & ((1 << FE) | (1 << DOR0) | (1 << UPE))) |
{ // discard buffer and start new on any error |
JetiBufferReady = 0; |
83,12 → 85,12 |
} |
#endif |
//***************************************************************************** |
// |
// |
void JETI_Init (void) |
{ |
DDRD &= ~(1 << DDD3); // set TXD1 pin as input |
PORTD &= ~(1 << PORTD3); // disable pullup on TXD1 pin |
|
|
// set clock divider |
#undef BAUD |
#define BAUD 9600 |
95,17 → 97,17 |
#include <util/setbaud.h> |
UBRRH = UBRRH_VALUE; |
UBRRL = UBRRL_VALUE; |
|
|
#if USE_2X |
UCSR1A |= (1 << U2X1); // enable double speed operation |
#else |
UCSRA &= ~(1 << U2X); // disable double speed operation |
#endif |
|
|
// set 9O1 |
UCSRC = (1 << UPM1) | (1 << UPM1) | (1 << UCSZ1) | (1 << UCSZ0); |
UCSRB = (1 << UCSZ2); |
|
|
// flush receive buffer |
while ( UCSRA & (1 << RXC) ) UDR; |
} |
126,7 → 128,7 |
|
|
//***************************************************************************** |
// |
// |
void JETI_putw (uint16_t c) |
{ |
loop_until_bit_is_set(UCSRA, UDRE); |
139,7 → 141,7 |
} |
|
//***************************************************************************** |
// |
// |
void JETI_putc (uint8_t c) |
{ |
loop_until_bit_is_set(UCSRA, UDRE); |
149,7 → 151,7 |
} |
|
//***************************************************************************** |
// |
// |
void JETI_puts (char *s) |
{ |
while (*s) |
160,7 → 162,7 |
} |
|
//***************************************************************************** |
// |
// |
void JETI_puts_p (const char *s) |
{ |
while (pgm_read_byte(s)) |
171,7 → 173,7 |
} |
|
//***************************************************************************** |
// |
// |
void JETI_put_start (void) |
{ |
loop_until_bit_is_set(UCSRA, UDRE); |
180,7 → 182,7 |
} |
|
//***************************************************************************** |
// |
// |
void JETI_put_stop (void) |
{ |
loop_until_bit_is_set(UCSRA, UDRE); |
189,7 → 191,7 |
} |
|
//***************************************************************************** |
// |
// |
void jeti (void) |
{ |
uint8_t key; |
198,11 → 200,11 |
// enable Rx |
UCSRB |= (1 << RXEN); |
UCSRB |= (1 << RXCIE); |
|
|
lcd_cls (); |
lcd_printp_at (0, 0, PSTR("Jeti Box Display"), 0); |
lcd_printpns_at (0, 7, PSTR(" \x1a \x1b \x1c \x1d"), 0); |
|
|
#ifdef font8x8 |
lcd_line(0, 21, 127, 21, 1); |
lcd_line(0, 22, 127, 22, 1); |
211,7 → 213,7 |
#else |
lcd_rect(10, 22, 98, 18, 1); |
#endif |
|
|
do |
{ |
if (JetiBufferReady) |
236,17 → 238,17 |
} |
JetiBufferReady = 0; // invalidate buffer |
// LED2_OFF; |
|
|
_delay_ms (1); // |
// Writing to the display takes aprox. 5.8 ms @ 7 MHz and 3.2 ms @ 20 MHz. |
// With the additional 4 ms we had a 10 ms delay. |
// 10 ms works perfect with the MUI30 and the MT125 |
// But not with the TU transceiver module. |
|
|
key = get_key_short ((1 << KEY_MINUS) | (1 << KEY_PLUS) | (1 << KEY_ESC) | (1 << KEY_ENTER)); |
key = (key << 1) | (key >> 3); |
key = (~key) & 0xf0; |
|
|
JETI_putw((uint16_t) key); |
_delay_ms (1); |
JETI_DisableTXD(); |