Hi everyone,
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!