#include <asf.h>
#include "conf_board.h"
#include "led.h"
#include "common_sw_timer.h"
#include "app_config.h"
#include "rf4ce.h"
#include "vendor_data.h"
#include "pb_pairing.h"
#include "zid.h"
#include "zid_device.h"
#include "Avr477QTouch.h"
Macros | |
#define | APP_USER_STRING_SIZE (15) |
#define | BUTTON_0 0 |
#define | BUTTON_1 1 |
#define | BUTTON_2 2 |
#define | BUTTON_DELETE (76) |
#define | BUTTON_DOWN (81) |
#define | BUTTON_ESC (41) |
#define | BUTTON_FUNCTION_F5 (62) |
#define | BUTTON_LEFT (80) |
#define | BUTTON_MEDIA_MODE (0x02) |
#define | BUTTON_MODE (0x00FE) |
#define | BUTTON_MPLAYER (0x0008) |
#define | BUTTON_MUTE (0x0001) |
#define | BUTTON_NEXT (0x0040) |
#define | BUTTON_PAGE_DOWN (78) |
#define | BUTTON_PAGE_UP (75) |
#define | BUTTON_PAUSE (0x0100) |
#define | BUTTON_PLAY (0x0080) |
#define | BUTTON_PPT_MODE (0x01) |
#define | BUTTON_PREVIOUS (0x0020) |
#define | BUTTON_REPEAT (0x0200) |
#define | BUTTON_RIGHT (79) |
#define | BUTTON_STOP (0x0010) |
#define | BUTTON_TAB (43) |
#define | BUTTON_UP (82) |
#define | BUTTON_VOLUME_N (0x0004) |
#define | BUTTON_VOLUME_P (0x0002) |
#define | INTER_FRAME_DURATION_US 200000 /* 200 ms */ |
#define | LAST_BUTTON_INDEX (0xFF) |
#define | TX_OPTIONS |
#define | VENDOR_STRING_LEN_SIZE (7) |
#define | ZID_ATTRIBUTE_REQ_SIZE (10) |
Typedefs | |
typedef enum node_status_tag | node_status_t |
Functions | |
static void | app_alert (void) |
application failure indication More... | |
static void | app_nlme_rx_enable_confirm (nwk_enum_t Status) |
The NLME-RX-ENABLE.confirm primitive reports the results of the attempt to enable or disable the receiver. More... | |
static void | app_task (void) |
Application task and state machine. More... | |
bool | check_zid_adaptor_compatibility (uint8_t PairingRef, uint8_t payload_length, uint8_t *payload) |
nlde_data_confirm The NLDE-DATA.confirm primitive is generated by the NWK layer entity in response to an NLDE-DATA.request primitive. More... | |
FLASH_DECLARE (uint16_t VendorIdentifier) | |
FLASH_DECLARE (uint8_t app_user_string[APP_USER_STRING_SIZE]) | |
static void | indicate_fault_behavior (void) |
Indicating malfunction. More... | |
int | main (void) |
Main function, initialization and main message loop. More... | |
void | nlde_data_confirm (nwk_enum_t Status, uint8_t PairingRef, profile_id_t ProfileId) |
nlde_data_confirm The NLDE-DATA.confirm primitive is generated by the NWK layer entity in response to an NLDE-DATA.request primitive. More... | |
static void | nlme_reset_confirm (nwk_enum_t Status) |
nlme_reset_confirm The NLME-RESET.confirm primitive allows the NLME to notify the application of the status of its request to reset the NWK layer. More... | |
static void | nlme_start_confirm (nwk_enum_t Status) |
nlme_start_confirm The NLME-START.confirm primitive allows the NLME to notify the application of the status of its request to start a network. More... | |
void | vendor_app_alive_req (void) |
Vendor-specific callback; handles reaction to incoming alive request. More... | |
static void | zid_connect_confirm (nwk_enum_t Status, uint8_t PairingRef) |
Push button pairing confirm; target and controller use. More... | |
static void | zid_data_confirm (nwk_enum_t Status, uint8_t PairingRef) |
zid_data_confirm is call back of zid_data_request which gives the status of the data request More... | |
static void | zid_get_report_indication (uint8_t PairingRef, zid_report_types_t zid_report_type, zid_report_desc_t zid_report_desc, uint8_t RxLinkQuality, uint8_t RxFlags) |
zid_data_confirm is call back to the application layer. More... | |
void | zid_heartbeat_confirm (nwk_enum_t Status, uint8_t PairingRef) |
heart beat confirm; target and controller use More... | |
static void | zid_report_data_confirm (nwk_enum_t Status, uint8_t PairingRef) |
zid_report_data_confirm is call back of zid_report_data_request which gives the status of the report data request More... | |
static void | zid_report_data_indication (uint8_t PairingRef, uint8_t num_report_records, zid_report_data_record_t *zid_report_data_record_ptr, uint8_t RxLinkQuality, uint8_t RxFlags) |
ZID Report Data indication used to know if the adaptor sends any output report to the ZID Device. More... | |
static void | zid_set_attribute_confirm (nwk_enum_t status, uint8_t PairingRef, zid_attribute_t ZIDAttribute, uint8_t ZIDAttributeIndex) |
zid_set_attribute_confirm ZID Set attribute confirm callback allows to check whether attributes are sent to the ZID Adaptor. More... | |
Variables | |
uint8_t | b_event = 0xFF |
uint8_t | b_state = 0xFF |
uint8_t | button_mode = BUTTON_MEDIA_MODE |
uint16_t | key_mapping_media [] |
static node_status_t | node_status |
static uint8_t | pairing_ref = 0xFF |
static uint8_t | report_id = 0 |
static uint8_t | set_attribute_index = 0 |
static zid_indication_callback_t | zid_ind |
#define APP_USER_STRING_SIZE (15) |
#define BUTTON_0 0 |
#define BUTTON_1 1 |
Referenced by app_task().
#define BUTTON_2 2 |
Referenced by app_task().
#define BUTTON_DELETE (76) |
#define BUTTON_DOWN (81) |
#define BUTTON_ESC (41) |
#define BUTTON_FUNCTION_F5 (62) |
#define BUTTON_LEFT (80) |
#define BUTTON_MEDIA_MODE (0x02) |
#define BUTTON_MODE (0x00FE) |
#define BUTTON_MPLAYER (0x0008) |
#define BUTTON_MUTE (0x0001) |
#define BUTTON_NEXT (0x0040) |
#define BUTTON_PAGE_DOWN (78) |
#define BUTTON_PAGE_UP (75) |
#define BUTTON_PAUSE (0x0100) |
#define BUTTON_PLAY (0x0080) |
#define BUTTON_PPT_MODE (0x01) |
#define BUTTON_PREVIOUS (0x0020) |
#define BUTTON_REPEAT (0x0200) |
#define BUTTON_RIGHT (79) |
#define BUTTON_STOP (0x0010) |
#define BUTTON_TAB (43) |
#define BUTTON_UP (82) |
#define BUTTON_VOLUME_N (0x0004) |
#define BUTTON_VOLUME_P (0x0002) |
#define INTER_FRAME_DURATION_US 200000 /* 200 ms */ |
Referenced by app_task().
#define LAST_BUTTON_INDEX (0xFF) |
Referenced by app_task().
#define TX_OPTIONS |
Referenced by app_task(), Send_Message(), and zid_get_report_indication().
#define VENDOR_STRING_LEN_SIZE (7) |
#define ZID_ATTRIBUTE_REQ_SIZE (10) |
Referenced by app_task(), nlme_start_confirm(), and zid_set_attribute_confirm().
typedef enum node_status_tag node_status_t |
enum node_status_tag |
|
static |
application failure indication
|
static |
The NLME-RX-ENABLE.confirm primitive reports the results of the attempt to enable or disable the receiver.
Status | Status of the nlme_rx_enable_req |
References COLD_START, delay_ms, FUNC_PTR, IDLE, indicate_fault_behavior(), LED_Off, LED_On, nlme_reset_confirm(), nlme_reset_request(), node_status, NWK_SUCCESS, WARM_START, and ZID_APP_LED.
Referenced by nlme_reset_confirm().
|
static |
Application task and state machine.
References aplHIDStdDescCompsList, b_event, b_state, CONFIGURING_ATTRIBUTES, CONTACT_DATA, FUNC_PTR, IDLE, INPUT, INTER_FRAME_DURATION_US, keyboard_input_desc_tag::key_code, key_mapping_media, KEYBOARD, LAST_BUTTON_INDEX, keyboard_input_desc_tag::modifier_keys, MOUSE, node_status, nwk_stack_idle(), pairing_ref, PINCH_GESTURE, zid_report_data_record_tag::report_data, zid_report_data_record_tag::report_desc_identifier, zid_report_data_record_tag::report_type, ROTATE_GESTURE, SCROLL_GESTURE, set_attribute_index, sw_timer_get_time(), SYNC, TAP_GESTURE, TAP_SUPPORT_PROPERTIES, Touch_measurement(), TOUCH_SENSOR_PROPERTIES, TRANSMITTING, TX_OPTIONS, ZID_ATTRIBUTE_REQ_SIZE, zid_report_data_confirm(), zid_report_data_request(), zid_set_attribute_confirm(), and zid_set_attribute_request().
Referenced by main().
bool check_zid_adaptor_compatibility | ( | uint8_t | PairingRef, |
uint8_t | payload_length, | ||
uint8_t * | payload | ||
) |
nlde_data_confirm The NLDE-DATA.confirm primitive is generated by the NWK layer entity in response to an NLDE-DATA.request primitive.
PairingRef | PairingRef for the current transaction |
payload_length | payload length |
payload | payload to check the adaptor compatibility |
FLASH_DECLARE | ( | uint16_t | VendorIdentifier | ) |
FLASH_DECLARE | ( | uint8_t | app_user_string[APP_USER_STRING_SIZE] | ) |
|
static |
Indicating malfunction.
References delay_ms, LED_Off, LED_On, and ZID_APP_LED.
Referenced by app_nlme_rx_enable_confirm(), nlde_data_confirm(), nlme_reset_confirm(), nlme_start_confirm(), zid_connect_confirm(), zid_data_confirm(), zid_report_data_confirm(), and zid_set_attribute_confirm().
int main | ( | void | ) |
Main function, initialization and main message loop.
Main function.
The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.
References app_alert(), app_task(), appButtonsInd(), b_event, b_state, board_init(), BSP_InitQTouch(), COLD_START, cpu_irq_enable, FUNC_PTR, LED0, LED_On, LED_Toggle, nlme_reset_confirm(), nlme_reset_request(), node_status, nwk_init(), NWK_SUCCESS, nwk_task(), register_zid_indication_callback(), sw_timer_init(), Touch_measurement(), WARM_START, ZID_APP_LED, zid_get_report_indication(), zid_indication_callback_tag::zid_get_report_indication_cb, zid_report_data_indication(), and zid_indication_callback_tag::zid_report_data_indication_cb.
|
static |
nlme_reset_confirm The NLME-RESET.confirm primitive allows the NLME to notify the application of the status of its request to reset the NWK layer.
Status | status from the network layer corresponds to the nlme_reset_req |
References app_nlme_rx_enable_confirm(), COLD_START, FUNC_PTR, indicate_fault_behavior(), nlme_reset_request(), nlme_rx_enable_request(), nlme_start_confirm(), nlme_start_request(), node_status, NWK_SUCCESS, pairing_ref, and WARM_START.
Referenced by app_nlme_rx_enable_confirm(), handle_incoming_msg(), handle_input(), main(), nlme_start_confirm(), zid_connect_confirm(), and zid_set_attribute_confirm().
|
static |
nlme_start_confirm The NLME-START.confirm primitive allows the NLME to notify the application of the status of its request to start a network.
Status | status from the network layer corresponds to the nlme_start_req |
References aplHIDNumStdDescComps, app_alert(), COLD_START, CONFIGURING_ATTRIBUTES, FUNC_PTR, indicate_fault_behavior(), nlme_reset_confirm(), nlme_reset_request(), node_status, NWK_SUCCESS, WARM_START, ZID_ATTRIBUTE_REQ_SIZE, zid_set_attribute_confirm(), and zid_set_attribute_request().
Referenced by handle_incoming_msg(), handle_input(), and nlme_reset_confirm().
void vendor_app_alive_req | ( | void | ) |
Vendor-specific callback; handles reaction to incoming alive request.
Vendor data alive request.
|
static |
Push button pairing confirm; target and controller use.
The push button pairing confirm is a callback that provides the status of the push pairing request.
Status | Status of the last pairing transaction |
PairingRef | If pairing was successful, PairingRef contains assigned pairing reference. |
References app_alert(), COLD_START, CONNECTING, delay_ms, FUNC_PTR, IDLE, indicate_fault_behavior(), LED_Off, LED_On, nlme_reset_confirm(), nlme_reset_request(), node_status, NWK_SUCCESS, pairing_ref, WARM_START, ZID_APP_LED, zid_state, and ZID_STATE_IDLE.
Referenced by zid_set_attribute_confirm().
|
static |
zid_data_confirm is call back of zid_data_request which gives the status of the data request
Status | Status of the zid_data_request |
PairingRef | pairing reference for current transaction |
References IDLE, indicate_fault_behavior(), LED_Off, node_status, NWK_SUCCESS, and ZID_APP_LED.
Referenced by zid_get_report_indication().
|
static |
zid_data_confirm is call back to the application layer.
HID adaptor shall create a get report command frame and transmit it to the appropriate HID class device. On receipt of the corresponding report data command frame, the HID adaptor shall pass
the report to the HID class driver.
zid_report_type | Report type |
PairingRef | pairing reference for current transaction |
zid_report_desc | zid report descriptor type |
RxLinkQuality | Received frame link quality |
RxFlags | Received frame RxFlags |
References mouse_desc_tag::button0, mouse_desc_tag::button1, mouse_desc_tag::button2, FUNC_PTR, IDLE, INPUT, MOUSE, node_status, pairing_ref, zid_report_data_record_tag::report_data, zid_report_data_record_tag::report_desc_identifier, zid_report_data_record_tag::report_type, TRANSMITTING, TX_OPTIONS, mouse_desc_tag::x_coordinate, mouse_desc_tag::y_coordinate, zid_data_confirm(), and zid_report_data_request().
Referenced by main().
static void zid_heartbeat_confirm | ( | nwk_enum_t | Status, |
uint8_t | PairingRef | ||
) |
heart beat confirm; target and controller use
The heart beat confirm is a callback that provides the status of the ZID Adaptor. HID class device can periodically check in with the HID adaptor to give it the opportunity to send a message back
Status | Status of the heartbeat command |
PairingRef | PairingRef contains assigned pairing reference. |
Referenced by handle_incoming_msg().
|
static |
zid_report_data_confirm is call back of zid_report_data_request which gives the status of the report data request
Status | Status of the zid_report_data_request |
PairingRef | pairing reference for current transaction |
References IDLE, indicate_fault_behavior(), LED_Off, node_status, NWK_SUCCESS, report_id, and ZID_APP_LED.
Referenced by app_task().
|
static |
ZID Report Data indication used to know if the adaptor sends any output report to the ZID Device.
PairingRef | PairingRef contains assigned pairing reference. |
num_report_records | total no of reports in the report data |
zid_report_data_record_ptr | pointer to the report data |
RxLinkQuality | Link Quality of the received report |
RxFlags | Flags for the Received frame |
Referenced by main().
|
static |
zid_set_attribute_confirm ZID Set attribute confirm callback allows to check whether attributes are sent to the ZID Adaptor.
Status | status from the network layer corresponds to the zid_set_attribute_request |
PairingRef | current pairing ref |
ZIDAttribute | attribute name |
ZIDAttributeIndex | attribute index |
References aplHIDStdDescCompsList, app_alert(), APP_CAPABILITIES, COLD_START, CONNECTING, DEV_TYPE_REMOTE_CONTROL, DEV_TYPE_WILDCARD, FUNC_PTR, indicate_fault_behavior(), LED_Off, nlme_reset_confirm(), nlme_reset_request(), node_status, NUM_SUPPORTED_PROFILES, NWK_SUCCESS, PROFILE_ID_ZID, set_attribute_index, WARM_START, ZID_APP_LED, ZID_ATTRIBUTE_REQ_SIZE, zid_connect_confirm(), and zid_org_connect_request().
Referenced by app_task(), and nlme_start_confirm().
uint8_t b_event = 0xFF |
Referenced by app_task(), and main().
uint8_t b_state = 0xFF |
Referenced by app_task(), and main().
uint8_t button_mode = BUTTON_MEDIA_MODE |
Referenced by app_task().
uint16_t key_mapping_media[] |
Referenced by app_task().
|
static |
|
static |
Referenced by app_task(), nlme_reset_confirm(), zid_connect_confirm(), and zid_get_report_indication().
|
static |
Referenced by zid_report_data_confirm().
|
static |
Referenced by app_task(), and zid_set_attribute_confirm().
|
static |