SPI and RFM69
Posted: Tue Apr 11, 2017 2:26 pm
Hello. I need to operate the RFM69HCW module from esp-idf.
I'm trying to adopt this library for ESP32: https://github.com/ahessling/RFM69-STM32
Also, off course, I know the official docs, like: http://esp-idf.readthedocs.io/en/latest ... aster.html
To init the SPI-master mode I'm using something like this:
#define HSPI 2
So, there is two questions: is this is right beginning and how to determine which SPI I'm must to use here. And, may be, somebody has a full example of using SPI in ESP-IDF.
P.S. Sorry, for me, newbye. I'm comming from the Arduino world, and new to ESP things.
I'm trying to adopt this library for ESP32: https://github.com/ahessling/RFM69-STM32
Also, off course, I know the official docs, like: http://esp-idf.readthedocs.io/en/latest ... aster.html
To init the SPI-master mode I'm using something like this:
#define HSPI 2
Code: Select all
//SPI clk = 40MHz
WRITE_PERI_REG(SPI_CLOCK(HSPI), (0<<SPI_CLKDIV_PRE_S) |
(1<<SPI_CLKCNT_N_S)|(1<<SPI_CLKCNT_L_S)|(0<<SPI_CLKCNT_H_S));
WRITE_PERI_REG(SPI_CTRL(HSPI), 0);//SPI_WR_BIT_ORDER);
WRITE_PERI_REG(SPI_USER(HSPI), SPI_CS_SETUP|SPI_CS_HOLD|SPI_USR_MOSI|SPI_WR_BYTE_ORDER);
WRITE_PERI_REG(SPI_USER1(HSPI), (9<<SPI_USR_MOSI_DBITLEN_S));
P.S. Sorry, for me, newbye. I'm comming from the Arduino world, and new to ESP things.