#include <stdio.h>
#include "conf_usb.h"
#include "conf_board.h"
#include <asf.h>
#include "app_config.h"
#include "led.h"
#include "delay.h"
#include "vendor_data.h"
#include "pb_pairing.h"
#include "common_sw_timer.h"
#include "zid.h"
Macros | |
#define | JOYSTICK_NEGATIVE_DISPLACEMENT (-10) |
#define | JOYSTICK_POSITIVE_DISPLACEMENT (10) |
#define | LED_DATA (LED0) |
#define | LED_DATA (LED0) |
#define | LED_NWK_SETUP (LED0) |
#define | LED_START (LED0) |
#define | PAIR_WAIT_PERIOD 500000 |
Typedefs | |
typedef enum node_status_tag | node_status_t |
Functions | |
static void | app_alert (void) |
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]) | |
static void | led_handling (void *callback_parameter) |
Function to handle the LED States based on application state. More... | |
int | main (void) |
Main function, initialization and main message loop. More... | |
void | main_kbd_disable (void) |
Called by HID interface Callback running when USB Host disable keyboard interface. More... | |
bool | main_kbd_enable (void) |
Called by HID interface Callback running when USB Host enable keyboard interface. More... | |
void | main_mouse_disable (void) |
Called by HID interface Callback running when USB Host disable mouse interface. More... | |
bool | main_mouse_enable (void) |
Called by HID interface Callback running when USB Host enable mouse interface. More... | |
static void | nlme_reset_confirm (nwk_enum_t Status) |
Notify the application of the status of its request to reset the NWK layer. More... | |
static void | nlme_start_confirm (nwk_enum_t Status) |
Notify the application of the status of its request to start the NWK. More... | |
static void | nlme_unpair_indication (uint8_t PairingRef) |
Notify the application of the removal of link by another device. 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... | |
static void | zid_connect_confirm (nwk_enum_t Status, uint8_t PairingRef) |
Notify the application of the status of its connect request. More... | |
static void | zid_heartbeat_indication (uint8_t PairingRef) |
Notify the application of the status of its heartbeat request. More... | |
static void | zid_indication_callback_init (void) |
This function registers the callback function for indications from the stack. 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) |
Notify the application when ZID report data is received from the paired device. More... | |
void | zid_standby_leave_indication (void) |
Notify the application of the status of its standby request. More... | |
Variables | |
static uint8_t | APP_TIMER |
static bool | duplicate_pair_entry = false |
static volatile bool | main_b_kbd_enable = false |
static bool | main_b_mouse_enable = false |
static node_status_t | node_status |
static uint8_t | number_of_paired_dev = 0 |
static nwk_indication_callback_t | nwk_ind |
static uint8_t | target_auto_start = true |
static zid_indication_callback_t | zid_ind |
#define JOYSTICK_NEGATIVE_DISPLACEMENT (-10) |
Referenced by zid_report_data_indication().
#define JOYSTICK_POSITIVE_DISPLACEMENT (10) |
Referenced by zid_report_data_indication().
#define LED_DATA (LED0) |
#define LED_DATA (LED0) |
#define LED_NWK_SETUP (LED0) |
Referenced by led_handling().
#define LED_START (LED0) |
#define PAIR_WAIT_PERIOD 500000 |
Referenced by led_handling(), and nlme_start_confirm().
typedef enum node_status_tag node_status_t |
enum node_status_tag |
|
static |
|
static |
Application task.
References ALL_IN_ONE_START, FUNC_PTR, nlme_reset_confirm(), nlme_reset_request(), node_status, and target_auto_start.
Referenced by main().
FLASH_DECLARE | ( | uint16_t | VendorIdentifier | ) |
FLASH_DECLARE | ( | uint8_t | vendor_string[7] | ) |
FLASH_DECLARE | ( | uint8_t | app_user_string[15] | ) |
|
static |
Function to handle the LED States based on application state.
callback_parameter | callback parameter if any. |
References ALL_IN_ONE_START, APP_TIMER, FUNC_PTR, LED_NWK_SETUP, node_status, PAIR_WAIT_PERIOD, SW_TIMEOUT_RELATIVE, sw_timer_start(), sw_timer_stop(), and ZID_CONNECTING.
Referenced by nlme_start_confirm().
int main | ( | void | ) |
Main function, initialization and main message loop.
References app_alert(), app_task(), APP_TIMER, board_init(), cpu_irq_enable, nwk_init(), NWK_SUCCESS, nwk_task(), sw_timer_get_id(), sw_timer_init(), sysclk_init, udc_start(), and zid_indication_callback_init().
void main_kbd_disable | ( | void | ) |
Called by HID interface Callback running when USB Host disable keyboard interface.
bool main_kbd_enable | ( | void | ) |
Called by HID interface Callback running when USB Host enable keyboard interface.
true | if keyboard startup is ok |
void main_mouse_disable | ( | void | ) |
Called by HID interface Callback running when USB Host disable mouse interface.
References main_b_mouse_enable.
bool main_mouse_enable | ( | void | ) |
Called by HID interface Callback running when USB Host enable mouse interface.
true | if mouse startup is ok |
References main_b_mouse_enable.
|
static |
Notify the application of the status of its request to reset the NWK layer.
Status | nwk status |
References FUNC_PTR, nlme_reset_request(), nlme_start_confirm(), nlme_start_request(), and NWK_SUCCESS.
Referenced by app_task().
|
static |
Notify the application of the status of its request to start the NWK.
Status | nwk status |
References APP_CAPABILITIES, APP_TIMER, DEVICE_TYPE_LIST_SIZE, FUNC_PTR, led_handling(), node_status, NWK_SUCCESS, PAIR_WAIT_PERIOD, PROFILE_ID_LIST_SIZE, SUPPORTED_DEV_TYPE_0, SUPPORTED_PROFILE_ID_0, SW_TIMEOUT_RELATIVE, sw_timer_start(), zid_connect_confirm(), ZID_CONNECTING, and zid_rec_connect_request().
Referenced by nlme_reset_confirm().
|
static |
Notify the application of the removal of link by another device.
The NLME-UNPAIR.indication primitive allows the NLME to notify the application of the removal of a pairing link by another device.
PairingRef | Pairing Ref for which entry is removed from pairing table. |
References number_of_paired_dev.
|
static |
Notify the application of the status of its connect request.
Status | nwk status. |
PairingRef | Pairing reference. |
References duplicate_pair_entry, IDLE, node_status, number_of_paired_dev, and NWK_SUCCESS.
Referenced by nlme_start_confirm().
|
static |
Notify the application of the status of its heartbeat request.
PairingRef | Pairing reference. |
|
static |
This function registers the callback function for indications from the stack.
|
static |
Notify the application when ZID report data is received from the paired device.
PairingRef | Pairing reference. |
num_report_records | number of Report records. |
*zid_report_data_record_ptr | pointer to the report data received. |
RxLinkQuality | LQI value of the report data frame. |
RxFlags | Receive flags. |
References JOYSTICK_NEGATIVE_DISPLACEMENT, JOYSTICK_POSITIVE_DISPLACEMENT, keyboard_input_desc_tag::key_code, KEYBOARD, zid_report_data_record_tag::report_desc_identifier, udi_hid_gpd_buttons(), udi_hid_gpd_moveX(), udi_hid_gpd_moveY(), and udi_hid_gpd_throttle_move().
void zid_standby_leave_indication | ( | void | ) |
Notify the application of the status of its standby request.
|
static |
Referenced by led_handling(), main(), and nlme_start_confirm().
Referenced by zid_connect_confirm().
Referenced by main_kbd_disable(), and main_kbd_enable().
Referenced by main_mouse_disable(), and main_mouse_enable().
|
static |
Referenced by app_task(), led_handling(), nlme_start_confirm(), and zid_connect_confirm().
|
static |
Referenced by nlme_unpair_indication(), and zid_connect_confirm().
|
static |
|
static |
Referenced by app_task().
|
static |