本文整理汇总了C++中DELAY_MS函数的典型用法代码示例。如果您正苦于以下问题:C++ DELAY_MS函数的具体用法?C++ DELAY_MS怎么用?C++ DELAY_MS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DELAY_MS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintDelayAndShow
//
// Function: PrintDelayAndShow
//
// Description: My function to delay an show progress
//
// Arguments:
//
// Name Type Direction Description
// ----------- ----------- ----------- -----------------------------------
// Message char * IN String
/// TempMessage char * IN String to show while delay
// Delay int IN Milliseconds to delay
//
void PrintDelayAndShow( char *Message, char *TempMessage, int Delay )
{
int i, NumRepeat = 60;
FILE *pFile = GetErrorFilePointer(); //stdout;
if ( pFile != NULL )
{
if ( Delay > 1000 )
{
Delay = Delay / NumRepeat; //For show 60 pixels
fprintf( pFile, "\r%s %s", Message, TempMessage );
for ( i=NumRepeat; i>0; i-- )
{
DELAY_MS( Delay );
printf( "." );
}//end for
fprintf( pFile, "\r%s DONE\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n", Message );
}//end if
}//end if
else
DELAY_MS( Delay + SHORT_DELAY );
}//end PrintDelayAndShow
示例2: xfm20512_set_gain_direction
/*****************************************************************************
�� �� �� : xfm20512_set_gain_direction
�������� : ����ʰ������ķ���
������� : int fd
unsigned int direction
������� : ��
�� �� ֵ :
���ú��� :
�������� :
����ʷ :
1.�� �� : 2016��6��16��
�� �� : zlg
������ : ����ɺ���
*****************************************************************************/
int xfm20512_set_gain_direction(unsigned int direction)
{
if (direction > 3)
{
return -1;
}
unsigned int data = 0x00001200 | ((direction & 0x3) << 16);
/* 1. ����ʰ������ */
if (i2c_write_proc(i2c_fileId, xfm20512_ADDR, 0x00, (unsigned char *)&data, sizeof(unsigned int)))
return -1;
DELAY_MS(1);
/* 2. ��ѯ����״̬ */
do
{
if (i2c_read_proc(i2c_fileId, xfm20512_ADDR, 0x00, (unsigned char *)&data, sizeof(unsigned int)))
return -1;
DELAY_MS(1);
} while (0x00030001 != data);
return 0;
}
示例3: mpu6050_init
void mpu6050_init() {
// printf("rspt: %x\n", MCM_ETBCC&6);
// SetIsr(NonMaskableInt_VECTORn, NMI_Handler);
// EnableIsr(NonMaskableInt_VECTORn);
i2c_init(I2C0, 400000);
DELAY_MS(100);
printf("init start\n");
mpu6050_short_init();
DELAY_MS(1000);
gyro_cal();
printf("init ends\n");
// float Rx = 0, raw_accel_angle = 0, sum = 0;
// for(int i=0; i<100; i++){
// float Rx = (((float) (adc_once(ADC0_SE17, ADC_10bit) - 525) * 3.3/ 1023))/ 0.8f;
//
// if(Rx > 1.0){
// Rx = 1.0;
// }else if(Rx < -1.0){
// Rx = -1.0;
// }
// raw_accel_angle = 90 - (acos(Rx) * 180 / 3.1415f - 90);
// sum += raw_accel_angle;
// }
// angle[0] = sum/100;
}
示例4: cc2520_init
void cc2520_init(void) {
// ------------------------------------- GPIO ----------------------------------------//
// enable cc2520 related gpio and clks
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
// RST -- PB8
GPIO_CONF_OUTPUT_PORT(B, 8, PUSH_PULL, 50);
// ---------------------------------- GPIO END ----------------------------------------//
// ------------------------------------ CC2520 ----------------------------------------//
CC2520_UNSELECT();
// reset
CC2520_DO_RST();
DELAY_MS(10);
CC2520_UNDO_RST();
DELAY_MS(10);
// ocs
cc2520_command(CMD_SXOSCON);
DELAY_MS(10);
//cc2520_wreg(FRMFILT0, 0x00); // no frame filtering
cc2520_command(CMD_SFLUSHRX);
cc2520_command(CMD_SFLUSHTX);
DELAY_MS(10);
// ---------------------------------- CC2520 END --------------------------------------//
}
示例5: cloudMain
void cloudMain() {
uprint("\r\n ************************ BOOT UP (CLOUD) ************************ \r\n");
configureAudio();
audioReset();
configureIRSend();
int sta = configureRadio(0x0A00, 0x0000111111111111);
uprint_int("Configured radio: ", sta);
char rxbuf[2];
int damageToSend, i;
configureCloudLighting();
DELAY_MS(400);
playSound(CS_BOOT);
DELAY_MS(CS_BOOT_LEN);
while (1) {
uprint("Beginning of main loop");
cloudLightingSetMode(ALGM_BLINK);
uprint("Waiting for hammer message");
radioGetMessage(rxbuf, 1);
uprint("Got message");
playSound(CS_FIRE);
// Don't wait for this sound
// Enter manual lighting mode
cloudLightingSetMode(ALGM_OFF);
cloudLightingSetAll(BRIGHTNESS_MAX);
cloudLightingUpdate();
damageToSend = rxbuf[0];
for (i = 0; i < damageToSend; i ++) {
uprint("Sending damage packet");
sendDamagePacket();
if ((i % 10) == 0) {
cloudLightingSetAll(BRIGHTNESS_MAX);
} else if ((i % 5) == 0) {
cloudLightingSetAll(50);
}
cloudLightingUpdate();
}
uprint("Sending DONE message");
radioSendMessage("DONE", 0x0A00);
}
}
示例6: SERVO_test
/*******************************************************************************
* Function Name : motor_test()
* Description : 电机驱动测试
* Input : None
* Output : None
* Return : None
* Editor :lyf
***************************************************************************/
void SERVO_test()
{
ftm_pwm_duty(FTM3, SERVO, 1100); //R
DELAY_MS(1000);
ftm_pwm_duty(FTM3, SERVO, 900);
DELAY_MS(1000);
}
示例7: SensorTagIO_blinkLed
/*******************************************************************************
* @fn SensorTagIO_blinkLed
*
* @brief Blinks a led 'n' times, duty-cycle 50-50
* @param led - led identifier
* @param nBlinks - number of blinks
*
* @return none
*/
void SensorTagIO_blinkLed(uint8_t led, uint8_t nBlinks)
{
uint8_t i;
for (i = 0; i<nBlinks; i++)
{
PIN_setOutputValue(hGpioPin, led, Board_LED_ON);
DELAY_MS(BLINK_DURATION);
PIN_setOutputValue(hGpioPin, led, Board_LED_OFF);
DELAY_MS(BLINK_DURATION);
}
}
示例8: start_check
/*!
* @brief 启动前进行检测(检测按键是否按下,按下则进入死循环,防止进入 main 函数,松开按键后再按下则进行解锁)
* @since v5.0
* @note 此函数可避免 下载口在 main 前 复用了导致无法下载等问题
*/
void start_check()
{
#if 0
uint8 flag = 0;
key_init(KEY_A);
if(key_check(KEY_A) == KEY_DOWN )
{
//按键按下
led_init(LED0);
while(1)
{
if(key_check(KEY_A) == KEY_UP)
{
flag = 1;
}
led_turn(LED0);
printf("\n进入死循环等待!");
DELAY_MS(500); //此处的延时,可起到 按键 消抖的功能
//如果 送开按键后,再按下 按键,则 进行解锁 操作
if((flag == 1) && (key_check(KEY_A) == KEY_DOWN ))
{
while(key_check(KEY_A) == KEY_DOWN) //等待按键 弹起
{
led_turn(LED0);
DELAY_MS(100); //此处的延时,可起到 按键 消抖的功能
}
while(key_check(KEY_A) == KEY_UP) //等待按键 弹起后 再 进行解锁
{
led_turn(LED0);
DELAY_MS(50); //此处的延时,可起到 按键 消抖的功能
}
printf("\n进行解锁操作,请重新刷入固件");
//解锁单片机
flash_init();
DELAY_MS(100);
flash_erase_sector(0); //擦除扇区 0 (解锁)
NVIC_SystemReset(); //复位单片机
}
}
}
#endif
}
示例9: sensorTaskFxn
/*********************************************************************
* @fn sensorTaskFxn
*
* @brief The task loop of the humidity readout task
*
* @return none
*/
static void sensorTaskFxn(UArg a0, UArg a1)
{
// Register task with BLE stack
ICall_registerApp(&sensorSelfEntity, &sensorSem);
// Deactivate task (active only when measurement is enabled)
Task_setPri(Task_handle(&sensorTask), -1);
// Task loop
while (true)
{
if (sensorConfig == ST_CFG_SENSOR_ENABLE)
{
uint8_t data[MS5607_DATA_SIZE];
sensorMs5607Read(data);
// int32_t temp;
// uint32_t press;
// bool success;
//
// // Readout
// SensorBmp280_enable(true);
// DELAY_MS(SENSOR_FSM_PERIOD);
// success = SensorBmp280_read(data);
// SensorBmp280_enable(false);
//
// // Processing
// if (success)
// {
// SensorBmp280_convert(data,&temp,&press);
//
// data[2] = (temp >> 16) & 0xFF;
// data[1] = (temp >> 8) & 0xFF;
// data[0] = temp & 0xFF;
//
// data[5] = (press >> 16) & 0xFF;
// data[4] = (press >> 8) & 0xFF;
// data[3] = press & 0xFF;
// }
// Send data
Barometer_setParameter(SENSOR_DATA, SENSOR_DATA_LEN, data);
DELAY_MS(sensorPeriod - SENSOR_FSM_PERIOD);
}
else
{
DELAY_MS(SENSOR_DEFAULT_PERIOD);
}
}
}
示例10: radio_init
void radio_init(uint8_t * rxbuf, uint8_t rxbufsz)
{
trx_regval_t status;
/* init cpu peripherals and global IRQ enable */
radiostatus.rxframe = rxbuf;
radiostatus.rxframesz = rxbufsz;
//trx_set_irq_handler(radio_irq_handler);
/* transceiver initialization */
TRX_RESET_LOW();
TRX_SLPTR_LOW();
DELAY_US(TRX_RESET_TIME_US);
#if defined(CUSTOM_RESET_TIME_MS)
DELAY_MS(CUSTOM_RESET_TIME_MS);
#endif
TRX_RESET_HIGH();
/* disable IRQ and clear any pending IRQs */
trx_reg_write(RG_IRQ_MASK, 0);
trx_reg_read(RG_IRQ_STATUS);
trx_bit_write(SR_TRX_CMD, CMD_TRX_OFF);
DELAY_US(510);
status = trx_bit_read(SR_TRX_STATUS);
if (status != TRX_OFF)
{
radio_error(STATE_SET_FAILED);
}
trx_bit_write(SR_TX_AUTO_CRC_ON, 1);
trx_reg_write(RG_IRQ_MASK, TRX_IRQ_RX_START | TRX_IRQ_RX_END | TRX_IRQ_TX_END);
radiostatus.state = STATE_OFF;
radiostatus.idle_state = STATE_OFF;
}
示例11: iec_reset
static void
iec_reset(bool forever)
{
DEBUGF(DBG_ALL, "reset\n");
iec_release(IO_DATA | IO_ATN | IO_CLK);
/*
* Hold the device in reset a while. 20 ms was too short and it didn't
* fully reset (e.g., motor did not run). Nate checked with a scope
* and his 1541-B grabs DATA exactly 25 ms after RESET goes active.
* 30 ms seems good. It takes about 1.2 seconds before the drive answers
* by grabbing DATA.
*
* There is a small glitch at 25 ms after grabbing RESET where RESET out
* goes inactive for 1 us. This corresponds with the drive grabbing CLK
* and DATA, and for about 40 ns, ATN also. Nate assumes this is
* crosstalk from the VIAs being setup by the 6502.
*/
iec_set(IO_RESET);
/*
* For one of Womo's drives a reset low hold time of 30 ms was too short.
* Therefore the value was increased to 100ms. The drive already worked
* with a value of 45 ms, but it was more than doubled to 100 ms to get a
* safety margin for even very worse cabling or input circuit conditions.
*/
DELAY_MS(100);
iec_release(IO_RESET);
wait_for_free_bus(forever);
}
示例12: turn_servo_CCW_degrees
void turn_servo_CCW_degrees(servoIDs id, float degrees) {
uint16_t u16_delayTime = (degrees/360) * CONT_COUNTER_FULL_ROTATION_TIME;
turn_servo_by_pulse(id, COUNTER_PULSE);
DELAY_MS(u16_delayTime);
turn_servo_by_pulse(id, NEUTRAL_PULSE);
}
示例13: task_wav_play
void task_wav_play() {
printf("WAV TASK (ID %d) started.\n", CURRENT_TASK_ID);
__vectors.user[MFP_INT + MFP_GPI2 - USER_ISR_START] = &wav_isr;
TBDR = 29; // approx 15.9 khz out
TBCR = 0x1; // prescaler of 4
// wait for the fifo to clear of garbage
DELAY_MS(50);
wav_ptr = song_start;
wav_end = wav_ptr + song_len - 1;
AER |= (1 << 2);
IERB |= INTR_GPI2;
IMRB |= INTR_GPI2;
// prime the fifo
memcpy(IO_DEV3, wav_ptr, 512);
wav_ptr += 512;
printf("Wav Playback started.\n");
// wait for end of clip & loop.
while(1) {
if (wav_ptr >= wav_end) {
wav_ptr = song_start;
printf("Wav looping!\n");
} else
TIL311 = ((int)(wav_ptr - song_start) * (song_len/16000) / song_len);
yield();
}
}
示例14: bnx2x_dev_start
static int
bnx2x_dev_start(struct rte_eth_dev *dev)
{
struct bnx2x_softc *sc = dev->data->dev_private;
int ret = 0;
PMD_INIT_FUNC_TRACE();
ret = bnx2x_init(sc);
if (ret) {
PMD_DRV_LOG(DEBUG, "bnx2x_init failed (%d)", ret);
return -1;
}
if (IS_PF(sc)) {
rte_intr_callback_register(&(dev->pci_dev->intr_handle),
bnx2x_interrupt_handler, (void *)dev);
if(rte_intr_enable(&(dev->pci_dev->intr_handle)))
PMD_DRV_LOG(ERR, "rte_intr_enable failed");
}
ret = bnx2x_dev_rx_init(dev);
if (ret != 0) {
PMD_DRV_LOG(DEBUG, "bnx2x_dev_rx_init returned error code");
return -3;
}
/* Print important adapter info for the user. */
bnx2x_print_adapter_info(sc);
DELAY_MS(2500);
return ret;
}
示例15: SecUtil_CHexPrintBuffer
void SecUtil_CHexPrintBuffer(
const char *Prefix_p,
const char *Postfix,
const void *Buffer_p,
size_t BufferLength
)
{
char LineBuf[84];
const uint8 *Data_p = Buffer_p;
size_t n;
char EmptyString[] = "";
static const SecUtil_HexFormat_t HexFormat = { "0x", ", ", ", " };
if (Prefix_p == NULL)
Prefix_p = EmptyString;
if (Postfix == NULL)
Postfix = EmptyString;
for (n = 0; n < BufferLength; n += 16) {
(void)SecUtil_BufferToHex(Data_p + n, MIN(16, BufferLength - n),
&HexFormat,
LineBuf, sizeof(LineBuf));
DELAY_MS(5);
printf("%s%s%s", Prefix_p, LineBuf, Postfix);
}
}