Skip to content

Latest commit

 

History

History
127 lines (79 loc) · 2.54 KB

api_reference.rst

File metadata and controls

127 lines (79 loc) · 2.54 KB

Full API reference

Device Initialization

EasyMCP2221

Device

Pin configuration

EasyMCP2221.Device.set_pin_function

EasyMCP2221.Device.save_config

GPIO

EasyMCP2221.Device.GPIO_read

EasyMCP2221.Device.GPIO_write

ADC - Analog input

EasyMCP2221.Device.ADC_read

EasyMCP2221.Device.ADC_config

DAC - Analog output

EasyMCP2221.Device.DAC_write

EasyMCP2221.Device.DAC_config

Interrupt On Change

EasyMCP2221.Device.IOC_config

EasyMCP2221.Device.IOC_read

EasyMCP2221.Device.IOC_clear

Clock output

EasyMCP2221.Device.clock_config

I2C bus

EasyMCP2221.Device.I2C_Slave

EasyMCP2221.Device.I2C_write

EasyMCP2221.Device.I2C_read

EasyMCP2221.Device.I2C_speed

USB wake-up

EasyMCP2221.Device.enable_power_management

Device reset

EasyMCP2221.Device.reset

Low level and debug

EasyMCP2221.Device.read_flash_info

EasyMCP2221.Device.revision

EasyMCP2221.Device.SRAM_config

EasyMCP2221.Device.send_cmd

EasyMCP2221.Device._i2c_release

EasyMCP2221.Device._i2c_status

EasyMCP2221.Device.cmd_retries

EasyMCP2221.Device.debug_messages

EasyMCP2221.Device.trace_packets

Exceptions

To capture EasyMCP2221.exceptions you must qualify them as EasyMCP2221.exceptions:

try:
    mcp.I2C_read(0x51, 1)
except EasyMCP2221.exceptions.NotAckError:
    print("No device")
    exit()
except EasyMCP2221.exceptions.LowSCLError:
    print("SCL low")

or import them explicitly:

from EasyMCP2221.exceptions import *

...

try:
    mcp.I2C_read(0x51, 1)
except NotAckError:
    print("No device")
    exit()
except LowSCLError:
    print("SCL low")

EasyMCP2221.exceptions.NotAckError

EasyMCP2221.exceptions.TimeoutError

EasyMCP2221.exceptions.LowSCLError

EasyMCP2221.exceptions.LowSDAError