Microchip® Advanced Software Framework

device_hid_qtouch_debug_task.c File Reference
#include "conf_usb.h"
#include "board.h"
#include "usb_drv.h"
#include "gpio.h"
#include "pdca.h"
#include "intc.h"
#include "usart.h"
#include "usb_descriptors.h"
#include "usb_standard_request.h"
#include "cycle_counter.h"
#include "fifo.h"
#include "power_clocks_lib.h"
#include "qtouch_debug_frame.h"
#include "device_hid_qtouch_debug_task.h"
#include <string.h>

Macros

#define AVR32_PDCA_PID_USART_TX   AVR32_PDCA_PID_USART1_TX
 
#define PDCA_CHANNEL_USART   0
 
#define RX_LED   AVR32_PIN_PA20
 
#define TX_LED   AVR32_PIN_PA21
 
#define USART   (&AVR32_USART1)
 
#define USART_BAUDRATE   115200
 
#define USART_IRQ   AVR32_USART1_IRQ
 
#define USART_RX_BUFFER   (EP_IN_LENGTH*2)
 
#define USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
 
#define USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN
 
#define USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
 
#define USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN
 

Functions

void device_generic_hid_task (void)
 Entry point of the HID generic communication task This function manages IN/OUT report management. More...
 
void device_generic_hid_task_init (void)
 This function initializes the hardware/software resources required for device generic HID task. More...
 
void fill_tx_buffer (void)
 Send data report to USB HID Host. More...
 
void hid_check_vbus (void)
 check if USB VBUS active. More...
 
static void hid_report_in (void)
 Send data report to USB HID Host. More...
 
static void hid_report_out (void)
 Get data report from Host. More...
 
void init_rs232 (unsigned long baudrate, long pba_hz)
 This function initializes USART connected to main UC3 device present on the kit. More...
 
static void int_handler_usart (void)
 
void usb_sof_action (void)
 usb_sof_action More...
 
void usb_write_message (void *ptr_cram)
 Write message to USB HID Host. More...
 

Variables

static struct hid_frames ack_message
 
static fifo_desc_t fifo_desc_usart
 
static uint8_t fifo_rx [USART_RX_BUFFER]
 
int jump_bootloader
 
struct hid_frames out_buffer
 
pcl_freq_param_t pcl_freq_param
 
static int recieved_data =0
 
static bool send_ack = false
 
static bool send_nack = false
 
static U16 sof_cnt
 
static bool write_hid_message = false
 
static int write_hid_message_index =0
 

#define AVR32_PDCA_PID_USART_TX   AVR32_PDCA_PID_USART1_TX
#define PDCA_CHANNEL_USART   0
#define TX_LED   AVR32_PIN_PA21
#define USART   (&AVR32_USART1)
#define USART_BAUDRATE   115200

Referenced by hid_check_vbus().

#define USART_IRQ   AVR32_USART1_IRQ
#define USART_RX_BUFFER   (EP_IN_LENGTH*2)
#define USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION

Referenced by init_rs232().

#define USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN

Referenced by hid_check_vbus(), and init_rs232().

#define USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION

Referenced by init_rs232().

#define USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN

Referenced by init_rs232().

void device_generic_hid_task ( void  )

Entry point of the HID generic communication task This function manages IN/OUT report management.

References fill_tx_buffer(), hid_check_vbus(), hid_report_in(), hid_report_out(), and Is_device_enumerated.

Referenced by main().

void hid_check_vbus ( void  )

check if USB VBUS active.

If VBUS is not active, put the device in Stop mode until VBUS become active

References cpu_delay_ms(), FOSC0, gpio_clr_gpio_pin(), gpio_enable_pin_pull_up(), gpio_set_gpio_pin(), gpio_tgl_gpio_pin(), init_rs232(), Is_usb_vbus_low, pcl_freq_param, RX_LED, SLEEP, TX_LED, USART, USART_BAUDRATE, and USART_RX_PIN.

Referenced by device_generic_hid_task().

void init_rs232 ( unsigned long  baudrate,
long  pba_hz 
)

This function initializes USART connected to main UC3 device present on the kit.

References usart_options_t::baudrate, gpio_enable_module(), USART, USART_1_STOPBIT, usart_init_rs232(), USART_NO_PARITY, USART_NORMAL_CHMODE, USART_RX_FUNCTION, USART_RX_PIN, USART_TX_FUNCTION, and USART_TX_PIN.

Referenced by hid_check_vbus().

static void int_handler_usart ( void  )
static
void usb_write_message ( void *  ptr_cram)

struct hid_frames ack_message
static
fifo_desc_t fifo_desc_usart
static
uint8_t fifo_rx[USART_RX_BUFFER]
static
int jump_bootloader
struct hid_frames out_buffer

Referenced by hid_report_out().

pcl_freq_param_t pcl_freq_param
int recieved_data =0
static

Referenced by fill_tx_buffer(), and hid_report_in().

bool send_ack = false
static

Referenced by hid_report_in(), and hid_report_out().

bool send_nack = false
static

Referenced by hid_report_in(), and hid_report_out().

U16 sof_cnt
static
bool write_hid_message = false
static

Referenced by fill_tx_buffer(), and hid_report_in().

int write_hid_message_index =0
static

Referenced by fill_tx_buffer(), and hid_report_in().