bug: IOC macros use raw register masks instead of bitfield accessors #36

Open
opened 2026-08-02 05:57:15 +00:00 by time · 2 comments
Contributor

The ioc_rising/falling/clear_flag macros use (IOCAP |= (1<<(pin))) pattern instead of IOCAPbits.IOCAPx = 1. Not currently used in code but should be fixed for consistency.

The ioc_rising/falling/clear_flag macros use (IOCAP |= (1<<(pin))) pattern instead of IOCAPbits.IOCAPx = 1. Not currently used in code but should be fixed for consistency.
Author
Contributor

Confirmed. The IOC macros (ioc_rising, ioc_falling, ioc_clear_flag) use raw register masks like (IOCAP |= (1<<(pin))) instead of bitfield accessors (IOCAPbits.IOCAP0 = 1).

These macros are currently unused in the codebase. The main I/O macros (pin_write, pin_read, pin_mode_output, etc.) also use raw bit-shifts instead of bitfield accessors, but those are functionally correct and would require a different macro signature since CONCAT(LATA, pin) is used for dynamic pin selection. The IOC macros could be fixed to use bitfield accessors if they're ever used.

Confirmed. The IOC macros (`ioc_rising`, `ioc_falling`, `ioc_clear_flag`) use raw register masks like `(IOCAP |= (1<<(pin)))` instead of bitfield accessors (`IOCAPbits.IOCAP0 = 1`). These macros are currently unused in the codebase. The main I/O macros (`pin_write`, `pin_read`, `pin_mode_output`, etc.) also use raw bit-shifts instead of bitfield accessors, but those are functionally correct and would require a different macro signature since `CONCAT(LATA, pin)` is used for dynamic pin selection. The IOC macros could be fixed to use bitfield accessors if they're ever used.
Author
Contributor

IOC macros still use raw register masks. Not currently used in the codebase, but should be fixed for consistency with the now-bitfield-based pin I/O macros. The pin I/O macros were converted to bitfield accessors in PR #39 (e.g., LATAbits.LATA##p), so the IOC macros should follow the same pattern.

IOC macros still use raw register masks. Not currently used in the codebase, but should be fixed for consistency with the now-bitfield-based pin I/O macros. The pin I/O macros were converted to bitfield accessors in PR #39 (e.g., `LATAbits.LATA##p`), so the IOC macros should follow the same pattern.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
daru/PICsense#36
No description provided.