Closed JonasForssell closed 3 years ago
Jonas,
You are correct that a lot has changed since these snippets were created, especially with the shift to nRF Connect SDK.
Please ask a question at DevZone, the Nordic Semiconductor tech support portal, and I'm sure they can help you out.
Ketil
Thanks. DevZone is kindly promoting ncs and Zephyr level but I finally managed to get a workable example running.
I am no friend of Github and Pullrequests but perhaps this can be useful for someone.
`File : main.c Purpose : Generic application start Uses Pin 0.11 on the 5340DK board
*/
int main(void) {
// Configure GPIO pin as output with standard drive strength. NRF_P0_S->PIN_CNF[PIN_GPIO] = (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos) | (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_PULL_Disabled << GPIO_PIN_CNF_PULL_Pos) | (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos);
// Toggle GPIO ON/OFF. while (1) { uint32_t volatile tmo;
tmo = 100000; while (tmo--); NRF_P0_S->OUTSET = (1UL << PIN_GPIO);
tmo = 100000;
while (tmo--);
NRF_P0_S->OUTCLR = (1UL << PIN_GPIO);
}
}`
Thank you gentlemen for this great contribution. This is exactly the approach I would like to take in learning how to program nrf5340.
However, the examples does not compile. Most likely due to the shift to ncs which nordic has chosen including moving to nrfx.h library.
I tried to compile the gpio_input example but it stopped at the NRF_GPIO->PIN_CNF[LED_GPIO] line. Looked through the nrfx options but could not find anything suitable. NRFX_GPIO is not an option.
Any idea what is the nrfx equivalent?
Thanks /Jonas