diff --git a/software/Arduino/Makefile b/software/Arduino/Makefile index 9777ba2..1e56138 100644 --- a/software/Arduino/Makefile +++ b/software/Arduino/Makefile @@ -10,7 +10,7 @@ SRC_CPP = main.cpp ardusss7.cpp TARGET = sss7 OBJDIR = bin ARDUINO_DIR = ./arduino-1.6.13 -ARDUINO_BOARD = mega +ARDUINO_BOARD = standard CC = avr-gcc CPP = avr-g++ @@ -103,7 +103,7 @@ clean : @rm -rf $(OBJDIR) flash : all - avrdude -c stk500v2 \ + avrdude -c arduino -F \ -p $(AVRMCU) -P $(ISPPORT) -D \ -U flash:w:$(OBJDIR)/$(AVRMCU)/$(TARGET).hex diff --git a/software/Arduino/ardusss7.cpp b/software/Arduino/ardusss7.cpp index 7f3cf9a..94a4d37 100644 --- a/software/Arduino/ardusss7.cpp +++ b/software/Arduino/ardusss7.cpp @@ -60,11 +60,11 @@ uint8_t uart_get_byte() { return UDR0; } -ISR(USART0_RX_vect) { +ISR(USART_RX_vect) { sss7_process_rx(); } -ISR(USART0_TX_vect) { +ISR(USART_TX_vect) { sss7_process_tx(); } diff --git a/software/Arduino/main.cpp b/software/Arduino/main.cpp index c2864c8..e434d78 100644 --- a/software/Arduino/main.cpp +++ b/software/Arduino/main.cpp @@ -2,11 +2,11 @@ #include "ardusss7.h" void setup() { - Serial.begin(9600); + //Serial.begin(9600); - Serial.print("Initializing SSS7..."); + //Serial.print("Initializing SSS7..."); SSS7.init(); - Serial.println("Done !"); + //Serial.println("Done !"); }; @@ -26,27 +26,76 @@ void loop() { msg[9] = 'l'; msg[10] = 'd'; + pinMode(13, OUTPUT); while(1) { - Serial.println("Waiting to send"); while(!SSS7.canSend()); - Serial.println("Sending ..."); + SSS7.send(msg); while(!SSS7.canSend()); - //Serial.println("Finished Sending"); + if(SSS7.sendFailed()) { - Serial.println("Send failed"); + // Do something } if(SSS7.hasReceived()) { uint8_t msg1[SSS7_PAYLOAD_SIZE]; SSS7.getReceived(msg1); - Serial.print("Got data:"); - Serial.println((char*)msg1); + + digitalWrite(13, HIGH); + _delay_ms(500); } + digitalWrite(13, LOW); _delay_ms(1000); } +/* + uint8_t msg[5][SSS7_PAYLOAD_SIZE]; + for(uint8_t i = 0; i < 5; i++) { + memset(msg[i], 0, SSS7_PAYLOAD_SIZE); + } + + msg[0][0] = 0x06; + msg[0][1] = 0; + msg[0][2] = 2; + + msg[1][0] = 0x00; + msg[1][1] = 11; + msg[1][2] = 0; + + msg[2][0] = 0x00; + msg[2][1] = 12; + msg[2][2] = 0; + + msg[3][0] = 0x00; + msg[3][1] = 13; + msg[3][2] = 0; + + msg[4][0] = 0x00; + msg[4][1] = 8; + msg[4][2] = 0; + + while(1) { + + for(uint8_t i = 0; i < 5; i++) { + Serial.println("Waiting to send"); + while(!SSS7.canSend()); + Serial.print("Sending "); + Serial.print(i); + Serial.println(" ..."); + SSS7.send(msg[i]); + while(!SSS7.canSend()); + Serial.println("Finished Sending"); + if(SSS7.sendFailed()) { + Serial.println("Send failed"); + } + + + _delay_ms(1000); + } + } + */ + };