/* System clock to the IOCON needs to be enabled or most of the I/O related peripherals won't work. */ LPC_SYSCON->SYSAHBCLKCTRL = 0x0001001FUL; |
/* System clock to the IOCON needs to be enabled or most of the I/O related peripherals won't work. */ LPC_SYSCON->SYSAHBCLKCTRL = 0x0001001FUL; |
LPC_SYSCON->SYSAHBCLKCTRL |= 0xE001001FUL; |
/*********************************************************************** * $Id:: main.c 6922 2011-03-23 17:20:21Z nxp28548 $ * * Copyright (C) 2010 NXP Semiconductors. * * Description: * Simple LED Blinky example. Uses SysTick timer to generate 1ms * tick events. * *********************************************************************** * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * products. This software is supplied "AS IS" without any warranties. * NXP Semiconductors assumes no responsibility or liability for the * use of the software, conveys no license or title under any patent, * copyright, or mask work right to the product. NXP Semiconductors * reserves the right to make changes in the software without * notification. NXP Semiconductors also make no representation or * warranty that such application will be suitable for the specified * use without further testing or modification. **********************************************************************/ #ifdef __USE_CMSIS #include "LPC122x.h" #endif #include <cr_section_macros.h> #include <NXP/crp.h> // Variable to store CRP value in. Will be placed automatically // by the linker when "Enable Code Read Protect" selected. // See crp.h header for more information __CRP const unsigned int CRP_WORD = CRP_NO_CRP ; volatile uint32_t msTicks=0; // **************** // SysTick_Handler void SysTick_Handler(void) { msTicks++; } int main(void) { /* Enable all three GPIO blocks and IOCON */ LPC_SYSCON->SYSAHBCLKCTRL |= 0xE001001FUL; LPC_GPIO0->DIR = 1 << 7; LPC_GPIO0->SET = 1 << 7; /* Generate 1ms Ticks */ SysTick_Config(SystemCoreClock / 1000); while (1) { switch (msTicks) { case 500: msTicks = 0; LPC_GPIO0->CLR = 1 << 7; break; case 100: case 200: case 300: LPC_GPIO0->NOT = 1 << 7; break; } __WFI(); } } |
PINSEL_CFG_Type PinCfg; // Pin configuration // P2.0 PinCfg.Funcnum = 0; PinCfg.OpenDrain = 0; PinCfg.Pinmode = PINSEL_PINMODE_PULLDOWN; PinCfg.Portnum = 2; // pin for wheelie sensor (P2.12) PinCfg.Pinnum = 12; PINSEL_ConfigPin(&PinCfg); // wheelie FIO_ByteSetDir(2, 1, WHEELIE, 0); FIO_ByteClearValue(2, 1, WHEELIE); |