Лучше через inline функции*
#define RS485_ENABLE_PORT PORTE
#define RS485_ENABLE_PIN 1
#define RS485_ENABLE_CTRL PIN1CTRL
#define RS485_DIRECTION_PORT PORTE
#define RS485_DIRECTION_PIN 0
#define RS485_DIRECTION_CTRL PIN0CTRL
INLINE static void Rs485_232_Enable()
{
RS485_ENABLE_PORT.RS485_ENABLE_CTRL=PORT_OPC_TOTEM_gc;
RS485_ENABLE_PORT.DIRSET=1<<RS485_ENABLE_PIN;
RS485_ENABLE_PORT.OUTCLR=1<<RS485_ENABLE_PIN;
}
INLINE static void Rs485_Disable()
{
RS485_ENABLE_PORT.RS485_ENABLE_CTRL=PORT_OPC_TOTEM_gc;
RS485_ENABLE_PORT.DIRSET=1<<RS485_ENABLE_PIN;
RS485_ENABLE_PORT.OUTSET=1<<RS485_ENABLE_PIN;
}
INLINE static void Rs485_EnableTx()
{
RS485_DIRECTION_PORT.RS485_DIRECTION_CTRL=PORT_OPC_TOTEM_gc;
RS485_DIRECTION_PORT.DIRSET=1<<RS485_DIRECTION_PIN;
RS485_DIRECTION_PORT.OUTSET=1<<RS485_DIRECTION_PIN;
}
INLINE static void Rs485_DisableTx()
{
RS485_DIRECTION_PORT.RS485_DIRECTION_CTRL=PORT_OPC_TOTEM_gc;
RS485_DIRECTION_PORT.DIRSET=1<<RS485_DIRECTION_PIN;
RS485_DIRECTION_PORT.OUTCLR=1<<RS485_DIRECTION_PIN;
}
Или с помощью шаблонов (если МК позволяет конечно).