This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Custom Board pin definitions in Zephyr

Migrating from nRF5 SDK to nRF Connect (Zephyr) what is the best way to define pin names using a custom board? in nRF5 SDK the header file custom_board.h usually defines the pins. Here is a snippet:

#ifndef CUSTOM_H
#define CUSTOM_H

#define LED1			NRF_GPIO_PIN_MAP(1,1)

#define SDA1			NRF_GPIO_PIN_MAP(0,17)
#define SCL1			NRF_GPIO_PIN_MAP(0,19)

#define SENSOR_VCC		NRF_GPIO_PIN_MAP(1,2)

#define ACTIVATE		NRF_GPIO_PIN_MAP(0,16)
#define STOP			NRF_GPIO_PIN_MAP(0,15)

What is the best way to define a gpio pin (e.g. SENSOR_VCC) in Zephyr so that it can be referenced by it's name? A define in the application will "hardcode" the pin number and make the code less portable. Is there another way? Editing the dts file?

Parents Reply Children
No Data
Related