EasyManua.ls Logo

Waveshare NRF52840 - Drive OLED

Waveshare NRF52840
72 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NRF52840 Eval Kit User Manual
Vision: V1.0.1 Date: 2019.01.19 30 / 72
NRF_LOG_INFO("SPI example started.");
NRF_LOG_FLUSH();
while (1)
{
memset(m_rx_buf, 0, m_length);
spi_xfer_done = false;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf,
m_length, m_rx_buf, m_length));
while (!spi_xfer_done)
{
__WFE();
}
NRF_LOG_FLUSH();
nrf_delay_ms(500);
}
}
DRIVE OLED
When you drive OLED via SPI interface, you should notice that:
1. Do not use interrupt callback function when initializing SPI
/*
Doesn't print what to send or what received in SPI
*/
//APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, NULL,
NULL));
/*
Print what to send or what received in SPI
*/
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config,
spi_event_handler, NULL));
2. If you must to add interrupt codes, add delay to it.
void Single_Command(unsigned char cmd)
{
nrf_gpio_pin_clear(DC);
//if SPI is busy Frequently,delay here
nrf_delay_us(30);
spi_write(&cmd, sizeof(cmd));
}