Closed jlarnal closed 2 years ago
Addendum : transfers shorter than 32 bits (4 bytes) aren't forbidden on ESP32 by the way, they're just really inefficient (DMA transfers are costly to initialize and arbiter, so not really worth it for small buffers) .
You SHOULD however ensure that the given buffer is in DMA-capable space, and that its address IS a multiple of 4 (i.e. on a DWORD boundary), otherwise... Panic on the core ! 😅
Great to know! But I think n % 4 != 0
is more intuitive than n & 3
. Thank you for the suggestion.
Dear author. I see you use this syntax when checking the size requirement of the buffers used in the Master::transfer(...) methods :
I'd recommend this 🤔 :
It saves us a division, and depending on the arch ( Xtensa or Risc-V (for ESP32-C3) ) the operation can be optimized to operate only the least significant byte of "n", regardless of the variable's bytesize.
😘