motorcontroldemo_035/Vinclude/V_bits_to_enum_numbers.h
2019-07-29 08:17:46 +03:00

78 lines
2.4 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_bits_to_enum_numbers.h
\brief Ìîäóëü "ëèñòàíèÿ" áèòîâûõ ïåðåìåííûõ (ñì. TBitsToEnumNums)
\author ÎÎÎ "ÍÏÔ Âåêòîð". http://motorcontrol.ru
\version v 2.0 25/03/2016
\defgroup V_bits_to_enum_numbers Ìîäóëü "ëèñòàíèÿ" áèòîâûõ ïåðåìåííûõ (ñì. TBitsToEnumNums)
@{
*/
#ifndef V_BITS_TO_ENUM_NUMS_H
#define V_BITS_TO_ENUM_NUMS_H
#ifdef __cplusplus
extern "C"
{
#endif
//!êîëè÷åñòâî çàðàçåðâèðîâàííûõ ìåñò äëÿ áèòîâûõ ïåðåìåííûõ
#define NUM_OF_W_PTRS 2
/*! \class TBitsToEnumNums
\brief Ìîäóëü "ëèñòàíèÿ" áèòîâûõ ïåðåìåííûõ
Êëàññ \a TBitsToEnumNums, îñíîâàííûé íà ñòðóêòóðå SBitsToEnumNums, ïðåîáðàçóåò
áèòîâûå ïåðåìåííûå â ÷èñëà (ñîîòâåòñòâóþùèå íîìåðàì áèòîâ âõîäíîé ïåðåìåíîé),
ìåíÿþùèåñÿ ñ çàäàííûì èíòåðâàëîì. Çíà÷åíèå â ñàìîì ìëàäøåì áèòå ñîîòâåòñòâóåò 1.
Âûäàåò 0 åñëè íèêàêèå áèòû â ïðîâåðÿåìûõ ñëîâàõ íå óñòàíîâëåíû. Ïðåäïîëàãàåòñÿ äëÿ
"ïðîëèñòûâàíèÿ" áèòîâ ñëîâ àâàðèé è ïðåäóïðåæäåíèé â öåëÿõ âûâîäà íà ÏÓ. */
//! ñì. TBitsToEnumNums
struct SBitsToEnumNums
{
Uint16 out_refresh_devisor;//!< äåëèòåëü, çàäàþùèé òåìï ëèñòàíèÿ
Uint16 counter;//!<ñ÷åò÷èê òàéìàóòà ëèñòàíèÿ
Uint16 num_of_words;//!<êîë-âî áèòîâûõ ïåðåìåííûõ
Uint16 last_word;//!<òåêóùåå ñëîâî
Uint16 last_bit;//!<òåêóùèé áèò
Uint16 *w_ptrs[NUM_OF_W_PTRS]; //!<óêàçàòåëü íà áèòîâûå ïåðåìåííûå (íåñêîëüêî)
Uint16 output;//!<âûõîä ìîäóëÿ (ëèñòàþùååñÿ ÷èñëî)
void (*calc)(volatile struct SBitsToEnumNums*);
};
typedef volatile struct SBitsToEnumNums TBitsToEnumNums;
//!èíèöèàëèçàòîð ïî óìîë÷àíèþ
#define BITS_TO_ENUM_NUMS_DEFAULTS {1000,0,4,0,0,{0},0,\
BitsToEnumNums,\
}
//! \memberof TBitsToEnumNums
void BitsToEnumNums(TBitsToEnumNums*);
#ifdef __cplusplus
}
#endif
#endif
/*@}*/