Spark Logic

beginTransaction in SPI library

tve Fri Aug 10, 2018 4:31 am

I’m trying to grok what ‘beginTransaction’ does in the SPI library. It has nothing to do with transactions, right? It’s more like defining a channel to talk to one remote device on the bus using a specific select pin, right? I don’t see anything that guarantees atomicity or any other property commonly associated with the term transaction. It doesn’t even begin a bus transaction. So just confusing name?

Replies

heisan Fri Aug 10, 2018 8:26 pm

[Rick Kimball – Fri Aug 10, 2018 8:07 pm] – …Are you actually using this feature? I think doing SPI transactions in an interrupt handler is a massively stupid approach.

Here I must agree, if you ever end up doing SPI or Wire calls inside an interrupt handler, you probably have a lot more to worry about than transaction safety…

More interesting yet, is that blocking interrupts does not stop yield() calls, so you would still need another interlock mechanism if you use yield() for concurrency.

Sign in to reply