This group contains macros and defines to initialize port pins for output and safely set output states.
More...
This group contains macros and defines to initialize port pins for output and safely set output states.
§ IO_PORT_DRAIN_DISABLE
#define IO_PORT_DRAIN_DISABLE 0 |
Bit mask to disable drain mode for all selected pins.
§ IO_PORT_DRAIN_ENABLE
#define IO_PORT_DRAIN_ENABLE 0xff |
Bit mask to enable drain mode for all selected pins.
§ IO_PORT_OUT_INIT
#define IO_PORT_OUT_INIT |
( |
|
port, |
|
|
|
pins, |
|
|
|
strength, |
|
|
|
drain, |
|
|
|
on, |
|
|
|
set |
|
) |
| |
Value:{ \
port##_DIR |= pins; \
SFR_PAGE(_pp3, noSST); \
port##_OD &= (drain) | ~(pins); \
port##_OD |= (drain) & (pins); \
port##_DS &= (strength) | ~(pins); \
port##_DS |= (strength) & (pins); \
SFR_PAGE(_pp0, noSST); \
port##_DATA &= ((set) ^ ~(on)) | ~(pins); \
port##_DATA |= ((set) ^ ~(on)) & (pins); \
}
Initializes a set of port pins as outputs.
- Warning
- Expects port page 0 and RMAP 0, take care in ISRs
- Parameters
-
port | The parallel port to configure |
pins | A bit mask of the pins to select |
strength | A bit mask of pins with strong drive strength |
drain | A bit mask of pins that only drive GND |
on | A bit mask of pins that defines the states which represent on |
- See also
- IO_PORT_ON_GND
-
IO_PORT_ON_HIGH
- Parameters
-
set | Initial logical values for the defined outputs |
§ IO_PORT_OUT_SET
#define IO_PORT_OUT_SET |
( |
|
port, |
|
|
|
pins, |
|
|
|
on, |
|
|
|
set |
|
) |
| |
Value:{\
port##_DATA &= ((set) ^ ~(on)) | ~(pins); \
port##_DATA |= ((set) ^ ~(on)) & (pins); \
}
Set a set of output port pins.
- Warning
- Expects port page 0 and RMAP 0, take care in ISRs
- Parameters
-
port | The parallel port to set |
pins | A bit mask of the pins to select |
on | A bit mask of pins that defines the states which represent on |
- See also
- IO_PORT_ON_GND
-
IO_PORT_ON_HIGH
- Parameters
-
set | Set logical values for the defined outputs |
§ IO_PORT_STRENGTH_STRONG
#define IO_PORT_STRENGTH_STRONG 0xff |
Bit mask to set strong drive strength for all selected pins.
§ IO_PORT_STRENGTH_WEAK
#define IO_PORT_STRENGTH_WEAK 0 |
Bit mask to set weak drive strength for all selected pins.