Terminal Target application.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include "pal.h"
#include "app_config.h"
#include "rf4ce.h"
#include "pb_pairing.h"
#include "zrc.h"
#include "vendor_data.h"
#include "qdebug_transport.h"
#include "twi_master.h"
#include "compiler.h"
Macros | |
#define | IEEE_ADDRESS_BYTES 8 |
#define | LED_DATA (LED_0) |
#define | LED_NWK_SETUP (LED_0) |
#define | LED_START (LED_0) |
#define | MAX_PAIRED_DEVICES NWKC_MAX_PAIRING_TABLE_ENTRIES |
#define | PAIR_WAIT_PERIOD 500000 |
#define | RESET_QT600_PORT (PORTD) |
List of defines for QT600 control with STB-RCB. More... | |
#define | RESET_QT600_DIR (DDRD) |
#define | RESET_QT600_PIN (PD5) |
#define | RESET_QT600_PIN_INIT() |
#define | RESET_QT600_ON() RESET_QT600_PORT &= ~(1 << RESET_QT600_PIN) /* low active */ |
#define | RESET_QT600_OFF() RESET_QT600_PORT |= 1 << RESET_QT600_PIN |
#define | QT_SIGN_ON 0x21 |
List of the command IDs used in QDebug. More... | |
#define | QT_GLOBAL_CONFIG 0x22 |
#define | QT_SENSOR_CONFIG 0x23 |
#define | QT_SIGNALS 0x24 |
#define | QT_REFERENCES 0x25 |
#define | QT_DELTAS 0x26 |
#define | QT_STATES 0x27 |
Typedefs | |
typedef enum node_status_tag | node_status_t |
Functions | |
static void | app_task (void) |
Application task. More... | |
FLASH_DECLARE (uint16_t VendorIdentifier) | |
FLASH_DECLARE (uint8_t vendor_string[7]) | |
FLASH_DECLARE (uint8_t app_user_string[15]) | |
FLASH_DECLARE (uint8_t supported_cec_cmds[32]) | |
int | main (void) |
Main function of the Terminal Target application. More... | |
void | nlde_data_confirm (nwk_enum_t Status, uint8_t PairingRef, profile_id_t ProfileId) |
Notify the application of the status of its request for data tx (nlde-data.request) More... | |
void | nlme_get_confirm (nwk_enum_t Status, nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex, void *NIBAttributeValue) |
Notify the application of the status of its request for the value of a NIB attribute. More... | |
void | nlme_reset_confirm (nwk_enum_t Status) |
Notify the application of the status of its request to reset the NWK layer. More... | |
void | nlme_rx_enable_confirm (nwk_enum_t Status) |
Notify the application of the status of its request to enable or disable the receiver. More... | |
void | nlme_set_confirm (nwk_enum_t Status, nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex) |
Notify the application of the status of its request to to change the value of a NIB attribute. More... | |
void | nlme_start_confirm (nwk_enum_t Status) |
Notify the application of the status of its request to start a network. More... | |
void | nlme_unpair_confirm (uint8_t Status, uint8_t PairingRef) |
Notify the application for the previous unpair request. More... | |
void | nlme_unpair_indication (uint8_t PairingRef) |
Notify the application of the removal of link by another device. More... | |
void | nlme_update_key_confirm (nwk_enum_t Status, uint8_t PairingRef) |
Notify the application about the key update. More... | |
void | nwk_ch_agility_confirm (nwk_enum_t Status, bool ChannelChanged, uint8_t LogicalChannel) |
Confirms the previous channel agility request, i.e. More... | |
void | nwk_ch_agility_indication (uint8_t LogicalChannel) |
Prints the new channel after channel agility took place. More... | |
bool | pbp_allow_pairing (nwk_enum_t Status, uint64_t SrcIEEEAddr, uint16_t OrgVendorId, uint8_t OrgVendorString[7], uint8_t OrgUserString[15], uint8_t KeyExTransferCount) |
This function decides whether push button pairing request should be allowed. More... | |
void | pbp_pair_confirm (nwk_enum_t Status, uint8_t PairingRef) |
Prints the status of push button pairing and if status is success, then send the cmd discovery to controller. More... | |
void | vendor_data_confirm (nwk_enum_t Status, uint8_t PairingRef) |
Post processing of the vendor data confirm. More... | |
void | vendor_data_ind (uint8_t PairingRef, profile_id_t ProfileId, uint16_t VendorId, uint8_t nsduLength, uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags) |
Post processing of the vendor data response. More... | |
void | zrc_cmd_disc_confirm (nwk_enum_t Status, uint8_t PairingRef, uint8_t *SupportedCmd) |
The command discovery confirm for the previous command discovery request. More... | |
void | zrc_cmd_disc_indication (uint8_t PairingRef) |
The command discovery indication callback indicates that a command discovery request command was receiced. More... | |
void | zrc_cmd_indication (uint8_t PairingRef, uint8_t nsduLength, uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags) |
Handles the rc command indications at terminal target. More... | |
static void | led_handling (void *callback_parameter) |
Application Task related APIs. More... | |
Variables | |
static bool | ch_ag_enabled = true |
static node_status_t | node_status |
uint8_t | rf4ce_new_msg = 0 |
uint8_t | tal_pib_CurrentChannel |
uint64_t | tal_pib_IeeeAddress |
uint16_t | tal_pib_PANId |
static uint8_t | target_auto_start = true |
#define IEEE_ADDRESS_BYTES 8 |
Referenced by main().
#define LED_DATA (LED_0) |
Referenced by led_handling(), main(), and zrc_cmd_indication().
#define LED_NWK_SETUP (LED_0) |
Referenced by led_handling(), main(), nlme_set_confirm(), and pbp_pair_confirm().
#define LED_START (LED_0) |
Referenced by main().
#define MAX_PAIRED_DEVICES NWKC_MAX_PAIRING_TABLE_ENTRIES |
#define PAIR_WAIT_PERIOD 500000 |
Referenced by led_handling(), and nlme_set_confirm().
#define QT_DELTAS 0x26 |
Referenced by Transmit_Delta().
#define QT_GLOBAL_CONFIG 0x22 |
Referenced by Transmit_Global_Config().
#define QT_REFERENCES 0x25 |
Referenced by Transmit_Ref().
#define QT_SENSOR_CONFIG 0x23 |
Referenced by Transmit_Sensor_Config().
#define QT_SIGN_ON 0x21 |
List of the command IDs used in QDebug.
Referenced by Transmit_Sign_On().
#define QT_SIGNALS 0x24 |
Referenced by Transmit_Signals().
#define QT_STATES 0x27 |
Referenced by Transmit_State().
#define RESET_QT600_DIR (DDRD) |
#define RESET_QT600_OFF | ( | ) | RESET_QT600_PORT |= 1 << RESET_QT600_PIN |
Referenced by zrc_cmd_disc_indication().
#define RESET_QT600_ON | ( | ) | RESET_QT600_PORT &= ~(1 << RESET_QT600_PIN) /* low active */ |
Referenced by main().
#define RESET_QT600_PIN (PD5) |
#define RESET_QT600_PIN_INIT | ( | ) |
Referenced by main().
#define RESET_QT600_PORT (PORTD) |
List of defines for QT600 control with STB-RCB.
typedef enum node_status_tag node_status_t |
enum node_status_tag |
FLASH_DECLARE | ( | uint16_t | VendorIdentifier | ) |
FLASH_DECLARE | ( | uint8_t | vendor_string[7] | ) |
FLASH_DECLARE | ( | uint8_t | app_user_string[15] | ) |
FLASH_DECLARE | ( | uint8_t | supported_cec_cmds[32] | ) |
int main | ( | void | ) |
Main function of the Terminal Target application.
Main function.
TWI and QT600 interface initialization
References app_task(), EE_IEEE_ADDR, IEEE_ADDRESS_BYTES, LED_DATA, LED_NWK_SETUP, LED_OFF, LED_ON, LED_START, nwk_init(), NWK_SUCCESS, nwk_task(), pal_alert(), pal_global_irq_enable(), pal_led(), pal_led_init(), pal_ps_set(), RESET_QT600_ON, RESET_QT600_PIN_INIT, rf4ce_new_msg, tal_pib_IeeeAddress, twi_master_init(), twi_send_message(), and TX_index.
void pbp_pair_confirm | ( | nwk_enum_t | Status, |
uint8_t | PairingRef | ||
) |
Prints the status of push button pairing and if status is success, then send the cmd discovery to controller.
Originator push pairing request; controller use.
Status | nwk status |
PairingRef | Pairing Ref of the new entry. |
References CMD_DISCOVERING, IDLE, LED_NWK_SETUP, LED_OFF, node_status, NWK_SUCCESS, pal_led(), target_auto_start, and zrc_cmd_disc_request().
void vendor_data_confirm | ( | nwk_enum_t | Status, |
uint8_t | PairingRef | ||
) |
Post processing of the vendor data confirm.
Vendor data confirm.
status | nwk status (constants defined by nwk layer) |
PairingRef | Pairing reference |
References UNUSED.
void vendor_data_ind | ( | uint8_t | PairingRef, |
profile_id_t | ProfileId, | ||
uint16_t | VendorId, | ||
uint8_t | nsduLength, | ||
uint8_t * | nsdu, | ||
uint8_t | RxLinkQuality, | ||
uint8_t | RxFlags | ||
) |
Post processing of the vendor data response.
Vendor data indication.
PairingRef | Pairing reference |
ProfileId | Profile id. |
VendorId | Vendor ID. |
nsduLength | Length of the payload. |
nsdu | Actual payload |
RxLinkQuality | Link quality of received packet. |
RxFlags | Rx Flags. |
References UNUSED.
Referenced by main(), stack_indication_callback_init(), and zid_indication_callback_init().
|
static |
Referenced by app_task().
|
static |
uint8_t rf4ce_new_msg = 0 |
Referenced by main(), and zrc_cmd_indication().
uint8_t tal_pib_CurrentChannel |
uint64_t tal_pib_IeeeAddress |
uint16_t tal_pib_PANId |
|
static |
Referenced by app_task(), and pbp_pair_confirm().