#ifdef CMD_TX
#error at the moment you can only have one component using the tx channel of the command port
#else
#define CMD_TX
#endif

HAL_COMP(en);

HAL_PIN(en) = 0.0;
HAL_PIN(txen) = 0.0;

RT_INIT(//TODO: change init, implement deinit
	 //PC12 TX
	 //PB13 TXEN


    GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
    GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_NOPULL;

    GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_12;
    GPIO_Init(GPIOC, &GPIO_InitStructure);
    GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_13;
    GPIO_Init(GPIOB, &GPIO_InitStructure);
);

RT(
	if(PIN(txen) > 0){
		GPIO_SetBits(GPIOB, GPIO_Pin_13);
	}
	else{
		GPIO_ResetBits(GPIOB, GPIO_Pin_13);
	}

	if(PIN(en) > 0)
		GPIO_SetBits(GPIOC, GPIO_Pin_12);
	else
		GPIO_ResetBits(GPIOC, GPIO_Pin_12);
);

ENDCOMP;
