77 lines
2.0 KiB
C
77 lines
2.0 KiB
C
/*!
|
|
Copyright 2017 ÀÎ "ÍÈÈÝÒ" è ÎÎÎ "ÍÏÔ ÂÅÊÒÎÐ"
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
\file V_Fan.h
|
|
\brief Ìîäóëü ðàáîòû âåíòèëÿòîðà
|
|
\author ÎÎÎ "ÍÏÔ Âåêòîð". http://motorcontrol.ru
|
|
\version v 1.0 25/08/2017
|
|
|
|
\addtogroup
|
|
@{*/
|
|
|
|
|
|
#ifndef V_FAN_H
|
|
#define V_FAN_H
|
|
|
|
|
|
//! âåíòèëÿòîð âûêëþ÷åí
|
|
#define FAN_CONTROL_STATE_OFF 0
|
|
//! âåíòèëÿòîð âêëþ÷åí
|
|
#define FAN_CONTROL_STATE_ON 1
|
|
//! ñîñòîÿíèå ïåðåãðåâà
|
|
#define FAN_CONTROL_STATE_OVERHEAT 2
|
|
|
|
/* Âêëþ÷åíèå è âûêëþ÷åíèå âåíòèëÿòîðà */
|
|
#define FAN_ON GPIOB->DATAOUTSET = GPIO_PIN_13
|
|
#define FAN_OFF GPIOB->DATAOUTCLR = GPIO_PIN_13
|
|
|
|
|
|
struct SFanControl{
|
|
Uint16 Enabled;
|
|
|
|
int state; //!<ñîñòîÿíèå
|
|
int state_shadow;//!< ñîñòîÿíèå òåíåâîå
|
|
int state_prev;//!<ñîñòîÿíèå ïðåäûäóùåå
|
|
int StateOn;//!<äâîè÷íîå ñîñòîÿíèå: âêëþ÷åí/íå âêëþ÷åí
|
|
|
|
long T_on;//!<òåìïåðàòóðà âêëþ÷åíèÿ
|
|
long T_off;//!<òåìïåðàòóðà âûêëþ÷åíèÿ
|
|
long T_alarm;//!òåìïåðàòóðà âûâîäà ïðåäóïðåæäåíèÿ
|
|
void (*init)(volatile struct SFanControl*);
|
|
void (*slow_calc)(volatile struct SFanControl*);
|
|
};
|
|
|
|
typedef volatile struct SFanControl TFanControl;
|
|
|
|
|
|
|
|
//! \memberof TFanControl
|
|
void FanControl_init(TFanControl*);
|
|
//! \memberof TFanControl
|
|
void FanControl_slow_calc(TFanControl*); //ðàñ÷åò â ôîíîâîì ðåæèìå
|
|
|
|
|
|
#define FAN_CONTROL_DEFAULTS {0,\
|
|
FAN_CONTROL_STATE_OFF,FAN_CONTROL_STATE_OFF,FAN_CONTROL_STATE_OFF,0,\
|
|
_IQ(2.5),_IQ(2), _IQ(4),\
|
|
FanControl_init,\
|
|
FanControl_slow_calc}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
/*@}*/
|