HWA
Bare metal programming with style
|
This is a variant of the previous example, showing how using spimaster0_swclk
instead of usi0
can simplify the application.
Gnd [1](2) Vcc Gnd <- CE (3)(4) CSN -> SCL <- SCK (5)(6) MOSI -> DO or MOSI MISO or DI <- MISO (7)(8) IRQ
Note For devices that use an USI to emulate an SPI interface, the MCU is considered a slave regarding the SPI pin names. Pin MISO, output of the nRF, has to be connected to pin MOSI/DI of the MCU, and pin MOSI, input of the nRF, has to be connected to pin MISO/DO of the MCU.
../09-1-swuart-usi-spi-master-nrf24l01+/main.py
should display:
Register CONFIG : 0x00 = 08 Register EN_AA : 0x01 = 3F Register EN_RX_ADDR: 0x02 = 03 Register SETUP_AW : 0x03 = 03 Register SETUP_RETR: 0x04 = 03 Register RF_CH : 0x05 = 02 Register RF_SETUP : 0x06 = 0F Register STATUS : 0x07 = 0E Register RX_ADDR_P0: 0x0A = E7 E7 E7 E7 E7 Register RX_ADDR_P1: 0x0B = C2 C2 C2 C2 C2 Register DYNPD : 0x1C = 00 Register FEATURE : 0x1D = 00
Symbols:
BOARD_H
is the name of the target board header file. It can be defined at compile time via the command line. For example, make BOARD=nanodccduino
will define BOARD_H
as <boards/nanodccduino.h>
. See Development boards for the board definitions provided with HWA.