WRITE_NC macro for non-critical (non-synchronized) access to

slow ports. The WRITE macro stores the CPU bits on the stack first,
then locks the interupts, reads the port, sets a bit, writes the port
and then finally reverts the CPU bits. The WRITE_NC does not lock
the interrupts, therefore it may only be used where it cannot
be interrupted.
This commit is contained in:
bubnikv 2018-01-12 20:15:59 +01:00
parent 6643f77648
commit db985065ff

View File

@ -66,6 +66,11 @@
#define READ(IO) _READ(IO)
/// Write to a pin wrapper
#define WRITE(IO, v) _WRITE(IO, v)
/// Write to a pin wrapper, non critical.
/// This macro is cheaper than WRITE(IO,v) on ports H,I,J,K,L, as _WRITE_C disables / enables interrupts
/// and stores the old CPU flags on the stack.
/// This macro should only be called, where it cannot be interrupted.
#define WRITE_NC(IO, v) _WRITE_NC(IO, v)
/// toggle a pin wrapper
#define TOGGLE(IO) _TOGGLE(IO)