#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"
Typedefs | |
typedef enum node_status_tag | node_status_t |
Functions | |
static void | acc_read_cb (void *parameter) |
static void | app_alert (void) |
application failure indication More... | |
static void | app_calculate_offset () |
Offset calculation function. 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... | |
static void | correct_negative_offset (uint16_t *temp_val, uint16_t temp_offset) |
Negative offset correction function. More... | |
static void | correct_positive_offset (uint16_t *temp_val, uint16_t temp_offset) |
Positive offset correction function. More... | |
FLASH_DECLARE (uint16_t VendorIdentifier) | |
FLASH_DECLARE (uint8_t app_user_string[APP_USER_STRING_SIZE]) | |
uint8_t | get_zid_keyrc_button (button_id_t button_id) |
get_zid_keyrc_button This function will get the index for each key More... | |
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... | |
static 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 | |
uint16_t | ADC_val |
static uint8_t | APP_TIMER_ACC_READ |
uint8_t | b_state = 0xFF |
uint16_t | button_mode = BUTTON_MEDIA_MODE |
button_id_t | button_val |
void(* | Correct_x_offset )(uint16_t *temp_val, uint16_t temp_offset) |
void(* | Correct_y_offset )(uint16_t *temp_val, uint16_t temp_offset) |
void(* | Correct_z_offset )(uint16_t *temp_val, uint16_t temp_offset) |
static uint8_t | key_mapping_gamepad [TOTAL_NO_OF_ZID_KEY_RC] |
static uint16_t | key_mapping_media [TOTAL_NO_OF_ZID_KEY_RC] |
static uint8_t | key_mapping_mouse [TOTAL_NO_OF_ZID_KEY_RC] |
static uint8_t | key_mapping_ppt [TOTAL_NO_OF_ZID_KEY_RC] |
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 |
uint8_t | status |
uint16_t | x_offset |
uint16_t | x_val |
uint16_t | y_offset |
uint16_t | y_val |
uint16_t | z_offset |
uint16_t | z_val |
static zid_indication_callback_t | zid_ind |
uint32_t | zid_interframe_duration = INTER_FRAME_DURATION_US |
#define ACCELEROMETER_SAMPLE_TIME 10000 |
Referenced by acc_read_cb(), and app_task().
#define APP_USER_STRING_SIZE (15) |
#define APPX_5_DEGREE_VALUE 10 |
Referenced by app_task().
#define BUTTON_1 0x10 |
#define BUTTON_2 0x20 |
#define BUTTON_3 0x40 |
Referenced by app_task().
#define BUTTON_4 0x80 |
Referenced by app_task().
#define BUTTON_DELETE (76) |
#define BUTTON_DOWN_E (81) |
Referenced by app_task().
#define BUTTON_ESC (41) |
#define BUTTON_FUNCTION_F5 (62) |
#define BUTTON_GAME_MODE (0xFD) |
Referenced by app_task().
#define BUTTON_INVALID (0xFF) |
Referenced by app_task(), and get_zid_keyrc_button().
#define BUTTON_LEFT_E (80) |
Referenced by app_task().
#define BUTTON_LEFT_SINGLE_CLK (90) |
Referenced by app_task().
#define BUTTON_MEDIA_MODE (0xFE) |
Referenced by app_task().
#define BUTTON_MIDDLE_CLK (94) |
Referenced by app_task().
#define BUTTON_MOUSE_MODE (0xFB) |
Referenced by app_task().
#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 (0xFC) |
Referenced by app_task().
#define BUTTON_PREVIOUS (0x0020) |
#define BUTTON_REPEAT (0x0200) |
#define BUTTON_RIGHT_E (79) |
Referenced by app_task().
#define BUTTON_RIGHT_SINGLE_CLK (91) |
Referenced by app_task().
#define BUTTON_SCROLL_DOWN (93) |
Referenced by app_task().
#define BUTTON_SCROLL_UP (92) |
Referenced by app_task().
#define BUTTON_STOP (0x0010) |
#define BUTTON_TAB (43) |
#define BUTTON_THROTTLE_DOWN 0x14 |
Referenced by app_task().
#define BUTTON_THROTTLE_UP 0x11 |
Referenced by app_task().
#define BUTTON_UP_E (82) |
Referenced by app_task().
#define BUTTON_VOLUME_N (0x0004) |
#define BUTTON_VOLUME_P (0x0002) |
#define INTER_FRAME_DURATION_MOUSE_US (5000) /* 5ms */ |
Referenced by app_task().
#define INTER_FRAME_DURATION_US (200000) /* 200ms */ |
Referenced by app_task().
#define MOUSE_NEGATIVE_DISPLACEMENT (-2) |
Referenced by app_task().
#define MOUSE_POSITIVE_DISPLACEMENT (2) |
Referenced by app_task().
#define TOTAL_NO_OF_ZID_KEY_RC (27) |
Referenced by get_zid_keyrc_button().
#define TX_OPTIONS |
Referenced by app_task(), and zid_get_report_indication().
#define VENDOR_STRING_LEN_SIZE (7) |
#define ZID_APP_LED (LED0) |
#define ZID_ATTRIBUTE_REQ_SIZE (10) |
Referenced by app_task(), and zid_set_attribute_confirm().
#define ZID_COLD_START (0) |
Referenced by main().
typedef enum node_status_tag node_status_t |
enum node_status_tag |
|
static |
References ACCELEROMETER_SAMPLE_TIME, ADC_val, APP_TIMER_ACC_READ, Correct_x_offset, Correct_y_offset, FUNC_PTR, NULL, SW_TIMEOUT_RELATIVE, sw_timer_start(), x_offset, x_val, y_offset, y_val, and z_val.
Referenced by app_task().
|
static |
application failure indication
|
static |
Offset calculation function.
References ADC_val, correct_negative_offset(), correct_positive_offset(), Correct_x_offset, Correct_y_offset, Correct_z_offset, temp, x_offset, x_val, y_offset, y_val, z_offset, and z_val.
Referenced by app_task().
|
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.
|
static |
Application task and state machine.
References acc_read_cb(), ACCELEROMETER_SAMPLE_TIME, ADC_val, aplHIDStdDescCompsList, app_calculate_offset(), APP_TIMER_ACC_READ, APPX_5_DEGREE_VALUE, b_state, mouse_desc_tag::button0, mouse_desc_tag::button1, mouse_desc_tag::button2, BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4, BUTTON_DOWN_E, BUTTON_GAME_MODE, BUTTON_INVALID, BUTTON_LEFT_E, BUTTON_LEFT_SINGLE_CLK, BUTTON_MEDIA_MODE, BUTTON_MIDDLE_CLK, button_mode, BUTTON_MOUSE_MODE, BUTTON_PPT_MODE, BUTTON_RIGHT_E, BUTTON_RIGHT_SINGLE_CLK, BUTTON_SCROLL_DOWN, BUTTON_SCROLL_UP, BUTTON_THROTTLE_DOWN, BUTTON_THROTTLE_UP, BUTTON_UP_E, CONFIGURING_ATTRIBUTES, CONTACT_DATA, Correct_x_offset, Correct_y_offset, FUNC_PTR, get_zid_keyrc_button(), IDLE, INPUT, INTER_FRAME_DURATION_MOUSE_US, INTER_FRAME_DURATION_US, keyboard_input_desc_tag::key_code, key_mapping_gamepad, key_mapping_media, key_mapping_mouse, key_mapping_ppt, KEYBOARD, LED_Off, LED_On, keyboard_input_desc_tag::modifier_keys, MOUSE, MOUSE_NEGATIVE_DISPLACEMENT, MOUSE_POSITIVE_DISPLACEMENT, node_status, NULL, 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_TIMEOUT_RELATIVE, sw_timer_get_time(), sw_timer_start(), SYNC, TAP_GESTURE, TAP_SUPPORT_PROPERTIES, TOUCH_SENSOR_PROPERTIES, TRANSMITTING, TX_OPTIONS, mouse_desc_tag::x_coordinate, x_offset, x_val, mouse_desc_tag::y_coordinate, y_offset, y_val, z_val, ZID_ATTRIBUTE_REQ_SIZE, zid_interframe_duration, 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 |
|
static |
Negative offset correction function.
temp_val | value to be corrected |
temp_offset | Offset value |
Referenced by app_calculate_offset().
|
static |
Positive offset correction function.
temp_val | value to be corrected |
temp_offset | Offset value |
Referenced by app_calculate_offset().
FLASH_DECLARE | ( | uint16_t | VendorIdentifier | ) |
FLASH_DECLARE | ( | uint8_t | app_user_string[APP_USER_STRING_SIZE] | ) |
uint8_t get_zid_keyrc_button | ( | button_id_t | button_id | ) |
get_zid_keyrc_button This function will get the index for each key
button_id | pressed button id will be given as input |
References BUTTON_INVALID, and TOTAL_NO_OF_ZID_KEY_RC.
Referenced by app_task(), and main().
|
static |
Indicating malfunction.
References delay_ms, LED_Off, LED_On, and ZID_APP_LED.
Referenced by app_nlme_rx_enable_confirm(), nlde_data_confirm(), zid_connect_confirm(), zid_data_confirm(), zid_report_data_confirm(), and zid_set_attribute_confirm().
|
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 |
|
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 |
void vendor_app_alive_req | ( | void | ) |
Vendor-specific callback; handles reaction to incoming alive request.
Vendor data alive request.
References delay_ms, LED_Off, LED_On, and ZID_APP_LED.
|
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 |
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. |
|
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().
uint16_t ADC_val |
Referenced by acc_read_cb(), app_calculate_offset(), and app_task().
|
static |
Referenced by acc_read_cb(), app_task(), and main().
uint8_t b_state = 0xFF |
uint16_t button_mode = BUTTON_MEDIA_MODE |
button_id_t button_val |
void(* Correct_x_offset)(uint16_t *temp_val, uint16_t temp_offset) |
Referenced by acc_read_cb(), app_calculate_offset(), and app_task().
void(* Correct_y_offset)(uint16_t *temp_val, uint16_t temp_offset) |
Referenced by acc_read_cb(), app_calculate_offset(), and app_task().
void(* Correct_z_offset)(uint16_t *temp_val, uint16_t temp_offset) |
Referenced by app_calculate_offset().
|
static |
Referenced by app_task().
|
static |
|
static |
Referenced by app_task().
|
static |
Referenced by app_task().
|
static |
|
static |
Referenced by app_task(), 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().
uint8_t status |
uint16_t x_offset |
Referenced by acc_read_cb(), app_calculate_offset(), and app_task().
uint16_t x_val |
Referenced by acc_read_cb(), app_calculate_offset(), app_task(), and kxtf9_get_accel().
uint16_t y_offset |
Referenced by acc_read_cb(), app_calculate_offset(), and app_task().
uint16_t y_val |
Referenced by acc_read_cb(), app_calculate_offset(), app_task(), and kxtf9_get_accel().
uint16_t z_offset |
Referenced by app_calculate_offset().
uint16_t z_val |
Referenced by acc_read_cb(), app_calculate_offset(), app_task(), and kxtf9_get_accel().
|
static |
uint32_t zid_interframe_duration = INTER_FRAME_DURATION_US |
Referenced by app_task().