Hello everyone, i'm currently doing a project with nrf52832 and i just came across a problem. I configured 3 pins as output, then i set 2 pins to high and 1 pin to low. But when i set that third pin to low, the other 2 pins which are currently high immediately turn to low state. Here is my code, thank you for reading.
#include "nrf.h"
#include "system_nrf52.h"
void output(int pin){
NRF_GPIO->PIN_CNF[pin] = (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos) |
(GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) |
(GPIO_PIN_CNF_INPUT_Disconnect << 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);
}
int main(void)
{
output(12);
output(18);
output(23);
SysTick_Config(64);
NRF_GPIO->OUTSET |= (1<<18);
NRF_GPIO->OUTSET |= (1<<12);
NRF_GPIO->OUTCLR |= (1<<23);
while(1)
{
}
}