Hello,
I am currently working on interfacing an e-paper display with the nRF9160 dk using SPI protocol. After some reading I was able to set up the prj.conf, overlay files and started working on the main files just want someone to check If I am moving on the right direction.
overlay:
&spi3 {
compatible ="nordic,nrf_spim";
status = "ok";
sck-pin = <13>;
sda_pin = <>;
cs_pin = <>;
dc_pin = <>;
reset_pin = <>;
busy_pin = <>;
pnlon_pin = <>;
bs_pin = <>;
css_pin = <>;
spi-max-frequency = <8000000>;
};
&gpio0 {
status = "ok";
}
prj.confg
CONFIG_SPM=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y CONFIG_STDOUT_CONSOLE=y CONFIG_LOG=y CONFIG_LOG_DEFAULT_LEVEL=4 CONFIG_HEAP_MEM_POOL_SIZE=16384 # SPI CONFIG_SERIAL=y CONFIG_SPI=y CONFIG_SPI_3=y CONFIG_SPI_SLAVE =y CONFIG_SPI_3_NRF_SPIM=y CONFIG_SPI_3=y CONFIG_SPI_NRFX=y CONFIG_SPI_3_OP_MODES =y CONFIG_MAIN_STACK_SIZE=4096 #GPIO CONFIG_GPIO=y CONFIG_PRINTK=y CONFIG_LOG_PRINTK=y
Also I have a basic question concerning the syntax and the structure
Does the pins to be defined inside the main src file again or just in the overlay. Also If I want to digitally write and read to/from a pin what is the correct syntax and setting the pin as an input or output
digital write and read
for ( int i = 0; i < 8; i++ ) {
if ((( data >> (7 - i) ) & 0x01 ) == 1 ) digitalWrite( SDA_PIN, HIGH );
else digitalWrite( SDA_PIN, LOW );
digitalWrite( SCL_PIN, HIGH );
digitalWrite( SCL_PIN, LOW );
}
setting the pin to output or input
pinMode( SDA_PIN, OUTPUT );
pinMode( CS_PIN, OUTPUT );
from zephyr doc . I can see I can set up the pin mode to input/output using
GPIO_INPUT & GPIO_OUTPUT.
for the digital write/ read it will be gpio_pin_write/read(sda_pin, 1) is that correct