本文整理汇总了C++中Board_LED_Set函数的典型用法代码示例。如果您正苦于以下问题:C++ Board_LED_Set函数的具体用法?C++ Board_LED_Set怎么用?C++ Board_LED_Set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Board_LED_Set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: SysTick_Handler
void SysTick_Handler(void)
{
uint16_t dataADC;
//int i;
uint32_t currentPWM;
currentPWM=LPC_PWM1->MR1;
//Board_LED_Toggle(0);
Board_LED_Set(0,1);
//Chip_ADC_SetStartMode(_LPC_ADC_ID, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
//while (Chip_ADC_ReadStatus(_LPC_ADC_ID, _ADC_CHANNLE, ADC_DR_DONE_STAT) != SET) {}
/* Read ADC value */
Chip_ADC_ReadValue(_LPC_ADC_ID, _ADC_CHANNLE, &dataADC);
/* Print ADC value */
//App_print_ADC_value(dataADC);
/*
if(rotation_time<MEMORY_CAPACITY){
rotation_debug_holder[rotation_time]=(int) dataADC;
rotation_time++;
}
*/
rotation_time++;
//if(rotation_counter<MEMORY_CAPACITY){ //debug line
if(dataADC>sensor_threshold){
if(rotation_phase==0){
//rotation_debug_holder[rotation_counter]=rotation_time; //debug line
//rotation_debug_holder2[rotation_counter]=dataADC; //debug line
if(currentPWM < (1000-regulation_step) && currentPWM > (regulation_step)){ //debug needed here
if(rotation_time>desired_rotation_time){
PWM_SetCycle(currentPWM+regulation_step,1000);
}else{
PWM_SetCycle(currentPWM-regulation_step,1000);
}
}
rotation_counter++;
rotation_time=0;
rotation_phase=1;
}
}else{
rotation_phase = 0;
}
//} //debug line
if(rotation_time==1000){
if(currentPWM < (1000-regulation_step)){
PWM_SetCycle(currentPWM+10*regulation_step,1000);
}
rotation_time=0;
}
Board_LED_Set(0,0);
}
示例3: Keyboard_SetReport
/* HID Set Report Request Callback. Called automatically on HID Set Report Request */
static ErrorCode_t Keyboard_SetReport(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length)
{
/* we will reuse standard EP0Buf */
if (length == 0) {
return LPC_OK;
}
/* ReportID = SetupPacket.wValue.WB.L; */
switch (pSetup->wValue.WB.H) {
case HID_REPORT_OUTPUT:
/* If the USB host tells us to turn on the NUM LOCK LED,
* then turn on LED#2.
*/
if (**pBuffer & 0x01) {
Board_LED_Set(0, 1);
}
else {
Board_LED_Set(0, 0);
}
break;
case HID_REPORT_INPUT: /* Not Supported */
case HID_REPORT_FEATURE: /* Not Supported */
return ERR_USBD_STALL;
}
return LPC_OK;
}
示例4: uartrom_error
/* UART ROM error handler */
static void uartrom_error(UART_HANDLE_T hUART, uint32_t err)
{
switch (err) {
case UART_ERROR_FRAME:
/* No stop bit in uart frame; mismatched baud(?) or incorrect/short BREAK condition(?) */
Board_LED_Set(0, 1);
break;
case UART_ERROR_PARITY:
/* Parity error; mismatched baud(?) */
while (1) {}
case UART_ERROR_AUTOBAUD:
/* Autobaud timeout error */
while (1) {}
case UART_ERROR_OVERRUN:
/* Uart received character before ROM_UART_Receive() is called */
Board_LED_Set(1, 1);
break;
case UART_ERROR_RXNOISE:
/* Typically problem is with the baud rate and or Over sampling count */
while (1) {}
default:
/* Control will never reach this */
break;
}
}
示例5: 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;
}
示例6: exit_error
void exit_error(int error_code) {
taskDISABLE_INTERRUPTS();
Board_LED_Set(0, false);
Board_LED_Set(1, false);
Board_LED_Set(2, false);
blink_error_code(error_code);
exit(error_code);
}
示例7: main
/**
* @brief main routine for timer example
* @return Function should not exit.
*/
int main(void)
{
uint32_t timerBaseClock;
SystemCoreClockUpdate();
Board_Init();
Board_LED_Set(0, false);
Board_LED_Set(1, false);
/* Initialize Timer 0 and Timer 1 */
Chip_TIMER_Init(LPC_TIMER0);
Chip_TIMER_Init(LPC_TIMER1);
/* Setup prescale value on Timer 0 to PCLK */
Chip_TIMER_PrescaleSet(LPC_TIMER0, 0);
/* Setup prescale value on Timer 1 for lower resolution */
Chip_TIMER_PrescaleSet(LPC_TIMER1, PRESCALE_HZ2);
/* Reset timers */
Chip_TIMER_Reset(LPC_TIMER0);
Chip_TIMER_Reset(LPC_TIMER1);
/* Enable both timers to generate interrupts when time matches */
Chip_TIMER_MatchEnableInt(LPC_TIMER0, 1);
Chip_TIMER_MatchEnableInt(LPC_TIMER1, 1);
/* Get rate of timer base clock */
timerBaseClock = Chip_Clock_GetAsyncSyscon_ClockRate();
/* Setup Timer 0 for a match every 1s */
Chip_TIMER_SetMatch(LPC_TIMER0, 1, (timerBaseClock / TICKRATE_HZ1));
/* Setup Timer 1 for a match twice in a second */
Chip_TIMER_SetMatch(LPC_TIMER1, 1, (timerBaseClock / ((PRESCALE_HZ2 + 1) * TICKRATE_HZ2)) );
/* Setup both timers to restart when match occurs */
Chip_TIMER_ResetOnMatchEnable(LPC_TIMER0, 1);
Chip_TIMER_ResetOnMatchEnable(LPC_TIMER1, 1);
/* Start both timers */
Chip_TIMER_Enable(LPC_TIMER0);
Chip_TIMER_Enable(LPC_TIMER1);
/* Clear both timers of any pending interrupts */
NVIC_ClearPendingIRQ(CT32B0_IRQn);
NVIC_ClearPendingIRQ(CT32B1_IRQn);
/* Enable both timer interrupts */
NVIC_EnableIRQ(CT32B0_IRQn);
NVIC_EnableIRQ(CT32B1_IRQn);
/* Wait for timers to generate interrupts (LEDs toggle in interrupt handlers) */
while (1) {
__WFI();
}
return 0;
}
示例8: Set_LED
inline void Set_LED(uint32_t LED_On_Off)
{
if(LED_On_Off==0)
{
Board_LED_Set(0, false);
}
else
{
Board_LED_Set(0, true);
}
}
示例9: Toggle_LED
inline void Toggle_LED(void)
{
if(Board_LED_Test(0)!=false)
{
Board_LED_Set(0, false);
}
else
{
Board_LED_Set(0, true);
}
}
示例10: TIMER1_IRQHandler
void TIMER1_IRQHandler(void)
{
if (Chip_TIMER_MatchPending(LPC_TIMER1, 0)) {
Chip_TIMER_ClearMatch(LPC_TIMER1, 0);
Board_LED_Set(0, 1);
}
if (Chip_TIMER_MatchPending(LPC_TIMER1, 1)) {
Chip_TIMER_ClearMatch(LPC_TIMER1, 1);
Board_LED_Set(0, 0);
}
}
示例11: booting_m0_failure
/* Function to blink the LED to show the error code
* caused by M0 image boot failure
*/
static void booting_m0_failure(uint32_t msec)
{
int32_t cnt = 60000 / (msec * 2);
DEBUGSTR("ERROR: Boot failure!!\r\n");
while (cnt--) {
Board_LED_Set(ERROR_LED, 1);
MSleep(msec);
Board_LED_Set(ERROR_LED, 0);
MSleep(msec);
}
}
示例12: taskBlink
static void taskBlink(void * p) {
portTickType ticks;
tiempoOprimido = 100;
uint32_t periodo = 1000;
while (1) {
ticks = xTaskGetTickCount();
Board_LED_Set(LED3, 1);
vTaskDelayUntil(&ticks, tiempoOprimido/portTICK_RATE_MS);
Board_LED_Set(LED3, 0);
vTaskDelayUntil(&ticks, (periodo-tiempoOprimido)/portTICK_RATE_MS);
}
}
示例13: SysTick_Handler
void SysTick_Handler(void)
{
//Board_LED_Set(BOARD_LED1_GREEN,true);
if (systick_counter==0xffffffff) systick_rollover_counter += 1;
systick_counter += 1;
if (systick_delay_counter!=0) systick_delay_counter -= 1;
systick_seconds_counter += 1;
if (systick_seconds_counter>=SYSTICK_RATE_HZ)
{
systick_seconds_counter = 0;
SysTick_Seconds();
}
systick_led_counter -= 1;
if (systick_led_counter==0)
{
systick_led_counter = LED_BLINK_RATE;
//Board_LED_Toggle(BOARD_LED1_RED);
}
// loop_priority_high();
keyboard_scan_encoders();
// Board_LED_Set(BOARD_LED1_GREEN,false);
if (systick_led1_green_counter>0)
{
systick_led1_green_counter -= 1;
if (systick_led1_green_counter==0)
{
Board_LED_Set(BOARD_LED1_GREEN,BOARD_LED_OFF);
}
}
if (systick_led1_red_counter>0)
{
systick_led1_red_counter -= 1;
if (systick_led1_red_counter==0)
{
Board_LED_Set(BOARD_LED1_RED,BOARD_LED_OFF);
}
}
if (systick_led3_counter>0)
{
systick_led3_counter -= 1;
if (systick_led3_counter==0)
{
Board_LED_Set(BOARD_LED3,0);
}
}
}
示例14: tareaLED
static void tareaLED(void* p) {
xQueueHandle queue = p;
long delay;
while (1) {
if (xQueueReceive(queue, &delay, portMAX_DELAY) == pdTRUE) {
Board_LED_Set(0, 1);
vTaskDelay(delay / portTICK_RATE_MS);
Board_LED_Set(0, 0);
} else {
// timeout
}
}
}
示例15: main
/**
* @brief Main entry point
* @return Nothing
*/
int main(void)
{
SPIFIobj *obj = &spifi_obj;
uint32_t spifi_clk_mhz;
SPIFIopers opers;
int ret;
spifi_rom_init(spifi);
/* Initialize the board & LEDs for error indication */
Board_Init();
/* Since this code runs from SPIFI no special initialization required here */
prepare_write_data(data_buffer, sizeof(data_buffer));
spifi_clk_mhz = Chip_Clock_GetRate(CLK_MX_SPIFI) / 1000000;
/* Typical time tCS is 20 ns min, we give 200 ns to be on safer side */
if (spifi_init(obj, spifi_clk_mhz / 5, S_RCVCLK | S_FULLCLK, spifi_clk_mhz)) {
DEBUGSTR("Error initializing SPIFI interface!\r\n");
Board_LED_Set(1, 1);
goto end_prog;
}
/* Prepare the operations structure */
memset(&opers, 0, sizeof(SPIFIopers));
opers.dest = (char *) SPIFI_WRITE_SECTOR_OFFSET;
opers.length = sizeof(data_buffer);
/* opers.options = S_VERIFY_PROG; */
/* NOTE: All interrupts must be disabled before calling program as
* any triggered interrupts might attempt to run a code from SPIFI area
*/
ret = spifi_program(obj, (char *) data_buffer, &opers);
if (ret) {
DEBUGOUT("Error 0x%x: Programming of data buffer to SPIFI Failed!\r\n", ret);
Board_LED_Set(1, 1);
goto end_prog;
}
DEBUGSTR("SPIFI Programming successful!\r\n");
if (verify_spifi_data((uint8_t *) SPIFI_WRITE_SECTOR_ADDRESS, sizeof(data_buffer))) {
DEBUGSTR("Error verifying the SPIFI data\r\n");
Board_LED_Set(1, 1);
goto end_prog;
}
Board_LED_Set(0, 1);
DEBUGSTR("SPIFI Data verified!\r\n");
end_prog:
while(1) {__WFI();}
}