Classes |
struct | GPPin |
struct | SPITransferSettingsDef |
struct | ChipSettingsDef |
struct | USBKeyParametersDef |
struct | ManufacturerProductNameDef |
struct | ChipStatusDef |
struct | SPIDataTransferStatusDef |
struct | ExternalInterruptPinStatusDef |
struct | GPPinDef |
Defines |
#define | MCP2210_VID 0x04d8 |
#define | MCP2210_PID 0x00de |
#define | GPIO_DIRECTION_OUTPUT 0 |
#define | GPIO_DIRECTION_INPUT 1 |
#define | GP_PIN_DESIGNATION_GPIO 0x0 |
#define | GP_PIN_DESIGNATION_CS 0x1 |
#define | GP_PIN_DESIGNATION_DEDICATED 0x2 |
#define | REMOTE_WAKEUP_DISABLED 0x0 |
#define | REMOTE_WAVEUP_ENABLED 0x1 |
#define | COUNT_HIGH_PULSES 0x4 |
#define | COUNT_LOW_PULSES 0x3 |
#define | COUNT_RISING_EDGES 0x2 |
#define | COUNT_FALLING_EDGES 0x1 |
#define | NO_INTERRUPT_COUNTING 0x0 |
#define | CHIP_SETTINGS_NOT_PROTECTED 0x0 |
#define | CHIP_SETTINGS_PROTECTED_BY_PWD 0x40 |
#define | CHIP_SETTINGS_LOCKED 0x80 |
#define | USB_STRING_DESCRIPTOR_ID 0x03 |
#define | CMD_UNSPOORTED 0x0 |
#define | CMD_GET_CHIP_STATUS 0x10 |
#define | CMD_SPI_CANCEL 0x11 |
#define | CMD_GET_NUM_EVENTS_FROM_INT_PIN 0x12 |
#define | CMD_GET_GPIO_SETTING 0x20 |
#define | CMD_SET_GPIO_SETTING 0x21 |
#define | CMD_SET_GPIO_PIN_VAL 0x30 |
#define | CMD_GET_GPIO_PIN_VAL 0x31 |
#define | CMD_SET_GPIO_PIN_DIR 0x32 |
#define | CMD_GET_GPIO_PIN_DIR 0x33 |
#define | CMD_SET_SPI_SETTING 0x40 |
#define | CMD_GET_SPI_SETTING 0x41 |
#define | CMD_SPI_TRANSFER 0x42 |
#define | CMD_READ_EEPROM_MEM 0x50 |
#define | CMD_WRITE_EEPROM_MEM 0x51 |
#define | CMD_SET_NVRAM_PARAM 0x60 |
#define | CMD_GET_NVRAM_PARAM 0x61 |
#define | CMD_SEND_PASSWORD 0x70 |
#define | CMD_SPI_BUS_RELEASE_REQ 0x80 |
#define | CMDSUB_SPI_POWERUP_XFER_SETTINGS 0x10 |
#define | CMDSUB_POWERUP_CHIP_SETTINGS 0x20 |
#define | CMDSUB_USB_KEY_PARAMETERS 0x30 |
#define | CMDSUB_USB_PRODUCT_NAME 0x40 |
#define | CMDSUB_USB_MANUFACTURER_NAME 0x50 |
#define | OPERATION_SUCCESSFUL 0 |
#define | ERROR_UNABLE_TO_OPEN_DEVICE -1 |
#define | ERROR_UNABLE_TO_WRITE_TO_DEVICE -2 |
#define | ERROR_UNABLE_TO_READ_FROM_DEVICE -3 |
#define | ERROR_INVALID_DEVICE_HANDLE -99 |
#define | COMMAND_BUFFER_LENGTH 64 |
#define | RESPONSE_BUFFER_LENGTH 64 |
#define | SPI_STATUS_FINISHED_NO_DATA_TO_SEND 0x10 |
#define | SPI_STATUS_STARTED_NO_DATA_TO_RECEIVE 0x20 |
#define | SPI_STATUS_SUCCESSFUL 0x30 |
Typedefs |
typedef uint8_t | byte |
Functions |
hid_device_info * | EnumerateMCP2210 () |
hid_device * | InitMCP2210 () |
hid_device * | InitMCP2210 (wchar_t *serialNumber) |
hid_device * | InitMCP2210 (unsigned short vid, unsigned short pid, wchar_t *serialNumber) |
void | ReleaseMCP2210 (hid_device *handle) |
int | SendUSBCmd (hid_device *handle, byte *cmdBuf, byte *responseBuf) |
SPITransferSettingsDef | GetSPITransferSettings (hid_device *handle, bool isVolatile=true) |
int | SetSPITransferSettings (hid_device *handle, SPITransferSettingsDef def, bool isVolatile=true) |
ChipSettingsDef | GetChipSettings (hid_device *handle, bool isVolatile=true) |
int | SetChipSettings (hid_device *handle, ChipSettingsDef def, bool isVolatile=true) |
USBKeyParametersDef | GetUSBKeyParameters (hid_device *handle) |
int | SetUSBKeyParameters (hid_device *handle, USBKeyParametersDef def) |
ManufacturerProductNameDef | GetManufacturerProductName (hid_device *handle, unsigned int subCmdCode) |
int | SetManufacturerProductName (hid_device *handle, unsigned int subCmdCode, ManufacturerProductNameDef def) |
int | SendAccessPassword (hid_device *handle, char *pwd, int pwdLength) |
int | ReadEEPROM (hid_device *handle, byte addr, byte *val) |
int | WriteEEPROM (hid_device *handle, byte addr, byte val) |
int | RequestSPIBusRelease (hid_device *handle, byte val) |
ChipStatusDef | GetChipStatus (hid_device *handle) |
ChipStatusDef | CancelSPITransfer (hid_device *handle) |
SPIDataTransferStatusDef | SPIDataTransfer (hid_device *handle, byte *data, int length) |
SPIDataTransferStatusDef | SPISendReceive (hid_device *handle, byte *data, int cmdBufferLength, int dataLength=-1) |
ExternalInterruptPinStatusDef | GetNumOfEventsFromInterruptPin (hid_device *handle, byte resetCounter) |
GPPinDef | GetGPIOPinDirection (hid_device *handle) |
int | SetGPIOPinDirection (hid_device *handle, GPPinDef def) |
GPPinDef | GetGPIOPinValue (hid_device *handle) |
int | SetGPIOPinVal (hid_device *handle, GPPinDef def) |
Copyright 2012, Kerry D. Wong
http://www.kerrywong.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Send data and wait till results are received from the SPI bus.
Note: this method differers from SPIDataTransfer in that it also waits till the transfer is finished. In SPIDataTransfer, the SPIEngineStatus in the returned data structure tells the status of the SPI engine, and the call returns after the data is sent, regardless of whether the data has been received.
- Parameters:
-
handle | The handle to the MCP2210 device |
data | a pointer to the data array to be transfered |
cmdBufferLength | number of command bytes to be transfered |
dataLength | (optional) number of data elements to be returned |
if this parameter is not supplied the default length is set to be the same as the command buffer length
- Returns:
- See also:
- SPIDataTransferStatusDef ErrorCode meaning: 0xF7: SPI bus not available 0xF8: SPI transfer in progress (cannot accept any data for the moment)