本文整理汇总了C++中Chip_Clock_EnablePeriphClock函数的典型用法代码示例。如果您正苦于以下问题:C++ Chip_Clock_EnablePeriphClock函数的具体用法?C++ Chip_Clock_EnablePeriphClock怎么用?C++ Chip_Clock_EnablePeriphClock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Chip_Clock_EnablePeriphClock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IrTherm_Init
void IrTherm_Init(void){
/* Enable clocks to SWM and IOCON to save power */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_SWM_MovablePinAssign(SWM_I2C_SDA_IO, 11);
Chip_SWM_MovablePinAssign(SWM_I2C_SCL_IO, 10);
#if (I2C_BITRATE > 400000)
/* Enable Fast Mode Plus for I2C pins */
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO10, PIN_I2CMODE_FASTPLUS);
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO11, PIN_I2CMODE_FASTPLUS);
#else
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO10, PIN_I2CMODE_STDFAST);
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO11, PIN_I2CMODE_STDFAST);
#endif
/* Enable I2C clock and reset I2C peripheral - the boot ROM does not do this */
Chip_I2C_Init();
/* Setup the I2C handle */
i2cHandleMaster = LPC_I2CD_API->i2c_setup(LPC_I2C_BASE, i2cMasterHandleMEM);
/* Set I2C bitrate */
LPC_I2CD_API->i2c_set_bitrate(i2cHandleMaster, Chip_Clock_GetSystemClockRate(), I2C_BITRATE);
/* Disable the interrupt for the I2C */
NVIC_DisableIRQ(I2C_IRQn);
/* Disable clocks to SWM and IOCON to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_IOCON);
}
示例2: Board_UART_Init
/* Board UART Initialisation function */
void Board_UART_Init(LPC_USART_T *pUART)
{
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_SetUARTClockDiv(1); /* divided by 1 */
if (pUART == LPC_USART0) {
/*connect the U0_TXD_O and U0_RXD_I signals to port pins(P0.4, P0.0) */
Chip_SWM_FixedPinEnable(ACMP_I1, DISABLE);
Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, PIO4);
Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, PIO0);
/* Enable USART0 clock */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART0); // FIXME UART clocking and reset need to be part of CHIP driver
/* Peripheral reset control to USART0, a "1" bring it out of reset. */
Chip_SYSCTL_PeriphReset(RESET_USART0);
}
else if (pUART == LPC_USART1) {
/*connect the U1_TXD_O and U1_RXD_I signals to port pins(P0.13, P0.14) */
Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, PIO13);
Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, PIO14);
/* Enable USART1 clock */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART1); // FIXME UART clocking and reset need to be part of CHIP driver
/* Peripheral reset control to USART1, a "1" bring it out of reset. */
Chip_SYSCTL_PeriphReset(RESET_USART1);
}
else {
/*connect the U2_TXD_O and U2_RXD_I signals to port pins(P0.13, P0.14) */
Chip_SWM_MovablePinAssign(SWM_U2_TXD_O, PIO13);
Chip_SWM_MovablePinAssign(SWM_U2_RXD_I, PIO14);
/* Enable USART2 clock */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_UART2); // FIXME UART clocking and reset need to be part of CHIP driver
/* Peripheral reset control to USART2, a "1" bring it out of reset. */
Chip_SYSCTL_PeriphReset(RESET_USART2);
}
}
示例3: usb_pin_clk_init
/* Initialize pin and clocks for USB0/USB1 port */
static void usb_pin_clk_init(void) {
/* enable USB main clock */
Chip_Clock_SetUSBClockSource(SYSCTL_USBCLKSRC_PLLOUT, 1);
/* Enable AHB clock to the USB block and USB RAM. */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USB);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USBRAM);
/* power UP USB Phy */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPAD_PD);
}
示例4: Chip_GPIO_Init
/* Initialize GPIO block */
void Chip_GPIO_Init(LPC_GPIO_T *pGPIO)
{
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO1);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO2);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_MUX);
Chip_SYSCTL_PeriphReset(RESET_MUX);
}
示例5: Init_SPI_PinMux
/* Initializes pin muxing for SPI1 interface - note that SystemInit() may
already setup your pin muxing at system startup */
static void Init_SPI_PinMux(void)
{
#if (defined(BOARD_NXP_LPCXPRESSO_812) || defined(BOARD_LPC812MAX))
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
/*
* Initialize SSP0 pins connect
* SCK1: PINASSIGN4[31:24]: Select P0.12
* MOSI1: PINASSIGN5[7:0]: Select P0.14
* MISO1: PINASSIGN5[15:8] : Select P0.6
* SSEL1: PINASSIGN5[23:16]: Select P0.13
*/
Chip_SWM_DisableFixedPin(SWM_FIXED_VDDCMP);
Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 12);
Chip_SWM_MovablePinAssign(SWM_SPI1_SCK_IO, 7);
Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 14);
Chip_SWM_MovablePinAssign(SWM_SPI1_MOSI_IO, 9);
#if defined(BOARD_LPC812MAX)
Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 15);
Chip_SWM_MovablePinAssign(SWM_SPI1_MISO_IO, 0);
#else
Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 6);
Chip_SWM_MovablePinAssign(SWM_SPI1_MISO_IO, 1);
#endif
Chip_SWM_DisableFixedPin(SWM_FIXED_ACMP_I1);
Chip_SWM_MovablePinAssign(SWM_SPI0_SSEL_IO, 13);
Chip_SWM_MovablePinAssign(SWM_SPI1_SSEL_IO, 10);
/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
#elif defined(BOARD_NXP_LPCXPRESSO_824)
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
/* Master Pins for SPI0 */
Chip_SWM_MovablePinAssign(SWM_SPI0_SSEL0_IO, 15);
Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 24);
Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 25);
Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 26);
/* Slave Pins for SPI1 */
Chip_SWM_MovablePinAssign(SWM_SPI1_SSEL0_IO, 17);
Chip_SWM_MovablePinAssign(SWM_SPI1_SCK_IO, 18);
Chip_SWM_MovablePinAssign(SWM_SPI1_MISO_IO, 28);
Chip_SWM_MovablePinAssign(SWM_SPI1_MOSI_IO, 16);
/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
#else
/* Configure your own SPI pin muxing here if needed */
#warning "No SPI pin muxing defined"
#endif
}
示例6: Board_SystemInit
/* Set up and initialize hardware prior to call to main */
void Board_SystemInit(void)
{
/* System clock to the GPIO & the SWM & the IOCON need to be enabled or
most of the I/O related peripherals won't work. */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
/* Setup system clocking and muxing */
SystemSetupMuxing();
}
示例7: Board_Init
/* Set up and initialize all required blocks and functions related to the
board hardware */
void Board_Init(void)
{
/* INMUX and IOCON are used by many apps, enable both INMUX and IOCON clock bits here. */
Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_INPUTMUX);
Chip_Clock_EnablePeriphClock(SYSCON_CLOCK_IOCON);
/* Sets up DEBUG UART */
DEBUGINIT();
/* Initialize GPIO */
Chip_GPIO_Init(LPC_GPIO);
/* Initialize the LEDs. Be careful with below routine, once it's called some of the I/O will be set to output. */
Board_LED_Init();
}
示例8: Init_SPI_PinMux
/* Initializes pin muxing for SPI interface - note that SystemInit() may
already setup your pin muxing at system startup */
static void Init_SPI_PinMux(void)
{
#if (defined(BOARD_NXP_LPCXPRESSO_1549))
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
/*
* Initialize SPI0 pins connect
* SCK0: PINASSIGN3[15:8]: Select P0.0
* MOSI0: PINASSIGN3[23:16]: Select P0.16
* MISO0: PINASSIGN3[31:24] : Select P0.10
* SSEL0: PINASSIGN4[7:0]: Select P0.9
*/
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 16, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 10, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_SWM_MovablePinAssign(SWM_SPI0_SCK_IO, 0); /* P0.0 */
Chip_SWM_MovablePinAssign(SWM_SPI0_MOSI_IO, 16);/* P0.16 */
Chip_SWM_MovablePinAssign(SWM_SPI0_MISO_IO, 10);/* P0.10 */
Chip_SWM_MovablePinAssign(SWM_SPI0_SSELSN_0_IO, 9); /* P0.9 */
/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
#else
/* Configure your own SPI pin muxing here if needed */
#warning "No SPI pin muxing defined"
#endif
}
示例9: usb_pin_clk_init
static void usb_pin_clk_init(void)
{
/* enable USB main clock */
Chip_Clock_SetUSBClockSource(SYSCTL_USBCLKSRC_PLLOUT, 1);
/* Enable AHB clock to the USB block and USB RAM. */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USB);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USBRAM);
/* power UP USB Phy */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPAD_PD);
/* Enable IOCON clock */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 3, (IOCON_FUNC1 | IOCON_MODE_INACT)); /* PIO0_3 used for USB_VBUS */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 6, (IOCON_FUNC1 | IOCON_MODE_INACT)); /* PIO0_6 used for USB_CONNECT */
}
示例10: Chip_SPI_Init
/* Initialize the SPI */
void Chip_SPI_Init(LPC_SPI_T *pSPI, SPI_CONFIG_T *pConfig)
{
uint32_t EnStat = pSPI->CFG & SPI_CFG_SPI_EN;
Chip_Clock_EnablePeriphClock((pSPI == LPC_SPI1) ? SYSCTL_CLOCK_SPI1 : SYSCTL_CLOCK_SPI0);
Chip_SYSCTL_PeriphReset((pSPI == LPC_SPI1) ? RESET_SPI1 : RESET_SPI0);
/* Disable before update CFG register */
if (EnStat) {
Chip_SPI_Disable(pSPI);
}
/* SPI Configurate */
pSPI->CFG = ((uint32_t) pConfig->ClockMode) | ((uint32_t) pConfig->DataOrder) | ((uint32_t) pConfig->Mode) |
((uint32_t) pConfig->SSELPol);
/* Rate Divider setting */
pSPI->DIV = SPI_DIV_VAL(pConfig->ClkDiv);
/* Clear status flag*/
Chip_SPI_ClearStatus(pSPI, SPI_STAT_CLR_RXOV | SPI_STAT_CLR_TXUR | SPI_STAT_CLR_SSA | SPI_STAT_CLR_SSD);
/* Return the previous state */
if (EnStat) {
Chip_SPI_Enable(pSPI);
}
}
示例11: Chip_USB_Init
void Chip_USB_Init(void)
{
/* Set USB PLL input to main oscillator */
Chip_Clock_SetUSBPLLSource(SYSCTL_PLLCLKSRC_MAINOSC);
/* Setup USB PLL (FCLKIN = 12MHz) * 4 = 48MHz
MSEL = 3 (this is pre-decremented), PSEL = 1 (for P = 2)
FCLKOUT = FCLKIN * (MSEL + 1) = 12MHz * 4 = 48MHz
FCCO = FCLKOUT * 2 * P = 48MHz * 2 * 2 = 192MHz (within FCCO range) */
Chip_Clock_SetupUSBPLL(3, 1);
/* Powerup USB PLL */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPLL_PD);
/* Wait for PLL to lock */
while (!Chip_Clock_IsUSBPLLLocked()) {}
/* enable USB main clock */
Chip_Clock_SetUSBClockSource(SYSCTL_USBCLKSRC_PLLOUT, 1);
/* Enable AHB clock to the USB block. */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USB);
/* power UP USB Phy */
Chip_SYSCTL_PowerUp(SYSCTL_POWERDOWN_USBPHY_PD);
/* Reset USB block */
Chip_SYSCTL_PeriphReset(RESET_USB);
}
示例12: CAN_baudrate_calculate
void CAN_baudrate_calculate(uint32_t baud_rate, uint32_t *can_api_timing_cfg)
{
uint32_t pClk, div, quanta, segs, seg1, seg2, clk_per_bit, can_sjw;
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_CAN);
pClk = Chip_Clock_GetMainClockRate();
clk_per_bit = pClk / baud_rate;
for (div = 0; div <= 15; div++) {
for (quanta = 1; quanta <= 32; quanta++) {
for (segs = 3; segs <= 17; segs++) {
if (clk_per_bit == (segs * quanta * (div + 1))) {
segs -= 3;
seg1 = segs / 2;
seg2 = segs - seg1;
can_sjw = seg1 > 3 ? 3 : seg1;
can_api_timing_cfg[0] = div;
can_api_timing_cfg[1] =
((quanta - 1) & 0x3F) | (can_sjw & 0x03) << 6 | (seg1 & 0x0F) << 8 | (seg2 & 0x07) << 12;
return;
}
}
}
}
}
示例13: Chip_I2C_Init
/* Initialize I2C Interface */
void Chip_I2C_Init(void)
{
/* Enable I2C clock */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_I2C);
/* Peripheral reset control to I2C */
Chip_SYSCTL_PeriphReset(RESET_I2C);
}
示例14: pb_init
// Initialize the push button
void pb_init(void){
// Set initial values
pbState = READY;
pbTenths = 0;
pbLongPress = false;
pbShortPress = false;
// Set up timer interrupt
Chip_MRT_IntClear(LPC_MRT_CH(0));
Chip_MRT_SetEnabled(LPC_MRT_CH(0));
// Set up pin interrupt
Chip_PININT_Init(LPC_GPIO_PIN_INT);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PININT);
Chip_SYSCTL_PeriphReset(RESET_PININT);
Chip_INMUX_PinIntSel(0, 0, PWR_PB_SENSE);
Chip_PININT_ClearIntStatus(LPC_GPIO_PIN_INT, 1 << 0);
Chip_PININT_SetPinModeLevel(LPC_GPIO_PIN_INT, 1 << 0);
PININT_EnableLevelInt(LPC_GPIO_PIN_INT, 1 << 0);
PININT_LowActive(LPC_GPIO_PIN_INT, 1 << 0); // Enable low first so that initial press is not detected
NVIC_ClearPendingIRQ(PIN_INT0_IRQn);
NVIC_EnableIRQ(PIN_INT0_IRQn);
NVIC_SetPriority(PIN_INT0_IRQn, 0x02); // Set higher than systick, but lower than sampling
}
示例15: Chip_ADC_Init
/* Initialize the ADC peripheral and the ADC setup structure to default value */
void Chip_ADC_Init(LPC_ADC_T *pADC, ADC_CLOCK_SETUP_T *ADCSetup)
{
uint8_t div;
uint32_t cr = 0;
uint32_t clk;
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC);
#if defined(ADC_TRIM_SUPPORT)
pADC->ADTRM = 0xF00;
#endif
pADC->INTEN = 0; /* Disable all interrupts */
cr |= ADC_CR_PDN;
ADCSetup->adcRate = ADC_MAX_SAMPLE_RATE;
ADCSetup->bitsAccuracy = 0; /* LPC17xx/40xx doesn't support this setting */
clk = 0;
ADCSetup->burstMode = false;
div = getClkDiv(pADC, false, ADCSetup->adcRate, clk);
cr |= ADC_CR_CLKDIV(div);
#if !defined(ADC_ACC_12BITS)
cr |= ADC_CR_BITACC(ADCSetup->bitsAccuracy);
#endif /*defined(ADC_ACC_12BITS)*/
pADC->CR = cr;
}