HWA
Bare metal programming with style
|
A class _spia
object is a Serial Peripheral Interface. It has the following relatives:
pin_mosi
: the MOSI pinpin_miso
: the MISO pinpin_sck
: the SCK pinpin_ss
: the SS pinIt is used by:
Class _spia
objects can trigger the following IRQs:
spi0
: transfer completeconfigure
:
Note 1 When configured in master or slave mode, the SPI automatically configures its related I/O pins as inputs or outputs according to the mode.
Note 2 In master mode, if the SS pin is configured as an input, it must be held high. Otherwise the SPI will be automatically turned into slave mode by hardware as soon as the SS pin goes low.
read
:
write
:
turn
: when the SPI is turned on, it takes control of the MOSI and MISO pins.
stat
: returns the collision
flag:
Reading the "transfer complete" flag:
The "transfer complete" flag is cleared by hardware when the corresponding ISR is executed. It is also cleared when the SPI is read or written after the flag has been read:
Class _spia
objects hold the following hardware registers:
cr
: control registersr
: status registerdr
: data registerthat hold the following logical registers:
en
: spi enabledord
: data ordermstr
: master/slavecpol
: clock polaritycpha
: clock phasexpr
: clock prescalerwcol
: write collisionsp2x
: double clock speedie
: overflow interrupt maskif
: overflow interrupt flag