Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
Wireless debug dongle

Macros

#define DEBUG_POLL   0
 Packed type used for polling opnly.
 
#define DEBUG_PKT   1
 Packed type used for packet with payload.
 
#define DEBUG_STR   2
 Packed type used for packet with string.
 
#define PIPE_NUMBER   0
 Use pipe 0 for the wireless debug interface (WDI)
 
#define ACK_PAYLOAD_LENGTH   1
 We use 1 byte payload length when transmitting.
 
#define DEBUG_PAYLOAD_LENGTH   32
 Debug payload length.
 
#define DEBUG_LINE_LENGTH   80
 Debug string length.
 
#define DEAD_BEEF   0xDEADBEEF
 Error code for assert.
 

Functions

static void uart_config (uint32_t baudrate, uint8_t rts_pin_number, uint8_t txd_pin_number, uint8_t cts_pin_number, uint8_t rxd_pin_number, bool hwfc)
 Local version of uart configure that take baud rate.
 
static bool m_uart_chars_available (void)
 Checks if there are any characters available in the UART.
 
static void line_print (void)
 Print a dashed line to the UART.
 
static char * state_string_get (uint8_t state)
 Convert state to string.
 
static void debug_output_print (uint8_t *debug_data)
 Print debug output. More...
 
void app_error_handler (uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name)
 Error handler function, which is called when an error has occurred.
 
void assert_nrf_callback (uint16_t line_num, const uint8_t *p_file_name)
 Assert macro callback function.
 
int main ()
 Dongle application.
 
void nrf_gzll_host_rx_data_ready (uint32_t pipe, nrf_gzll_host_rx_info_t rx_info)
 GZLL data packet received callback.
 
void nrf_gzll_device_tx_success (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
 GZLL ACK received callback.
 
void nrf_gzll_device_tx_failed (uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
 GZLL Transmission failed callback.
 
void nrf_gzll_disabled ()
 GZLL Disabled callback.
 

Variables

static uint8_t data_payload [NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH]
 GZLL data payload.
 
static uint8_t ack_payload [ACK_PAYLOAD_LENGTH]
 GZLL ack payload.
 
static bool pkt_received
 True when a packet with first byte = DEBUG_POLL received.
 

Detailed Description

Function Documentation

static void debug_output_print ( uint8_t *  debug_data)
static

Print debug output.

Parameters
debug_dataPointer to the debug data

< Debug output collection

Definition at line 121 of file main.c.

122 {
124  uint16_t tmp16_1, tmp16_2, tmp16_3, tmp16_4, tmp16_5;
125  int16_t temperature;
126 
127  // Status
128  line_print();
129  print_string("StatusStart\r\n");
130  line_print();
131  print_string("State\r\n");
132  sprintf(temp_string, "%s\r\n", state_string_get(debug_data[0]));
133  print_string(temp_string);
134 
135  // Dynamic parameters
136  line_print();
137  print_string("Dynamic parameters\r\n");
138  line_print();
139  tmp16_1 = (uint16_t)debug_data[2] << 8 | (uint16_t)debug_data[1];
140  tmp16_2 = (uint16_t)debug_data[4] << 8 | (uint16_t)debug_data[3];
141  tmp16_3 = (uint16_t)debug_data[6] << 8 | (uint16_t)debug_data[5];
142  tmp16_4 = (uint16_t)debug_data[8] << 8 | (uint16_t)debug_data[7];
143  temperature = (int16_t)((uint16_t)(debug_data[10]<<8 | (uint16_t)debug_data[9]));
144  print_string("Vrect\tIrect\tVout\tIout\tTemp\tCharged\tP_adj\r\n");
145  sprintf(temp_string, "%u\t%u\t%u\t%u\t%u\t%u\t%u\r\n", tmp16_1, tmp16_2, tmp16_3, tmp16_4, temperature, debug_data[11], debug_data[24]);
146  print_string(temp_string);
147 
148  // Static parameters
149  line_print();
150  print_string("Static parameters\r\n");
151  line_print();
152  tmp16_1 = (uint16_t)debug_data[13] << 8 | (uint16_t)debug_data[12];
153  tmp16_2 = (uint16_t)debug_data[15] << 8 | (uint16_t)debug_data[14];
154  tmp16_3 = (uint16_t)debug_data[17] << 8 | (uint16_t)debug_data[16];
155  tmp16_4 = (uint16_t)debug_data[20] << 8 | (uint16_t)debug_data[19];
156  tmp16_5 = (uint16_t)debug_data[22] << 8 | (uint16_t)debug_data[21];
157  print_string("Vrset\tVrmin\tVrmax\tTempmax\tVrmax\tPrmax\r\n");
158  sprintf(temp_string, "%u\t%u\t%u\t%u\t%u\t%u\r\n", tmp16_1, tmp16_2, tmp16_3, debug_data[18], tmp16_4, tmp16_5);
159  print_string(temp_string);
160 
161  // Previous received control data
162  line_print();
163  print_string("Control packet\r\n");
164  line_print();
165 
166  print_string("En_out\tEn_Chin\tAdj_pow\tPerm\tTset\r\n");
167  sprintf(temp_string, "%u\t%u\t%u\t%u\t%u\r\n", debug_data[25], debug_data[26], debug_data[27], debug_data[28], debug_data[29]);
168  print_string(temp_string);
169 
170  if(debug_data[23] != 0)
171  {
172  print_string("\r\n");
173  print_string("Alert sent\r\n");
174  }
175  print_string("StatusEnd\r\n");
176 }
static void line_print(void)
Print a dashed line to the UART.
Definition: main.c:86
static char * state_string_get(uint8_t state)
Convert state to string.
Definition: main.c:99
void print_string(char *char_array)
Decomposes char array and send chars through UART TX.
Definition: app_print.c:25
#define DEBUG_LINE_LENGTH
Debug string length.
Definition: main.c:36
static char temp_string[DEBUG_LINE_LENGTH]