I want to write several bits at once.
Example:
void modifyLower5Bits(uint32_t value)
{
GPIOA_PDOR = (GPIOA_PDOR & ~0x1f) | (value & 0x1f);
}
This seems like such a basic function and I cannot find a component in Processor Export that can handle more than one bit at a time.
Is the solution to simply do direct port access as shown above, or is there a component method?
I would rather not write:
void modifyLower5Bits(uint32_t value)
{
GPIO_DRV_WritePinOutput(Port_A0, value & 1);
value >>= 1;
GPIO_DRV_WritePinOutput(Port_A1, value & 1);
value >>= 1;
GPIO_DRV_WritePinOutput(Port_A2, value & 1);
value >>= 1;
GPIO_DRV_WritePinOutput(Port_A3, value & 1);
value >>= 1;
GPIO_DRV_WritePinOutput(Port_A4, value & 1);
}
Is this forum the correct forum to ask this question?