How to Control GPIO Using Registers in Zephyr?

Hi,

As the title suggests, I need to simulate I2C-like functionality using software. Therefore, I want to control GPIO using registers. I attempted the following approach, but the GPIO did not respond at all.

My hardware is nRF5340, and the project example is Matter Lock.

gpio_pin_configure_dt(&comm_data, GPIO_OUTPUT_INACTIVE);  // output low
volatile NRF_GPIO_Type *gpio = NRF_P1;
  
if ((udata & 0x01) == 0) gpio->OUTSET &= ~BIT(BCOMM_DATA_PIN);//gpio_pin_set_dt(&comm_data, 0);
else                     gpio->OUTSET |= BIT(BCOMM_DATA_PIN);//gpio_pin_set_dt(&comm_data, 1);

Parents Reply Children
No Data
Related