Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
aa7d527fbThis file is pinned to the selected release. Download the original to open it in your design tool.
COMP(fan);
HAL_PIN(fan) = 0.0;
HAL_PIN(tacho) = 0.0;
INIT(
RCC_AHB1PeriphClockCmd(FAN_IO_RCC, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
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 = FAN_PIN;
GPIO_Init(FAN_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_Init(GPIOC, &GPIO_InitStructure);
);
NRT(
if(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_13)){
PIN(tacho) = 1.0;
}
else{
PIN(tacho) = 0.0;
}
if(PIN(fan) > 0)
GPIO_SetBits(FAN_PORT, FAN_PIN);
else
GPIO_ResetBits(FAN_PORT, FAN_PIN);
);
ENDCOMP;