Drive Oled - Waveshare NRF52840 User Manual

Eval kit
Table of Contents

Advertisement

NRF52840 Eval Kit User Manual
NRF_LOG_INFO("SPI example
NRF_LOG_FLUSH();
while
(1)
{
memset(m_rx_buf, 0, m_length);
spi_xfer_done
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
{
nrf_gpio_pin_clear(DC);
//if SPI is busy Frequently,delay here
nrf_delay_us(30);
spi_write(&cmd, sizeof(cmd));
}
Vision: V1.0.1 Date: 2019.01.19
started.");
= false;
cmd)
30 / 72

Advertisement

Table of Contents
loading

Table of Contents