1 /**********************************************************************
\r
2 * $Id$ lpc18xx_sct.c 2011-06-02
\r
4 * @file lpc18xx_sct.c
\r
5 * @brief Contains all functions support for SCT firmware library on LPC18xx
\r
7 * @date 02. June. 2011
\r
8 * @author NXP MCU SW Application Team
\r
10 * Copyright(C) 2011, NXP Semiconductor
\r
11 * All rights reserved.
\r
13 ***********************************************************************
\r
14 * Software that is described herein is for illustrative purposes only
\r
15 * which provides customers with programming information regarding the
\r
16 * products. This software is supplied "AS IS" without any warranties.
\r
17 * NXP Semiconductors assumes no responsibility or liability for the
\r
18 * use of the software, conveys no license or title under any patent,
\r
19 * copyright, or mask work right to the product. NXP Semiconductors
\r
20 * reserves the right to make changes in the software without
\r
21 * notification. NXP Semiconductors also make no representation or
\r
22 * warranty that such application will be suitable for the specified
\r
23 * use without further testing or modification.
\r
24 **********************************************************************/
\r
26 /* Peripheral group ----------------------------------------------------------- */
\r
31 /* Includes ------------------------------------------------------------------- */
\r
32 #include "lpc18xx_sct.h"
\r
34 /* If this source file built with example, the LPC18xx FW library configuration
\r
35 * file in each example directory ("lpc18xx_libcfg.h") must be included,
\r
36 * otherwise the default FW library configuration file must be included instead
\r
38 #ifdef __BUILD_WITH_EXAMPLE__
\r
39 #include "lpc18xx_libcfg.h"
\r
41 #include "lpc18xx_libcfg_default.h"
\r
42 #endif /* __BUILD_WITH_EXAMPLE__ */
\r
47 /* Public Functions ----------------------------------------------------------- */
\r
48 /** @addtogroup SCT_Public_Functions
\r
52 /*********************************************************************//**
\r
53 * @brief Select 16/32 bit SCT counter
\r
54 * @param[in] value configuration value for SCT
\r
55 * - SCT_CONFIG_16BIT_COUNTER :16-bit counter
\r
56 * - SCT_CONFIG_32BIT_COUNTER :32-bit counter
\r
58 **********************************************************************/
\r
59 void SCT_Config(uint32_t value)
\r
61 CHECK_PARAM(PARAM_SCT_CONFIG_COUNTER_TYPE(value));
\r
63 LPC_SCT->CONFIG = value;
\r
66 /*********************************************************************//**
\r
67 * @brief Setting SCT control
\r
68 * @param[in] value setting value
\r
69 * @param[in] ena Enable/disable status
\r
73 **********************************************************************/
\r
74 void SCT_ControlSet(uint32_t value, FunctionalState ena)
\r
78 CHECK_PARAM(PARAM_FUNCTIONALSTATE(ena));
\r
80 tem = LPC_SCT->CTRL_U;
\r
91 LPC_SCT->CTRL_U = tem;
\r
95 /*********************************************************************//**
\r
96 * @brief Set start mode for ADC
\r
97 * @param[in] outnum number of SCT output, should be: 0..15
\r
98 * @param[in] value solution value, should be
\r
99 * - SCT_RES_NOCHANGE :No change
\r
100 * - SCT_RES_SET_OUTPUT :Set output
\r
101 * - SCT_RES_CLEAR_OUTPUT :Clear output
\r
102 * - SCT_RES_TOGGLE_OUTPUT :Toggle output
\r
104 *********************************************************************/
\r
105 void SCT_ConflictResolutionSet(uint8_t outnum, uint8_t value)
\r
109 CHECK_PARAM(PARAM_SCT_OUTPUT_NUM(outnum));
\r
110 CHECK_PARAM(PARAM_SCT_RES(value));
\r
112 tem = LPC_SCT->RES;
\r
113 tem &= ~(0x03 << (2*outnum));
\r
114 tem |= (value << (2*outnum));
\r
115 LPC_SCT->RES = tem;
\r
118 /*********************************************************************//**
\r
119 * @brief Clear SCT event generating interrupt request
\r
120 * @param[in] even_num SCT event number, should be: 0..15
\r
122 *********************************************************************/
\r
123 void SCT_EventFlagClear(uint8_t even_num)
\r
125 CHECK_PARAM(PARAM_SCT_EVENT(even_num));
\r
127 LPC_SCT->EVFLAG = (1 << (even_num));
\r
139 /* --------------------------------- End Of File ------------------------------ */
\r