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

How Can I Multiple Pins Configurated

I try multiple pins set. My pro code is here. 

//unsigned char sutunlar;

void Sutun_Cikislari(void)
{
  nrf_gpio_cfg_output(LED_DENEME);
//  sutunlar = NRF_GPIO->DIRSET & ((1UL << SUTUN_1) | (1UL << SUTUN_2) | (1UL << SUTUN_3));
  nrf_gpio_cfg_output(SUTUN_1);
  nrf_gpio_cfg_output(SUTUN_2);
  nrf_gpio_cfg_output(SUTUN_3);
  nrf_gpio_pin_set(SUTUN_1);
  nrf_gpio_pin_set(SUTUN_2);
  nrf_gpio_pin_set(SUTUN_3);
//  nrf_gpio_pin_set(sutunlar);
  nrf_gpio_cfg_input(SATIR_1, NRF_GPIOTE_POLARITY_LOTOHI);
  nrf_gpio_pin_read(SATIR_1);
  nrf_gpio_cfg_input(SATIR_2, NRF_GPIOTE_POLARITY_LOTOHI);
  nrf_gpio_pin_read(SATIR_2);

But this is not clear. I want to decrease my code line. Then I tried this.

//unsigned char sutunlar;

void Sutun_Cikislari(void)
{
  nrf_gpio_cfg_output(LED_DENEME);
  sutunlar = NRF_GPIO->DIRSET & ((1UL << SUTUN_1) | (1UL << SUTUN_2) | (1UL << SUTUN_3));
//  nrf_gpio_cfg_output(SUTUN_1);
//  nrf_gpio_cfg_output(SUTUN_2);
//  nrf_gpio_cfg_output(SUTUN_3);
//  nrf_gpio_pin_set(SUTUN_1);
//  nrf_gpio_pin_set(SUTUN_2);
//  nrf_gpio_pin_set(SUTUN_3);
  nrf_gpio_pin_set(sutunlar);
  nrf_gpio_cfg_input(SATIR_1, NRF_GPIOTE_POLARITY_LOTOHI);
  nrf_gpio_pin_read(SATIR_1);
  nrf_gpio_cfg_input(SATIR_2, NRF_GPIOTE_POLARITY_LOTOHI);
  nrf_gpio_pin_read(SATIR_2);

I want to know where is my mistake?

Parents Reply Children
No Data
Related