示例#1
0
void HAL_USBInit(uint8_t corenum)
{
	/* Enable PLL1 for 48MHz output */
	Chip_Clock_EnablePLL(SYSCTL_USB_PLL, SYSCTL_PLL_ENABLE);
#if defined(__LPC175X_6X__)
	while ((Chip_Clock_GetPLLStatus(SYSCTL_USB_PLL) & SYSCTL_PLL1STS_LOCKED) == 0);
#else
	while ((Chip_Clock_GetPLLStatus(SYSCTL_USB_PLL) & SYSCTL_PLLSTS_LOCKED) == 0);
#endif

	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC1);	/* P0.29 D1+, P0.30 D1- */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC1);

	#if defined(USB_CAN_BE_HOST)
	Chip_IOCON_PinMux(LPC_IOCON, 1, 19, IOCON_MODE_INACT, IOCON_FUNC2);	/* USB_Power switch */
#endif
	
#if defined(USB_CAN_BE_DEVICE)
	Chip_IOCON_PinMux(LPC_IOCON, 2, 9, IOCON_MODE_INACT, IOCON_FUNC1);	/* USB_SoftConnect */
#endif
	
	LPC_SYSCTL->PCONP |= (1UL << 31);					/* USB PCLK -> enable USB Per.*/

#if defined(USB_CAN_BE_DEVICE)
	LPC_USB->USBClkCtrl = 0x12;					/* Dev, PortSel, AHB clock enable */
	while ((LPC_USB->USBClkSt & 0x12) != 0x12) ;

	HAL_Reset(corenum);
#endif
}
示例#2
0
void HAL_USBDeInit(uint8_t corenum, uint8_t mode)
{
	NVIC_DisableIRQ(USB_IRQn);													/* disable USB interrupt */
	LPC_SYSCTL->PCONP &= (~(1UL << 31));								/* disable USB Per.      */	
	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC0);	/* P0.29 D+, P0.30 D- reset to GPIO function */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC0);
	/* Disable PLL1 to save power */
	Chip_Clock_DisablePLL(SYSCTL_USB_PLL, SYSCTL_PLL_ENABLE);
}
示例#3
0
文件: i2c.c 项目: qermit/afcipm
void vI2CInit( I2C_ID_T i2c_id, I2C_Mode mode )
{
    char pcI2C_Tag[4];
    uint8_t sla_addr;

    sprintf( pcI2C_Tag, "I2C%u", i2c_id );
    /*! @todo Maybe wrap these functions, or use some board-specific defines
     * so this code is generic enough to be applied on other hardware.
     * Example: (if using LPC17xx and LPCOpen library)
     * @code
     * #define PIN_FUNC_CFG( port, pin, func ) Chip_IOCON_PinMux(...)
     * @endcode
    */
    Chip_IOCON_PinMux( LPC_IOCON, i2c_cfg[i2c_id].pins.sda_port, i2c_cfg[i2c_id].pins.sda_pin, IOCON_MODE_INACT, i2c_cfg[i2c_id].pins.pin_func );
    Chip_IOCON_PinMux( LPC_IOCON, i2c_cfg[i2c_id].pins.scl_port, i2c_cfg[i2c_id].pins.scl_pin, IOCON_MODE_INACT, i2c_cfg[i2c_id].pins.pin_func );
    Chip_IOCON_EnableOD( LPC_IOCON, i2c_cfg[i2c_id].pins.sda_port, i2c_cfg[i2c_id].pins.sda_pin );
    Chip_IOCON_EnableOD( LPC_IOCON, i2c_cfg[i2c_id].pins.scl_port, i2c_cfg[i2c_id].pins.scl_pin );
    NVIC_SetPriority(i2c_cfg[i2c_id].irq, configMAX_SYSCALL_INTERRUPT_PRIORITY);
    NVIC_EnableIRQ( i2c_cfg[i2c_id].irq );

    /* Create mutex for accessing the shared memory (i2c_cfg) */
    I2C_mutex[i2c_id] = xSemaphoreCreateMutex();

    /* Make sure that the mutex is freed */
    xSemaphoreGive( I2C_mutex[i2c_id] );

    /* Set I2C operating mode */
    if( xSemaphoreTake( I2C_mutex[i2c_id], 0 ) ) {
        i2c_cfg[i2c_id].mode = mode;
        xSemaphoreGive( I2C_mutex[i2c_id] );
    }

    /* Enable and configure I2C clock */
    Chip_I2C_Init( i2c_id );
    Chip_I2C_SetClockRate( i2c_id, 100000 );

    /* Enable I2C interface (Master Mode only) */
    I2CCONSET( i2c_id, I2C_I2EN );

    if ( mode == I2C_Mode_IPMB )
    {
        /* Configure Slave Address */
        sla_addr = get_ipmb_addr( );
        I2CADDR_WRITE( i2c_id, sla_addr );

        /* Configure Slave Address Mask */
        I2CMASK( i2c_id, 0xFE);

        /* Enable slave mode */
        I2CCONSET( i2c_id, I2C_AA );
    }

    /* Clear I2C0 interrupt (just in case) */
    I2CCONCLR( i2c_id, I2C_SI );

} /* End of vI2C_Init */
示例#4
0
文件: board.c 项目: MFDM/SE2-SV1314
void Board_USBD_Init(uint32_t port)
{
	/* VBUS is not connected on the NXP LPCXpresso LPC1769, so leave the pin at default setting. */
	/*Chip_IOCON_PinMux(LPC_IOCON, 1, 30, IOCON_MODE_INACT, IOCON_FUNC2);*/ /* USB VBUS */
	
	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC1);	/* P0.29 D1+, P0.30 D1- */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC1);

	LPC_USB->USBClkCtrl = 0x12;                /* Dev, AHB clock enable */
	while ((LPC_USB->USBClkSt & 0x12) != 0x12); 
}
示例#5
0
void HAL_USBInit(uint8_t corenum)
{
	/* Enable PLL1 for 48MHz output */
	Chip_Clock_EnablePLL(SYSCTL_USB_PLL, SYSCTL_PLL_ENABLE);
	while ((Chip_Clock_GetPLLStatus(SYSCTL_USB_PLL) & SYSCTL_PLLSTS_LOCKED) == 0);

#if defined(__LPC175X_6X__)
	//LPC_PINCON->PINSEL1 &= ~((3 << 26) | (3 << 28));	/* P0.29 D+, P0.30 D- */
	//LPC_PINCON->PINSEL1 |=  ((1 << 26) | (1 << 28));	/* PINSEL1 26.27, 28.29  = 01 */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, MD_PLN, FUNC1);
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, MD_PLN, FUNC1);

#if defined(USB_CAN_BE_HOST)
	LPC_PINCON->PINSEL3 &= ~(3 << 6);
	LPC_PINCON->PINSEL3 |= (2 << 6);
#endif

#elif defined(__LPC177X_8X__) || defined(__LPC407X_8X__)

	//LPC_IOCON->P0_29 &= ~0x07;					/* P0.29 D1+, P0.30 D1- */
	LPC_IOCON->p[0][29] &= ~0x07;
	LPC_IOCON->p[0][30] &= ~0x07;
	LPC_IOCON->p[0][29] |= 0x1;
	LPC_IOCON->p[0][30] |= 0x1;
	//Chip_IOCON_PinMux(LPC_IOCON, 0, 29, MD_PLN, FUNC1);
	//Chip_IOCON_PinMux(LPC_IOCON, 0, 30, MD_PLN, FUNC1);
#if defined(USB_CAN_BE_DEVICE)
	//LPC_IOCON->P2_9  &= ~0x07;					/* USB_SoftConnect */
	//LPC_IOCON->P2_9  |= 0x1;
	//Chip_IOCON_PinMux(LPC_IOCON, 2, 9, MD_PLN, FUNC1);
	LPC_IOCON->p[2][9] &= ~0x07;		/* USB_SoftConnect */
	LPC_IOCON->p[2][9] |= 0x1;
#endif
#if defined(USB_CAN_BE_HOST)
	//LPC_IOCON->P1_19  &= ~0x07;					/* USB_Power switch */
	LPC_IOCON->p[1][19] &= ~0x07;
	LPC_IOCON->p[1][19] |= 0x2;
#endif

#endif

	LPC_SYSCTL->PCONP |= (1UL << 31);					/* USB PCLK -> enable USB Per.*/

#if defined(USB_CAN_BE_DEVICE)
	LPC_USB->USBClkCtrl = 0x12;					/* Dev, PortSel, AHB clock enable */
	while ((LPC_USB->USBClkSt & 0x12) != 0x12) ;

	HAL_Reset(corenum);
#endif
}
/* Initialize pin muxing for SSP interface */
void schBoard_SSP_Init(LPC_SSP_T *pSSP)
{
	if (pSSP == LPC_SSP1) {
		/* Set up clock and muxing for SSP1 interface */
		/*
		 * Initialize SSP0 pins connect
		 * P0.7: SCK
		 * P0.6: SSEL
		 * P0.8: MISO
		 * P0.9: MOSI
		 */
		Chip_IOCON_PinMux(LPC_IOCON, 0, 7, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 6, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 8, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 9, IOCON_MODE_INACT, IOCON_FUNC2);
	}
	else {
		/* Set up clock and muxing for SSP0 interface */
		/*
		 * Initialize SSP0 pins connect
		 * P0.15: SCK
		 * P0.16: SSEL
		 * P0.17: MISO
		 * P0.18: MOSI
		 */
		Chip_IOCON_PinMux(LPC_IOCON, 0, 15, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 16, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 17, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 18, IOCON_MODE_INACT, IOCON_FUNC2);
	}
}
示例#7
0
int skynetbase_windvane_init(void) {
	DBG("Initialize Wind Vane...\n");
	Chip_IOCON_PinMux(LPC_IOCON, WINVANE_PORT, WINVANE_PIN, IOCON_MODE_INACT, IOCON_FUNC2);

	skynetbase_windvane_start();
	DBG("Initialize Wind Vane complete.\n");
	return true;
}
示例#8
0
void InitSPI ()
{
    Chip_IOCON_PinMux(LPC_IOCON,TOUCH_E,IOCON_MODE_PULLUP,IOCON_FUNC0);
	Chip_GPIO_SetPinDIROutput(LPC_GPIO,TOUCH_E);
	Chip_IOCON_DisableOD(LPC_IOCON,TOUCH_E);
	Chip_GPIO_SetPinOutHigh(LPC_GPIO,TOUCH_E);

	Chip_IOCON_PinMux(LPC_IOCON,TOUCH_CLK,IOCON_MODE_INACT,IOCON_FUNC2);
	Chip_IOCON_PinMux(LPC_IOCON,TOUCH_MOSI,IOCON_MODE_INACT,IOCON_FUNC2);
	Chip_IOCON_PinMux(LPC_IOCON,TOUCH_MISO,IOCON_MODE_INACT,IOCON_FUNC2);

	Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SSP0);
	Chip_SSP_Set_Mode(LPC_SSP0,SSP_MASTER_MODE);
	Chip_SSP_SetFormat(LPC_SSP0,SSP_BITS_8,SSP_FRAMEFORMAT_SPI,SSP_CLOCK_CPHA0_CPOL0);
	Chip_SSP_SetBitRate(LPC_SSP0,1000000 );
	Chip_SSP_Enable(LPC_SSP0);
}
示例#9
0
void HAL_USBDeInit(uint8_t corenum, uint8_t mode)
{
	NVIC_DisableIRQ(USB_IRQn);					/* disable USB interrupt */
	LPC_SYSCTL->PCONP &= (~(1UL << 31));				/* disable USB Per.      */
#if defined(__LPC175X_6X__)
	//LPC_PINCON->PINSEL1 &= ~((3 << 26) | (3 << 28));	/* P0.29 D+, P0.30 D- reset to GPIO function */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, MD_PLN, FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, MD_PLN, FUNC0);
#elif defined(__LPC177X_8X__) || defined(__LPC407X_8X__)
	//LPC_IOCON->P0_29 &= ~0x07;					/* P0.29 D1+, P0.30 D1- reset to GPIO function */
	//LPC_IOCON->P0_30 &= ~0x07;
	Chip_IOCON_PinMux(LPC_IOCON, 0, 29, MD_PLN, FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON, 0, 30, MD_PLN, FUNC0);
#endif

	/* Disable PLL1 to save power */
	Chip_Clock_DisablePLL(SYSCTL_USB_PLL, SYSCTL_PLL_ENABLE);
}
示例#10
0
platform_result_t platform_gpio_init( const platform_gpio_t* gpio, platform_pin_config_t config )
{
    uint16_t mode;
    uint8_t  direction;

    switch(config)
    {
        case INPUT_PULL_UP:
        {
            mode = IOCON_MODE_PULLUP;
            direction =LPC_PIN_INPUT;
            break;
        }
        case INPUT_PULL_DOWN:
        {
            mode = IOCON_MODE_PULLDOWN;
            direction =LPC_PIN_INPUT;
            break;
        }
        case INPUT_HIGH_IMPEDANCE:
        {
            mode = IOCON_MODE_INACT;
            direction =LPC_PIN_INPUT;
            break;
        }
        case OUTPUT_PUSH_PULL:
        {
            mode = IOCON_MODE_REPEATER;
            direction =LPC_PIN_OUTPUT;
            break;
        }
        case OUTPUT_OPEN_DRAIN_NO_PULL:
        {
            mode = IOCON_MODE_INACT;
            direction =LPC_PIN_OUTPUT;
            break;
        }
        case OUTPUT_OPEN_DRAIN_PULL_UP:
        {
            mode = IOCON_MODE_PULLUP;
            direction =LPC_PIN_OUTPUT;
            break;
        }
        default:
        {
            return PLATFORM_UNSUPPORTED;
        }

    }
    Chip_IOCON_PinMux(LPC_IOCON, gpio->port, gpio->pin, mode, IOCON_FUNC0);
    Chip_GPIO_WriteDirBit(LPC_GPIO, gpio->port, gpio->pin, direction );
    return PLATFORM_SUCCESS;
}
示例#11
0
void Board_Joystick_Init(void)
{
	Chip_IOCON_PinMux(LPC_IOCON, JOYSTICK_UP_GPIO_PORT_NUM, JOYSTICK_UP_GPIO_BIT_NUM, IOCON_MODE_INACT, IOCON_FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON, JOYSTICK_DOWN_GPIO_PORT_NUM, JOYSTICK_DOWN_GPIO_BIT_NUM, IOCON_MODE_INACT, IOCON_FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON, JOYSTICK_LEFT_GPIO_PORT_NUM, JOYSTICK_LEFT_GPIO_BIT_NUM, IOCON_MODE_INACT, IOCON_FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON,
					  JOYSTICK_RIGHT_GPIO_PORT_NUM,
					  JOYSTICK_RIGHT_GPIO_BIT_NUM,
					  IOCON_MODE_INACT,
					  IOCON_FUNC0);
	Chip_IOCON_PinMux(LPC_IOCON,
					  JOYSTICK_PRESS_GPIO_PORT_NUM,
					  JOYSTICK_PRESS_GPIO_BIT_NUM,
					  IOCON_MODE_INACT,
					  IOCON_FUNC0);
	Chip_GPIO_WriteDirBit(LPC_GPIO, JOYSTICK_UP_GPIO_PORT_NUM, JOYSTICK_UP_GPIO_BIT_NUM, false);		/* input */
	Chip_GPIO_WriteDirBit(LPC_GPIO, JOYSTICK_DOWN_GPIO_PORT_NUM, JOYSTICK_DOWN_GPIO_BIT_NUM, false);	/* input */
	Chip_GPIO_WriteDirBit(LPC_GPIO, JOYSTICK_LEFT_GPIO_PORT_NUM, JOYSTICK_LEFT_GPIO_BIT_NUM, false);	/* input */
	Chip_GPIO_WriteDirBit(LPC_GPIO, JOYSTICK_RIGHT_GPIO_PORT_NUM, JOYSTICK_RIGHT_GPIO_BIT_NUM, false);	/* input */
	Chip_GPIO_WriteDirBit(LPC_GPIO, JOYSTICK_PRESS_GPIO_PORT_NUM, JOYSTICK_PRESS_GPIO_BIT_NUM, false);	/* input */
}
示例#12
0
void ssp_init( uint8_t id, uint32_t bitrate, uint8_t frame_sz, bool master_mode, bool poll )
{
    ssp_cfg[id].polling = poll;
    ssp_cfg[id].frame_size = frame_sz;
    ssp_cfg[id].master_mode = master_mode;
    ssp_cfg[id].bitrate = bitrate;

    /* Set up clock and muxing for SSP0/1 interface */
    /* Slave Select (SSEL/FCS_B) is left as GPIO so we can send more than one byte without this pin going high (default operation of SSP interface) */

    Chip_IOCON_Init(LPC_IOCON);

    Chip_IOCON_PinMux(LPC_IOCON, ssp_pins[id].port, ssp_pins[id].sck_pin, IOCON_MODE_PULLDOWN, ssp_pins[id].sck_func);
    Chip_IOCON_PinMux(LPC_IOCON, ssp_pins[id].port, ssp_pins[id].ssel_pin, IOCON_MODE_PULLUP, ssp_pins[id].ssel_func);
    Chip_IOCON_PinMux(LPC_IOCON, ssp_pins[id].port, ssp_pins[id].mosi_pin, IOCON_MODE_INACT, ssp_pins[id].mosi_func);
    Chip_IOCON_PinMux(LPC_IOCON, ssp_pins[id].port, ssp_pins[id].miso_pin, IOCON_MODE_INACT, ssp_pins[id].miso_func);

    if (ssp_pins[id].ssel_func == 0) {
        gpio_set_pin_dir( ssp_pins[id].port, ssp_pins[id].ssel_pin, OUTPUT);
        gpio_set_pin_state( ssp_pins[id].port, ssp_pins[id].ssel_pin, HIGH);
    }

    Chip_SSP_Init(ssp_cfg[id].lpc_id);
    Chip_SSP_SetBitRate(ssp_cfg[id].lpc_id, bitrate);
    Chip_SSP_SetMaster(ssp_cfg[id].lpc_id, master_mode);
    Chip_SSP_SetFormat(ssp_cfg[id].lpc_id, (frame_sz-1), SSP_FRAMEFORMAT_SPI, SSP_CLOCK_CPHA0_CPOL0);
    Chip_SSP_Enable(ssp_cfg[id].lpc_id);

    if (!poll) {
        /* Configure interruption priority and enable it */
        NVIC_SetPriority( ssp_cfg[id].irq, configMAX_SYSCALL_INTERRUPT_PRIORITY );
        NVIC_EnableIRQ( ssp_cfg[id].irq );
    }

    if (ssp_cfg[id].lpc_id == LPC_SSP0) {
        active_SSP0 = id;
    }
}
示例#13
0
/* Initialize pin muxing for SPI interface */
void schBoard_SPI_Init(bool isMaster)
{
	/* Set up clock and muxing for SSP0 interface */
	/*
	 * Initialize SSP0 pins connect
	 * P0.15: SCK
	 * P0.16: SSEL
	 * P0.17: MISO
	 * P0.18: MOSI
	 */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 15, IOCON_MODE_PULLDOWN, IOCON_FUNC3);
	if (isMaster) {
		Chip_IOCON_PinMux(LPC_IOCON, 0, 16, IOCON_MODE_PULLUP, IOCON_FUNC0);
		Chip_GPIO_WriteDirBit(LPC_GPIO, 0, 16, true);
		Board_SPI_DeassertSSEL();

	}
	else {
		Chip_IOCON_PinMux(LPC_IOCON, 0, 16, IOCON_MODE_PULLUP, IOCON_FUNC3);
	}
	Chip_IOCON_PinMux(LPC_IOCON, 0, 17, IOCON_MODE_INACT, IOCON_FUNC3);
	Chip_IOCON_PinMux(LPC_IOCON, 0, 18, IOCON_MODE_INACT, IOCON_FUNC3);
}
示例#14
0
static void initHardware(void)
{
#if defined (__USE_LPCOPEN)
#if !defined(NO_BOARD_LIB)
    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
    // Set up and initialize all required blocks and
    // functions related to the board hardware
    Board_Init();
    // Set the LED to the state of "Off"
    Board_LED_Set(0, false);
#endif
#endif
    Board_I2C_Init(I2C1);

    /* pines del stick */
	Chip_IOCON_PinMux(LPC_IOCON, 0, 0, IOCON_MODE_INACT, IOCON_FUNC3);
	Chip_IOCON_PinMux(LPC_IOCON, 0, 1, IOCON_MODE_INACT, IOCON_FUNC3);
	Chip_IOCON_EnableOD(LPC_IOCON, 0, 0);
	Chip_IOCON_EnableOD(LPC_IOCON, 0, 1);

    Chip_I2C_SetClockRate(I2C1, 100000);
	Chip_I2C_SetMasterEventHandler(I2C1, Chip_I2C_EventHandlerPolling);
}
示例#15
0
void setupTimer(void)
{
	Chip_IOCON_PinMux(LPC_IOCON, 1, 28, 2, 3);
	Chip_GPIO_SetPinDIROutput(LPC_GPIO, 1, 28);

	Chip_TIMER_Init(LPC_TIMER0);
	Chip_TIMER_Reset(LPC_TIMER0);
	Chip_TIMER_PrescaleSet(LPC_TIMER0, 500);
	Chip_TIMER_SetMatch(LPC_TIMER0, 0, 16000);
	Chip_TIMER_ResetOnMatchEnable(LPC_TIMER0, 0);
	//	Chip_TIMER_MatchEnableInt(LPC_TIMER0, 0);
	Chip_TIMER_ExtMatchControlSet(LPC_TIMER0, RESET, TIMER_EXTMATCH_TOGGLE, 0);
	Chip_TIMER_Enable(LPC_TIMER0);
	//	NVIC_ClearPendingIRQ(TIMER0_IRQn);
	//	NVIC_EnableIRQ(TIMER0_IRQn);
}
示例#16
0
/*
 * Wind Speed translation : V = p*(2,25/t)
 * V: speed in mph
 * p: pulses per sampelperiod
 * t: sample period in sec
 */
void setupirq(){
	DBG("Initialize Wind Cups...\n");

	Chip_GPIOINT_Init(LPC_GPIOINT);
	Chip_GPIO_SetPinDIRInput(LPC_GPIO,2,13);
	Chip_GPIO_SetPinState(LPC_GPIO, 2, 13, true);

	Chip_IOCON_PinMux(LPC_IOCON, 2, 13, IOCON_MODE_PULLUP, IOCON_FUNC0);

	const uint32_t prescaleDivisor = 8;
	Chip_TIMER_Init(LPC_TIMER2);
	Chip_TIMER_PrescaleSet(LPC_TIMER2, prescaleDivisor - 1);
	Chip_TIMER_Enable(LPC_TIMER2);
	ticksPerSecond = Chip_Clock_GetSystemClockRate() / prescaleDivisor / 4;

	Chip_GPIOINT_SetIntFalling(LPC_GPIOINT, GPIOINT_PORT2, (1 << 13));
	Chip_GPIOINT_ClearIntStatus(LPC_GPIOINT, GPIOINT_PORT2, (1 << 13));

	NVIC_ClearPendingIRQ(EINT3_IRQn);
	NVIC_EnableIRQ(EINT3_IRQn);
	DBG("Initialize Wind Cups complete...\n");


}
示例#17
0
/* Sets up board specific I2C interface */
void Board_I2C_Init(I2C_ID_T id)
{
	switch (id) {
	case I2C0:
		Chip_IOCON_PinMux(LPC_IOCON, 0, 27, IOCON_MODE_INACT, IOCON_FUNC1);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 28, IOCON_MODE_INACT, IOCON_FUNC1);
		Chip_IOCON_SetI2CPad(LPC_IOCON, I2CPADCFG_STD_MODE);
		break;

	case I2C1:
		Chip_IOCON_PinMux(LPC_IOCON, 0, 19, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 20, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_EnableOD(LPC_IOCON, 0, 19);
		Chip_IOCON_EnableOD(LPC_IOCON, 0, 20);
		break;

	case I2C2:
		Chip_IOCON_PinMux(LPC_IOCON, 0, 10, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_PinMux(LPC_IOCON, 0, 11, IOCON_MODE_INACT, IOCON_FUNC2);
		Chip_IOCON_EnableOD(LPC_IOCON, 0, 10);
		Chip_IOCON_EnableOD(LPC_IOCON, 0, 11);
		break;
	}
}
示例#18
0
platform_result_t platform_gpio_set_alternate_function( const platform_gpio_config_t* gpio)
{
    Chip_IOCON_PinMux(LPC_IOCON, gpio->config.port, gpio->config.pin, gpio->mode, gpio->function);
    return PLATFORM_SUCCESS;
}
示例#19
0
static void prvSetupHardware(void) {
	SystemCoreClockUpdate();
	Board_Init();
	Chip_IOCON_PinMux(LPC_IOCON, 0, 26, IOCON_MODE_PULLUP, IOCON_FUNC0);
}