vpaeder / pymcp2221

A python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters
https://pypi.org/project/pymcp2221
MIT License
5 stars 2 forks source link

_write_sram: copy settings if no GPIO operation #10

Closed jremmet closed 1 year ago

jremmet commented 1 year ago

By now we lost a GP Designation if we write a new one: .gpio2_write_function(GPIO2Function.ADC2) gpio2_read_function() <GPIO2Function.ADC2: 2> gpio3_read_function() <GPIO3Function.GPIO: 0> gpio3_write_function(GPIO3Function.ADC3) gpio2_read_function() <GPIO2Function.GPIO: 0>

jremmet commented 1 year ago

We may even move this down into he elif clause https://github.com/vpaeder/pymcp2221/blob/03a6d647190c2c3fd7aa1ddb42f341e415c5773e/mcp2221/__init__.py#L370

vpaeder commented 1 year ago

That's fine this way since the expensive operations are needed anyway either way. Thanks for spotting this one.