for a project, we need to interface an analog sensor which is not using standard protocols like I2C or SPI.
Instead, it uses 6 pins to receive commands. So, if I need to send for example command 0x24, I need to set this value on the 6 GPIOs.
I found an older discussion where a solution to this problem was proposed using some pins (discussed here) but since I am
forced by design to use pins P1.01-P1.06 I am getting a warning from Segger Embedded Studio compiler "left shift count >= width of type".
My code is simply the following
void writeCommandPort(uint8_t value)
uint32_t pin_mask = 0xF << SENSOR_FIRST_PIN;
NRF_GPIO->OUT = (NRF_GPIO->OUT & ~pin_mask) | (value << SENSOR_FIRST_PIN);
//Where SENSOR_FIRST_PIN = NRF_GPIO_PIN_MAP(1,1)
Can someone help me understanding what I am doing wrong?
Thanks a lot!
Tried your code, but couldn't get the warning. Maybe you can share a small SES project + main.c I can run on a nRF52840?
Of course, I did not consider using NRF_P1->OUT directly
Your solution is cleaner, thanks for the help!