MCP2221 HID Library
1.0.4
|
#include <stdint.h>
#include <wchar.h>
Go to the source code of this file.
Data Structures | |
struct | mcp2221_usbinfo_t |
Contains enumerated USB info about the device. More... | |
struct | mcp2221_t |
TODO. More... | |
struct | mcp2221_i2cpins_t |
Raw I2C pin values. More... | |
struct | mcp2221_gpioconf_t |
GPIO configuration. More... | |
struct | mcp2221_gpioconfset_t |
TODO. More... | |
Macros | |
#define | MCP2221_STR_LEN 31 |
#define | MCP2221_GPIO_COUNT 4 |
#define | MCP2221_DAC_MAX 31 |
#define | MCP2221_ADC_COUNT 3 |
#define | MCP2221_DEFAULT_VID 0x04D8 |
#define | MCP2221_DEFAULT_PID 0x00DD |
#define | MCP2221_DEFAULT_MANUFACTURER L"Microchip Technology Inc." |
#define | MCP2221_DEFAULT_PRODUCT L"MCP2221 USB-I2C/UART Combo" |
#define | MCP2221_REPORT_SIZE 64 |
#define | MCP2221_GPIO_MODE_SSPND MCP2221_GPIO_MODE_DEDI |
#define | MCP2221_GPIO_MODE_ADC MCP2221_GPIO_MODE_ALT1 |
#define | MCP2221_GPIO_MODE_DAC MCP2221_GPIO_MODE_ALT2 |
#define | MCP2221_GPIO_MODE_IOC MCP2221_GPIO_MODE_ALT3 |
Functions | |
mcp2221_error | mcp2221_init (void) |
Initialise, must be called before anything else! More... | |
void | mcp2221_exit (void) |
TODO. More... | |
int | mcp2221_find (int vid, int pid, wchar_t *manufacturer, wchar_t *product, wchar_t *serial) |
Find all HIDs matching the supplied parameters, must be called before attempting to open a device. More... | |
int | mcp2221_sameDevice (mcp2221_t *dev1, mcp2221_t *dev2) |
TODO. More... | |
mcp2221_t * | mcp2221_open (void) |
Open first MCP2221 device found. More... | |
mcp2221_t * | mcp2221_open_byIndex (int idx) |
Open device with specified index number (starting from 0 up to however many devices were found) More... | |
mcp2221_t * | mcp2221_open_bySerial (wchar_t *serial) |
Open device with specified serial. More... | |
void | mcp2221_close (mcp2221_t *device) |
Close device. More... | |
mcp2221_error | mcp2221_reset (mcp2221_t *device) |
Perform a reset of the device. More... | |
mcp2221_error | mcp2221_isConnected (mcp2221_t *device) |
Check to see if the device is still connected, should return MCP2221_SUCCESS. More... | |
mcp2221_error | mcp2221_rawReport (mcp2221_t *device, uint8_t *report) |
Send a custom report, the response is placed in the same buffer. More... | |
mcp2221_gpioconfset_t | mcp2221_GPIOConfInit (void) |
TODO. More... | |
mcp2221_error | mcp2221_setClockOut (mcp2221_t *device, mcp2221_clkdiv_t div, mcp2221_clkduty_t duty) |
Set the clock reference output divider and duty cycle (SRAM) More... | |
mcp2221_error | mcp2221_setDAC (mcp2221_t *device, mcp2221_dac_ref_t ref, int value) |
Set the DAC voltage reference and output value (SRAM) More... | |
mcp2221_error | mcp2221_setADC (mcp2221_t *device, mcp2221_adc_ref_t ref) |
Set the ADC voltage reference (SRAM) More... | |
mcp2221_error | mcp2221_setInterrupt (mcp2221_t *device, mcp2221_int_trig_t trig, int clearInt) |
Set the interrupt trigger mode and optionally clear pending interrupt (SRAM) More... | |
mcp2221_error | mcp2221_setGPIOConf (mcp2221_t *device, mcp2221_gpioconfset_t *confSet) |
Apply GPIO configuration. More... | |
mcp2221_error | mcp2221_setGPIO (mcp2221_t *device, mcp2221_gpio_t pins, mcp2221_gpio_value_t value) |
Set GPIO pin output values. More... | |
mcp2221_error | mcp2221_getClockOut (mcp2221_t *device, mcp2221_clkdiv_t *div, mcp2221_clkduty_t *duty) |
Get the current clock output divider (SRAM) More... | |
mcp2221_error | mcp2221_getDAC (mcp2221_t *device, mcp2221_dac_ref_t *ref, int *value) |
Get the current DAC voltage reference and output value (SRAM) More... | |
mcp2221_error | mcp2221_getADC (mcp2221_t *device, mcp2221_adc_ref_t *ref) |
Get the current ADC voltage reference (SRAM) More... | |
mcp2221_error | mcp2221_getInterrupt (mcp2221_t *device, mcp2221_int_trig_t *trig) |
Get the current interrupt trigger mode (SRAM) More... | |
mcp2221_error | mcp2221_getGPIO (mcp2221_t *device, mcp2221_gpioconfset_t *confGet) |
Get the current GPIO configuration (SRAM) More... | |
mcp2221_error | mcp2221_readADC (mcp2221_t *device, int values[MCP2221_ADC_COUNT]) |
Read ADC values. More... | |
mcp2221_error | mcp2221_readInterrupt (mcp2221_t *device, int *state) |
Read interrupt state. More... | |
mcp2221_error | mcp2221_clearInterrupt (mcp2221_t *device) |
Clear interrupt state. More... | |
mcp2221_error | mcp2221_readGPIO (mcp2221_t *device, mcp2221_gpio_value_t values[MCP2221_GPIO_COUNT]) |
Read GPIO values. More... | |
mcp2221_error | mcp2221_saveManufacturer (mcp2221_t *device, wchar_t *buffer) |
Save new manufacturer USB descriptor string to flash (max 30 characters) More... | |
mcp2221_error | mcp2221_saveProduct (mcp2221_t *device, wchar_t *buffer) |
Save new product USB descriptor string to flash (max 30 characters) More... | |
mcp2221_error | mcp2221_saveSerial (mcp2221_t *device, wchar_t *buffer) |
Save new serial USB descriptor string to flash (max 30 characters) More... | |
mcp2221_error | mcp2221_saveVIDPID (mcp2221_t *device, int vid, int pid) |
Save new VID and PID to flash. More... | |
mcp2221_error | mcp2221_saveSerialEnumerate (mcp2221_t *device, int enumerate) |
Enable/disable enumerating with serial number. More... | |
mcp2221_error | mcp2221_saveMilliamps (mcp2221_t *device, int milliamps) |
Set USB current limit. More... | |
mcp2221_error | mcp2221_savePowerSource (mcp2221_t *device, mcp2221_pwrsrc_t source) |
Set power source. More... | |
mcp2221_error | mcp2221_saveRemoteWakeup (mcp2221_t *device, mcp2221_wakeup_t wakeup) |
Enable/disable remote host wakeup. More... | |
mcp2221_error | mcp2221_savePolarity (mcp2221_t *device, mcp2221_dedipin_t pin, int polarity) |
Save polarity of dedicated pin functions to flash. More... | |
mcp2221_error | mcp2221_saveClockOut (mcp2221_t *device, mcp2221_clkdiv_t div, mcp2221_clkduty_t duty) |
Save clock reference output settings to flash. More... | |
mcp2221_error | mcp2221_saveDAC (mcp2221_t *device, mcp2221_dac_ref_t ref, int value) |
Save the DAC voltage reference and output value to flash. More... | |
mcp2221_error | mcp2221_saveADC (mcp2221_t *device, mcp2221_adc_ref_t ref) |
Save the ADC voltage reference to flash. More... | |
mcp2221_error | mcp2221_saveInterrupt (mcp2221_t *device, mcp2221_int_trig_t trig) |
Save the interrupt trigger mode to flash. More... | |
mcp2221_error | mcp2221_saveGPIOConf (mcp2221_t *device, mcp2221_gpioconfset_t *confSet) |
Save GPIO configuration to flash. More... | |
mcp2221_error | mcp2221_loadManufacturer (mcp2221_t *device, wchar_t *buffer) |
Read manufacturer USB descriptor string from flash. More... | |
mcp2221_error | mcp2221_loadProduct (mcp2221_t *device, wchar_t *buffer) |
Read product USB descriptor string from flash. More... | |
mcp2221_error | mcp2221_loadSerial (mcp2221_t *device, wchar_t *buffer) |
Read serial USB descriptor string from flash. More... | |
mcp2221_error | mcp2221_loadVIDPID (mcp2221_t *device, int *vid, int *pid) |
Read VID and PID from flash. More... | |
mcp2221_error | mcp2221_loadSerialEnumerate (mcp2221_t *device, int *enumerate) |
Read serial enumeration setting from flash. More... | |
mcp2221_error | mcp2221_loadMilliamps (mcp2221_t *device, int *milliamps) |
Read current limit from flash. More... | |
mcp2221_error | mcp2221_loadPowerSource (mcp2221_t *device, mcp2221_pwrsrc_t *source) |
Read power source from flash. More... | |
mcp2221_error | mcp2221_loadRemoteWakeup (mcp2221_t *device, mcp2221_wakeup_t *wakeup) |
Read remote USB host wakeup from flash. More... | |
mcp2221_error | mcp2221_loadPolarity (mcp2221_t *device, mcp2221_dedipin_t pin, int *polarity) |
Read dedicated pin polarity from flash. More... | |
mcp2221_error | mcp2221_loadClockOut (mcp2221_t *device, mcp2221_clkdiv_t *div, mcp2221_clkduty_t *duty) |
Read clock output settings from flash. More... | |
mcp2221_error | mcp2221_loadDAC (mcp2221_t *device, mcp2221_dac_ref_t *ref, int *value) |
Read DAC settings from flash. More... | |
mcp2221_error | mcp2221_loadADC (mcp2221_t *device, mcp2221_adc_ref_t *ref) |
Read ADC settings from flash. More... | |
mcp2221_error | mcp2221_loadInterrupt (mcp2221_t *device, mcp2221_int_trig_t *trig) |
Read interrupt settings from flash. More... | |
mcp2221_error | mcp2221_loadGPIOConf (mcp2221_t *device, mcp2221_gpioconfset_t *confSet) |
Read GPIO config from flash. More... | |
mcp2221_error | mcp2221_i2cWrite (mcp2221_t *device, int address, void *data, int len, mcp2221_i2crw_t type) |
Perform an I2C write. More... | |
mcp2221_error | mcp2221_i2cRead (mcp2221_t *device, int address, int len, mcp2221_i2crw_t type) |
Perform an I2C read. More... | |
mcp2221_error | mcp2221_i2cGet (mcp2221_t *device, void *data, int len) |
Get the data that was read. More... | |
mcp2221_error | mcp2221_i2cCancel (mcp2221_t *device) |
TODO. More... | |
mcp2221_error | mcp2221_i2cState (mcp2221_t *device, mcp2221_i2c_state_t *state) |
TODO. More... | |
mcp2221_error | mcp2221_i2cDivider (mcp2221_t *device, int i2cdiv) |
TODO. More... | |
mcp2221_error | mcp2221_i2cReadPins (mcp2221_t *device, mcp2221_i2cpins_t *pins) |
Read raw values of I2C pins. Allows using these pins as 2 additional input pins. More... | |
#define MCP2221_ADC_COUNT 3 |
ADC count
#define MCP2221_DAC_MAX 31 |
Maximum value of DAC output
#define MCP2221_DEFAULT_MANUFACTURER L"Microchip Technology Inc." |
Default manufacturer descriptor
#define MCP2221_DEFAULT_PID 0x00DD |
Default PID
#define MCP2221_DEFAULT_PRODUCT L"MCP2221 USB-I2C/UART Combo" |
Default product descriptor
#define MCP2221_DEFAULT_VID 0x04D8 |
Default VID
#define MCP2221_GPIO_COUNT 4 |
GPIO pin count
#define MCP2221_GPIO_MODE_ADC MCP2221_GPIO_MODE_ALT1 |
TODO
#define MCP2221_GPIO_MODE_DAC MCP2221_GPIO_MODE_ALT2 |
TODO
#define MCP2221_GPIO_MODE_IOC MCP2221_GPIO_MODE_ALT3 |
TODO
#define MCP2221_GPIO_MODE_SSPND MCP2221_GPIO_MODE_DEDI |
TODO
#define MCP2221_REPORT_SIZE 64 |
HID Report size
#define MCP2221_STR_LEN 31 |
Maximum length of wchar_t USB descriptor strings + 1 for null term
enum mcp2221_adc_ref_t |
enum mcp2221_clkdiv_t |
enum mcp2221_clkduty_t |
enum mcp2221_dac_ref_t |
enum mcp2221_dedipin_t |
enum mcp2221_error |
enum mcp2221_gpio_mode_t |
GPIO modes (check GP DESIGNATION TABLE in the datasheet for what the dedicated and alternative functions do for each pin)
enum mcp2221_gpio_t |
enum mcp2221_gpio_value_t |
enum mcp2221_i2c_state_t |
enum mcp2221_i2crw_t |
enum mcp2221_int_trig_t |
enum mcp2221_pwrsrc_t |
enum mcp2221_wakeup_t |
mcp2221_error mcp2221_clearInterrupt | ( | mcp2221_t * | device | ) |
void mcp2221_close | ( | mcp2221_t * | device | ) |
Close device.
void mcp2221_exit | ( | void | ) |
TODO.
int mcp2221_find | ( | int | vid, |
int | pid, | ||
wchar_t * | manufacturer, | ||
wchar_t * | product, | ||
wchar_t * | serial | ||
) |
Find all HIDs matching the supplied parameters, must be called before attempting to open a device.
[vid] | VID to match, 0 will match all VIDs |
[pid] | PID to match, 0 will match all PIDs |
[manufacturer] | Manufacturer to match, NULL will match all manufacturers |
[product] | Product to match, NULL will match all products |
[serial] | Serial to match, NULL will match all serials (enumerating with serial needs to be enabled for this to work - mcp2221_saveSerialEnumerate()) |
mcp2221_error mcp2221_getADC | ( | mcp2221_t * | device, |
mcp2221_adc_ref_t * | ref | ||
) |
Get the current ADC voltage reference (SRAM)
[device] | Device to operate on |
[ref] | Pointer to mcp2221_adc_ref_t variable where value will be placed |
mcp2221_error mcp2221_getClockOut | ( | mcp2221_t * | device, |
mcp2221_clkdiv_t * | div, | ||
mcp2221_clkduty_t * | duty | ||
) |
Get the current clock output divider (SRAM)
[device] | Device to operate on |
[div] | Pointer to mcp2221_clkdiv_t variable where value will be placed |
[duty] | Pointer to mcp2221_clkduty_t variable where value will be placed |
mcp2221_error mcp2221_getDAC | ( | mcp2221_t * | device, |
mcp2221_dac_ref_t * | ref, | ||
int * | value | ||
) |
Get the current DAC voltage reference and output value (SRAM)
[device] | Device to operate on |
[ref] | Pointer to mcp2221_dac_ref_t variable where value will be placed |
[value] | Pointer to int variable where value will be placed |
mcp2221_error mcp2221_getGPIO | ( | mcp2221_t * | device, |
mcp2221_gpioconfset_t * | confGet | ||
) |
Get the current GPIO configuration (SRAM)
[device] | Device to operate on |
[confGet] | Pointer to mcp2221_gpioconfset_t struct where data will be placed |
mcp2221_error mcp2221_getInterrupt | ( | mcp2221_t * | device, |
mcp2221_int_trig_t * | trig | ||
) |
Get the current interrupt trigger mode (SRAM)
[device] | Device to operate on |
[trig] | Pointer to mcp2221_int_trig_t variable where value will be placed |
mcp2221_gpioconfset_t mcp2221_GPIOConfInit | ( | void | ) |
TODO.
mcp2221_error mcp2221_i2cCancel | ( | mcp2221_t * | device | ) |
TODO.
[device] | Device to operate on |
mcp2221_error mcp2221_i2cDivider | ( | mcp2221_t * | device, |
int | i2cdiv | ||
) |
TODO.
[device] | Device to operate on |
[i2cdiv] | TODO |
mcp2221_error mcp2221_i2cGet | ( | mcp2221_t * | device, |
void * | data, | ||
int | len | ||
) |
Get the data that was read.
[device] | Device to operate on |
[data] | Buffer to place data into |
[len] | Number of bytes to read (max 60) |
mcp2221_error mcp2221_i2cRead | ( | mcp2221_t * | device, |
int | address, | ||
int | len, | ||
mcp2221_i2crw_t | type | ||
) |
Perform an I2C read.
[device] | Device to operate on |
[address] | I2C slave address (7 bit addresses only) |
[len] | Number of bytes to read (max 60) |
[type] | TODO |
mcp2221_error mcp2221_i2cReadPins | ( | mcp2221_t * | device, |
mcp2221_i2cpins_t * | pins | ||
) |
Read raw values of I2C pins. Allows using these pins as 2 additional input pins.
[device] | Device to operate on |
[pins] | Pointer to mcp2221_i2cpins_t struct to place values into |
mcp2221_error mcp2221_i2cState | ( | mcp2221_t * | device, |
mcp2221_i2c_state_t * | state | ||
) |
TODO.
[device] | Device to operate on |
[state] | TODO |
mcp2221_error mcp2221_i2cWrite | ( | mcp2221_t * | device, |
int | address, | ||
void * | data, | ||
int | len, | ||
mcp2221_i2crw_t | type | ||
) |
Perform an I2C write.
[device] | Device to operate on |
[address] | I2C slave address (7 bit addresses only) |
[data] | Data to send |
[len] | Number of bytes to send (max 60) |
[type] | TODO |
mcp2221_error mcp2221_init | ( | void | ) |
Initialise, must be called before anything else!
mcp2221_error mcp2221_isConnected | ( | mcp2221_t * | device | ) |
Check to see if the device is still connected, should return MCP2221_SUCCESS.
[device] | Device to operate on |
mcp2221_error mcp2221_loadADC | ( | mcp2221_t * | device, |
mcp2221_adc_ref_t * | ref | ||
) |
Read ADC settings from flash.
[device] | Device to operate on |
[ref] | TODO |
mcp2221_error mcp2221_loadClockOut | ( | mcp2221_t * | device, |
mcp2221_clkdiv_t * | div, | ||
mcp2221_clkduty_t * | duty | ||
) |
Read clock output settings from flash.
[device] | Device to operate on |
[div] | Pointer to mcp2221_clkdiv_t variable where value will be placed |
[duty] | Pointer to mcp2221_clkduty_t variable where value will be placed |
mcp2221_error mcp2221_loadDAC | ( | mcp2221_t * | device, |
mcp2221_dac_ref_t * | ref, | ||
int * | value | ||
) |
Read DAC settings from flash.
[device] | Device to operate on |
[ref] | TODO |
[value] | TODO |
mcp2221_error mcp2221_loadGPIOConf | ( | mcp2221_t * | device, |
mcp2221_gpioconfset_t * | confSet | ||
) |
Read GPIO config from flash.
[device] | Device to operate on |
[confSet] | TODO |
mcp2221_error mcp2221_loadInterrupt | ( | mcp2221_t * | device, |
mcp2221_int_trig_t * | trig | ||
) |
Read interrupt settings from flash.
[device] | Device to operate on |
[trig] | TODO |
mcp2221_error mcp2221_loadManufacturer | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Read manufacturer USB descriptor string from flash.
[device] | Device to operate on |
[buffer] | Wide string buffer of at least 31 elements (62 bytes) |
mcp2221_error mcp2221_loadMilliamps | ( | mcp2221_t * | device, |
int * | milliamps | ||
) |
Read current limit from flash.
[device] | Device to operate on |
[milliamps] | TODO |
mcp2221_error mcp2221_loadPolarity | ( | mcp2221_t * | device, |
mcp2221_dedipin_t | pin, | ||
int * | polarity | ||
) |
Read dedicated pin polarity from flash.
[device] | Device to operate on |
[pin] | The dedicated pin to read |
[polarity] | TODO |
mcp2221_error mcp2221_loadPowerSource | ( | mcp2221_t * | device, |
mcp2221_pwrsrc_t * | source | ||
) |
Read power source from flash.
[device] | Device to operate on |
[source] | TODO |
mcp2221_error mcp2221_loadProduct | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Read product USB descriptor string from flash.
[device] | Device to operate on |
[buffer] | Wide string buffer of at least 31 elements (62 bytes) |
mcp2221_error mcp2221_loadRemoteWakeup | ( | mcp2221_t * | device, |
mcp2221_wakeup_t * | wakeup | ||
) |
Read remote USB host wakeup from flash.
[device] | Device to operate on |
[wakeup] | TODO |
mcp2221_error mcp2221_loadSerial | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Read serial USB descriptor string from flash.
[device] | Device to operate on |
[buffer] | Wide string buffer of at least 31 elements (62 bytes) |
mcp2221_error mcp2221_loadSerialEnumerate | ( | mcp2221_t * | device, |
int * | enumerate | ||
) |
Read serial enumeration setting from flash.
[device] | Device to operate on |
[enumerate] | TODO |
mcp2221_error mcp2221_loadVIDPID | ( | mcp2221_t * | device, |
int * | vid, | ||
int * | pid | ||
) |
Read VID and PID from flash.
[device] | Device to operate on |
[vid] | TODO |
[pid] |
mcp2221_t* mcp2221_open | ( | void | ) |
Open first MCP2221 device found.
mcp2221_t* mcp2221_open_byIndex | ( | int | idx | ) |
Open device with specified index number (starting from 0 up to however many devices were found)
mcp2221_t* mcp2221_open_bySerial | ( | wchar_t * | serial | ) |
Open device with specified serial.
Serial enumeration must be enable for this to work - mcp2221_saveSerialEnumerate()
mcp2221_error mcp2221_rawReport | ( | mcp2221_t * | device, |
uint8_t * | report | ||
) |
Send a custom report, the response is placed in the same buffer.
[device] | Device to operate on |
[report] | The report, should be an array with at least MCP2221_REPORT_SIZE elements |
mcp2221_error mcp2221_readADC | ( | mcp2221_t * | device, |
int | values[MCP2221_ADC_COUNT] | ||
) |
Read ADC values.
[device] | Device to operate on |
[values] | Int array of at least MCP2221_ADC_COUNT elements where values will be placed |
mcp2221_error mcp2221_readGPIO | ( | mcp2221_t * | device, |
mcp2221_gpio_value_t | values[MCP2221_GPIO_COUNT] | ||
) |
Read GPIO values.
[device] | Device to operate on |
[values] | mcp2221_gpio_value_t array of at least MCP2221_GPIO_COUNT elements where values will be placed |
mcp2221_error mcp2221_readInterrupt | ( | mcp2221_t * | device, |
int * | state | ||
) |
Read interrupt state.
[device] | Device to operate on |
[state] | Pointer to variable where state will be placed (0 = not triggered, 1 = triggered) |
mcp2221_error mcp2221_reset | ( | mcp2221_t * | device | ) |
Perform a reset of the device.
[device] | Device to operate on |
TODO.
mcp2221_error mcp2221_saveADC | ( | mcp2221_t * | device, |
mcp2221_adc_ref_t | ref | ||
) |
Save the ADC voltage reference to flash.
[device] | Device to operate on |
[ref] | Voltage reference |
mcp2221_error mcp2221_saveClockOut | ( | mcp2221_t * | device, |
mcp2221_clkdiv_t | div, | ||
mcp2221_clkduty_t | duty | ||
) |
Save clock reference output settings to flash.
[device] | Device to operate on |
[div] | Frequency divider from 48MHz |
[duty] | Duty cycle |
mcp2221_error mcp2221_saveDAC | ( | mcp2221_t * | device, |
mcp2221_dac_ref_t | ref, | ||
int | value | ||
) |
Save the DAC voltage reference and output value to flash.
[device] | Device to operate on |
[ref] | Voltage reference |
[value] | Output value (0 - 31) |
mcp2221_error mcp2221_saveGPIOConf | ( | mcp2221_t * | device, |
mcp2221_gpioconfset_t * | confSet | ||
) |
Save GPIO configuration to flash.
[device] | Device to operate on |
[confSet] | Pointer to mcp2221_gpioconfset_t struct to place configuration data into |
mcp2221_error mcp2221_saveInterrupt | ( | mcp2221_t * | device, |
mcp2221_int_trig_t | trig | ||
) |
Save the interrupt trigger mode to flash.
[device] | Device to operate on |
[trig] | Trigger mode |
mcp2221_error mcp2221_saveManufacturer | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Save new manufacturer USB descriptor string to flash (max 30 characters)
[device] | Device to operate on |
[buffer] | The wide string buffer to read from |
mcp2221_error mcp2221_saveMilliamps | ( | mcp2221_t * | device, |
int | milliamps | ||
) |
Set USB current limit.
[device] | Device to operate on |
[milliamps] | 2 - 500 |
mcp2221_error mcp2221_savePolarity | ( | mcp2221_t * | device, |
mcp2221_dedipin_t | pin, | ||
int | polarity | ||
) |
Save polarity of dedicated pin functions to flash.
[device] | Device to operate on |
[pin] | Which dedicated pin |
[polarity] | 0 = Default off, 1 = Default on |
mcp2221_error mcp2221_savePowerSource | ( | mcp2221_t * | device, |
mcp2221_pwrsrc_t | source | ||
) |
Set power source.
[device] | Device to operate on |
[source] | Power source |
mcp2221_error mcp2221_saveProduct | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Save new product USB descriptor string to flash (max 30 characters)
[device] | Device to operate on |
[buffer] | The wide string buffer to read from |
mcp2221_error mcp2221_saveRemoteWakeup | ( | mcp2221_t * | device, |
mcp2221_wakeup_t | wakeup | ||
) |
Enable/disable remote host wakeup.
[device] | Device to operate on |
[wakeup] | Enable/disable |
mcp2221_error mcp2221_saveSerial | ( | mcp2221_t * | device, |
wchar_t * | buffer | ||
) |
Save new serial USB descriptor string to flash (max 30 characters)
[device] | Device to operate on |
[buffer] | The wide string buffer to read from |
mcp2221_error mcp2221_saveSerialEnumerate | ( | mcp2221_t * | device, |
int | enumerate | ||
) |
Enable/disable enumerating with serial number.
[device] | Device to operate on |
[enumerate] | 1 = Enable, 0 = Disable |
mcp2221_error mcp2221_saveVIDPID | ( | mcp2221_t * | device, |
int | vid, | ||
int | pid | ||
) |
Save new VID and PID to flash.
[device] | Device to operate on |
[vid] | New VID |
[pid] | New PID |
mcp2221_error mcp2221_setADC | ( | mcp2221_t * | device, |
mcp2221_adc_ref_t | ref | ||
) |
Set the ADC voltage reference (SRAM)
[device] | Device to operate on |
[ref] | Voltage reference |
mcp2221_error mcp2221_setClockOut | ( | mcp2221_t * | device, |
mcp2221_clkdiv_t | div, | ||
mcp2221_clkduty_t | duty | ||
) |
Set the clock reference output divider and duty cycle (SRAM)
[device] | Device to operate on |
[div] | Frequency divider from 48MHz |
[duty] | Duty cycle |
mcp2221_error mcp2221_setDAC | ( | mcp2221_t * | device, |
mcp2221_dac_ref_t | ref, | ||
int | value | ||
) |
Set the DAC voltage reference and output value (SRAM)
[device] | Device to operate on |
[ref] | Voltage reference |
[value] | Output value (0 - 31) |
mcp2221_error mcp2221_setGPIO | ( | mcp2221_t * | device, |
mcp2221_gpio_t | pins, | ||
mcp2221_gpio_value_t | value | ||
) |
Set GPIO pin output values.
[device] | Device to operate on |
[pins] | Which GPIO pins should the new value be applied to |
[value] | The new value |
mcp2221_error mcp2221_setGPIOConf | ( | mcp2221_t * | device, |
mcp2221_gpioconfset_t * | confSet | ||
) |
Apply GPIO configuration.
[device] | Device to operate on |
[confSet] | Pointer to mcp2221_gpioconfset_t struct |
mcp2221_error mcp2221_setInterrupt | ( | mcp2221_t * | device, |
mcp2221_int_trig_t | trig, | ||
int | clearInt | ||
) |
Set the interrupt trigger mode and optionally clear pending interrupt (SRAM)
[device] | Device to operate on |
[trig] | Trigger mode |
[clearInt] | Clear pending interrupt (0 = Don't clear, 1 = Clear) |