1 |
577 |
jeremybenn |
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
|
2 |
|
|
* File Name : 75x_tb.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 03/10/2006
|
5 |
|
|
* Description : This file contains all the functions prototypes for the
|
6 |
|
|
* TB software library.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 07/17/2006 : V1.0
|
10 |
|
|
* 03/10/2006 : V0.1
|
11 |
|
|
********************************************************************************
|
12 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
13 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
14 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
15 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
16 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
17 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
18 |
|
|
*******************************************************************************/
|
19 |
|
|
|
20 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
21 |
|
|
#ifndef __75x_TB_H
|
22 |
|
|
#define __75x_TB_H
|
23 |
|
|
|
24 |
|
|
/* Includes ------------------------------------------------------------------*/
|
25 |
|
|
#include "75x_map.h"
|
26 |
|
|
|
27 |
|
|
/* Exported types ------------------------------------------------------------*/
|
28 |
|
|
typedef struct
|
29 |
|
|
{
|
30 |
|
|
u16 TB_Mode; /* TB mode */
|
31 |
|
|
u16 TB_ClockSource; /* TB clock source: CK_TIM or CK_RTC */
|
32 |
|
|
u16 TB_CounterMode; /* TB counter mode */
|
33 |
|
|
u16 TB_ICAPolarity; /* TB Input Capture signal Polarity */
|
34 |
|
|
u16 TB_Prescaler; /* TB Prescaler factor */
|
35 |
|
|
u16 TB_AutoReload; /* TB AutoReload factor */
|
36 |
|
|
} TB_InitTypeDef;
|
37 |
|
|
|
38 |
|
|
/* Exported constants --------------------------------------------------------*/
|
39 |
|
|
/* TB modes */
|
40 |
|
|
#define TB_Mode_IC 0x0002
|
41 |
|
|
#define TB_Mode_Timing 0x0001
|
42 |
|
|
|
43 |
|
|
/* TB clock source */
|
44 |
|
|
#define TB_ClockSource_CKTIM 0x0001
|
45 |
|
|
#define TB_ClockSource_CKRTC 0x0002
|
46 |
|
|
|
47 |
|
|
/* TB Input capture polarity */
|
48 |
|
|
#define TB_ICAPolarity_Rising 0x7000
|
49 |
|
|
#define TB_ICAPolarity_Falling 0x8000
|
50 |
|
|
|
51 |
|
|
/* TB counter modes */
|
52 |
|
|
#define TB_CounterMode_Up 0x0000
|
53 |
|
|
#define TB_CounterMode_Down 0x0010
|
54 |
|
|
#define TB_CounterMode_CenterAligned 0x0060
|
55 |
|
|
|
56 |
|
|
/* TB interrupt sources */
|
57 |
|
|
#define TB_IT_Update 0x0001
|
58 |
|
|
#define TB_IT_IC 0x0004
|
59 |
|
|
#define TB_IT_GlobalUpdate 0x8001
|
60 |
|
|
|
61 |
|
|
/* TB Flags */
|
62 |
|
|
#define TB_FLAG_IC 0x0004
|
63 |
|
|
#define TB_FLAG_Update 0x0001
|
64 |
|
|
|
65 |
|
|
/* TB Slave Mode Selection */
|
66 |
|
|
#define TB_SMSMode_Trigger 0x0018
|
67 |
|
|
#define TB_SMSMode_Gated 0x0010
|
68 |
|
|
#define TB_SMSMode_External 0x0008
|
69 |
|
|
#define TB_SMSMode_Reset 0x0000
|
70 |
|
|
|
71 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
72 |
|
|
/* Exported functions ------------------------------------------------------- */
|
73 |
|
|
void TB_DeInit(void);
|
74 |
|
|
void TB_Init(TB_InitTypeDef* TB_InitStruct);
|
75 |
|
|
void TB_StructInit(TB_InitTypeDef *TB_InitStruct);
|
76 |
|
|
void TB_Cmd(FunctionalState Newstate );
|
77 |
|
|
void TB_ITConfig(u16 TB_IT, FunctionalState Newstate);
|
78 |
|
|
void TB_SetPrescaler(u16 Prescaler);
|
79 |
|
|
void TB_ResetCounter(void);
|
80 |
|
|
void TB_DebugCmd(FunctionalState Newstate);
|
81 |
|
|
void TB_CounterModeConfig(u16 TB_CounterMode);
|
82 |
|
|
void TB_SLaveModeConfig(u16 TB_SMSMode);
|
83 |
|
|
u16 TB_GetCounter(void);
|
84 |
|
|
u16 TB_GetICAP1(void);
|
85 |
|
|
void TB_SetCounter(u16 Counter);
|
86 |
|
|
FlagStatus TB_GetFlagStatus(u16 TB_FLAG);
|
87 |
|
|
void TB_ClearFlag(u16 TB_FLAG);
|
88 |
|
|
ITStatus TB_GetITStatus(u16 TB_IT);
|
89 |
|
|
void TB_ClearITPendingBit(u16 TB_IT);
|
90 |
|
|
|
91 |
|
|
#endif /* __75x_TB_H */
|
92 |
|
|
|
93 |
|
|
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
|