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?
Hello Ken,
In SDK, there isn't the function can set more than one bit . I recommend you directly use the method you mentioned .
And in the initialization , if you want configure some gpio, you can configure here :
then after generate code , you can see the code here :
Hope it helps
Alice