Ho to use GPIO_PDDR_PDD(x) in my code efficiently.
Earlier I have used to write it as : PTD->PDDR &= ~((1 << 15) ;
Hi @VaneB ,
For input: base->PDDR &= ~GPIO_PDDR_PDD(pins);
For output: base->PDDR |= GPIO_PDDR_PDD(pins);
Are these lines be passed MISRA-C 2012.?
The SDK driver is MISRA-C: 2012 compliant, but also is documented in the user manual that the driver still contains Violations of MISRA C 2012. Please refer to the below pictures for more information.
hi @VaneB ,
We usually write data direction as,
For input: base->PDDR &= ~GPIO_PDDR_PDD(pins);
For output: base->PDDR |= GPIO_PDDR_PDD(pins);
Help me avoid bitwise operators '|'and '&''.
The suggestion we provide for setting the pin direction always uses '|' and '&''.
As I mentioned before you can refer to the functions PINS_GPIO_SetPinDirection() or PINS_GPIO_SetPinsDirection(). Also, you can refer to the examples provided in the S32K1xx Series Cookbook.
The macro needs to be used as base->PDDR = GPIO_PDDR_PDD(pins);
You can also refer to the SDK functions PINS_GPIO_SetPinDirection() and PINS_GPIO_SetPinsDirection() which use this macro.
B.R.
VaneB