Microchip® Advanced Software Framework

cdc.c File Reference

Application CDC Implementation.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include "nvm.h"
#include "keyboard.h"
#include "cdc.h"

Macros

#define USER_SIGNATURE_USBID_POS   8
 USBID position in user signature row. More...
 
#define USER_SIGNATURE_USBID_SIZE   12
 USBID size in user signature row. More...
 

Functions

keycode_t cdc_getkey (void)
 Read character from CDC interface and translate to keycode. More...
 
static void cdc_put_help (void)
 
void cdc_set_dtr (bool enable)
 Called by CDC interface to open/close port communication. More...
 
void cdc_start (void)
 Start up the needed parts for USB CDC. More...
 
 PROGMEM_DECLARE (char const, cdc_help[])
 

Variables

bool cdc_opened = false
 
uint8_t cdc_serial_number [USB_DEVICE_GET_SERIAL_NAME_LENGTH+1]
 Serial number to be passed to USB stack. More...
 

#define USER_SIGNATURE_USBID_POS   8

USBID position in user signature row.

Referenced by cdc_start().

#define USER_SIGNATURE_USBID_SIZE   12

USBID size in user signature row.

Referenced by cdc_start().

keycode_t cdc_getkey ( void  )

Read character from CDC interface and translate to keycode.

References cdc_opened, cdc_put_help(), KEYBOARD_DOWN, KEYBOARD_NO_KEY, KEYBOARD_UP, udi_cdc_getc(), and udi_cdc_is_rx_ready().

Referenced by keyboard_get_key_state().

static void cdc_put_help ( void  )
static

References PROGMEM_PTR_T, PROGMEM_READ_BYTE, and udi_cdc_putc().

Referenced by cdc_getkey().

void cdc_set_dtr ( bool  enable)

Called by CDC interface to open/close port communication.

Parameters
enableOpen if true, and close if false

References cdc_opened.

void cdc_start ( void  )

Start up the needed parts for USB CDC.

References cdc_serial_number, nvm_read_user_signature_row(), udc_start(), USER_SIGNATURE_USBID_POS, and USER_SIGNATURE_USBID_SIZE.

Referenced by main().

PROGMEM_DECLARE ( char  const,
cdc_help  [] 
)

bool cdc_opened = false

Referenced by cdc_getkey(), and cdc_set_dtr().

uint8_t cdc_serial_number[USB_DEVICE_GET_SERIAL_NAME_LENGTH+1]

Serial number to be passed to USB stack.

Referenced by cdc_start().