Skip to content
Snippets Groups Projects
Commit 6989e776 authored by Julia Scharsich's avatar Julia Scharsich
Browse files

Update lay1+2_remastered.c

parent 473a10ea
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,8 @@ byte frame[MAXFRAMESIZE] = {0}; // 0 - Preambel, 1 to 4 - CRC checksum, 5 - size ...@@ -26,8 +26,8 @@ byte frame[MAXFRAMESIZE] = {0}; // 0 - Preambel, 1 to 4 - CRC checksum, 5 - size
byte** queue; byte** queue;
byte flag = 1; byte flag = 1;
uint16_t bufferIndex = 0; // Zählvariable für ISR byte bufferIndex = 0; // Zählvariable für ISR
uint16_t sendIndex = 0; byte sendIndex = 0;
byte bitIndex = 7; byte bitIndex = 7;
byte readyToReceive = 0; byte readyToReceive = 0;
byte readyToSend = 0; byte readyToSend = 0;
...@@ -36,8 +36,8 @@ byte readyToSend = 0; ...@@ -36,8 +36,8 @@ byte readyToSend = 0;
void delay(int ms){ void delay(int ms){
while(ms>0){ while(ms>0){
_delay_ms(1); _delay_ms(1);
ms--; ms--;
} }
return; return;
} }
...@@ -55,7 +55,7 @@ void fillSend (byte* payload, byte size){ ...@@ -55,7 +55,7 @@ void fillSend (byte* payload, byte size){
send[5] = size; send[5] = size;
for(byte i = 6; i < size+6; i++){ //+6 für preamble, crc, size, for(byte i = 6; i < size+6; i++){ //+8 für preamble, crc, size; dest, src gehören zur payload
send[i]= payload[i-6]; send[i]= payload[i-6];
} }
readyToSend = 1; readyToSend = 1;
...@@ -82,9 +82,9 @@ int main(void){ ...@@ -82,9 +82,9 @@ int main(void){
setup_PinC(); setup_PinC();
sei(); //set SREG (one) sei(); //set SREG (one)
uint16_t receiveIndex = 0; byte receiveIndex = 0;
byte* receivedFrame = malloc(MAXFRAMESIZE*sizeof(byte)); byte* receivedFrame = malloc(MAXFRAMESIZE*sizeof(byte));
uint16_t sizeToReceive = MAXFRAMESIZE; byte sizeToReceive = MAXFRAMESIZE;
byte action; // 0 - broadcast successful, to layer 4; 1 - receive, to layer 4; 2 - relay byte action; // 0 - broadcast successful, to layer 4; 1 - receive, to layer 4; 2 - relay
/* /*
...@@ -178,7 +178,7 @@ int main(void){ ...@@ -178,7 +178,7 @@ int main(void){
PORTB &= ~(1 << PB3); //PB3 löschen -> LED aus PORTB &= ~(1 << PB3); //PB3 löschen -> LED aus
} }
if(bitIndex==0) sendIndex++; if(bitIndex==0) sendIndex++;
if(sendIndex == (uint16_t)send[5]+6) { if(sendIndex == send[5]+6) {
sendIndex = 0; sendIndex = 0;
readyToSend = 0; readyToSend = 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment