mirror of
https://github.com/halleysfifthinc/Toyota-AVC-LAN
synced 2025-06-07 16:06:12 +00:00
Uncommitted changes from 8 years ago
This commit is contained in:
parent
1b66ecf306
commit
49ceb1e5e8
9
Makefile
9
Makefile
@ -10,7 +10,7 @@ sniffer.hex: sniffer.elf
|
||||
avr-objcopy -j .text -j .data -O ihex sniffer.elf sniffer.hex
|
||||
|
||||
sniffer.elf: sniffer.o com232.o avclandrv.o GlobalDef.o
|
||||
$(CC) $(LFLAGS) $(DEFS) -o sniffer.elf sniffer.o com232.o avclandrv.o GlobalDef.o
|
||||
$(CC) $(LFLAGS) -o sniffer.elf sniffer.o com232.o avclandrv.o GlobalDef.o
|
||||
|
||||
sniffer.o: sniffer.c GlobalDef.h com232.h avclandrv.h
|
||||
$(CC) $(CFLAGS) $(DEFS) sniffer.c
|
||||
@ -29,8 +29,11 @@ clean::
|
||||
|
||||
.PHONY: upload connect size
|
||||
|
||||
upload: sniffer.hex
|
||||
avrdude -C/home/allen/Programs/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/arduino -b57600 -D -Uflash:w:sniffer.hex:i
|
||||
upload-final: sniffer.hex
|
||||
avrdude -C/home/allen/Programs/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -patmega328p -cstk500v1 -P/dev/arduino -b19200 -D -U flash:w:sniffer.hex:i
|
||||
|
||||
upload-arduino: sniffer.hex
|
||||
avrdude -C/home/allen/Programs/arduino-1.6.5/hardware/tools/avr/etc/avrdude.conf -patmega328p -carduino -P/dev/arduino -b57600 -D -U flash:w:sniffer.hex:i
|
||||
|
||||
connect:
|
||||
@picocom --nolock -b 115200 /dev/arduino ||:
|
||||
|
146
avclandrv.c
146
avclandrv.c
@ -38,8 +38,8 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define AVC_OUT_EN() sbi(PORTD, 6); sbi(DDRD, 6); sbi(DDRD, 7); sbi(ACSR, ACD);
|
||||
#define AVC_OUT_DIS() cbi(PORTD, 6); cbi(DDRD, 6); cbi(DDRD, 7); cbi(ACSR, ACD);
|
||||
#define AVC_OUT_EN() sbi(PORTD, 6); sbi(DDRD, 6); sbi(DDRD, 7); sbi(ACSR, ACD); // Write mode
|
||||
#define AVC_OUT_DIS() cbi(PORTD, 6); cbi(DDRD, 6); cbi(DDRD, 7); cbi(ACSR, ACD); // Read mpde
|
||||
#define AVC_SET_1() sbi(PORTD, 6);
|
||||
#define AVC_SET_0() cbi(PORTD, 6);
|
||||
|
||||
@ -98,8 +98,6 @@ const byte lan_init[] = { 0x3, SW_ID, 0x01, 0x01 };
|
||||
const byte lan_check[] = { 0x3, SW_ID, 0x01, 0x20 };
|
||||
const byte lan_playit[] = { 0x4, SW_ID, 0x01, 0x45, 0x63 };
|
||||
|
||||
|
||||
|
||||
const byte play_req1[] = { 0x4, 0x00, 0x25, 0x63, 0x80 };
|
||||
|
||||
#ifdef __AVENSIS__
|
||||
@ -108,7 +106,7 @@ const byte play_req1[] = { 0x4, 0x00, 0x25, 0x63, 0x80 };
|
||||
const byte play_req2[] = { 0x6, 0x00, SW_ID, 0x63, 0x42, 0x01, 0x00 };
|
||||
#endif
|
||||
|
||||
const byte play_req3[] = { 0x6, 0x00, SW_ID, 0x63, 0x42, 0x41, 0x00 };
|
||||
const byte play_req3[] = { 0x5, 0x00, SW_ID, 0x63, 0x42, 0x41 };
|
||||
const byte stop_req[] = { 0x5, 0x00, SW_ID, 0x63, 0x43, 0x01 };
|
||||
const byte stop_req2[] = { 0x5, 0x00, SW_ID, 0x63, 0x43, 0x41 };
|
||||
|
||||
@ -192,6 +190,7 @@ void AVCLan_Init()
|
||||
// Analog comparator
|
||||
|
||||
cbi(ADCSRB, ACME); // Analog Comparator Multiplexer Enable - NO
|
||||
//cbi(ADCSRA, ADEN);
|
||||
/*
|
||||
cbi(ACSR, ACBG); // Analog Comparator Bandgap Select
|
||||
// ACI: Analog Comparator Interrupt Flag
|
||||
@ -249,11 +248,11 @@ byte AVCLan_Send_StartBit()
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 255 );
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 76 );
|
||||
while( TCNT0 < 77 );
|
||||
|
||||
AVC_SET_0();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 61 );
|
||||
while( TCNT0 < 38 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -277,11 +276,11 @@ void AVCLan_Send_Bit0()
|
||||
{
|
||||
AVC_SET_1();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 65 ); // 28-37 us
|
||||
while( TCNT0 < 68 ); // 28-37 us
|
||||
|
||||
AVC_SET_0();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 15 ); // 00-09 us
|
||||
while( TCNT0 < 11 ); // 00-09 us
|
||||
}
|
||||
|
||||
// DONE: Timing adjusted.
|
||||
@ -290,19 +289,15 @@ byte AVCLan_Read_ACK()
|
||||
{
|
||||
AVC_SET_1();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 39 );
|
||||
|
||||
AVC_SET_0();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 4 ); // Replace with AVC_ReleaseLine?
|
||||
|
||||
while( TCNT0 < 38 );
|
||||
|
||||
AVC_SET_0(); // Replace with AVC_ReleaseLine?
|
||||
AVC_OUT_DIS(); // switch to read mode
|
||||
TCNT0 = 1;
|
||||
|
||||
while(1) {
|
||||
if (INPUT_IS_SET && (TCNT0 > 5)) break; // Make sure INPUT is not still set from us
|
||||
if (INPUT_IS_SET && (TCNT0 > 52 )) break; // Make sure INPUT is not still set from us
|
||||
// Line of experimentation: Try changing TCNT0 comparison value or remove check entirely
|
||||
if (TCNT0 > 174 ) return 1; // Not sure if this fix is intent correct
|
||||
if (TCNT0 > 75 ) return 1; // Not sure if this fix is intent correct
|
||||
}
|
||||
|
||||
while(INPUT_IS_SET);
|
||||
@ -324,11 +319,11 @@ byte AVCLan_Send_ACK()
|
||||
|
||||
AVC_SET_1();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 65 ); //28-37
|
||||
while( TCNT0 < 68 ); //28-37
|
||||
|
||||
AVC_SET_0();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 15 ); //00-09
|
||||
while( TCNT0 < 11 ); //00-09
|
||||
|
||||
AVC_OUT_DIS();
|
||||
|
||||
@ -934,7 +929,7 @@ void ShowOutMessage()
|
||||
|
||||
AVC_HoldLine();
|
||||
|
||||
RS232_Print_P(PSTR("out > "));
|
||||
RS232_Print_P(PSTR(" out > "));
|
||||
for (i=0; i<data_len; i++) {
|
||||
RS232_PrintHex8(data[i]);
|
||||
RS232_SendByte(' ');
|
||||
@ -944,53 +939,100 @@ void ShowOutMessage()
|
||||
AVC_ReleaseLine();
|
||||
}
|
||||
|
||||
void AVCLan_Measure()
|
||||
{
|
||||
#ifdef SOFTWARE_DEBUG
|
||||
word temp_b[100];
|
||||
|
||||
void AVCLan_Measure()
|
||||
{
|
||||
STOPEvent;
|
||||
|
||||
word tmp, tmp1, tmp2, bit0, bit1;
|
||||
word n = 0;
|
||||
//word tmp, tmp1, tmp2, bit0, bit1;
|
||||
byte n = 0;
|
||||
|
||||
cbi(TCCR1B,CS12);
|
||||
TCCR1B = _BV(CS10);
|
||||
|
||||
while ( n < 1000 )
|
||||
{
|
||||
while(INPUT_IS_CLEAR);
|
||||
|
||||
TCNT1 = 0;
|
||||
|
||||
while(INPUT_IS_SET);
|
||||
|
||||
tmp = TCNT1;
|
||||
char str[5];
|
||||
|
||||
while ( n < 100 )
|
||||
{
|
||||
temp_b[n] = TCNT1;
|
||||
while(INPUT_IS_CLEAR);
|
||||
|
||||
tmp1 = TCNT1;
|
||||
|
||||
temp_b[n+1] = TCNT1;
|
||||
while(INPUT_IS_SET);
|
||||
|
||||
tmp2 = TCNT1;
|
||||
|
||||
bit0 = tmp1-tmp;
|
||||
bit1 = tmp2-tmp1;
|
||||
|
||||
RS232_Print_P(PSTR("1,"));
|
||||
RS232_PrintDec(bit1);
|
||||
RS232_Print_P(PSTR("\n"));
|
||||
|
||||
RS232_Print_P(PSTR("0,"));
|
||||
RS232_PrintDec(bit0);
|
||||
RS232_Print_P(PSTR("\n"));
|
||||
n++;
|
||||
temp_b[n+2] = TCNT1;
|
||||
while(INPUT_IS_CLEAR);
|
||||
temp_b[n+3] = TCNT1;
|
||||
while(INPUT_IS_SET);
|
||||
temp_b[n+4] = TCNT1;
|
||||
while(INPUT_IS_CLEAR);
|
||||
temp_b[n+5] = TCNT1;
|
||||
while(INPUT_IS_SET);
|
||||
temp_b[n+6] = TCNT1;
|
||||
while(INPUT_IS_CLEAR);
|
||||
temp_b[n+7] = TCNT1;
|
||||
while(INPUT_IS_SET);
|
||||
temp_b[n+8] = TCNT1;
|
||||
while(INPUT_IS_CLEAR);
|
||||
temp_b[n+9] = TCNT1;
|
||||
while(INPUT_IS_SET);
|
||||
//
|
||||
// while(INPUT_IS_CLEAR);
|
||||
//
|
||||
// tmp1 = TCNT1;
|
||||
//
|
||||
// while(INPUT_IS_SET);
|
||||
//
|
||||
// tmp2 = TCNT1;
|
||||
//
|
||||
// bit0 = tmp1-tmp;
|
||||
// bit1 = tmp2-tmp1;
|
||||
//
|
||||
// RS232_Print_P(PSTR("1,"));
|
||||
// RS232_PrintDec(bit1);
|
||||
// RS232_Print_P(PSTR("\n"));
|
||||
//
|
||||
// RS232_Print_P(PSTR("0,"));
|
||||
// RS232_PrintDec(bit0);
|
||||
// RS232_Print_P(PSTR("\n"));
|
||||
n += 10;
|
||||
}
|
||||
|
||||
RS232_Print_P(PSTR("Done.\n"));
|
||||
for(byte i =0; i < 100; i++)
|
||||
{
|
||||
itoa(temp_b[i],str);
|
||||
if(i & 1) {
|
||||
RS232_Print_P(PSTR("High,"));
|
||||
} else {
|
||||
RS232_Print_P(PSTR("Low,"));
|
||||
}
|
||||
RS232_Print(str);
|
||||
RS232_Print_P(PSTR("\n"));
|
||||
}
|
||||
RS232_Print_P(PSTR("\nDone.\n"));
|
||||
|
||||
cbi(TCCR1B,CS10);
|
||||
TCCR1B = _BV(CS12);
|
||||
|
||||
STARTEvent;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HARDWARE_DEBUG
|
||||
void SetHighLow() {
|
||||
AVC_OUT_EN();
|
||||
sbi(TCCR1B, CS10);
|
||||
word n = 60000;
|
||||
TCNT1 = 0;
|
||||
AVC_SET_1();
|
||||
while ( TCNT1 < n );
|
||||
TCNT1 = 0;
|
||||
AVC_SET_0();
|
||||
while ( TCNT1 < n );
|
||||
cbi(TCCR1B, CS10);
|
||||
AVC_OUT_DIS();
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
@ -128,7 +128,12 @@ byte AVCLan_SendMyDataBroadcast(byte *data_tmp, byte s_len);
|
||||
void ShowInMessage();
|
||||
void ShowOutMessage();
|
||||
|
||||
void AVCLan_Measure();
|
||||
#ifdef SOFTWARE_DEBUG
|
||||
void AVCLan_Measure();
|
||||
#endif
|
||||
#ifdef HARDWARE_DEBUG
|
||||
void SetHighLow();
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
extern byte answerReq;
|
||||
|
124
capture.md
Normal file
124
capture.md
Normal file
@ -0,0 +1,124 @@
|
||||
``` c
|
||||
HU < (bro) 190| FFF| 11 01 00 // lan_reg
|
||||
out > 00 01 11 10 63 // CMD_REGISTER
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
HU < (bro) 190| FFF| 11 01 01 // lan_init
|
||||
out > 63 31 F1 00 80 FF FF FF FF 00 80 // /*
|
||||
out > 63 31 F3 00 3F 00 00 00 00 02
|
||||
out > 63 31 F3 00 3F 00 01 00 01 02
|
||||
out > 63 31 F3 00 3D 00 01 00 01 02
|
||||
out > 63 31 F3 00 39 00 01 00 01 02 // Registration gobbledygook
|
||||
out > 63 31 F3 00 31 00 01 00 01 02 // probably not all necessary
|
||||
out > 63 31 F3 00 21 00 01 00 01 02
|
||||
out > 63 31 F1 00 90 01 FF FF FF 00 80
|
||||
out > 63 31 F3 00 01 00 01 00 01 02
|
||||
out > 63 31 F1 00 30 01 FF FF FF 00 80 // */
|
||||
HU < (dir) 190| 360| 00 31 63 E0 // Similar to play_req1
|
||||
// Logic device ID 31 => Me (63)
|
||||
// Command E0
|
||||
// What is logic device 31???
|
||||
|
||||
HU < (dir) 190| 360| 00 25 63 E4 // Also similar to play_req1
|
||||
|
||||
HU < (bro) 190| FFF| 01 01 59 39 // Nothing heard?
|
||||
HU < (bro) 190| FFF| 01 01 59 39 // What is logic device 59???
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
|
||||
HU < (dir) 190| 360| 00 31 63 E0 // Try again?
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (bro) 190| FFF| 11 01 00
|
||||
out > 00 01 11 10 63
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
HU < (bro) 190| FFF| 11 01 01
|
||||
out > 63 31 F1 00 80 FF FF FF FF 00 80
|
||||
out > 63 31 F3 00 3F 00 00 00 00 02
|
||||
out > 63 31 F3 00 3F 00 01 00 01 02
|
||||
out > 63 31 F3 00 3D 00 01 00 01 02
|
||||
out > 63 31 F3 00 39 00 01 00 01 02
|
||||
out > 63 31 F3 00 31 00 01 00 01 02
|
||||
out > 63 31 F3 00 21 00 01 00 01 02
|
||||
out > 63 31 F1 00 90 01 FF FF FF 00 80
|
||||
out > 63 31 F3 00 01 00 01 00 01 02
|
||||
out > 63 31 F1 00 30 01 FF FF FF 00 80
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
|
||||
HU < (dir) 190| 360| 00 25 63 E4
|
||||
|
||||
HU < (bro) 190| FFF| 01 01 59 39
|
||||
HU < (bro) 190| FFF| 01 01 59 39
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
HU < (bro) 190| FFF| 01 01 59 39
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
HU < (dir) 190| 360| 00 31 63 E0
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 31 63 E2
|
||||
HU < (dir) 190| 360| 00 25 63 80 // play_req1
|
||||
out > 00 63 11 50 01 // CMD_PLAY_OK1
|
||||
HU < (dir) 190| 360| 00 11 63 43 01 // stop_req
|
||||
out > 00 63 11 53 01 // CMD_STOP1
|
||||
out > 63 31 F1 00 30 01 01 00 00 00 80 // Player Status
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
|
||||
|
||||
|
||||
HU < (dir) 190| 360| 00 25 63 80 // play_req1
|
||||
out > 00 63 11 50 01 // CMD_PLAY_OK1
|
||||
HU < (dir) 190| 360| 00 11 63 42 41 // play_req3 but without ending 00
|
||||
|
||||
HU < (dir) 190| 360| 00 11 63 42 41 // Trying again?
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 43 01
|
||||
out > 00 63 11 53 01
|
||||
out > 63 31 F1 00 30 01 01 00 00 00 80
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 43 01
|
||||
out > 00 63 11 53 01
|
||||
out > 63 31 F1 00 30 01 01 00 00 00 80
|
||||
HU < (bro) 190| FFF| 11 01 45 60 // Tuner in use
|
||||
|
||||
HU < (dir) 190| 360| 00 25 63 80
|
||||
out > 00 63 11 50 01
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 11 63 42 41
|
||||
HU < (dir) 190| 360| 00 11 63 43 01
|
||||
out > 00 63 11 53 01
|
||||
out > 63 31 F1 00 30 01 01 00 00 00 80
|
||||
|
||||
```
|
20
com232.c
20
com232.c
@ -126,4 +126,24 @@ void RS232_PrintDec2(byte Data)
|
||||
if (Data<10) RS232_SendByte('0');
|
||||
RS232_PrintDec(Data);
|
||||
}
|
||||
|
||||
char* itoa(int i, char b[]){
|
||||
char const digit[] = "0123456789";
|
||||
char* p = b;
|
||||
if(i<0){
|
||||
*p++ = '-';
|
||||
i *= -1;
|
||||
}
|
||||
int shifter = i;
|
||||
do{ //Move to where representation ends
|
||||
++p;
|
||||
shifter = shifter/10;
|
||||
}while(shifter);
|
||||
*p = '\0';
|
||||
do{ //Move back, inserting digits as u go
|
||||
*--p = digit[i%10];
|
||||
i = i/10;
|
||||
}while(i);
|
||||
return b;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
1
com232.h
1
com232.h
@ -44,6 +44,7 @@ extern void RS232_PrintHex4(byte Data);
|
||||
extern void RS232_PrintHex8(byte Data);
|
||||
extern void RS232_PrintDec(byte Data);
|
||||
extern void RS232_PrintDec2(byte Data);
|
||||
extern char* itoa(int i, char b[]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// LED
|
||||
|
91
sniffer.c
91
sniffer.c
@ -52,8 +52,6 @@ byte rcv_time_clr = 0;
|
||||
//
|
||||
int main()
|
||||
{
|
||||
// byte h;
|
||||
|
||||
|
||||
byte readSeq = 0;
|
||||
byte s_len = 0;
|
||||
@ -63,20 +61,17 @@ int main()
|
||||
byte data_tmp[32];
|
||||
|
||||
Setup();
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 250 );
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 250 );
|
||||
TCNT0 = 0;
|
||||
while( TCNT0 < 250 );
|
||||
|
||||
|
||||
|
||||
RS232_Print("AVCLan reader 1.00\nReady\n\n");
|
||||
LED_OFF();
|
||||
RS232_Print_P(PSTR("D - device id\nH - HU id\nS - read sequence\nW - send command\nQ - send broadcast\nL/l - log on/off\nK/k - seq. echo on/off\nR/r - register device\nB - Beep\nT - Measure interval\n"));
|
||||
|
||||
|
||||
RS232_Print_P(PSTR("\nS - read sequence\nW - send command\nQ - send broadcast\nL/l - log on/off\nK/k - seq. echo on/off\n"));
|
||||
RS232_Print_P(PSTR("R/r - register device\nB - Beep\n"));
|
||||
#ifdef HARDWARE_DEBUG
|
||||
RS232_Print_P(PSTR("1 - Hold High/low\nE - Print line status\n"));
|
||||
#endif
|
||||
#ifdef SOFTWARE_DEBUG
|
||||
RS232_Print_P(PSTR("M - Measure high and low lengths\n"));
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
|
||||
@ -107,44 +102,6 @@ int main()
|
||||
RS232_RxCharBegin = RS232_RxCharEnd = 0; // do reset Buffer
|
||||
sbi(UCSR0B, RXCIE0); // enable RX complete interrupt
|
||||
switch (readkey) {
|
||||
case 'D': if (readSeq) {
|
||||
CD_ID_1 = data_tmp[0];
|
||||
CD_ID_2 = data_tmp[1];
|
||||
RS232_Print_P(PSTR("DEV ID SET: 0x"));
|
||||
RS232_PrintHex8(CD_ID_1);
|
||||
RS232_PrintHex8(CD_ID_2);
|
||||
RS232_Print_P(PSTR("\n"));
|
||||
showLog = 1;
|
||||
readSeq=0;
|
||||
} else {
|
||||
showLog = 0;
|
||||
RS232_Print_P(PSTR("DEV ID > \n"));
|
||||
readSeq = 1;
|
||||
s_len=0;
|
||||
s_dig=0;
|
||||
s_c[0]=s_c[1]=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'H': if (readSeq) {
|
||||
HU_ID_1 = data_tmp[0];
|
||||
HU_ID_2 = data_tmp[1];
|
||||
RS232_Print_P(PSTR("HU ID SET: 0x"));
|
||||
RS232_PrintHex8(HU_ID_1);
|
||||
RS232_PrintHex8(HU_ID_2);
|
||||
RS232_Print_P(PSTR("\n"));
|
||||
showLog = 1;
|
||||
readSeq=0;
|
||||
} else {
|
||||
showLog = 0;
|
||||
RS232_Print_P(PSTR("HU ID > \n"));
|
||||
readSeq = 1;
|
||||
s_len=0;
|
||||
s_dig=0;
|
||||
s_c[0]=s_c[1]=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S': showLog = 0;
|
||||
RS232_Print_P(PSTR("READ SEQUENCE > \n"));
|
||||
readSeq = 1;
|
||||
@ -160,8 +117,6 @@ int main()
|
||||
readSeq=0;
|
||||
AVCLan_SendMyDataBroadcast(data_tmp, s_len);
|
||||
break;
|
||||
|
||||
|
||||
case 'R': RS232_Print_P(PSTR("REGIST:\n"));
|
||||
AVCLan_Command( cmRegister );
|
||||
TCNT0 = 0;
|
||||
@ -170,15 +125,12 @@ int main()
|
||||
break;
|
||||
case 'r': AVCLan_Register();
|
||||
break;
|
||||
|
||||
|
||||
case 'l': RS232_Print_P(PSTR("Log OFF\n"));
|
||||
showLog = 0;
|
||||
break;
|
||||
case 'L': RS232_Print_P(PSTR("Log ON\n"));
|
||||
showLog = 1;
|
||||
break;
|
||||
|
||||
case 'k': RS232_Print_P(PSTR("str OFF\n"));
|
||||
showLog2 = 0;
|
||||
break;
|
||||
@ -187,16 +139,33 @@ int main()
|
||||
break;
|
||||
case 'B':
|
||||
data_tmp[0] = 0x00;
|
||||
data_tmp[0] = 0x5E;
|
||||
data_tmp[0] = 0x29;
|
||||
data_tmp[0] = 0x60;
|
||||
data_tmp[0] = 0x01;
|
||||
data_tmp[1] = 0x5E;
|
||||
data_tmp[2] = 0x29;
|
||||
data_tmp[3] = 0x60;
|
||||
data_tmp[4] = 0x01;
|
||||
s_len = 5;
|
||||
AVCLan_SendMyData(data_tmp, s_len);
|
||||
break;
|
||||
case 'T':
|
||||
|
||||
#ifdef HARDWARE_DEBUG
|
||||
case '1':
|
||||
SetHighLow();
|
||||
break;
|
||||
case 'E':
|
||||
if(INPUT_IS_SET) {
|
||||
RS232_Print_P(PSTR("Set/High/1\n"));
|
||||
} else if (INPUT_IS_CLEAR) {
|
||||
RS232_Print_P(PSTR("Unset/Low/0\n"));
|
||||
} else {
|
||||
RS232_Print_P(PSTR("WTF?\n"));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef SOFTWARE_DEBUG
|
||||
case 'M':
|
||||
AVCLan_Measure();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default :
|
||||
if (readSeq==1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user