当前位置: 首页>>代码示例>>C++>>正文


C++ Board_Init函数代码示例

本文整理汇总了C++中Board_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ Board_Init函数的具体用法?C++ Board_Init怎么用?C++ Board_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Board_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void){ unsigned long status;
  Switch_Init();           // PA5 is input
  status = Switch_Input(); // 0x00 or 0x20
  status = Switch_Input(); // 0x00 or 0x20
  
  Board_Init();             // initialize PF0 and PF4 and make them inputs
                            // make PF3-1 out (PF3-1 built-in LEDs)
  GPIO_PORTF_DIR_R |= (RED|BLUE|GREEN);
                              // disable alt funct on PF3-1
  GPIO_PORTF_AFSEL_R &= ~(RED|BLUE|GREEN);
                              // enable digital I/O on PF3-1
  GPIO_PORTF_DEN_R |= (RED|BLUE|GREEN);
                              // configure PF3-1 as GPIO
  GPIO_PORTF_PCTL_R = (GPIO_PORTF_PCTL_R&0xFFFF000F)+0x00000000;
  GPIO_PORTF_AMSEL_R = 0;     // disable analog functionality on PF
  while(1){
    status = Board_Input();
    switch(status){                    // switches are negative logic on PF0 and PF4
      case 0x01: LEDS = BLUE; break;   // SW1 pressed
      case 0x10: LEDS = RED; break;    // SW2 pressed
      case 0x00: LEDS = GREEN; break;  // both switches pressed
      case 0x11: LEDS = 0; break;      // neither switch pressed
      default: LEDS = (RED|GREEN|BLUE);// unexpected return value
    }
  }
}
开发者ID:OrlandoWzk,项目名称:TExaSware,代码行数:26,代码来源:SwitchTestMain.c

示例2: main

/**
 * @brief	Main entry point
 * @return	Nothing
 */
int main(void)
{
	volatile uint32_t status;

	SystemCoreClockUpdate();
	Board_Init();

	/* Initialize the OTP Controller */
	status = Chip_OTP_Init();

    /* Fix as per Errata, required for some LPC43xx parts */
    OTP_fix(0, 0, 0, 0);

    /* Set Boot Source */
    /* Please note that this function is commented to avoid accidental
     * programming of OTP values (which can result in not booting of boards).
     * Make sure that you understand the OTP programming before you
     * try this example
     */
#if (defined(BOARD_KEIL_MCB_1857) || defined(BOARD_KEIL_MCB_4357))
    //status = Chip_OTP_ProgBootSrc(CHIP_OTP_BOOTSRC_PINS);
#else
    //status = Chip_OTP_ProgBootSrc(CHIP_OTP_BOOTSRC_SPIFI);
#endif

	while (1);
}
开发者ID:edodm85,项目名称:LPCOpen-keil-lpc43xx,代码行数:31,代码来源:otp_funcs.c

示例3: main

int main(void) {

#if defined (__USE_LPCOPEN)
    // Read clock settings and update SystemCoreClock variable
    SystemCoreClockUpdate();
#if !defined(NO_BOARD_LIB)
    // Set up and initialize all required blocks and
    // functions related to the board hardware
    Board_Init();
    // Set the LED to the state of "On"
    Board_LED_Set(0, true);
#endif
#endif

    // TODO: insert code here

    Chip_SWM_MovablePortPinAssign(SWM_SWO_O, 1, 2);

	SysTick_Config(SystemCoreClock / 1000);

	printf("Started\n");
	Setup();

    i2cTest();

    // Force the counter to be placed into memory
    volatile static int i = 0 ;
    // Enter an infinite loop, just incrementing a counter
    while(1) {
        i++ ;
    }
    return 0 ;
}
开发者ID:SantunKoodia,项目名称:Fan-Control-System,代码行数:33,代码来源:PressureSensorTesti.cpp

示例4: main

int main(void) {
	SystemCoreClockUpdate();

	Board_Init();

	Board_LED_Set(0, false);

	// SW4 setup
	Chip_GPIO_SetDir(LPC_GPIO, 1, 31, false);
	sw4 = debounce_add(DEBOUNCE_TIME / DEBOUNCE_CYCLE, is_sw4_pushed, NULL);

	// RGB Rojo
	Chip_GPIO_SetDir(LPC_GPIO, 2, 0, true);

	// RGB Verde
	Chip_GPIO_SetDir(LPC_GPIO, 2, 1, true);

	// RGB Azul
	Chip_GPIO_SetDir(LPC_GPIO, 0, 26, true);

	queue_init(&queue, 1, EventQueue, AlarmTimeoutPush, AlarmTimeoutPop, MutexQueue);

	StartOS(AppMode1);

	while (1) {
	}

	return 0;
}
开发者ID:kamejoko80,项目名称:RTOS-FreeOSEK,代码行数:29,代码来源:main.c

示例5: main

/**
 * @brief	Main program body
 * @return	Does not return
 */
int main(void)
{
	/* Generic Initialization */
	SystemCoreClockUpdate();

	/* Board_Init calls Chip_GPIO_Init and enables GPIO clock if needed,
	   Chip_GPIO_Init is not called again */
	Board_Init();
	Board_LED_Set(0, false);

	/* Configure GPIO interrupt pin as input */
	Chip_GPIO_SetPinDIRInput(LPC_GPIO, GPIO_INTERRUPT_PORT, GPIO_INTERRUPT_PIN);

	/* Configure the GPIO interrupt */
	Chip_GPIOINT_SetIntFalling(LPC_GPIOINT, GPIO_INTERRUPT_PORT, 1 << GPIO_INTERRUPT_PIN);

	/* Enable interrupt in the NVIC */
	NVIC_ClearPendingIRQ(GPIO_INTERRUPT_NVIC_NAME);
	NVIC_EnableIRQ(GPIO_INTERRUPT_NVIC_NAME);

	/* Wait for interrupts - LED will toggle on each wakeup event */
	while (1) {
		__WFI();
	}

	return 0;
}
开发者ID:MFDM,项目名称:SE2-SV1314,代码行数:31,代码来源:pinint.c

示例6: main

/**
 * @brief	main routine for blinky example
 * @return	Function should not exit.
 */
int main(void)
{
	uint32_t sysTickRate;

	SystemCoreClockUpdate();
	Board_Init();
	Board_LED_Set(0, false);
	Board_LED_Set(1, true);

	/* The sysTick counter only has 24 bits of precision, so it will
	   overflow quickly with a fast core clock. You can alter the
	   sysTick divider to generate slower sysTick clock rates. */
	Chip_Clock_SetSysTickClockDiv(1);

	/* A SysTick divider is present that scales the sysTick rate down
	   from the core clock. Using the SystemCoreClock variable as a
	   rate reference for the SysTick_Config() function won't work,
	   so get the sysTick rate by calling Chip_Clock_GetSysTickClockRate() */
	sysTickRate = Chip_Clock_GetSysTickClockRate();

	/* Enable and setup SysTick Timer at a periodic rate */
	SysTick_Config(sysTickRate / TICKRATE_HZ1);

	/* LEDs toggle in interrupt handlers */
	while (1) {
		__WFI();
	}

	return 0;
}
开发者ID:0xBADCA7,项目名称:lk,代码行数:34,代码来源:systick.c

示例7: main

/**
 * @brief	Main routine for I2C example
 * @return	Function should not exit
 */
int main(void)
{
	/* Generic Initialization */
	SystemCoreClockUpdate();
	Board_Init();

	Board_LED_Set(0, false);

	/* Setup I2C at the board level (usually pin muxing) */
	Init_I2C_PinMux();

	/* Allocate I2C handle, setup I2C rate, and initialize I2C
	   clocking */
	setupI2CSlave();

	/* Enable the interrupt for the I2C */
	NVIC_EnableIRQ(I2C_IRQn);

	/* Setup I2C receive slave mode - this will setup a
	   non-blocking I2C mode which will be handled via the I2C interrupt */
	readI2CSlave();	/* From master first */

	/* I2C slave handler loop - wait for requests from master and
	   receive or send data */
	while (1) {
		/* Sleep while waiting for I2C master requests */
		__WFI();

		/* All I2C slave processing is performed in the I2C IRQ
		   handler, so there is nothing to really do here */
	}

	return 0;
}
开发者ID:dmamalis,项目名称:LPC812,代码行数:38,代码来源:periph_i2c_rom_slave.c

示例8: main

/**
 * @brief	Main program body
 * @return	int
 */
int main(void)
{
	int tmp = 0;
	int activityIndex = 0;
	int writeVal = 0;

	SystemCoreClockUpdate();
	Board_Init();
	i2c_app_init(I2C0, SPEED_100KHZ);

	/* Loop forever */
	while (1) {
		/* Toggle LED to show activity. */
		tmp = ShowActivity(tmp);

		/* Test for activity time */
		if ((tmp & ACTIVITY_MASK) == 0) {
			/* Toggle between writes and reads */
			switch (activityIndex++ & 1) {
			case 0:
				/* Perform target board I2CM write */
				WriteBoard_I2CM(writeVal++ & 1);
				break;

			case 1:
			default:
				/* Perform target board I2CM read */
				ReadBoard_I2CM();
				break;
			}
		}
	}

	return 0;
}
开发者ID:edodm85,项目名称:LPCOpen-keil-lpc43xx,代码行数:39,代码来源:periph_i2cm_polling.c

示例9: main

/**
 * @brief	main routine for hello world example
 * @return	Function should not exit.
 */
int main(void)
{
	volatile uint32_t *vt;
	uint32_t cpu_id;
	SystemCoreClockUpdate();
	Board_Init();

	/* Enable SysTick Timer */
	SysTick_Config(SystemCoreClock / TICKRATE_HZ);

	/* Display system information */
	__disable_irq();
	DEBUGOUT("System Clock: %uMHz\r\n", SystemCoreClock / 1000000);
	DEBUGOUT("Device ID: 0x%04X\r\n", Chip_SYSCTL_GetDeviceID());
	vt = &(SCB->VTOR);
	cpu_id = SCB->CPUID;
	DEBUGOUT("VTOR Address: 0x%08X\r\n", (uint32_t) vt);
	DEBUGOUT("CPU ID: 0x%08X\r\n", (uint32_t) cpu_id);
	__enable_irq();

	/* Loop forever */
	while (1) {
		__WFI();
	}
	//	return 0;
}
开发者ID:Magicoe,项目名称:LPC820,代码行数:30,代码来源:main_hello_world.c

示例10: main

/**
 * @brief	Main UART program body
 * @return	Doesn't return
 */
int main(void)
{
	/* initialize the board */
	SystemCoreClockUpdate();
	Board_Init();

	Board_CMP_Init();

	/* initialize the CMP */
	Chip_CMP_Init();

	/* Power-up */
	Chip_CMP_EnableCurrentSrc(CMP_ENCTRL_ENABLE);
	Chip_CMP_EnableBandGap(CMP_ENCTRL_ENABLE);
	Chip_CMP_Enable(CMP_ID, CMP_ENCTRL_ENABLE);
	
	/* Positive and negative references, both edges, no hysteresis */
	Chip_CMP_SetPosVoltRef(CMP_ID, CMP_INPUT_CMPx_IN0);
	Chip_CMP_SetNegVoltRef(CMP_ID, CMP_INPUT_INTERNAL_09VBG);
	Chip_CMP_SetHysteresis(CMP_ID, CMP_HYS_NONE);
	
	while (1) {
		if (Chip_CMP_GetCmpStatus(CMP_ID)) {
			Board_LED_Set(0, false);
		}
		else {
			Board_LED_Set(0, true);
		}
	}

	return 0;
}
开发者ID:TiddoLangerak,项目名称:mmc_test,代码行数:36,代码来源:cmp.c

示例11: main

/**
 * @brief	main routine for blinky example
 * @return	Function should not exit.
 */
int main(void)
{
	uint32_t timerFreq;

	/* Generic Initialization */
	SystemCoreClockUpdate();
	Board_Init();

	/* Enable timer 1 clock */
	Chip_TIMER_Init(LPC_TIMER0);

	/* Timer rate is system clock rate */
	timerFreq = Chip_Clock_GetSystemClockRate();

	/* Timer setup for match and interrupt at TICKRATE_HZ */
	Chip_TIMER_Reset(LPC_TIMER0);
	Chip_TIMER_MatchEnableInt(LPC_TIMER0, 1);
	Chip_TIMER_SetMatch(LPC_TIMER0, 1, (timerFreq / TICKRATE_HZ1));
	Chip_TIMER_ResetOnMatchEnable(LPC_TIMER0, 1);
	Chip_TIMER_Enable(LPC_TIMER0);

	/* Enable timer interrupt */
	NVIC_ClearPendingIRQ(TIMER0_IRQn);
	NVIC_EnableIRQ(TIMER0_IRQn);

	/* LEDs toggle in interrupt handlers */
	while (1) {
		__WFI();
	}

	return 0;
}
开发者ID:MFDM,项目名称:SE2-SV1314,代码行数:36,代码来源:timer.c

示例12: main

/**
 * @brief	Main routine for SSP example
 * @return	Nothing
 */
int main(void)
{
	SystemCoreClockUpdate();
	Board_Init();

	/* SSP initialization */
	Board_SSP_Init(LPC_SSP);

	Chip_SSP_Init(LPC_SSP);

	ssp_format.frameFormat = SSP_FRAMEFORMAT_SPI;
	ssp_format.bits = SSP_DATA_BITS;
	ssp_format.clockMode = SSP_CLOCK_MODE0;
	Chip_SSP_SetFormat(LPC_SSP, ssp_format.bits, ssp_format.frameFormat, ssp_format.clockMode);

	Chip_SSP_Enable(LPC_SSP);

	/* Initialize GPDMA controller */
	Chip_GPDMA_Init(LPC_GPDMA);

	/* Setting GPDMA interrupt */
	NVIC_DisableIRQ(DMA_IRQn);
	NVIC_SetPriority(DMA_IRQn, ((0x01 << 3) | 0x01));
	NVIC_EnableIRQ(DMA_IRQn);

	/* Setting SSP interrupt */
	NVIC_EnableIRQ(SSP_IRQ);

	appSSPMainMenu();

	/* DeInitialize SSP peripheral */
	Chip_SSP_DeInit(LPC_SSP);

	return 0;
}
开发者ID:TiddoLangerak,项目名称:mmc_test,代码行数:39,代码来源:ssp.c

示例13: main

/**
 * @brief	main routine for ADC example
 * @return	Function should not exit
 */
int main(void)
{
	uint16_t dataADC;
	int j;

	SystemCoreClockUpdate();
	Board_Init();
	Init_ADC_PinMux();
	DEBUGSTR("ADC Demo\r\n");

	/* ADC Init */
	Chip_ADC_Init(LPC_ADC, &ADCSetup);
	Chip_ADC_EnableChannel(LPC_ADC, ADC_CH0, ENABLE);

	while (1) {
		/* Start A/D conversion */
		Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);

		/* Waiting for A/D conversion complete */
		while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH0, ADC_DR_DONE_STAT) != SET) {}

		/* Read ADC value */
		Chip_ADC_ReadValue(LPC_ADC, ADC_CH0, &dataADC);

		/* Print ADC value */
		DEBUGOUT("ADC value is 0x%x\r\n", dataADC);

		/* Delay */
		j = 500000;
		while (j--) {}
	}

	/* Should not run to here */
	return 0;
}
开发者ID:Andriiy,项目名称:Circuit-Boards,代码行数:39,代码来源:adc_11xx.c

示例14: main

/**
 * @brief	MRT example main function
 * @return	Status (This function will not return)
 */
int main(void)
{
	int mrtch;

	/* Generic Initialization */
	SystemCoreClockUpdate();
	Board_Init();

	DEBUGSTR("LPC15xx MRT Example \r\n");

	/* MRT Initialization and disable all timers */
	Chip_MRT_Init();
	for (mrtch = 0; mrtch < MRT_CHANNELS_NUM; mrtch++) {
		Chip_MRT_SetDisabled(Chip_MRT_GetRegPtr(mrtch));
	}

	/* Enable the interrupt for the MRT */
	NVIC_EnableIRQ(MRT_IRQn);

	/* Enable timers 0 and 1 in repeat mode with different rates */
	setupMRT(0, MRT_MODE_REPEAT, 2);/* 2Hz rate */
	setupMRT(1, MRT_MODE_REPEAT, 5);/* 5Hz rate */

	/* Enable timer 2 in single one mode with the interrupt restarting the
	   timer */
	setupMRT(2, MRT_MODE_ONESHOT, 7);	/* Will fire in 1/7 seconds */

	/* All processing and MRT reset in the interrupt handler */
	while (1) {
		__WFI();
	}

	return 0;
}
开发者ID:frankzzcn,项目名称:M2_SE_RTOS_Project,代码行数:38,代码来源:mrt.c

示例15: main

/**
 * @brief	Main routine for SPI example
 * @return	Function should not exit
 */
int main(void)
{
	/* Generic Initialization */
	SystemCoreClockUpdate();
	Board_Init();

	/* Clear activity LED */
	Board_LED_Set(0, false);

	/* Setup SPI pin muxing */
	Init_SPI_PinMux();

	/* Allocate SPI handle, setup rate, and initialize clocking */
	setupSpiMaster();

	/* Enable SPI0 interrupt */
	NVIC_EnableIRQ(SPI0_IRQn);

	/* Loop forever */
	while (1) {
		/* Write simple message over SPI */
		WriteSpiMssg(xferArray, sizeof(xferArray) / sizeof(xferArray[0]));

		/* Toggle LED to show activity. */
		Board_LED_Toggle(0);
	}

	/* Code never reaches here. Only used to satisfy standard main() */
	return 0;
}
开发者ID:JamesHinnant,项目名称:osp,代码行数:34,代码来源:spi_rom_interrupt.c


注:本文中的Board_Init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。