Add support for mcp23xxx IO expanders, SPI and IIC variants. Interrupt support left out for now.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 66720 Build 63603: arc lint + arc unit
Event Timeline
The new files (excluding the makefiles) are missing licenses.
sys/conf/files | ||
---|---|---|
1737–1738 | ||
sys/dev/gpio/mcp23017.c | ||
16 | This is unused. | |
42 | Wouldn't buf[1] be uninitialized if sc->npin isn't 16? | |
65–66 | ||
117–131 | We traditionally put these here. | |
sys/dev/gpio/mcp23s17.c | ||
37 | Not very familiar with the SPI stuff. Is this guaranteed to work? It looks odd to me. | |
71–72 | ||
105–106 | ||
sys/dev/gpio/mcp23xxx.c | ||
78 | ||
103 | ||
152 | I'm confused by this. What does pin direction have to do with toggling the pin? | |
291 | I know this is done elsewhere, but style(9) prohibits it. |
Update code for style(9)
Add licenses
Fix pin toggle using sc->dir instead of sc->gpio
sys/dev/gpio/mcp23017.c | ||
---|---|---|
42 | It should be fine since the upper bits aren't used if npin is not 16, but not 100% sure. | |
sys/dev/gpio/mcp23s17.c | ||
37 | It might actually be driver dependent, if it sends the data before receiving. Might require a discard buffer just in case. |
The inline comments are in wildly incorrect places now, I'm not sure if I can fix that.
sys/dev/gpio/mcp23017.c | ||
---|---|---|
42 |
They are used either way. (uint16_t)buf[1] << 8
I think it would be better to explicitly initialize it to zero. Default initialization is a C23 extension. :) |
sys/dev/gpio/mcp23017.c | ||
---|---|---|
42 |
Correction: empty initialization is a C23 thing. |