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. 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//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);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//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);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I want to know where is my mistake?