/mcp2221-kt

Kotlin library allowing communication with MCP2221(a) devices

Primary LanguageKotlinMIT LicenseMIT

mcp2221-kt

This is a Kotlin library allowing you to communicate with MCP2221 and MCP2221A devices over USB. It supports all of the operations described in the data sheet.

Usage example

import mcp2221.MCP2221Device
import mcp2221.commands.ResetCommand

fun resetDevice() {
    val device = MCP2221Device(".*MCP2221.*")
    // Device is now opened and ready to use.
    
    device.reset()
    // or alternatively:
    device.sendCommand(ResetCommand())
    
    // Output:
    // Device reset.
}

Roadmap

  • improve testing
  • improve error handling
  • add listener functionality to observe GPIO statuses
  • create GUI similar to the utility tool by MicroChip

Acknowledgements

The code is based on this .NET implementation by DerekGn.

License

cf. LICENSE