lpc_pwm.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /**********************************************************************
  2. * $Id$ lpc_pwm.c 2011-06-02
  3. *//**
  4. * @file lpc_pwm.c
  5. * @brief Contains all functions support for PWM firmware library
  6. * on LPC
  7. * @version 1.0
  8. * @date 02. June. 2011
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2011, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @addtogroup PWM
  34. * @{
  35. */
  36. #ifdef __BUILD_WITH_EXAMPLE__
  37. #include "lpc_libcfg.h"
  38. #else
  39. #include "lpc_libcfg_default.h"
  40. #endif /* __BUILD_WITH_EXAMPLE__ */
  41. #ifdef _PWM
  42. /* Includes ------------------------------------------------------------------- */
  43. #include "lpc_pwm.h"
  44. #include "lpc_clkpwr.h"
  45. /* Public Functions ----------------------------------------------------------- */
  46. /** @addtogroup PWM_Public_Functions
  47. * @{
  48. */
  49. static LPC_PWM_TypeDef* PWM_GetPointer (uint8_t pwmId);
  50. /*********************************************************************//**
  51. * @brief Setting CAN baud rate (bps)
  52. * @param[in] canId point to LPC_CAN_TypeDef object, should be:
  53. * - LPC_CAN1: CAN1 peripheral
  54. * - LPC_CAN2: CAN2 peripheral
  55. * @return The pointer to CAN peripheral that's expected to use
  56. ***********************************************************************/
  57. static LPC_PWM_TypeDef* PWM_GetPointer (uint8_t pwmId)
  58. {
  59. LPC_PWM_TypeDef* pPwm;
  60. switch (pwmId)
  61. {
  62. case PWM_0:
  63. pPwm = LPC_PWM0;
  64. break;
  65. case PWM_1:
  66. pPwm = LPC_PWM1;
  67. break;
  68. default:
  69. pPwm = NULL;
  70. break;
  71. }
  72. return pPwm;
  73. }
  74. /*********************************************************************//**
  75. * @brief Check whether specified interrupt flag in PWM is set or not
  76. * @param[in] pwmId The Id of the expected PWM component
  77. *
  78. * @param[in] IntFlag: PWM interrupt flag, should be:
  79. * - PWM_INTSTAT_MR0: Interrupt flag for PWM match channel 0
  80. * - PWM_INTSTAT_MR1: Interrupt flag for PWM match channel 1
  81. * - PWM_INTSTAT_MR2: Interrupt flag for PWM match channel 2
  82. * - PWM_INTSTAT_MR3: Interrupt flag for PWM match channel 3
  83. * - PWM_INTSTAT_MR4: Interrupt flag for PWM match channel 4
  84. * - PWM_INTSTAT_MR5: Interrupt flag for PWM match channel 5
  85. * - PWM_INTSTAT_MR6: Interrupt flag for PWM match channel 6
  86. * - PWM_INTSTAT_CAP0: Interrupt flag for capture input 0
  87. * - PWM_INTSTAT_CAP1: Interrupt flag for capture input 1
  88. * @return New State of PWM interrupt flag (SET or RESET)
  89. **********************************************************************/
  90. IntStatus PWM_GetIntStatus(uint8_t pwmId, uint32_t IntFlag)
  91. {
  92. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  93. return ((pPwm->IR & IntFlag) ? SET : RESET);
  94. }
  95. /*********************************************************************//**
  96. * @brief Clear specified PWM Interrupt pending
  97. * @param[in] pwmId The Id of the expected PWM component
  98. *
  99. * @param[in] IntFlag: PWM interrupt flag, should be:
  100. * - PWM_INTSTAT_MR0: Interrupt flag for PWM match channel 0
  101. * - PWM_INTSTAT_MR1: Interrupt flag for PWM match channel 1
  102. * - PWM_INTSTAT_MR2: Interrupt flag for PWM match channel 2
  103. * - PWM_INTSTAT_MR3: Interrupt flag for PWM match channel 3
  104. * - PWM_INTSTAT_MR4: Interrupt flag for PWM match channel 4
  105. * - PWM_INTSTAT_MR5: Interrupt flag for PWM match channel 5
  106. * - PWM_INTSTAT_MR6: Interrupt flag for PWM match channel 6
  107. * - PWM_INTSTAT_CAP0: Interrupt flag for capture input 0
  108. * - PWM_INTSTAT_CAP1: Interrupt flag for capture input 1
  109. * @return None
  110. **********************************************************************/
  111. void PWM_ClearIntPending(uint8_t pwmId, uint32_t IntFlag)
  112. {
  113. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  114. pPwm->IR = IntFlag;
  115. }
  116. /*****************************************************************************//**
  117. * @brief Fills each PWM_InitStruct member with its default value:
  118. * - If PWMCounterMode = PWM_MODE_TIMER:
  119. * + PrescaleOption = PWM_TIMER_PRESCALE_USVAL
  120. * + PrescaleValue = 1
  121. * - If PWMCounterMode = PWM_MODE_COUNTER:
  122. * + CountInputSelect = PWM_COUNTER_PCAP1_0
  123. * + CounterOption = PWM_COUNTER_RISING
  124. * @param[in] PWMTimerCounterMode Timer or Counter mode, should be:
  125. * - PWM_MODE_TIMER: Counter of PWM peripheral is in Timer mode
  126. * - PWM_MODE_COUNTER: Counter of PWM peripheral is in Counter mode
  127. * @param[in] PWM_InitStruct Pointer to structure (PWM_TIMERCFG_Type or
  128. * PWM_COUNTERCFG_Type) which will be initialized.
  129. * @return None
  130. * Note: PWM_InitStruct pointer will be assigned to corresponding structure
  131. * (PWM_TIMERCFG_Type or PWM_COUNTERCFG_Type) due to PWMTimerCounterMode.
  132. *******************************************************************************/
  133. void PWM_ConfigStructInit(uint8_t PWMTimerCounterMode, void *PWM_InitStruct)
  134. {
  135. PWM_TIMERCFG_Type *pTimeCfg;
  136. PWM_COUNTERCFG_Type *pCounterCfg;
  137. pTimeCfg = (PWM_TIMERCFG_Type *) PWM_InitStruct;
  138. pCounterCfg = (PWM_COUNTERCFG_Type *) PWM_InitStruct;
  139. if (PWMTimerCounterMode == PWM_MODE_TIMER )
  140. {
  141. pTimeCfg->PrescaleOption = PWM_TIMER_PRESCALE_USVAL;
  142. pTimeCfg->PrescaleValue = 1;
  143. }
  144. else if (PWMTimerCounterMode == PWM_MODE_COUNTER)
  145. {
  146. pCounterCfg->CountInputSelect = PWM_COUNTER_PCAP1_0;
  147. pCounterCfg->CounterOption = PWM_COUNTER_RISING;
  148. }
  149. }
  150. /*********************************************************************//**
  151. * @brief Initializes the pPwm peripheral corresponding to the specified
  152. * parameters in the PWM_ConfigStruct.
  153. * @param[in] pwmId The Id of the expected PWM component
  154. *
  155. *
  156. * @param[in] PWMTimerCounterMode Timer or Counter mode, should be:
  157. * - PWM_MODE_TIMER: Counter of PWM peripheral is in Timer mode
  158. * - PWM_MODE_COUNTER: Counter of PWM peripheral is in Counter mode
  159. * @param[in] PWM_ConfigStruct Pointer to structure (PWM_TIMERCFG_Type or
  160. * PWM_COUNTERCFG_Type) which will be initialized.
  161. * @return None
  162. * Note: PWM_ConfigStruct pointer will be assigned to corresponding structure
  163. * (PWM_TIMERCFG_Type or PWM_COUNTERCFG_Type) due to PWMTimerCounterMode.
  164. **********************************************************************/
  165. void PWM_Init(uint8_t pwmId, uint32_t PWMTimerCounterMode, void *PWM_ConfigStruct)
  166. {
  167. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  168. PWM_TIMERCFG_Type *pTimeCfg;
  169. PWM_COUNTERCFG_Type *pCounterCfg;
  170. uint64_t clkdlycnt;
  171. pTimeCfg = (PWM_TIMERCFG_Type *)PWM_ConfigStruct;
  172. pCounterCfg = (PWM_COUNTERCFG_Type *)PWM_ConfigStruct;
  173. if(pwmId == PWM_0)
  174. {
  175. CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCPWM0, ENABLE);
  176. }
  177. else if(pwmId == PWM_1)
  178. {
  179. CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCPWM1, ENABLE);
  180. }
  181. else
  182. {
  183. //Trap the error
  184. while(1);
  185. }
  186. // Get peripheral clock of PWM1
  187. clkdlycnt = CLKPWR_GetCLK(CLKPWR_CLKTYPE_PER);
  188. // Clear all interrupts pending
  189. pPwm->IR = 0xFF & PWM_IR_BITMASK;
  190. pPwm->TCR = 0x00;
  191. pPwm->CTCR = 0x00;
  192. pPwm->MCR = 0x00;
  193. pPwm->CCR = 0x00;
  194. pPwm->PCR = 0x00;
  195. pPwm->LER = 0x00;
  196. if (PWMTimerCounterMode == PWM_MODE_TIMER)
  197. {
  198. /* Absolute prescale value */
  199. if (pTimeCfg->PrescaleOption == PWM_TIMER_PRESCALE_TICKVAL)
  200. {
  201. pPwm->PR = pTimeCfg->PrescaleValue - 1;
  202. }
  203. /* uSecond prescale value */
  204. else
  205. {
  206. clkdlycnt = (clkdlycnt * pTimeCfg->PrescaleValue) / 1000000;
  207. pPwm->PR = ((uint32_t) clkdlycnt) - 1;
  208. }
  209. }
  210. else if (PWMTimerCounterMode == PWM_MODE_COUNTER)
  211. {
  212. pPwm->CTCR |= (PWM_CTCR_MODE((uint32_t)pCounterCfg->CounterOption)) \
  213. | (PWM_CTCR_SELECT_INPUT((uint32_t)pCounterCfg->CountInputSelect));
  214. }
  215. }
  216. /*********************************************************************//**
  217. * @brief De-initializes the PWM peripheral registers to their
  218. * default reset values.
  219. * @param[in] pwmId The Id of the expected PWM component
  220. *
  221. * @return None
  222. **********************************************************************/
  223. void PWM_DeInit (uint8_t pwmId)
  224. {
  225. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  226. // Disable PWM control (timer, counter and PWM)
  227. pPwm->TCR = 0x00;
  228. if(pwmId == PWM_0)
  229. {
  230. CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCPWM0, DISABLE);
  231. }
  232. else if(pwmId == PWM_1)
  233. {
  234. CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCPWM1, DISABLE);
  235. }
  236. }
  237. /*********************************************************************//**
  238. * @brief Enable/Disable PWM peripheral
  239. * @param[in] pwmId The Id of the expected PWM component
  240. *
  241. * @param[in] NewState New State of this function, should be:
  242. * - ENABLE: Enable PWM peripheral
  243. * - DISABLE: Disable PWM peripheral
  244. * @return None
  245. **********************************************************************/
  246. void PWM_Cmd(uint8_t pwmId, FunctionalState NewState)
  247. {
  248. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  249. if (NewState == ENABLE)
  250. {
  251. pPwm->TCR |= PWM_TCR_PWM_ENABLE;
  252. }
  253. else
  254. {
  255. pPwm->TCR &= (~PWM_TCR_PWM_ENABLE) & PWM_TCR_BITMASK;
  256. }
  257. }
  258. /*********************************************************************//**
  259. * @brief Enable/Disable Counter in PWM peripheral
  260. * @param[in] pwmId The Id of the expected PWM component
  261. *
  262. * @param[in] NewState New State of this function, should be:
  263. * - ENABLE: Enable Counter in PWM peripheral
  264. * - DISABLE: Disable Counter in PWM peripheral
  265. * @return None
  266. **********************************************************************/
  267. void PWM_CounterCmd(uint8_t pwmId, FunctionalState NewState)
  268. {
  269. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  270. if (NewState == ENABLE)
  271. {
  272. pPwm->TCR |= PWM_TCR_COUNTER_ENABLE;
  273. }
  274. else
  275. {
  276. pPwm->TCR &= (~PWM_TCR_COUNTER_ENABLE) & PWM_TCR_BITMASK;
  277. }
  278. }
  279. /*********************************************************************//**
  280. * @brief Reset Counter in PWM peripheral
  281. * @param[in] pwmId The Id of the expected PWM component
  282. *
  283. * @return None
  284. **********************************************************************/
  285. void PWM_ResetCounter(uint8_t pwmId)
  286. {
  287. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  288. pPwm->TCR |= PWM_TCR_COUNTER_RESET;
  289. pPwm->TCR &= (~PWM_TCR_COUNTER_RESET) & PWM_TCR_BITMASK;
  290. }
  291. /*********************************************************************//**
  292. * @brief Configures match for PWM peripheral
  293. * @param[in] pwmId The Id of the expected PWM component
  294. *
  295. * @param[in] PWM_MatchConfigStruct Pointer to a PWM_MATCHCFG_Type structure
  296. * that contains the configuration information for the
  297. * specified PWM match function.
  298. * @return None
  299. **********************************************************************/
  300. void PWM_ConfigMatch(uint8_t pwmId, PWM_MATCHCFG_Type *PWM_MatchConfigStruct)
  301. {
  302. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  303. //interrupt on MRn
  304. if (PWM_MatchConfigStruct->IntOnMatch == ENABLE)
  305. {
  306. pPwm->MCR |= PWM_MCR_INT_ON_MATCH(PWM_MatchConfigStruct->MatchChannel);
  307. }
  308. else
  309. {
  310. pPwm->MCR &= (~ PWM_MCR_INT_ON_MATCH(PWM_MatchConfigStruct->MatchChannel)) \
  311. & PWM_MCR_BITMASK;
  312. }
  313. //reset on MRn
  314. if (PWM_MatchConfigStruct->ResetOnMatch == ENABLE)
  315. {
  316. pPwm->MCR |= PWM_MCR_RESET_ON_MATCH(PWM_MatchConfigStruct->MatchChannel);
  317. }
  318. else
  319. {
  320. pPwm->MCR &= (~ PWM_MCR_RESET_ON_MATCH(PWM_MatchConfigStruct->MatchChannel)) \
  321. & PWM_MCR_BITMASK;
  322. }
  323. //stop on MRn
  324. if (PWM_MatchConfigStruct->StopOnMatch == ENABLE)
  325. {
  326. pPwm->MCR |= PWM_MCR_STOP_ON_MATCH(PWM_MatchConfigStruct->MatchChannel);
  327. }
  328. else
  329. {
  330. pPwm->MCR &= (~ PWM_MCR_STOP_ON_MATCH(PWM_MatchConfigStruct->MatchChannel)) \
  331. & PWM_MCR_BITMASK;
  332. }
  333. }
  334. /*********************************************************************//**
  335. * @brief Configures capture input for PWM peripheral
  336. * @param[in] pwmId The Id of the expected PWM component
  337. *
  338. * @param[in] PWM_CaptureConfigStruct Pointer to a PWM_CAPTURECFG_Type structure
  339. * that contains the configuration information for the
  340. * specified PWM capture input function.
  341. * @return None
  342. **********************************************************************/
  343. void PWM_ConfigCapture(uint8_t pwmId, PWM_CAPTURECFG_Type *PWM_CaptureConfigStruct)
  344. {
  345. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  346. if (PWM_CaptureConfigStruct->RisingEdge == ENABLE)
  347. {
  348. pPwm->CCR |= PWM_CCR_CAP_RISING(PWM_CaptureConfigStruct->CaptureChannel);
  349. }
  350. else
  351. {
  352. pPwm->CCR &= (~ PWM_CCR_CAP_RISING(PWM_CaptureConfigStruct->CaptureChannel)) \
  353. & PWM_CCR_BITMASK;
  354. }
  355. if (PWM_CaptureConfigStruct->FallingEdge == ENABLE)
  356. {
  357. pPwm->CCR |= PWM_CCR_CAP_FALLING(PWM_CaptureConfigStruct->CaptureChannel);
  358. }
  359. else
  360. {
  361. pPwm->CCR &= (~ PWM_CCR_CAP_FALLING(PWM_CaptureConfigStruct->CaptureChannel)) \
  362. & PWM_CCR_BITMASK;
  363. }
  364. if (PWM_CaptureConfigStruct->IntOnCaption == ENABLE)
  365. {
  366. pPwm->CCR |= PWM_CCR_INT_ON_CAP(PWM_CaptureConfigStruct->CaptureChannel);
  367. }
  368. else
  369. {
  370. pPwm->CCR &= (~ PWM_CCR_INT_ON_CAP(PWM_CaptureConfigStruct->CaptureChannel)) \
  371. & PWM_CCR_BITMASK;
  372. }
  373. }
  374. /*********************************************************************//**
  375. * @brief Read value of capture register PWM peripheral
  376. * @param[in] pwmId The Id of the expected PWM component
  377. *
  378. * @param[in] CaptureChannel: capture channel number, should be in
  379. * range 0 to 1
  380. * @return Value of capture register
  381. **********************************************************************/
  382. uint32_t PWM_GetCaptureValue(uint8_t pwmId, uint8_t CaptureChannel)
  383. {
  384. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  385. switch (CaptureChannel)
  386. {
  387. case 0:
  388. return pPwm->CR0;
  389. case 1:
  390. return pPwm->CR1;
  391. default:
  392. return (0);
  393. }
  394. }
  395. /********************************************************************//**
  396. * @brief Update value for each PWM channel with update type option
  397. * @param[in] pwmId The Id of the expected PWM component
  398. *
  399. * @param[in] MatchChannel Match channel
  400. * @param[in] MatchValue Match value
  401. * @param[in] UpdateType Type of Update, should be:
  402. * - PWM_MATCH_UPDATE_NOW: The update value will be updated for
  403. * this channel immediately
  404. * - PWM_MATCH_UPDATE_NEXT_RST: The update value will be updated for
  405. * this channel on next reset by a PWM Match event.
  406. * @return None
  407. *********************************************************************/
  408. void PWM_MatchUpdate(uint8_t pwmId, uint8_t MatchChannel,
  409. uint32_t MatchValue, uint8_t UpdateType)
  410. {
  411. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  412. switch (MatchChannel)
  413. {
  414. case 0:
  415. pPwm->MR0 = MatchValue;
  416. break;
  417. case 1:
  418. pPwm->MR1 = MatchValue;
  419. break;
  420. case 2:
  421. pPwm->MR2 = MatchValue;
  422. break;
  423. case 3:
  424. pPwm->MR3 = MatchValue;
  425. break;
  426. case 4:
  427. pPwm->MR4 = MatchValue;
  428. break;
  429. case 5:
  430. pPwm->MR5 = MatchValue;
  431. break;
  432. case 6:
  433. pPwm->MR6 = MatchValue;
  434. break;
  435. }
  436. // Write Latch register
  437. pPwm->LER |= PWM_LER_EN_MATCHn_LATCH(MatchChannel);
  438. // In case of update now
  439. if (UpdateType == PWM_MATCH_UPDATE_NOW)
  440. {
  441. pPwm->TCR |= PWM_TCR_COUNTER_RESET;
  442. pPwm->TCR &= (~PWM_TCR_COUNTER_RESET) & PWM_TCR_BITMASK;
  443. }
  444. }
  445. /********************************************************************//**
  446. * @brief Configure Edge mode for each PWM channel
  447. * @param[in] pwmId The Id of the expected PWM component
  448. *
  449. * @param[in] PWMChannel PWM channel, should be in range from 2 to 6
  450. * @param[in] ModeOption PWM mode option, should be:
  451. * - PWM_CHANNEL_SINGLE_EDGE: Single Edge mode
  452. * - PWM_CHANNEL_DUAL_EDGE: Dual Edge mode
  453. * @return None
  454. * Note: PWM Channel 1 can not be selected for mode option
  455. *********************************************************************/
  456. void PWM_ChannelConfig(uint8_t pwmId, uint8_t PWMChannel, uint8_t ModeOption)
  457. {
  458. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  459. // Single edge mode
  460. if (ModeOption == PWM_CHANNEL_SINGLE_EDGE)
  461. {
  462. pPwm->PCR &= (~ PWM_PCR_PWMSELn(PWMChannel)) & PWM_PCR_BITMASK;
  463. }
  464. // Double edge mode
  465. else if (PWM_CHANNEL_DUAL_EDGE)
  466. {
  467. pPwm->PCR |= PWM_PCR_PWMSELn(PWMChannel);
  468. }
  469. }
  470. /********************************************************************//**
  471. * @brief Enable/Disable PWM channel output
  472. * @param[in] pwmId The Id of the expected PWM component
  473. *
  474. * @param[in] PWMChannel PWM channel, should be in range from 1 to 6
  475. * @param[in] NewState New State of this function, should be:
  476. * - ENABLE: Enable this PWM channel output
  477. * - DISABLE: Disable this PWM channel output
  478. * @return None
  479. *********************************************************************/
  480. void PWM_ChannelCmd(uint8_t pwmId, uint8_t PWMChannel, FunctionalState NewState)
  481. {
  482. LPC_PWM_TypeDef* pPwm = PWM_GetPointer(pwmId);
  483. if (NewState == ENABLE)
  484. {
  485. pPwm->PCR |= PWM_PCR_PWMENAn(PWMChannel);
  486. }
  487. else
  488. {
  489. pPwm->PCR &= (~ PWM_PCR_PWMENAn(PWMChannel)) & PWM_PCR_BITMASK;
  490. }
  491. }
  492. /**
  493. * @}
  494. */
  495. #endif /*_PWM*/
  496. /**
  497. * @}
  498. */
  499. /* --------------------------------- End Of File ------------------------------ */