|
@@ -165,7 +165,7 @@ SYSTEM_TaskStatus_t APP_TaskHandler(void) |
|
|
|
|
|
|
|
|
// Exit receive mode |
|
|
// Exit receive mode |
|
|
radio_exit_receive_mode() ; |
|
|
radio_exit_receive_mode() ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare and transmit buttonCounter |
|
|
// Prepare and transmit buttonCounter |
|
|
buffer[0] = buttonCounter ; |
|
|
buffer[0] = buttonCounter ; |
|
|
radio_transmit_uplink(buffer, 1) ; |
|
|
radio_transmit_uplink(buffer, 1) ; |
|
@@ -196,7 +196,7 @@ void serial_data_handler(void) |
|
|
/* Configure LoRa Radio for P2P */ |
|
|
/* Configure LoRa Radio for P2P */ |
|
|
static void configure_radio(void) |
|
|
static void configure_radio(void) |
|
|
{ |
|
|
{ |
|
|
// MAC reset 868 - reset the LoRaWAN stack and initialize it with the parameters of the selected ISM band |
|
|
|
|
|
|
|
|
// Cmd mac reset 868 - reset the LoRaWAN stack and initialize it with the parameters of the selected ISM band |
|
|
LORAWAN_Reset(ISM_EU868) ; // Refer to stack_common.h for the definition of IsmBand_t |
|
|
LORAWAN_Reset(ISM_EU868) ; // Refer to stack_common.h for the definition of IsmBand_t |
|
|
|
|
|
|
|
|
// Cmd mac pause |
|
|
// Cmd mac pause |
|
@@ -289,13 +289,13 @@ void appData_callback(void *appHandle, appCbParams_t *appdata) |
|
|
int8_t rssi_value, snr_value ; |
|
|
int8_t rssi_value, snr_value ; |
|
|
RADIO_GetAttr(PACKET_RSSI_VALUE, &rssi_value) ; |
|
|
RADIO_GetAttr(PACKET_RSSI_VALUE, &rssi_value) ; |
|
|
RADIO_GetAttr(PACKET_SNR, &snr_value) ; |
|
|
RADIO_GetAttr(PACKET_SNR, &snr_value) ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf(">> Payload received: ") ; |
|
|
printf(">> Payload received: ") ; |
|
|
print_array(pData, dataLength) ; |
|
|
print_array(pData, dataLength) ; |
|
|
printf("RSSI Value: %d\r\n", rssi_value) ; |
|
|
printf("RSSI Value: %d\r\n", rssi_value) ; |
|
|
printf("SNR Value: %d", snr_value) ; |
|
|
printf("SNR Value: %d", snr_value) ; |
|
|
printf("\r\n*******************\r\n") ; |
|
|
printf("\r\n*******************\r\n") ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LED_On(LED_0_PIN) ; |
|
|
LED_On(LED_0_PIN) ; |
|
|
delay_ms(50) ; |
|
|
delay_ms(50) ; |
|
|
LED_Off(LED_0_PIN) ; |
|
|
LED_Off(LED_0_PIN) ; |
|
@@ -304,7 +304,7 @@ void appData_callback(void *appHandle, appCbParams_t *appdata) |
|
|
print_menu() ; |
|
|
print_menu() ; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
case LORAWAN_RADIO_NO_DATA: |
|
|
case LORAWAN_RADIO_NO_DATA: |
|
|
{ |
|
|
{ |
|
|
printf("\n\rRADIO_NO_DATA \n\r"); |
|
|
printf("\n\rRADIO_NO_DATA \n\r"); |
|
@@ -333,27 +333,27 @@ void appData_callback(void *appHandle, appCbParams_t *appdata) |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
printf("UNKNOWN ERROR %d\r\n", status) ; |
|
|
printf("UNKNOWN ERROR %d\r\n", status) ; |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if(appdata->evt == LORAWAN_EVT_TRANSACTION_COMPLETE) |
|
|
else if(appdata->evt == LORAWAN_EVT_TRANSACTION_COMPLETE) |
|
|
{ |
|
|
{ |
|
|
// Uplink Event |
|
|
|
|
|
|
|
|
// Uplink event |
|
|
switch(status = appdata->param.transCmpl.status) |
|
|
switch(status = appdata->param.transCmpl.status) |
|
|
{ |
|
|
{ |
|
|
case LORAWAN_SUCCESS: |
|
|
case LORAWAN_SUCCESS: |
|
|
case LORAWAN_RADIO_SUCCESS: |
|
|
case LORAWAN_RADIO_SUCCESS: |
|
|
printf("Transmission success\r\n") ; |
|
|
printf("Transmission success\r\n") ; |
|
|
radio_enter_receive_mode() ; |
|
|
radio_enter_receive_mode() ; |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
case LORAWAN_RADIO_NO_DATA: |
|
|
case LORAWAN_RADIO_NO_DATA: |
|
|
printf("\r\nRADIO_NO_DATA\r\n") ; |
|
|
printf("\r\nRADIO_NO_DATA\r\n") ; |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
case LORAWAN_RADIO_BUSY: |
|
|
case LORAWAN_RADIO_BUSY: |
|
|
printf("\r\nRADIO_BUSY\r\n") ; |
|
|
printf("\r\nRADIO_BUSY\r\n") ; |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
default: |
|
|
default: |
|
|
break ; |
|
|
|
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|