LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sct_simple_match.c
Go to the documentation of this file.
1 /*
2  * @brief State Configurable Timer Simple Match example
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #include <stdlib.h>
33 #include <string.h>
34 #include "board.h"
35 #include "sct_fsm.h"
36 
70 /*****************************************************************************
71  * Private types/enumerations/variables
72  ****************************************************************************/
73 #ifdef BOARD_HITEX_EVA_18504350
74 #define MCSEL_BIT 23
75 #define MCSEL_PORT 6
76 #endif
77 
78 /*****************************************************************************
79  * Public types/enumerations/variables
80  ****************************************************************************/
81 
82 /*****************************************************************************
83  * Private functions
84  ****************************************************************************/
85 
86 /* Initialise the SCT Pins */
88 {
89 #ifdef BOARD_HITEX_EVA_18504350
90  /* Enable signals on MC connector X19 */
91  Chip_SCU_PinMuxSet(0xD, 9, (SCU_MODE_MODE_INACT | SCU_MODE_FUNC4)); /* PD_9: GPIO 6.23, MCSEL */
92  Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, MCSEL_PORT, MCSEL_BIT, true);
93  Chip_GPIO_WritePortBit(LPC_GPIO_PORT, MCSEL_PORT, MCSEL_BIT, false);
94 
95  Chip_SCU_PinMuxSet(0xE, 6, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* PE_6: SCTOUT_2 connected to RGB green */
96  Chip_SCU_PinMuxSet(0xE, 5, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* PE_5: SCTOUT_3 connected to RGB red */
97  Chip_SCU_PinMuxSet(0xE, 8, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P4_4: SCTOUT_4 connected to RGB blue */
98  Chip_SCU_PinMuxSet(0xE, 7, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P4_3: SCTOUT_5 */
99  Chip_SCU_PinMuxSet(0xD, 3, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* PD_3: SCTOUT_6 */
100 
101  /* Global configuration of the SCT */
102  /* use Core clock */
104 
105 #elif defined(BOARD_KEIL_MCB_18574357)
106 
107  Chip_SCU_PinMuxSet(0xD, 11, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC6)); /* PD_11: SCTOUT_14 connected to LED1 */
108  Chip_SCU_PinMuxSet(0xD, 12, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC6)); /* PD_12: SCTOUT_10 connected to LED2 */
109  Chip_SCU_PinMuxSet(0xD, 13, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC6)); /* PD_13: SCTOUT_13 connected to LED3 */
110  Chip_SCU_PinMuxSet(0xD, 14, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC6)); /* PD_14: SCTOUT_11 connected to LED4 */
111  Chip_SCU_PinMuxSet(0xD, 3, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* PD_3: SCTOUT_6 connected */
112 
113  /* Global configuration of the SCT */
114  /* use Core clock */
116 
117 #elif defined(BOARD_NGX_XPLORER_18304330)
118 
119  Chip_SCU_PinMuxSet(0x2, 11, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P2_11: SCTOUT_5 connected to LED1 */
120  Chip_SCU_PinMuxSet(0x2, 12, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P2_12: SCTOUT_4 connected to LED2 */
121  Chip_SCU_PinMuxSet(0x2, 10, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P2_10: SCTOUT_2 */
122  Chip_SCU_PinMuxSet(0x2, 9, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P2_9: SCTOUT_3 */
123  Chip_SCU_PinMuxSet(0x6, 5, (SCU_MODE_MODE_PULLUP | SCU_MODE_FUNC1)); /* P6_5: SCTOUT_6 */
124 
125  /* Global configuration of the SCT */
126  /* use Core clock */
128 
129 #else
130 #error Board not supported!
131 #endif
132 
133 }
134 
135 /*****************************************************************************
136  * Public functions
137  ****************************************************************************/
138 
143 int main(void)
144 {
145  Board_Init();
146 
147  /* Initialize SCT */
149 
150  /* Configure SCT pins */
152 
155  ENABLE);
156 
157  /* Now use the FSM code to configure the state machine */
158  sct_fsm_init();
159 
160  /* Start the SCT */
162 
163  while (1) {}
164 }
165