本文整理汇总了C++中WAIT1_Waitms函数的典型用法代码示例。如果您正苦于以下问题:C++ WAIT1_Waitms函数的具体用法?C++ WAIT1_Waitms怎么用?C++ WAIT1_Waitms使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WAIT1_Waitms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CDC_Run
static void CDC_Run(void) {
int i;
for(;;) {
while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
// LED1_Neg(); LED2_Off();
WAIT1_Waitms(10);
}
// LED1_Off(); LED2_Neg();
if (CDC1_GetCharsInRxBuf()!=0) {
i = 0;
while( i<sizeof(in_buffer)-1
&& CDC1_GetChar(&in_buffer[i])==ERR_OK
)
{
i++;
}
in_buffer[i] = '\0';
(void)CDC1_SendString((unsigned char*)"echo: ");
(void)CDC1_SendString(in_buffer);
(void)CDC1_SendString((unsigned char*)"\r\n");
} else {
WAIT1_Waitms(10);
}
}
}
示例2: APP_Run
void APP_Run(void) {
int i;
uint32_t val = 0;
unsigned char buf[16];
for(;;) {
while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
LED1_Neg(); LED2_Off();
WAIT1_Waitms(10);
}
LED2_Off(); LED1_Neg();
if (CDC1_GetCharsInRxBuf()!=0) {
i = 0;
while( i<sizeof(in_buffer)-1
&& CDC1_GetChar(&in_buffer[i])==ERR_OK
)
{
i++;
}
in_buffer[i] = '\0';
(void)CDC1_SendString((unsigned char*)"echo: ");
(void)CDC1_SendString(in_buffer);
UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"val: ");
UTIL1_strcatNum32u(buf, sizeof(buf), val);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n");
(void)CDC1_SendString(buf);
val++;
} else {
WAIT1_Waitms(10);
}
}
}
示例3: BL_CheckBootloaderMode
static bool BL_CheckBootloaderMode(void) {
/* let's check if the user presses the BTLD switch. Need to configure the pin first */
/* PTB8 as input */
/* clock all port pins */
SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK |
SIM_SCGC5_PORTB_MASK |
SIM_SCGC5_PORTC_MASK |
SIM_SCGC5_PORTD_MASK |
SIM_SCGC5_PORTE_MASK;
/* Configure pin as input */
#if 0
/* GPIOB_PDDR: PDD&=~0x0100 */
GPIOB_PDDR = (uint32_t)((GPIOB_PDDR & (uint32_t)~0x0100UL) | (uint32_t)0x00UL);
/* Initialization of Port Control register */
/* PORTB_PCR8: ISF=0,MUX=1 */
PORTB_PCR8 = (uint32_t)((PORTB_PCR8 & (uint32_t)~0x01000600UL) | (uint32_t)0x0100UL);
#else
(void)BitIoLdd3_Init(NULL); /* initialize the port pin PTB8 */
/* enable internal pull-up on PTB8 */
PORT_PDD_SetPinPullSelect(PORTB_BASE_PTR, 8, PORT_PDD_PULL_UP);
PORT_PDD_SetPinPullEnable(PORTB_BASE_PTR, 8, PORT_PDD_PULL_ENABLE);
WAIT1_Waitms(5); /* wait get pull-up a chance to pull-up */
#endif
if (!BL_SW_GetVal()) { /* button pressed (has pull-up!) */
WAIT1_Waitms(50); /* wait to debounce */
if (!BL_SW_GetVal()) { /* still pressed */
return TRUE; /* go into bootloader mode */
}
}
/* BTLD switch not pressed, and we have a valid user application vector */
return FALSE; /* do not enter bootloader mode */
}
示例4: APP_Run
void APP_Run(void) {
int cnt=0; /* counter to slow down LED blinking */
for(;;) {
WAIT1_Waitms(10);
cnt++;
if (HIDM1_App_Task()==ERR_BUSOFF) {
if ((cnt%128)==0) { /* just slow down blinking */
LEDG_Off();
LEDR_Neg();
}
} else {
if ((cnt%128)==0) { /* just slow down blinking */
LEDR_Off();
LEDG_Neg();
}
if (SW2_GetVal()==0) { /* button pressed */
WAIT1_Waitms(100); /* wait for debouncing */
if (SW2_GetVal()==0) { /* still pressed */
//(void)HIDM1_Send(0, 8, 8); /* raw move message */
//(void)HIDM1_Send(HIDM1_MOUSE_LEFT, 0, 0); /* send left mouse button */
//(void)HIDM1_Send(0, 0, 0); /* send release button message */
//(void)HIDM1_Move(-8, 0); /* moving the cursor up */
//HIDM1_Click(HIDM1_MOUSE_LEFT); /* left mouse click */
HIDM1_Click(HIDM1_MOUSE_RIGHT); /* right mouse click */
}
while(SW2_GetVal()==0) {} /* wait until button is released */
}
}
}
}
示例5: APP_Start
void APP_Start(void) {
PL_Init(); /* platform initialization */
//TEST_Test();
EVNT_SetEvent(EVNT_INIT); /* set initial event */
#if PL_HAS_RTOS
if (FRTOS1_xTaskCreate(AppTask, (signed portCHAR *)"App", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL) != pdPASS) {
for(;;){} /* error */
}
RTOS_Run();
#else
APP_Loop();
#endif
#if 0
for(;;) {
#if PL_HAS_MEALY
MEALY_Step();
#else
LED1_On();
WAIT1_Waitms(300);
LED1_Off();
LED2_On();
WAIT1_Waitms(300);
LED2_Off();
LED3_On();
WAIT1_Waitms(300);
LED3_Off();
#endif
}
#endif
/* just in case we leave the main application loop */
PL_Deinit();
}
示例6: main
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
LCD1_Clear();
WAIT1_Waitms(1000);
LCD1_WriteLineStr(1, "Hello FRDM-KL25z");
for(;;) {
uint8_t cnt;
uint8_t buf[5];
LCD1_GotoXY(2,1);
UTIL1_Num16uToStr(buf, sizeof(buf), cnt);
LCD1_WriteString((char*)buf);
cnt++;
WAIT1_Waitms(100);
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
示例7: main
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
LED1_On();
WAIT1_Waitms(100);
LED1_Off();
LED2_On();
WAIT1_Waitms(100);
LED2_Off();
LED3_On();
WAIT1_Waitms(100);
LED3_Off();
CDC_Run();
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
示例8: setup_cc2500
uint8_t setup_cc2500(void) {
uint8_t returnValue=0;
uint8_t initial_power = 0xFB; // 0 dBm
// Set-up rx_callback function
do
{
// Changed
//spi_init(); // Initialize SPI port
// FIXME Add uscib0 files
cc_powerup_reset(); // Reset CCxxxx
// TODO implement this
wait_cycles(500); // Wait for device to reset (Not sure why this is needed)
if(writeRFSettings()) // Write RF settings to config reg
{
returnValue = 1; // Failed
break;
}
// FIXME Add uscib0 files
cc_write_burst_reg( TI_CCxxx0_PATABLE, &initial_power, 1);//Write PATABLE
// FIXME Add uscib0 files
cc_strobe(TI_CCxxx0_SIDLE);
WAIT1_Waitms(10);
cc_strobe(TI_CCxxx0_SFRX); // Flush RXFIFO
WAIT1_Waitms(10);
cc_strobe(TI_CCxxx0_SFTX); // Flush RXFIFO
WAIT1_Waitms(10);
cc_strobe(TI_CCxxx0_SRX); // Initialize CCxxxx in RX mode.
returnValue = cc_read_status(TI_CCxxx0_MARCSTATE);
returnValue =0;
// When a pkt is received, it will
// signal on GDO0 and wake CPU
// FIXME
// Configure GDO0 port
// GDO0_PxIES |= GDO0_PIN; // Int on falling edge (end of pkt)
// GDO0_PxIFG &= ~GDO0_PIN; // Clear flag
// GDO0_PxIE |= GDO0_PIN; // Enable int on end of packet
CC_2500_SETUP_DONE = true;
}while(0);
return returnValue;
}
示例9: APP_Run
void APP_Run(void) {
int value;
char buffer[64];
#if 0
for(;;) {
printf("Hello world!\r\n");
LEDR_On();
WAIT1_Waitms(500);
LEDR_Off();
LEDG_On();
WAIT1_Waitms(500);
LEDG_Off();
}
#endif
for(;;) {
printf("Hello world!\r\n");
printf("Please enter a name:\n\r");
scanf("%s", buffer);
printf(" I have received: '%s'\r\n", buffer);
printf("Please enter a number:\r\n");
scanf("%i", &value);
printf(" I have received: '%i'\r\n", value);
}
}
示例10: APP_Run
void APP_Run(void) {
DHTxx_ErrorCode res;
uint16_t temperature, humidity;
CLS1_ConstStdIOType *io = CLS1_GetStdio();
uint8_t buf[48];
#if DHTxx_SENSOR_TYPE_IS_DHT11
CLS1_SendStr("DHT11 Sensor Demo:\r\n", io->stdErr);
#else
CLS1_SendStr("DHT22 Sensor Demo:\r\n", io->stdErr);
#endif
WAIT1_Waitms(1000); /* wait one second after power-up to get the sensor stable */
for(;;) {
res = DHTxx_Read(&temperature, &humidity);
if (res!=DHTxx_OK) { /* error */
LEDR_Neg(); /* indicate error with red LED */
/* write error message */
CLS1_SendStr("ERROR: ", io->stdErr);
CLS1_SendStr(DHTxx_GetReturnCodeString(res), io->stdErr);
CLS1_SendStr("\r\n", io->stdErr);
} else { /* ok! */
LEDG_Neg();
/* write data values */
UTIL1_strcpy(buf, sizeof(buf), "Temperature ");
UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)temperature);
UTIL1_strcat(buf, sizeof(buf), "°C, Humidity ");
UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)humidity);
UTIL1_strcat(buf, sizeof(buf), "%\r\n");
CLS1_SendStr(buf, io->stdOut);
}
WAIT1_Waitms(DHTxx_SENSOR_PERIOD_MS); /* can only read sensor values with a certain frequency! */
}
}
示例11: CDC_Run
static void CDC_Run(void) {
int i;
for(;;) {
reactToButton();
int j = 0;
while(CDC1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
/* device not enumerated */
//LEDR_Neg(); LEDG_Off();
reactToButton();
if(j % 50 == 0) {
LED_Neg();
}
j++;
WAIT1_Waitms(10);
}
//LEDR_Off(); LEDG_Neg();
if (CDC1_GetCharsInRxBuf()!=0) {
i = 0;
while(i<sizeof(in_buffer)-1 && CDC1_GetChar(&in_buffer[i])==ERR_OK) {
switchLEDs(in_buffer[i]);
i++;
}
in_buffer[i] = '\0';
(void)CDC1_SendString((unsigned char*)"echo: ");
(void)CDC1_SendString(in_buffer);
(void)CDC1_SendString((unsigned char*)"\r\n");
} else {
WAIT1_Waitms(10);
}
}
}
示例12: main
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
#if OPTIMIZE_BIT_ACCESS
GREEN_Clr(); /* turn on green LED */
WAIT1_Waitms(1000);
GREEN_Set(); /* turn off green LED */
for(;;) {
if (SW1_Get()==0) { /* button low level => pressed */
RED_Clr(); /* LED cathode is connected to microcontroller pin: low level turns it on */
BLUE_Set(); /* turn off blue led */
} else {
RED_Set(); /* turn off red led */
BLUE_Clr(); /* turn on blue led */
}
if (SW2_Get()==0) { /* switch low level => pressed */
BLUE_Clr(); /* turn on blue led */
} else {
BLUE_Set(); /* turn off blue led */
}
}
#else
GREEN_ClrVal(GREEN_DeviceData); /* turn on green LED */
WAIT1_Waitms(1000);
GREEN_SetVal(GREEN_DeviceData); /* turn off green LED */
for(;;) {
if (SW1_GetVal(SW1_DeviceData)==0) { /* button low level => pressed */
RED_ClrVal(RED_DeviceData); /* LED cathode is connected to microcontroller pin: low level turns it on */
BLUE_SetVal(BLUE_DeviceData); /* turn off blue led */
} else {
RED_SetVal(RED_DeviceData); /* turn off red led */
BLUE_ClrVal(BLUE_DeviceData); /* turn on blue led */
}
if (SW2_GetVal(SW2_DeviceData)==0) { /* switch low level => pressed */
BLUE_ClrVal(BLUE_DeviceData); /* turn on blue led */
} else {
BLUE_SetVal(BLUE_DeviceData); /* turn off blue led */
}
}
#endif
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
示例13: TI1_OnInterrupt
/*
** ===================================================================
** Event : TI1_OnInterrupt (module Events)
**
** Component : TI1 [TimerInt]
** Description :
** When a timer interrupt occurs this event is called (only
** when the component is enabled - <Enable> and the events are
** enabled - <EnableEvent>). This event is enabled only if a
** <interrupt service/event> is enabled.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void TI1_OnInterrupt(void)
{
/* Write your code here ... */
LED_VERD_Neg();WAIT1_Waitms(333);
LED_AZUL_Neg();WAIT1_Waitms(333);
LED_VERM_Neg();WAIT1_Waitms(333);
LED_VERD_Off();
LED_AZUL_Off();
LED_VERM_Off();
AS1_SendBlock(NULL, "Serial.", 8);
}
示例14: Cpu_OnLLSWakeUpINT
void Cpu_OnLLSWakeUpINT(void)
{
uint32_t tmp;
tmp = Cpu_GetLLSWakeUpFlags();
if (tmp&LLWU_INT_MODULE0) { /* LPTMR */
#if 0
LED1_On(); /* red */
WAIT1_Waitms(1);
LED1_Off(); /* red */
WAIT1_Waitms(100);
#endif
LPTMR_PDD_ClearInterruptFlag(LPTMR0_BASE_PTR); /* Clear interrupt flag */
}
}
示例15: main
void main(void)
{
/* Write your local variable definition here */
int i = 0;
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* For example: for(;;) { } */
for(;;) {
i++;
if ((i%5)==0) {
data[0]++; /* change data */
TestFlash();
}
LED1_Neg();
WAIT1_Waitms(250);
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;){}
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/