MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Classes | Macros | Typedefs
MeUSBHost.h File Reference

Header for MeUSBHost.cpp module. More...

`#include <Arduino.h>`
`#include <stdint.h>`
`#include <stdbool.h>`
`#include "MeConfig.h"`
`#include "MePort.h"`
`#include "MeSerial.h"`
Include dependency graph for MeUSBHost.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | _USB_DEVICE_DEscriptOR
struct | _USB_CONFIG_DEscriptOR
struct | _USB_INTERF_DEscriptOR
struct | _USB_ENDPOINT_DEscriptOR
struct | _USB_CONFIG_DEscriptOR_LONG
class | MeUSBHost
| Driver for Me USB Host module. More...

## Macros
#define | USB2_0 1
#define | USB1_0 0
#define | CH375_MAX_DATA_LEN 0x40 /* max package length */
#define | CMD_RESET_ALL 0x05 /* Reset Device */
#define | CMD_CHECK_EXIST 0x06 /* Chip check */
#define | CMD_SET_USB_ID 0x12 /* Device Mode: Setup the VID and PID in device mode */
#define | CMD_SET_USB_ADDR 0x13 /* Setup the usb address */
#define | CMD_SET_USB_MODE 0x15 /* Setup the module work mode, with enable or disable state */
#define | CMD_SET_ENDP2 0x18 /* Device Mode: setup endpoint 0 receiver */
#define | CMD_SET_ENDP3 0x19 /* Device Mode: setup endpoint 0 transmitter */
#define | CMD_SET_ENDP4 0x1A /* Device Mode: setup endpoint 1 receiver */
#define | CMD_SET_ENDP5 0x1B /* Device Mode: setup endpoint 1 transmitter */
#define | CMD_SET_ENDP6 0x1C /* Device Mode: setup endpoint 2 receiver */
#define | CMD_SET_ENDP7 0x1D /* Device Mode: setup endpoint 2 transmitter */
#define | CMD_GET_TOGGLE 0x0A /* get the out token sync state */
#define | CMD_GET_STATUS 0x22 /* Get interrupt state */
#define | CMD_UNLOCK_USB 0x23 /* Device Mode: release buffer */
#define | CMD_RD_USB_DATA 0x28 /* block read from usb device, and release buffer */
#define | CMD_WR_USB_DATA3 0x29 /* Device Mode: write to usb endpoint 0 */
#define | CMD_WR_USB_DATA5 0x2A /* Device Mode: write to usb endpoint 1 */
#define | CMD_WR_USB_DATA7 0x2B /* write to usb endpoint 2 */
#define | CMD_SET_BAUDRATE 0x02 /* Serial Mode: setup serial baudrate */
#define | CMD_ABORT_NAK 0x17 /* Host Mode: abort nak retry */
#define | CMD_SET_RETRY 0x0B /* Host Mode: setup usb token retry times */
#define | CMD_ISSUE_TOKEN 0x4F /* Host Mode: issue the token */
#define | CMD_CLR_STALL 0x41 /* Host Mode: clear the endpoint Error */
#define | CMD_SET_ADDRESS 0x45 /* Host Mode: Control-setup usb address */
#define | CMD_GET_DESCR 0x46 /* Host Mode: Control-get descriptor */
#define | CMD_SET_CONFIG 0x49 /* Host Mode: Control-config and enable the device */
#define | CMD_DISK_INIT 0x51 /* Host Mode: init usb storage device */
#define | CMD_DISK_RESET 0x52 /* Host Mode: reset usb storage device */
#define | CMD_DISK_SIZE 0x53 /* Host Mode: get the capacity of usb storage device */
#define | CMD_DISK_READ 0x54 /* Host Mode: read from usb storage device(512byte) */
#define | CMD_DISK_RD_GO 0x55 /* Host Mode: continus read */
#define | CMD_DISK_WRITE 0x56 /* Host Mode: write to usb storage device(512byte) */
#define | CMD_DISK_WR_GO 0x57 /* Host Mode: continus write */
#define | CMD_GET_IC_VER 0x01 /* get chip version */
#define | CMD_ENTER_SLEEP 0x03 /* into sleep mode */
#define | CMD_RD_USB_DATA0 0x27 /* read from usb endpoint */
#define | CMD_DELAY_100US 0x0F /* Parallel : delay 100uS */
#define | CMD_CHK_SUSPEND 0x0B /* Device Mode: check usb bus hung */
#define | CMD_SET_SYS_FREQ 0x04 /* setup system working frequency */
#define | CMD_TEST_CONNECT 0x16 /* Host Mode: check usb device connection */
#define | CMD_AUTO_SETUP 0x4D /* Host Mode: auto setup usb device */
#define | CMD_ISSUE_TKN_X 0x4E /* Host Mode: issue sync token */
#define | CMD_RET_SUCCESS 0x51 /* success */
#define | CMD_RET_ABORT 0x5F /* fail */
#define | USB_INT_USB_SUSPEND 0x05 /* usb bus susspend */
#define | USB_INT_WAKE_UP 0x06 /* wake up */
#define | USB_INT_EP0_SETUP 0x0C /* USB ep0 SETUP */
#define | USB_INT_EP0_OUT 0x00 /* USB ep0 OUT */
#define | USB_INT_EP0_IN 0x08 /* USB ep0 IN */
#define | USB_INT_EP1_OUT 0x01 /* USB ep1 OUT */
#define | USB_INT_EP1_IN 0x09 /* USB ep1 IN */
#define | USB_INT_EP2_OUT 0x02 /* USB ep2 OUT */
#define | USB_INT_EP2_IN 0x0A /* USB ep2 IN */
#define | USB_INT_BUS_RESET1 0x03 /* USB BUS RESET */
#define | USB_INT_BUS_RESET2 0x07 /* USB BUS RESET */
#define | USB_INT_BUS_RESET3 0x0B /* USB BUS RESET */
#define | USB_INT_BUS_RESET4 0x0F /* USB BUS RESET */
#define | USB_INT_SUCCESS 0x14 /* token successful sent */
#define | USB_INT_CONNECT 0x15 /* detect usb device plug in */
#define | USB_INT_DISCONNECT 0x16 /* detect usb device plug out */
#define | USB_INT_BUF_OVER 0x17 /* USB control buffer overflow */
#define | USB_INT_DISK_READ 0x1D /* USB storage, read request */
#define | USB_INT_DISK_WRITE 0x1E /* USB storage, write request */
#define | USB_INT_DISK_ERR 0x1F /* USB storage, fail */
#define | DEF_USB_PID_NULL 0x00 /* reserve PID, not defined */
#define | DEF_USB_PID_SOF 0x05
#define | DEF_USB_PID_SETUP 0x0D
#define | DEF_USB_PID_IN 0x09
#define | DEF_USB_PID_OUT 0x01
#define | DEF_USB_PID_ACK 0x02
#define | DEF_USB_PID_NAK 0x0A
#define | DEF_USB_PID_STALL 0x0E
#define | DEF_USB_PID_DATA0 0x03
#define | DEF_USB_PID_DATA1 0x0B
#define | DEF_USB_PID_PRE 0x0C
#define | DEF_USB_REQ_READ 0x80 /* control read request */
#define | DEF_USB_REQ_WRITE 0x00 /* control write request */
#define | DEF_USB_REQ_TYPE 0x60 /* control type request */
#define | DEF_USB_REQ_STAND 0x00 /* standard request */
#define | DEF_USB_REQ_CLASS 0x20 /* device class request */
#define | DEF_USB_REQ_VENDOR 0x40 /* vendor request */
#define | DEF_USB_REQ_RESERVE 0x60 /* reserved request */
#define | DEF_USB_CLR_FEATURE 0x01
#define | DEF_USB_SET_FEATURE 0x03
#define | DEF_USB_GET_STATUS 0x00
#define | DEF_USB_SET_ADDRESS 0x05
#define | DEF_USB_GET_DESCR 0x06
#define | DEF_USB_SET_DESCR 0x07
#define | DEF_USB_GET_CONFIG 0x08
#define | DEF_USB_SET_CONFIG 0x09
#define | DEF_USB_GET_INTERF 0x0A
#define | DEF_USB_SET_INTERF 0x0B
#define | DEF_USB_SYNC_FRAME 0x0C

## Typedefs
typedef struct _USB_DEVICE_DEscriptOR | USB_DEV_DESCR
typedef struct _USB_DEVICE_DEscriptOR * | PUSB_DEV_DESCR
typedef struct _USB_CONFIG_DEscriptOR | USB_CFG_DESCR
typedef struct _USB_CONFIG_DEscriptOR * | PUSB_CFG_DESCR
typedef struct _USB_INTERF_DEscriptOR | USB_ITF_DESCR
typedef struct _USB_INTERF_DEscriptOR * | PUSB_ITF_DESCR
typedef struct _USB_ENDPOINT_DEscriptOR | USB_ENDP_DESCR
typedef struct _USB_ENDPOINT_DEscriptOR * | PUSB_ENDP_DESCR
typedef struct _USB_CONFIG_DEscriptOR_LONG | USB_CFG_DESCR_LONG
typedef struct _USB_CONFIG_DEscriptOR_LONG * | PUSB_CFG_DESCR_LONG

## Detailed Description

Header for MeUSBHost.cpp module.

Author
  MakeBlock

Version
  V1.0.1

Date
  2016/01/20

Copyright
  This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
  conditions. The main licensing options available are GPL V2 or Commercial:

Open Source Licensing GPL V2
  This is the appropriate option if you want to share the source code of your
  application with everyone you distribute it to, and you also want to give them
  the right to share who uses it. If you wish to use this software under Open
  Source Licensing, you must contribute all your source code to the open source
  community in accordance with the GPL Version 2 when your application is
  distributed. See http://www.gnu.org/copyleft/gpl.html

Description
  This file is a drive for Me USB Host device, The USB Host inherited the MeSerial class from SoftwareSerial.

Method List:

1. void MeUSBHost::init(int8_t type);
2. int16_t MeUSBHost::initHIDDevice();
3. int16_t MeUSBHost::probeDevice();
4. void MeUSBHost::resetBus();
5. uint8_t MeUSBHost::host_recv();

History:

      `<Author>`         `<Time>`        `<Version>`        `<Descr>`
      forfish         2015/11/10     1.0.0            Add description
      Mark Yan        2016/01/20     1.0.1            Support hardware serial automatic Identification