Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

This module handles the functionalities of the receptor in PER mode.

Macros

#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)
 
#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
 
#define LED_BLINK_COUNT_FOR_IDENTIFY   (20)
 

Functions

void app_reset (trx_id_t trx)
 
static void app_reset_cb (void *parameter)
 Timer Callback function if disconnect command is received on air by a node in reflector configuration.This is used to do a software reset on the reflector side. More...
 
static void get_node_info (trx_id_t trx, peer_info_rsp_t *data)
 Function used to get the board details of peer node. More...
 
static void identify_timer_handler_cb (void *parameter)
 Timer Callback function if identify command is received on air by a node in reflector configuration. More...
 
void marker_rsp_timer_handler_cb (void *parameter)
 Timer Callback function if marker command is received on air This is used to blink the LED and thus identify that the marker frame is received. More...
 
void marker_tx_timer_handler_cb (void *parameter)
 Timer Callback function if marker response command is transmitted on air This is used to blink the LED and thus identify that the transmission is done. More...
 
void per_mode_receptor_init (trx_id_t trx, void *parameter)
 Initialize the application in PER Measurement mode as Receptor. More...
 
void per_mode_receptor_rx_cb (trx_id_t trx, frame_info_t *frame)
 Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
void per_mode_receptor_task (trx_id_t trx)
 The application task when the node is in PER_TEST_RECEPTOR state i.e.PER Measurement mode as Receptor. More...
 
void per_mode_receptor_tx_done_cb (trx_id_t trx, retval_t status, frame_info_t *frame)
 Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor. More...
 
static void send_crc_status_rsp (trx_id_t trx)
 Function used to send crc settings on remote node to host node. More...
 
static void send_peer_info_rsp (trx_id_t trx)
 Function used to send peer_info_rsp command. More...
 
static bool send_range_test_marker_cmd (trx_id_t trx)
 Function to send the range test marker command to the initiator node. More...
 
static void send_range_test_rsp (trx_id_t trx, uint8_t seq_num, uint32_t frame_count, int8_t ed, uint8_t lqi)
 Function used to send response to the received range test packet. More...
 
static void send_result_rsp (trx_id_t trx)
 Function used to send PER test result. More...
 
static void set_default_configuration_peer_node (trx_id_t trx)
 Function used to set default configurations on peer node on reception of set_default req. More...
 
static void set_paramter_on_recptor_node (trx_id_t trx, app_payload_t *msg)
 Extract the received command frame and set the parameters like channel, tx power etc on Receptor node. More...
 

Variables

bool trx_config_params_t::ack_request
 
static uint32_t aver_lqi [NUM_TRX]
 
static uint32_t aver_rssi [NUM_TRX]
 
uint16_t trx_config_params_t::channel
 
uint8_t ed_scan_result_t::channel_no
 
uint8_t trx_config_params_t::channel_page
 
int char_received
 
bool trx_config_params_t::csma_enabled
 
uint32_t frames_with_wrong_crc [NUM_TRX]
 
float trx_config_params_t::ism_frequency
 
bool manual_crc [NUM_TRX] = {false, false}
 
static uint8_t marker_seq_num [NUM_TRX] = {0, 0}
 
static uint32_t number_rx_frames [NUM_TRX]
 
uint32_t trx_config_params_t::number_test_frames
 
int8_t ed_scan_result_t::p_in
 
uint16_t trx_config_params_t::phy_frame_length
 
static bool range_test_in_progress [NUM_TRX] = {false, false}
 
bool trx_config_params_t::retry_enabled
 
bool trx_config_params_t::rpc_enable
 
static uint8_t seq_num_receptor [NUM_TRX]
 
sun_phy_t trx_config_params_t::sun_phy_page
 
uint8_t trx_config_params_t::trx_state
 
int8_t trx_config_params_t::tx_power_dbm
 

#define DELAY_BEFORE_APP_RESET_IN_MICRO_SEC   (5000)

Referenced by per_mode_receptor_rx_cb().

#define LED_BLINK_COUNT_FOR_BUTTON_PRESS   (10)
#define LED_BLINK_COUNT_FOR_IDENTIFY   (20)

static void app_reset_cb ( void *  parameter)
static

Timer Callback function if disconnect command is received on air by a node in reflector configuration.This is used to do a software reset on the reflector side.

Parameters
parameterpass parameters to timer handler

References app_reset().

Referenced by per_mode_receptor_rx_cb().

static void identify_timer_handler_cb ( void *  parameter)
static

Timer Callback function if identify command is received on air by a node in reflector configuration.

This is used to blink the LED and thus identify itself

Parameters
parameterpass parameters to timer handler

References app_led_event(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_COUNT_FOR_IDENTIFY, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_ALL_OFF, LED_EVENT_ALL_ON, LED_EVENT_PEER_SEARCH_DONE, SW_TIMEOUT_RELATIVE, sw_timer_start(), and sw_timer_stop().

Referenced by per_mode_receptor_rx_cb().

void marker_rsp_timer_handler_cb ( void *  parameter)

Timer Callback function if marker command is received on air This is used to blink the LED and thus identify that the marker frame is received.

Parameters
parameterpass parameters to timer handler

References app_led_event(), FUNC_PTR, LED_BLINK_COUNT_FOR_BUTTON_PRESS, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, LED_Off, LED_On, RX_LED, SW_TIMEOUT_RELATIVE, sw_timer_start(), sw_timer_stop(), and T_APP_TIMER.

Referenced by per_mode_initiator_rx_cb(), and per_mode_receptor_rx_cb().

void marker_tx_timer_handler_cb ( void *  parameter)

Timer Callback function if marker response command is transmitted on air This is used to blink the LED and thus identify that the transmission is done.

Parameters
parameterpass parameters to timer handler

References app_led_event(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_COUNT_FOR_BUTTON_PRESS, LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, LED_Off, LED_On, SW_TIMEOUT_RELATIVE, sw_timer_start(), sw_timer_stop(), and TX_LED.

Referenced by per_mode_receptor_task(), and send_range_test_marker_rsp().

void per_mode_receptor_init ( trx_id_t  trx,
void *  parameter 
)

Initialize the application in PER Measurement mode as Receptor.

Parameters
parameterPointer to the paramter to be carried, if any.

References phyTransmitPower, seq_num_receptor, tal_pib_set(), and TAL_TRANSMIT_POWER_DEFAULT.

void per_mode_receptor_rx_cb ( trx_id_t  trx,
frame_info_t frame 
)

Callback that is called if data has been received by trx in the PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
framePointer to received frame

References AACK_PROM_DISABLE, AACK_PROM_ENABLE, app_led_event(), app_reset_cb(), APP_TIMER_TO_TX, aver_lqi, aver_rssi, CCPU_ENDIAN_TO_LE32, phy_tag::ch_spacing, app_payload_t::cmd_id, crc_check_ok(), general_pkt_t::crc_set_req_data, DELAY_BEFORE_APP_RESET_IN_MICRO_SEC, DISCONNECT_NODE, range_tx_t::frame_count, FRAME_OVERHEAD, frames_with_wrong_crc, phy_tag::freq_band, phy_tag::freq_f0, FSK, FUNC_PTR, IDENTIFY_NODE, identify_timer_handler_cb(), LED_BLINK_RATE_IN_MICRO_SEC, LED_EVENT_PEER_SEARCH_DONE, LED_EVENT_RX_FRAME, LED_TOGGLE_COUNT_FOR_PER, LEG_OQPSK, frame_info_tag::len_no_crc, MAC_SUCCESS, macShortAddress, manual_crc, marker_rsp_timer_handler_cb(), marker_seq_num, phy_tag::modulation, frame_info_tag::mpdu, NUM_TRX, number_rx_frames, OFDM, OQPSK, OQPSK_DATA_RATE_250, app_payload_t::payload, PEER_INFO_REQ, PER_TEST_PKT, PER_TEST_START_PKT, phy_tag::phy_mode, phyFSKFECEnabled, phyHighRateEnabled, phyOFDMMCS, phyOQPSKRateMode, phySetting, PL_POS_DST_ADDR_START, PL_POS_SEQ_NUM, range_test_in_progress, RANGE_TEST_MARKER_RSP, RANGE_TEST_PKT, RANGE_TEST_START_PKT, RANGE_TEST_STOP_PKT, general_pkt_t::range_tx_data, RESULT_REQ, send_crc_status_rsp(), send_peer_info_rsp(), send_range_test_rsp(), send_result_rsp(), app_payload_t::seq_num, set_default_configuration_peer_node(), SET_DEFAULT_REQ, SET_PARAM, set_paramter_on_recptor_node(), SET_SUN_PAGE, SHORT_ADDR_LEN, crc_set_req_t::status, SW_TIMEOUT_RELATIVE, sw_timer_start(), T_APP_TIMER, tal_pib, tal_pib_get(), tal_pib_set(), and tal_rxaack_prom_mode_ctrl().

void per_mode_receptor_task ( trx_id_t  trx)

The application task when the node is in PER_TEST_RECEPTOR state i.e.PER Measurement mode as Receptor.

References app_debounce_button(), APP_TIMER_TO_TX, FUNC_PTR, LED_BLINK_RATE_IN_MICRO_SEC, marker_tx_timer_handler_cb(), range_test_in_progress, RF09, RF24, send_range_test_marker_cmd(), SW_TIMEOUT_RELATIVE, and sw_timer_start().

void per_mode_receptor_tx_done_cb ( trx_id_t  trx,
retval_t  status,
frame_info_t frame 
)

Callback that is called once tx is done in PER_TEST_RECEPTOR state This call back is used when the node is operating as PER Measurement mode Receptor.

Parameters
statusStatus of the transmission procedure
framePointer to the transmitted frame structure

References node_info, and node_ib_t::transmitting.

static void send_crc_status_rsp ( trx_id_t  trx)
static
static void send_peer_info_rsp ( trx_id_t  trx)
static
static bool send_range_test_marker_cmd ( trx_id_t  trx)
static
static void send_range_test_rsp ( trx_id_t  trx,
uint8_t  seq_num,
uint32_t  frame_count,
int8_t  ed,
uint8_t  lqi 
)
static

Function used to send response to the received range test packet.

Parameters
seq_numsequence number of the range test packet received
frame_countCount of the received Range Test Packet
edED value of the received range test packet which has to be uploaded into the response payload
lqiLQI value of the received range test packet which has to be uploaded into the response payload

References app_led_event(), app_transmit_frame(), app_payload_t::cmd_id, data, range_tx_t::ed, FCF_SHORT_ADDR, range_tx_t::frame_count, LED_EVENT_TX_FRAME, range_tx_t::lqi, node_info, app_payload_t::payload, RANGE_TEST_RSP, seq_num, app_payload_t::seq_num, and seq_num_receptor.

Referenced by per_mode_receptor_rx_cb().

static void set_default_configuration_peer_node ( trx_id_t  trx)
static
static void set_paramter_on_recptor_node ( trx_id_t  trx,
app_payload_t msg 
)
static

Extract the received command frame and set the parameters like channel, tx power etc on Receptor node.

Parameters
pointerto cmd payload

References CHANNEL, CHANNEL_PAGE, MAC_SUCCESS, set_parm_req_t::param_type, set_parm_req_t::param_value, app_payload_t::payload, phyCurrentChannel, phyCurrentPage, phyTransmitPower, general_pkt_t::set_parm_req_data, tal_convert_reg_value_to_dBm(), tal_pib_set(), and TX_POWER_DBM.

Referenced by per_mode_receptor_rx_cb().

uint32_t aver_lqi[NUM_TRX]
static
uint32_t aver_rssi[NUM_TRX]
static
uint8_t ed_scan_result_t::channel_no
int char_received
uint32_t frames_with_wrong_crc[NUM_TRX]
float trx_config_params_t::ism_frequency
uint8_t marker_seq_num[NUM_TRX] = {0, 0}
static
uint32_t number_rx_frames[NUM_TRX]
static
int8_t ed_scan_result_t::p_in
bool range_test_in_progress[NUM_TRX] = {false, false}
static
bool trx_config_params_t::rpc_enable
sun_phy_t trx_config_params_t::sun_phy_page