stm8l15x_tim1.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_tim1.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the TIM1 firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_TIM1_H
  30. #define __STM8L15x_TIM1_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup TIM1
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup TIM1_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup TIM1_Output_Compare_Mode
  44. * @{
  45. */
  46. typedef enum
  47. {
  48. TIM1_OCMode_Timing = ((uint8_t)0x00),
  49. TIM1_OCMode_Active = ((uint8_t)0x10),
  50. TIM1_OCMode_Inactive = ((uint8_t)0x20),
  51. TIM1_OCMode_Toggle = ((uint8_t)0x30),
  52. TIM1_OCMode_PWM1 = ((uint8_t)0x60),
  53. TIM1_OCMode_PWM2 = ((uint8_t)0x70)
  54. }TIM1_OCMode_TypeDef;
  55. /**
  56. * @}
  57. */
  58. /** @defgroup TIM1_One_Pulse_Mode
  59. * @{
  60. */
  61. typedef enum
  62. {
  63. TIM1_OPMode_Single = ((uint8_t)0x01),
  64. TIM1_OPMode_Repetitive = ((uint8_t)0x00)
  65. }TIM1_OPMode_TypeDef;
  66. /**
  67. * @}
  68. */
  69. /** @defgroup TIM1_Channels
  70. * @{
  71. */
  72. typedef enum
  73. {
  74. TIM1_Channel_1 = ((uint8_t)0x00),
  75. TIM1_Channel_2 = ((uint8_t)0x01),
  76. TIM1_Channel_3 = ((uint8_t)0x02),
  77. TIM1_Channel_4 = ((uint8_t)0x03)
  78. }TIM1_Channel_TypeDef;
  79. /**
  80. * @}
  81. */
  82. /** @defgroup TIM1_Counter_Mode
  83. * @{
  84. */
  85. typedef enum
  86. {
  87. TIM1_CounterMode_Up = ((uint8_t)0x00),
  88. TIM1_CounterMode_Down = ((uint8_t)0x10),
  89. TIM1_CounterMode_CenterAligned1 = ((uint8_t)0x20),
  90. TIM1_CounterMode_CenterAligned2 = ((uint8_t)0x40),
  91. TIM1_CounterMode_CenterAligned3 = ((uint8_t)0x60)
  92. }TIM1_CounterMode_TypeDef;
  93. /**
  94. * @}
  95. */
  96. /** @defgroup TIM1_Output_Compare_Polarity
  97. * @{
  98. */
  99. typedef enum
  100. {
  101. TIM1_OCPolarity_High = ((uint8_t)0x00),
  102. TIM1_OCPolarity_Low = ((uint8_t)0x22)
  103. }TIM1_OCPolarity_TypeDef;
  104. /**
  105. * @}
  106. */
  107. /** @defgroup TIM1_Output_Compare_N_Polarity
  108. * @{
  109. */
  110. typedef enum
  111. {
  112. TIM1_OCNPolarity_High = ((uint8_t)0x00),
  113. TIM1_OCNPolarity_Low = ((uint8_t)0x88)
  114. }TIM1_OCNPolarity_TypeDef;
  115. /**
  116. * @}
  117. */
  118. /** @defgroup TIM1_Output_State
  119. * @{
  120. */
  121. typedef enum
  122. {
  123. TIM1_OutputState_Disable = ((uint8_t)0x00),
  124. TIM1_OutputState_Enable = ((uint8_t)0x11)
  125. }TIM1_OutputState_TypeDef;
  126. /**
  127. * @}
  128. */
  129. /** @defgroup TIM1_Output_N_State
  130. * @{
  131. */
  132. typedef enum
  133. {
  134. TIM1_OutputNState_Disable = ((uint8_t)0x00),
  135. TIM1_OutputNState_Enable = ((uint8_t)0x44)
  136. } TIM1_OutputNState_TypeDef;
  137. /**
  138. * @}
  139. */
  140. /** @defgroup TIM1_Break_State
  141. * @{
  142. */
  143. typedef enum
  144. {
  145. TIM1_BreakState_Enable = ((uint8_t)0x10),
  146. TIM1_BreakState_Disable = ((uint8_t)0x00)
  147. }TIM1_BreakState_TypeDef;
  148. /**
  149. * @}
  150. */
  151. /** @defgroup TIM1_Break_Polarity
  152. * @{
  153. */
  154. typedef enum
  155. {
  156. TIM1_BreakPolarity_Low = ((uint8_t)0x00),
  157. TIM1_BreakPolarity_High = ((uint8_t)0x20)
  158. }TIM1_BreakPolarity_TypeDef;
  159. /**
  160. * @}
  161. */
  162. /** @defgroup TIM1_Automatic_Output
  163. * @{
  164. */
  165. typedef enum
  166. {
  167. TIM1_AutomaticOutput_Enable = ((uint8_t)0x40),
  168. TIM1_AutomaticOutput_Disable = ((uint8_t)0x00)
  169. }TIM1_AutomaticOutput_TypeDef;
  170. /**
  171. * @}
  172. */
  173. /** @defgroup TIM1_Lock_Level
  174. * @{
  175. */
  176. typedef enum
  177. {
  178. TIM1_LockLevel_Off = ((uint8_t)0x00),
  179. TIM1_LockLevel_1 = ((uint8_t)0x01),
  180. TIM1_LockLevel_2 = ((uint8_t)0x02),
  181. TIM1_LockLevel_3 = ((uint8_t)0x03)
  182. }TIM1_LockLevel_TypeDef;
  183. /**
  184. * @}
  185. */
  186. /** @defgroup TIM1_OSSI_State
  187. * @{
  188. */
  189. typedef enum
  190. {
  191. TIM1_OSSIState_Enable = ((uint8_t)0x04),
  192. TIM1_OSSIState_Disable = ((uint8_t)0x00)
  193. }TIM1_OSSIState_TypeDef;
  194. /**
  195. * @}
  196. */
  197. /** @defgroup TIM1_Output_Compare_Idle_state
  198. * @{
  199. */
  200. typedef enum
  201. {
  202. TIM1_OCIdleState_Set = ((uint8_t)0x55),
  203. TIM1_OCIdleState_Reset = ((uint8_t)0x00)
  204. }TIM1_OCIdleState_TypeDef;
  205. /**
  206. * @}
  207. */
  208. /** @defgroup TIM1_Output_Compare_N_Idle_state
  209. * @{
  210. */
  211. typedef enum
  212. {
  213. TIM1_OCNIdleState_Set = ((uint8_t)0x2A),
  214. TIM1_OCNIdleState_Reset = ((uint8_t)0x00)
  215. }TIM1_OCNIdleState_TypeDef;
  216. /**
  217. * @}
  218. */
  219. /** @defgroup TIM1_Input_Capture_Polarity
  220. * @{
  221. */
  222. typedef enum
  223. {
  224. TIM1_ICPolarity_Rising = ((uint8_t)0x00),
  225. TIM1_ICPolarity_Falling = ((uint8_t)0x01)
  226. }TIM1_ICPolarity_TypeDef;
  227. /**
  228. * @}
  229. */
  230. /** @defgroup TIM1_Input_Capture_Selection
  231. * @{
  232. */
  233. typedef enum
  234. {
  235. TIM1_ICSelection_DirectTI = ((uint8_t)0x01),
  236. TIM1_ICSelection_IndirectTI = ((uint8_t)0x02),
  237. TIM1_ICSelection_TRGI = ((uint8_t)0x03)
  238. }TIM1_ICSelection_TypeDef;
  239. /**
  240. * @}
  241. */
  242. /** @defgroup TIM1_Input_Capture_Prescaler
  243. * @{
  244. */
  245. typedef enum
  246. {
  247. TIM1_ICPSC_DIV1 = ((uint8_t)0x00),
  248. TIM1_ICPSC_DIV2 = ((uint8_t)0x04),
  249. TIM1_ICPSC_DIV4 = ((uint8_t)0x08),
  250. TIM1_ICPSC_DIV8 = ((uint8_t)0x0C)
  251. }TIM1_ICPSC_TypeDef;
  252. /**
  253. * @}
  254. */
  255. /** @defgroup TIM1_Output_Compare_Reference_Clear
  256. * @{
  257. */
  258. typedef enum
  259. {
  260. TIM1_OCReferenceClear_ETRF = ((uint8_t)0x08),
  261. TIM1_OCReferenceClear_OCREFCLR = ((uint8_t)0x00)
  262. }
  263. TIM1_OCReferenceClear_TypeDef;
  264. /**
  265. * @}
  266. */
  267. /** @defgroup TIM1_Interrupts
  268. * @{
  269. */
  270. typedef enum
  271. {
  272. TIM1_IT_Update = ((uint8_t)0x01),
  273. TIM1_IT_CC1 = ((uint8_t)0x02),
  274. TIM1_IT_CC2 = ((uint8_t)0x04),
  275. TIM1_IT_CC3 = ((uint8_t)0x08),
  276. TIM1_IT_CC4 = ((uint8_t)0x10),
  277. TIM1_IT_COM = ((uint8_t)0x20),
  278. TIM1_IT_Trigger = ((uint8_t)0x40),
  279. TIM1_IT_Break = ((uint8_t)0x80)
  280. }TIM1_IT_TypeDef;
  281. /**
  282. * @}
  283. */
  284. /** @defgroup TIM1_External_Trigger_Prescaler
  285. * @{
  286. */
  287. typedef enum
  288. {
  289. TIM1_ExtTRGPSC_OFF = ((uint8_t)0x00),
  290. TIM1_ExtTRGPSC_DIV2 = ((uint8_t)0x10),
  291. TIM1_ExtTRGPSC_DIV4 = ((uint8_t)0x20),
  292. TIM1_ExtTRGPSC_DIV8 = ((uint8_t)0x30)
  293. }TIM1_ExtTRGPSC_TypeDef;
  294. /**
  295. * @}
  296. */
  297. /** @defgroup TIM1_Internal_Trigger_Selection
  298. * @{
  299. */
  300. typedef enum
  301. {
  302. TIM1_TRGSelection_TIM4 = ((uint8_t)0x00), /*!< TRIG Input source = TIM TRIG Output */
  303. TIM1_TRGSelection_TIM5 = ((uint8_t)0x10), /*!< TRIG Input source = TIM TRIG Output */
  304. TIM1_TRGSelection_TIM3 = ((uint8_t)0x20), /*!< TRIG Input source = TIM TRIG Output */
  305. TIM1_TRGSelection_TIM2 = ((uint8_t)0x30), /*!< TRIG Input source = TIM TRIG Output */
  306. TIM1_TRGSelection_TI1F_ED = ((uint8_t)0x40),
  307. TIM1_TRGSelection_TI1FP1 = ((uint8_t)0x50),
  308. TIM1_TRGSelection_TI2FP2 = ((uint8_t)0x60),
  309. TIM1_TRGSelection_ETRF = ((uint8_t)0x70)
  310. }TIM1_TRGSelection_TypeDef;
  311. /**
  312. * @}
  313. */
  314. /** @defgroup TIM1_TI_External_Clock_Source
  315. * @{
  316. */
  317. typedef enum
  318. {
  319. TIM1_TIxExternalCLK1Source_TI1ED = ((uint8_t)0x40),
  320. TIM1_TIxExternalCLK1Source_TI1 = ((uint8_t)0x50),
  321. TIM1_TIxExternalCLK1Source_TI2 = ((uint8_t)0x60)
  322. }TIM1_TIxExternalCLK1Source_TypeDef;
  323. /**
  324. * @}
  325. */
  326. /** @defgroup TIM1_External_Trigger_Polarity
  327. * @{
  328. */
  329. typedef enum
  330. {
  331. TIM1_ExtTRGPolarity_Inverted = ((uint8_t)0x80),
  332. TIM1_ExtTRGPolarity_NonInverted = ((uint8_t)0x00)
  333. }TIM1_ExtTRGPolarity_TypeDef;
  334. /**
  335. * @}
  336. */
  337. /** @defgroup TIM1_Prescaler_Reload_Mode
  338. * @{
  339. */
  340. typedef enum
  341. {
  342. TIM1_PSCReloadMode_Update = ((uint8_t)0x00),
  343. TIM1_PSCReloadMode_Immediate = ((uint8_t)0x01)
  344. }TIM1_PSCReloadMode_TypeDef;
  345. /**
  346. * @}
  347. */
  348. /** @defgroup TIM1_Encoder_Mode
  349. * @{
  350. */
  351. typedef enum
  352. {
  353. TIM1_EncoderMode_TI1 = ((uint8_t)0x01),
  354. TIM1_EncoderMode_TI2 = ((uint8_t)0x02),
  355. TIM1_EncoderMode_TI12 = ((uint8_t)0x03)
  356. }TIM1_EncoderMode_TypeDef;
  357. /**
  358. * @}
  359. */
  360. /** @defgroup TIM1_Event_Source
  361. * @{
  362. */
  363. typedef enum
  364. {
  365. TIM1_EventSource_Update = ((uint8_t)0x01),
  366. TIM1_EventSource_CC1 = ((uint8_t)0x02),
  367. TIM1_EventSource_CC2 = ((uint8_t)0x04),
  368. TIM1_EventSource_CC3 = ((uint8_t)0x08),
  369. TIM1_EventSource_CC4 = ((uint8_t)0x10),
  370. TIM1_EventSource_COM = ((uint8_t)0x20),
  371. TIM1_EventSource_Trigger = ((uint8_t)0x40),
  372. TIM1_EventSource_Break = ((uint8_t)0x80)
  373. }TIM1_EventSource_TypeDef;
  374. /**
  375. * @}
  376. */
  377. /** @defgroup TIM1_Update_Source
  378. * @{
  379. */
  380. typedef enum
  381. {
  382. TIM1_UpdateSource_Global = ((uint8_t)0x00),
  383. TIM1_UpdateSource_Regular = ((uint8_t)0x01)
  384. }TIM1_UpdateSource_TypeDef;
  385. /**
  386. * @}
  387. */
  388. /** @defgroup TIM1_Trigger_Output_Source
  389. * @{
  390. */
  391. typedef enum
  392. {
  393. TIM1_TRGOSource_Reset = ((uint8_t)0x00),
  394. TIM1_TRGOSource_Enable = ((uint8_t)0x10),
  395. TIM1_TRGOSource_Update = ((uint8_t)0x20),
  396. TIM1_TRGOSource_OC1 = ((uint8_t)0x30),
  397. TIM1_TRGOSource_OC1REF = ((uint8_t)0x40),
  398. TIM1_TRGOSource_OC2REF = ((uint8_t)0x50),
  399. TIM1_TRGOSource_OC3REF = ((uint8_t)0x60),
  400. TIM1_TRGOSource_OC4REF = ((uint8_t)0x70)
  401. }TIM1_TRGOSource_TypeDef;
  402. /**
  403. * @}
  404. */
  405. /** @defgroup TIM1_Slave_Mode
  406. * @{
  407. */
  408. typedef enum
  409. {
  410. TIM1_SlaveMode_Reset = ((uint8_t)0x04),
  411. TIM1_SlaveMode_Gated = ((uint8_t)0x05),
  412. TIM1_SlaveMode_Trigger = ((uint8_t)0x06),
  413. TIM1_SlaveMode_External1 = ((uint8_t)0x07)
  414. }TIM1_SlaveMode_TypeDef;
  415. /**
  416. * @}
  417. */
  418. /** @defgroup TIM1_Flags
  419. * @{
  420. */
  421. typedef enum
  422. {
  423. TIM1_FLAG_Update = ((uint16_t)0x0001),
  424. TIM1_FLAG_CC1 = ((uint16_t)0x0002),
  425. TIM1_FLAG_CC2 = ((uint16_t)0x0004),
  426. TIM1_FLAG_CC3 = ((uint16_t)0x0008),
  427. TIM1_FLAG_CC4 = ((uint16_t)0x0010),
  428. TIM1_FLAG_COM = ((uint16_t)0x0020),
  429. TIM1_FLAG_Trigger = ((uint16_t)0x0040),
  430. TIM1_FLAG_Break = ((uint16_t)0x0080),
  431. TIM1_FLAG_CC1OF = ((uint16_t)0x0200),
  432. TIM1_FLAG_CC2OF = ((uint16_t)0x0400),
  433. TIM1_FLAG_CC3OF = ((uint16_t)0x0800),
  434. TIM1_FLAG_CC4OF = ((uint16_t)0x1000)
  435. }TIM1_FLAG_TypeDef;
  436. /**
  437. * @}
  438. */
  439. /** @defgroup TIM1_Forced_Action
  440. * @{
  441. */
  442. typedef enum
  443. {
  444. TIM1_ForcedAction_Active = ((uint8_t)0x50),
  445. TIM1_ForcedAction_Inactive = ((uint8_t)0x40)
  446. }TIM1_ForcedAction_TypeDef;
  447. /**
  448. * @}
  449. */
  450. /** @defgroup TIM1_DMA_Source_Requests
  451. * @{
  452. */
  453. typedef enum
  454. {
  455. TIM1_DMASource_Update = ((uint8_t)0x01), /*!< TIM1 DMA Update Request*/
  456. TIM1_DMASource_CC1 = ((uint8_t)0x02), /*!< TIM1 DMA CC1 Request*/
  457. TIM1_DMASource_CC2 = ((uint8_t)0x04), /*!< TIM1 DMA CC2 Request*/
  458. TIM1_DMASource_CC3 = ((uint8_t)0x08), /*!< TIM1 DMA CC3 Request*/
  459. TIM1_DMASource_CC4 = ((uint8_t)0x10), /*!< TIM1 DMA CC4 Request*/
  460. TIM1_DMASource_COM = ((uint8_t)0x20) /*!< TIM1 DMA COM Req */
  461. } TIM1_DMASource_TypeDef;
  462. /**
  463. * @}
  464. */
  465. /** @defgroup TIM1_DMA_Base_Address
  466. * @{
  467. */
  468. typedef enum
  469. {
  470. TIM1_DMABase_CR1 = ((uint8_t)0x00),
  471. TIM1_DMABase_CR2 = ((uint8_t)0x01),
  472. TIM1_DMABase_SMCR = ((uint8_t)0x02),
  473. TIM1_DMABase_ETR = ((uint8_t)0x03),
  474. TIM1_DMABase_DER = ((uint8_t)0x04),
  475. TIM1_DMABase_IER = ((uint8_t)0x05),
  476. TIM1_DMABase_SR1 = ((uint8_t)0x06),
  477. TIM1_DMABase_SR2 = ((uint8_t)0x07),
  478. TIM1_DMABase_EGR = ((uint8_t)0x08),
  479. TIM1_DMABase_CCMR1 = ((uint8_t)0x09),
  480. TIM1_DMABase_CCMR2 = ((uint8_t)0x0A),
  481. TIM1_DMABase_CCMR3 = ((uint8_t)0x0B),
  482. TIM1_DMABase_CCMR4 = ((uint8_t)0x0C),
  483. TIM1_DMABase_CCER1 = ((uint8_t)0x0D),
  484. TIM1_DMABase_CCER2 = ((uint8_t)0x0E),
  485. TIM1_DMABase_CNTH = ((uint8_t)0x0F),
  486. TIM1_DMABase_CNTL = ((uint8_t)0x10),
  487. TIM1_DMABase_PSCH = ((uint8_t)0x11),
  488. TIM1_DMABase_PSCL = ((uint8_t)0x12),
  489. TIM1_DMABase_ARRH = ((uint8_t)0x13),
  490. TIM1_DMABase_ARRL = ((uint8_t)0x14),
  491. TIM1_DMABase_RCR = ((uint8_t)0x15),
  492. TIM1_DMABase_CCR1H = ((uint8_t)0x16),
  493. TIM1_DMABase_CCR1L = ((uint8_t)0x17),
  494. TIM1_DMABase_CCR2H = ((uint8_t)0x18),
  495. TIM1_DMABase_CCR2L = ((uint8_t)0x19),
  496. TIM1_DMABase_CCR3H = ((uint8_t)0x1A),
  497. TIM1_DMABase_CCR3L = ((uint8_t)0x1B),
  498. TIM1_DMABase_CCR4H = ((uint8_t)0x1C),
  499. TIM1_DMABase_CCR4L = ((uint8_t)0x1D),
  500. TIM1_DMABase_BKR = ((uint8_t)0x1E),
  501. TIM1_DMABase_DTR = ((uint8_t)0x1F)
  502. } TIM1_DMABase_TypeDef;
  503. /**
  504. * @}
  505. */
  506. /** @defgroup TIM1_DMA_Burst_Length
  507. * @{
  508. */
  509. typedef enum
  510. {
  511. TIM1_DMABurstLength_1Byte = ((uint8_t)0x00),
  512. TIM1_DMABurstLength_2Byte = ((uint8_t)0x01),
  513. TIM1_DMABurstLength_3Byte = ((uint8_t)0x02),
  514. TIM1_DMABurstLength_4Byte = ((uint8_t)0x03),
  515. TIM1_DMABurstLength_5Byte = ((uint8_t)0x04),
  516. TIM1_DMABurstLength_6Byte = ((uint8_t)0x05),
  517. TIM1_DMABurstLength_7Byte = ((uint8_t)0x06),
  518. TIM1_DMABurstLength_8Byte = ((uint8_t)0x07),
  519. TIM1_DMABurstLength_9Byte = ((uint8_t)0x08),
  520. TIM1_DMABurstLength_10Byte = ((uint8_t)0x09),
  521. TIM1_DMABurstLength_11Byte = ((uint8_t)0x0A),
  522. TIM1_DMABurstLength_12Byte = ((uint8_t)0x0B),
  523. TIM1_DMABurstLength_13Byte = ((uint8_t)0x0C),
  524. TIM1_DMABurstLength_14Byte = ((uint8_t)0x0D),
  525. TIM1_DMABurstLength_15Byte = ((uint8_t)0x0E),
  526. TIM1_DMABurstLength_16Byte = ((uint8_t)0x0F),
  527. TIM1_DMABurstLength_17Byte = ((uint8_t)0x10),
  528. TIM1_DMABurstLength_18Byte = ((uint8_t)0x11),
  529. TIM1_DMABurstLength_19Byte = ((uint8_t)0x12),
  530. TIM1_DMABurstLength_20Byte = ((uint8_t)0x13),
  531. TIM1_DMABurstLength_21Byte = ((uint8_t)0x14),
  532. TIM1_DMABurstLength_22Byte = ((uint8_t)0x15),
  533. TIM1_DMABurstLength_23Byte = ((uint8_t)0x16),
  534. TIM1_DMABurstLength_24Byte = ((uint8_t)0x17),
  535. TIM1_DMABurstLength_25Byte = ((uint8_t)0x18),
  536. TIM1_DMABurstLength_26Byte = ((uint8_t)0x19),
  537. TIM1_DMABurstLength_27Byte = ((uint8_t)0x1A),
  538. TIM1_DMABurstLength_28Byte = ((uint8_t)0x1B),
  539. TIM1_DMABurstLength_29Byte = ((uint8_t)0x1C),
  540. TIM1_DMABurstLength_30Byte = ((uint8_t)0x1D),
  541. TIM1_DMABurstLength_31Byte = ((uint8_t)0x1E),
  542. TIM1_DMABurstLength_32Byte = ((uint8_t)0x1F)
  543. } TIM1_DMABurstLength_TypeDef;
  544. /**
  545. * @}
  546. */
  547. /**
  548. * @}
  549. */
  550. /* Exported constants --------------------------------------------------------*/
  551. /* Exported macros -----------------------------------------------------------*/
  552. /** @defgroup TIM1_Exported_Macros
  553. * @{
  554. */
  555. #define IS_TIM1_OC_MODE(MODE) (((MODE) == TIM1_OCMode_Timing) || \
  556. ((MODE) == TIM1_OCMode_Active) || \
  557. ((MODE) == TIM1_OCMode_Inactive) || \
  558. ((MODE) == TIM1_OCMode_Toggle)|| \
  559. ((MODE) == TIM1_OCMode_PWM1) || \
  560. ((MODE) == TIM1_OCMode_PWM2))
  561. #define IS_TIM1_OCM(MODE)(((MODE) == TIM1_OCMode_Timing) || \
  562. ((MODE) == TIM1_OCMode_Active) || \
  563. ((MODE) == TIM1_OCMode_Inactive) || \
  564. ((MODE) == TIM1_OCMode_Toggle)|| \
  565. ((MODE) == TIM1_OCMode_PWM1) || \
  566. ((MODE) == TIM1_OCMode_PWM2) || \
  567. ((MODE) == (uint8_t)TIM1_ForcedAction_Active) || \
  568. ((MODE) == (uint8_t)TIM1_ForcedAction_Inactive))
  569. #define IS_TIM1_OPM_MODE(MODE) (((MODE) == TIM1_OPMode_Single) || \
  570. ((MODE) == TIM1_OPMode_Repetitive))
  571. #define IS_TIM1_CHANNEL(CHANNEL) (((CHANNEL) == TIM1_Channel_1) || \
  572. ((CHANNEL) == TIM1_Channel_2) || \
  573. ((CHANNEL) == TIM1_Channel_3) || \
  574. ((CHANNEL) == TIM1_Channel_4))
  575. #define IS_TIM1_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TIM1_Channel_1) || \
  576. ((CHANNEL) == TIM1_Channel_2))
  577. #define IS_TIM1_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TIM1_Channel_1) || \
  578. ((CHANNEL) == TIM1_Channel_2) || \
  579. ((CHANNEL) == TIM1_Channel_3))
  580. #define IS_TIM1_COUNTER_MODE(MODE) (((MODE) == TIM1_CounterMode_Up) || \
  581. ((MODE) == TIM1_CounterMode_Down) || \
  582. ((MODE) == TIM1_CounterMode_CenterAligned1) || \
  583. ((MODE) == TIM1_CounterMode_CenterAligned2) || \
  584. ((MODE) == TIM1_CounterMode_CenterAligned3))
  585. #define IS_TIM1_OC_POLARITY(POLARITY) (((POLARITY) == TIM1_OCPolarity_High) || \
  586. ((POLARITY) == TIM1_OCPolarity_Low))
  587. #define IS_TIM1_OCN_POLARITY(POLARITY) (((POLARITY) == TIM1_OCNPolarity_High) || \
  588. ((POLARITY) == TIM1_OCNPolarity_Low))
  589. #define IS_TIM1_OUTPUT_STATE(STATE) (((STATE) == TIM1_OutputState_Disable) || \
  590. ((STATE) == TIM1_OutputState_Enable))
  591. #define IS_TIM1_OUTPUTN_STATE(STATE) (((STATE) == TIM1_OutputNState_Disable) ||\
  592. ((STATE) == TIM1_OutputNState_Enable))
  593. #define IS_TIM1_BREAK_STATE(STATE) (((STATE) == TIM1_BreakState_Enable) || \
  594. ((STATE) == TIM1_BreakState_Disable))
  595. #define IS_TIM1_BREAK_POLARITY(POLARITY) (((POLARITY) == TIM1_BreakPolarity_Low) || \
  596. ((POLARITY) == TIM1_BreakPolarity_High))
  597. #define IS_TIM1_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TIM1_AutomaticOutput_Enable) || \
  598. ((STATE) == TIM1_AutomaticOutput_Disable))
  599. #define IS_TIM1_LOCK_LEVEL(LEVEL) (((LEVEL) == TIM1_LockLevel_Off) || \
  600. ((LEVEL) == TIM1_LockLevel_1) || \
  601. ((LEVEL) == TIM1_LockLevel_2) || \
  602. ((LEVEL) == TIM1_LockLevel_3))
  603. #define IS_TIM1_OSSI_STATE(STATE) (((STATE) == TIM1_OSSIState_Enable) || \
  604. ((STATE) == TIM1_OSSIState_Disable))
  605. #define IS_TIM1_OCIDLE_STATE(STATE) (((STATE) == TIM1_OCIdleState_Set) || \
  606. ((STATE) == TIM1_OCIdleState_Reset))
  607. #define IS_TIM1_OCNIDLE_STATE(STATE) (((STATE) == TIM1_OCNIdleState_Set) || \
  608. ((STATE) == TIM1_OCNIdleState_Reset))
  609. #define IS_TIM1_IC_POLARITY(POLARITY) (((POLARITY) == TIM1_ICPolarity_Rising) || \
  610. ((POLARITY) == TIM1_ICPolarity_Falling))
  611. #define IS_TIM1_IC_SELECTION(SELECTION) (((SELECTION) == TIM1_ICSelection_DirectTI) || \
  612. ((SELECTION) == TIM1_ICSelection_IndirectTI) || \
  613. ((SELECTION) == TIM1_ICSelection_TRGI))
  614. #define IS_TIM1_IC_PRESCALER(PRESCALER) (((PRESCALER) == TIM1_ICPSC_DIV1) || \
  615. ((PRESCALER) == TIM1_ICPSC_DIV2) || \
  616. ((PRESCALER) == TIM1_ICPSC_DIV4) || \
  617. ((PRESCALER) == TIM1_ICPSC_DIV8))
  618. #define IS_TIM1_OCREFERENCECECLEAR_SOURCE(SOURCE) (((SOURCE) == TIM1_OCReferenceClear_ETRF) || \
  619. ((SOURCE) == TIM1_OCReferenceClear_OCREFCLR))
  620. #define IS_TIM1_IT(IT) ((IT) != 0x00)
  621. #define IS_TIM1_GET_IT(IT) (((IT) == TIM1_IT_Update) || \
  622. ((IT) == TIM1_IT_CC1) || \
  623. ((IT) == TIM1_IT_CC2) || \
  624. ((IT) == TIM1_IT_CC3) || \
  625. ((IT) == TIM1_IT_CC4) || \
  626. ((IT) == TIM1_IT_COM) || \
  627. ((IT) == TIM1_IT_Trigger) || \
  628. ((IT) == TIM1_IT_Break))
  629. #define IS_TIM1_EXT_PRESCALER(PRESCALER) (((PRESCALER) == TIM1_ExtTRGPSC_OFF) || \
  630. ((PRESCALER) == TIM1_ExtTRGPSC_DIV2) || \
  631. ((PRESCALER) == TIM1_ExtTRGPSC_DIV4) || \
  632. ((PRESCALER) == TIM1_ExtTRGPSC_DIV8))
  633. #define IS_TIM1_TRIGGER_SELECTION(SELECTION) \
  634. (((SELECTION) == TIM1_TRGSelection_TIM2) || \
  635. ((SELECTION) == TIM1_TRGSelection_TIM3) || \
  636. ((SELECTION) == TIM1_TRGSelection_TIM4) || \
  637. ((SELECTION) == TIM1_TRGSelection_TIM5) || \
  638. ((SELECTION) == TIM1_TRGSelection_TI1F_ED) || \
  639. ((SELECTION) == TIM1_TRGSelection_TI1FP1) || \
  640. ((SELECTION) == TIM1_TRGSelection_TI2FP2) || \
  641. ((SELECTION) == TIM1_TRGSelection_ETRF))
  642. #define IS_TIM1_TIX_TRIGGER_SELECTION(SELECTION) \
  643. (((SELECTION) == TIM1_TRGSelection_TI1F_ED) || \
  644. ((SELECTION) == TIM1_TRGSelection_TI1FP1) || \
  645. ((SELECTION) == TIM1_TRGSelection_TI2FP2))
  646. #define IS_TIM1_TIXCLK_SOURCE(SOURCE) (((SOURCE) == TIM1_TIxExternalCLK1Source_TI1ED) || \
  647. ((SOURCE) == TIM1_TIxExternalCLK1Source_TI2) || \
  648. ((SOURCE) == TIM1_TIxExternalCLK1Source_TI1))
  649. #define IS_TIM1_EXT_POLARITY(POLARITY) (((POLARITY) == TIM1_ExtTRGPolarity_Inverted) || \
  650. ((POLARITY) == TIM1_ExtTRGPolarity_NonInverted))
  651. #define IS_TIM1_PRESCALER_RELOAD(RELOAD) (((RELOAD) == TIM1_PSCReloadMode_Update) || \
  652. ((RELOAD) == TIM1_PSCReloadMode_Immediate))
  653. #define IS_TIM1_ENCODER_MODE(MODE) (((MODE) == TIM1_EncoderMode_TI1) || \
  654. ((MODE) == TIM1_EncoderMode_TI2) || \
  655. ((MODE) == TIM1_EncoderMode_TI12))
  656. #define IS_TIM1_EVENT_SOURCE(SOURCE) ((SOURCE) != 0x00)
  657. #define IS_TIM1_TRGO_SOURCE(SOURCE) (((SOURCE) == TIM1_TRGOSource_Reset) || \
  658. ((SOURCE) == TIM1_TRGOSource_Enable) || \
  659. ((SOURCE) == TIM1_TRGOSource_Update) || \
  660. ((SOURCE) == TIM1_TRGOSource_OC1) || \
  661. ((SOURCE) == TIM1_TRGOSource_OC1REF) || \
  662. ((SOURCE) == TIM1_TRGOSource_OC2REF) || \
  663. ((SOURCE) == TIM1_TRGOSource_OC3REF) || \
  664. ((SOURCE) == TIM1_TRGOSource_OC4REF))
  665. #define IS_TIM1_UPDATE_SOURCE(SOURCE) (((SOURCE) == TIM1_UpdateSource_Global) || \
  666. ((SOURCE) == TIM1_UpdateSource_Regular))
  667. #define IS_TIM1_GET_FLAG(FLAG) (((FLAG) == TIM1_FLAG_Update) || \
  668. ((FLAG) == TIM1_FLAG_CC1) || \
  669. ((FLAG) == TIM1_FLAG_CC2) || \
  670. ((FLAG) == TIM1_FLAG_CC3) || \
  671. ((FLAG) == TIM1_FLAG_CC4) || \
  672. ((FLAG) == TIM1_FLAG_COM) || \
  673. ((FLAG) == TIM1_FLAG_Trigger)|| \
  674. ((FLAG) == TIM1_FLAG_Break) || \
  675. ((FLAG) == TIM1_FLAG_CC1OF) || \
  676. ((FLAG) == TIM1_FLAG_CC2OF) || \
  677. ((FLAG) == TIM1_FLAG_CC3OF) || \
  678. ((FLAG) == TIM1_FLAG_CC4OF))
  679. #define IS_TIM1_SLAVE_MODE(MODE) (((MODE) == TIM1_SlaveMode_Reset) || \
  680. ((MODE) == TIM1_SlaveMode_Gated) || \
  681. ((MODE) == TIM1_SlaveMode_Trigger) || \
  682. ((MODE) == TIM1_SlaveMode_External1))
  683. #define IS_TIM1_CLEAR_FLAG(FLAG) ((((uint16_t)(FLAG) & (uint16_t)0xE100) == 0x0000) && ((FLAG) != 0x0000))
  684. #define IS_TIM1_FORCED_ACTION(ACTION) (((ACTION) == TIM1_ForcedAction_Active) || \
  685. ((ACTION) == TIM1_ForcedAction_Inactive))
  686. #define IS_TIM1_DMA_SOURCE(SOURCE) \
  687. (((SOURCE) == TIM1_DMASource_Update) || \
  688. ((SOURCE) == TIM1_DMASource_CC1) || \
  689. ((SOURCE) == TIM1_DMASource_CC2) || \
  690. ((SOURCE) == TIM1_DMASource_CC3) || \
  691. ((SOURCE) == TIM1_DMASource_CC4) || \
  692. ((SOURCE) == TIM1_DMASource_COM))
  693. #define IS_TIM1_DMABase(SOURCE) \
  694. (((SOURCE) == TIM1_DMABase_CR1) || \
  695. ((SOURCE) == TIM1_DMABase_CR2) || \
  696. ((SOURCE) == TIM1_DMABase_SMCR) || \
  697. ((SOURCE) == TIM1_DMABase_ETR) || \
  698. ((SOURCE) == TIM1_DMABase_DER) || \
  699. ((SOURCE) == TIM1_DMABase_IER) || \
  700. ((SOURCE) == TIM1_DMABase_SR1) || \
  701. ((SOURCE) == TIM1_DMABase_SR2) || \
  702. ((SOURCE) == TIM1_DMABase_EGR) || \
  703. ((SOURCE) == TIM1_DMABase_CCMR1) || \
  704. ((SOURCE) == TIM1_DMABase_CCMR2 ) || \
  705. ((SOURCE) == TIM1_DMABase_CCMR3) || \
  706. ((SOURCE) == TIM1_DMABase_CCMR4) || \
  707. ((SOURCE) == TIM1_DMABase_CCER1) || \
  708. ((SOURCE) == TIM1_DMABase_CCER2) || \
  709. ((SOURCE) == TIM1_DMABase_CNTH) || \
  710. ((SOURCE) == TIM1_DMABase_CNTL) || \
  711. ((SOURCE) == TIM1_DMABase_PSCH) || \
  712. ((SOURCE) == TIM1_DMABase_PSCL) || \
  713. ((SOURCE) == TIM1_DMABase_ARRH) || \
  714. ((SOURCE) == TIM1_DMABase_ARRL) || \
  715. ((SOURCE) == TIM1_DMABase_RCR) || \
  716. ((SOURCE) == TIM1_DMABase_CCR1H) || \
  717. ((SOURCE) == TIM1_DMABase_CCR1L) || \
  718. ((SOURCE) == TIM1_DMABase_CCR2H ) || \
  719. ((SOURCE) == TIM1_DMABase_CCR2L) || \
  720. ((SOURCE) == TIM1_DMABase_CCR3H) || \
  721. ((SOURCE) == TIM1_DMABase_CCR3L) || \
  722. ((SOURCE) == TIM1_DMABase_CCR4H) || \
  723. ((SOURCE) == TIM1_DMABase_CCR4L) || \
  724. ((SOURCE) == TIM1_DMABase_BKR) || \
  725. ((SOURCE) == TIM1_DMABase_DTR))
  726. #define IS_TIM1_DMABurstLength(SOURCE) \
  727. (((SOURCE) == TIM1_DMABurstLength_1Byte) || \
  728. ((SOURCE) == TIM1_DMABurstLength_2Byte) || \
  729. ((SOURCE) == TIM1_DMABurstLength_3Byte) || \
  730. ((SOURCE) == TIM1_DMABurstLength_4Byte) || \
  731. ((SOURCE) == TIM1_DMABurstLength_5Byte) || \
  732. ((SOURCE) == TIM1_DMABurstLength_6Byte) || \
  733. ((SOURCE) == TIM1_DMABurstLength_7Byte) || \
  734. ((SOURCE) == TIM1_DMABurstLength_8Byte) || \
  735. ((SOURCE) == TIM1_DMABurstLength_9Byte) || \
  736. ((SOURCE) == TIM1_DMABurstLength_10Byte) || \
  737. ((SOURCE) == TIM1_DMABurstLength_11Byte ) || \
  738. ((SOURCE) == TIM1_DMABurstLength_12Byte) || \
  739. ((SOURCE) == TIM1_DMABurstLength_13Byte) || \
  740. ((SOURCE) == TIM1_DMABurstLength_14Byte) || \
  741. ((SOURCE) == TIM1_DMABurstLength_15Byte) || \
  742. ((SOURCE) == TIM1_DMABurstLength_16Byte) || \
  743. ((SOURCE) == TIM1_DMABurstLength_17Byte) || \
  744. ((SOURCE) == TIM1_DMABurstLength_18Byte) || \
  745. ((SOURCE) == TIM1_DMABurstLength_19Byte) || \
  746. ((SOURCE) == TIM1_DMABurstLength_20Byte) || \
  747. ((SOURCE) == TIM1_DMABurstLength_21Byte) || \
  748. ((SOURCE) == TIM1_DMABurstLength_22Byte) || \
  749. ((SOURCE) == TIM1_DMABurstLength_23Byte) || \
  750. ((SOURCE) == TIM1_DMABurstLength_24Byte) || \
  751. ((SOURCE) == TIM1_DMABurstLength_25Byte) || \
  752. ((SOURCE) == TIM1_DMABurstLength_26Byte) || \
  753. ((SOURCE) == TIM1_DMABurstLength_27Byte) || \
  754. ((SOURCE) == TIM1_DMABurstLength_28Byte) || \
  755. ((SOURCE) == TIM1_DMABurstLength_29Byte) || \
  756. ((SOURCE) == TIM1_DMABurstLength_30Byte) || \
  757. ((SOURCE) == TIM1_DMABurstLength_31Byte) || \
  758. ((SOURCE) == TIM1_DMABurstLength_32Byte))
  759. /** TIM1 External Trigger Filer Value */
  760. #define IS_TIM1_EXT_TRG_FILTER(FILTER) ((FILTER) <= 0x0F)
  761. /** TIM1 Input Capture Filer Value */
  762. #define IS_TIM1_IC_FILTER(ICFILTER) ((ICFILTER) <= 0x0F)
  763. /**
  764. * @}
  765. */
  766. /* Exported Functions -----------------------------------------------------------*/
  767. /* TimeBase management ********************************************************/
  768. void TIM1_DeInit(void);
  769. void TIM1_TimeBaseInit(uint16_t TIM1_Prescaler,
  770. TIM1_CounterMode_TypeDef TIM1_CounterMode,
  771. uint16_t TIM1_Period,
  772. uint8_t TIM1_RepetitionCounter);
  773. void TIM1_PrescalerConfig(uint16_t Prescaler,
  774. TIM1_PSCReloadMode_TypeDef TIM1_PSCReloadMode);
  775. void TIM1_CounterModeConfig(TIM1_CounterMode_TypeDef TIM1_CounterMode);
  776. void TIM1_SetCounter(uint16_t Counter);
  777. void TIM1_SetAutoreload(uint16_t Autoreload);
  778. uint16_t TIM1_GetCounter(void);
  779. uint16_t TIM1_GetPrescaler(void);
  780. void TIM1_UpdateDisableConfig(FunctionalState NewState);
  781. void TIM1_UpdateRequestConfig(TIM1_UpdateSource_TypeDef TIM1_UpdateSource);
  782. void TIM1_ARRPreloadConfig(FunctionalState NewState);
  783. void TIM1_SelectOnePulseMode(TIM1_OPMode_TypeDef TIM1_OPMode);
  784. void TIM1_Cmd(FunctionalState NewState);
  785. /* Output Compare management **************************************************/
  786. void TIM1_OC1Init(TIM1_OCMode_TypeDef TIM1_OCMode,
  787. TIM1_OutputState_TypeDef TIM1_OutputState,
  788. TIM1_OutputNState_TypeDef TIM1_OutputNState,
  789. uint16_t TIM1_Pulse,
  790. TIM1_OCPolarity_TypeDef TIM1_OCPolarity,
  791. TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity,
  792. TIM1_OCIdleState_TypeDef TIM1_OCIdleState,
  793. TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);
  794. void TIM1_OC2Init(TIM1_OCMode_TypeDef TIM1_OCMode,
  795. TIM1_OutputState_TypeDef TIM1_OutputState,
  796. TIM1_OutputNState_TypeDef TIM1_OutputNState,
  797. uint16_t TIM1_Pulse,
  798. TIM1_OCPolarity_TypeDef TIM1_OCPolarity,
  799. TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity,
  800. TIM1_OCIdleState_TypeDef TIM1_OCIdleState,
  801. TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);
  802. void TIM1_OC3Init(TIM1_OCMode_TypeDef TIM1_OCMode,
  803. TIM1_OutputState_TypeDef TIM1_OutputState,
  804. TIM1_OutputNState_TypeDef TIM1_OutputNState,
  805. uint16_t TIM1_Pulse,
  806. TIM1_OCPolarity_TypeDef TIM1_OCPolarity,
  807. TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity,
  808. TIM1_OCIdleState_TypeDef TIM1_OCIdleState,
  809. TIM1_OCNIdleState_TypeDef TIM1_OCNIdleState);
  810. void TIM1_BDTRConfig(TIM1_OSSIState_TypeDef TIM1_OSSIState,
  811. TIM1_LockLevel_TypeDef TIM1_LockLevel,
  812. uint8_t TIM1_DeadTime,
  813. TIM1_BreakState_TypeDef TIM1_Break,
  814. TIM1_BreakPolarity_TypeDef TIM1_BreakPolarity,
  815. TIM1_AutomaticOutput_TypeDef TIM1_AutomaticOutput);
  816. void TIM1_CtrlPWMOutputs(FunctionalState NewState);
  817. void TIM1_SelectOCxM(TIM1_Channel_TypeDef TIM1_Channel, TIM1_OCMode_TypeDef TIM1_OCMode);
  818. void TIM1_SetCompare1(uint16_t Compare1);
  819. void TIM1_SetCompare2(uint16_t Compare2);
  820. void TIM1_SetCompare3(uint16_t Compare3);
  821. void TIM1_SetCompare4(uint16_t Compare4);
  822. void TIM1_CCPreloadControl(FunctionalState NewState);
  823. void TIM1_ForcedOC1Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);
  824. void TIM1_ForcedOC2Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);
  825. void TIM1_ForcedOC3Config(TIM1_ForcedAction_TypeDef TIM1_ForcedAction);
  826. void TIM1_OC1PreloadConfig(FunctionalState NewState);
  827. void TIM1_OC2PreloadConfig(FunctionalState NewState);
  828. void TIM1_OC3PreloadConfig(FunctionalState NewState);
  829. void TIM1_OC4PreloadConfig(FunctionalState NewState);
  830. void TIM1_OC1FastConfig(FunctionalState NewState);
  831. void TIM1_OC2FastConfig(FunctionalState NewState);
  832. void TIM1_OC3FastConfig(FunctionalState NewState);
  833. void TIM1_ClearOC1Ref(FunctionalState NewState);
  834. void TIM1_ClearOC2Ref(FunctionalState NewState);
  835. void TIM1_ClearOC3Ref(FunctionalState NewState);
  836. void TIM1_ClearOC4Ref(FunctionalState NewState);
  837. void TIM1_OC1PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);
  838. void TIM1_OC1NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);
  839. void TIM1_OC2PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);
  840. void TIM1_OC2NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);
  841. void TIM1_OC3PolarityConfig(TIM1_OCPolarity_TypeDef TIM1_OCPolarity);
  842. void TIM1_OC3NPolarityConfig(TIM1_OCNPolarity_TypeDef TIM1_OCNPolarity);
  843. void TIM1_SelectOCREFClear(TIM1_OCReferenceClear_TypeDef TIM1_OCReferenceClear);
  844. void TIM1_SelectCOM(FunctionalState NewState);
  845. void TIM1_CCxCmd(TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState);
  846. void TIM1_CCxNCmd(TIM1_Channel_TypeDef TIM1_Channel, FunctionalState NewState);
  847. /* Input Capture management ***************************************************/
  848. void TIM1_ICInit(TIM1_Channel_TypeDef TIM1_Channel,
  849. TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
  850. TIM1_ICSelection_TypeDef TIM1_ICSelection,
  851. TIM1_ICPSC_TypeDef TIM1_ICPrescaler,
  852. uint8_t TIM1_ICFilter);
  853. void TIM1_PWMIConfig(TIM1_Channel_TypeDef TIM1_Channel,
  854. TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
  855. TIM1_ICSelection_TypeDef TIM1_ICSelection,
  856. TIM1_ICPSC_TypeDef TIM1_ICPrescaler,
  857. uint8_t TIM1_ICFilter);
  858. uint16_t TIM1_GetCapture1(void);
  859. uint16_t TIM1_GetCapture2(void);
  860. uint16_t TIM1_GetCapture3(void);
  861. uint16_t TIM1_GetCapture4(void);
  862. void TIM1_SetIC1Prescaler(TIM1_ICPSC_TypeDef TIM1_IC1Prescaler);
  863. void TIM1_SetIC2Prescaler(TIM1_ICPSC_TypeDef TIM1_IC2Prescaler);
  864. void TIM1_SetIC3Prescaler(TIM1_ICPSC_TypeDef TIM1_IC3Prescaler);
  865. void TIM1_SetIC4Prescaler(TIM1_ICPSC_TypeDef TIM1_IC4Prescaler);
  866. /* Interrupts, DMA and flags management ***************************************/
  867. void TIM1_ITConfig(TIM1_IT_TypeDef TIM1_IT, FunctionalState NewState);
  868. void TIM1_GenerateEvent(TIM1_EventSource_TypeDef TIM1_EventSource);
  869. FlagStatus TIM1_GetFlagStatus(TIM1_FLAG_TypeDef TIM1_FLAG);
  870. void TIM1_ClearFlag(TIM1_FLAG_TypeDef TIM1_FLAG);
  871. ITStatus TIM1_GetITStatus(TIM1_IT_TypeDef TIM1_IT);
  872. void TIM1_ClearITPendingBit(TIM1_IT_TypeDef TIM1_IT);
  873. void TIM1_DMAConfig(TIM1_DMABase_TypeDef TIM1_DMABase,
  874. TIM1_DMABurstLength_TypeDef TIM1_DMABurstLength);
  875. void TIM1_DMACmd(TIM1_DMASource_TypeDef TIM1_DMASource, FunctionalState NewState);
  876. void TIM1_SelectCCDMA(FunctionalState NewState);
  877. /* Clocks management **********************************************************/
  878. void TIM1_InternalClockConfig(void);
  879. void TIM1_TIxExternalClockConfig(TIM1_TIxExternalCLK1Source_TypeDef TIM1_TIxExternalCLKSource,
  880. TIM1_ICPolarity_TypeDef TIM1_ICPolarity,
  881. uint8_t ICFilter);
  882. void TIM1_ETRClockMode1Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
  883. TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
  884. uint8_t ExtTRGFilter);
  885. void TIM1_ETRClockMode2Config(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
  886. TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
  887. uint8_t ExtTRGFilter);
  888. /* Synchronization management *************************************************/
  889. void TIM1_SelectInputTrigger(TIM1_TRGSelection_TypeDef TIM1_InputTriggerSource);
  890. void TIM1_SelectOutputTrigger(TIM1_TRGOSource_TypeDef TIM1_TRGOSource);
  891. void TIM1_SelectSlaveMode(TIM1_SlaveMode_TypeDef TIM1_SlaveMode);
  892. void TIM1_SelectMasterSlaveMode(FunctionalState NewState);
  893. void TIM1_ETRConfig(TIM1_ExtTRGPSC_TypeDef TIM1_ExtTRGPrescaler,
  894. TIM1_ExtTRGPolarity_TypeDef TIM1_ExtTRGPolarity,
  895. uint8_t ExtTRGFilter);
  896. /* Specific interface management **********************************************/
  897. void TIM1_EncoderInterfaceConfig(TIM1_EncoderMode_TypeDef TIM1_EncoderMode,
  898. TIM1_ICPolarity_TypeDef TIM1_IC1Polarity,
  899. TIM1_ICPolarity_TypeDef TIM1_IC2Polarity);
  900. void TIM1_SelectHallSensor(FunctionalState NewState);
  901. #endif /* __STM8L15x_TIM1_H */
  902. /**
  903. * @}
  904. */
  905. /**
  906. * @}
  907. */
  908. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/