uraimo / MCP3008.swift

A Swift library for the MCP3008 (and MCP3002,MCP3004) 10 bits SPI ADC
Other
4 stars 1 forks source link

Trying to understand SPI interface #2

Closed rjo closed 2 years ago

rjo commented 2 years ago

I'm reading the MCP3008 datasheet and trying to map my understanding to this code:

https://github.com/uraimo/MCP3008.swift/blob/eaa7e2be68ae8bb1a54cf26609327bcd4b12c98e/Sources/MCP3008.swift#L44

It seems that the start bit is being sent via the first byte in the tx array, but wouldn't that clock out 7 0's before sending the command bits? Is this something peculiar to the ioctl call?

rjo commented 2 years ago

Ahh ... was just reading a C++ MCP3008 driver and realized those zeros are clocked out ahead of the 1. I'm a dummy.