本文整理汇总了C++中CyDelay函数的典型用法代码示例。如果您正苦于以下问题:C++ CyDelay函数的具体用法?C++ CyDelay怎么用?C++ CyDelay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CyDelay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReallyDisableEverything
void ReallyDisableEverything() //For the pause mode.
{
DisableAll();
MotorControl1EN_Write(1);
CyDelay(10);
MotorComms_UartPutChar(0);
MotorControl1EN_Write(0);
MotorControl2EN_Write(1);
CyDelay(10);
MotorComms_UartPutChar(0);
MotorControl2EN_Write(0);
MotorControl3EN_Write(1);
CyDelay(10);
MotorComms_UartPutChar(0);
MotorControl3EN_Write(0);
MotorControl4EN_Write(1);
CyDelay(10);
MotorComms_UartPutChar(0);
MotorControl4EN_Write(0);
MotorControl5EN_Write(1);
CyDelay(10);
MotorComms_UartPutChar(0);
MotorControl5EN_Write(0);
}
示例2: main
int main(void) {
uint8 x = 1;
uint8 i;
CR1_Write(0);
LCD_Start();
show();
for(;;) {
if (!SW2_Read()) {
// PUSH button
CY_SET_REG8(Fifo_dp_u0__F0_REG, x++);
show();
while (!SW2_Read()) {
CyDelay(10);
}
}
if (!SW3_Read()) {
// PULL button
for (i = 0; i < 7; i++) {
v[i] = v[i+1];
}
v[7] = CY_GET_REG8(Fifo_dp_u0__F0_REG);
show();
while (!SW3_Read()) {
CyDelay(10);
}
}
}
}
示例3: main
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
InitNetwork();
DisplayStart();
RTC_WDT_Init();
Display("Sync time...");
CyDelay(2000);
if(NTPsync() == TIME_SYNC_OK)
{
Display("Sync ok");
CyDelay(4 * TIMEOUT_USER_READ_INFO);
result = TIME_SYNC_OK;
}
else
{
Display("Sync time error");
CyDelay(4 * TIMEOUT_USER_READ_INFO);
result = TIME_SYNC_ERR;
}
for(;;)
{
DisplayRealTime();
CyDelay(100);
}
}
示例4: main
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
Clock_Start();
SPIM_Start();
setup_matrix();
for(;;)
{
for(h=0;h<=256;h++)
{
for(i=0;i<8;i++)
{
dato=(((i+1)<<8)+fuente[h][i]);
SPIM_WriteTxData(dato);
CyDelay(1);
}
CyDelay(1000);
}
}
}
示例5: mbed_die
WEAK void mbed_die(void) {
#ifndef EMUNO
CyHalt(1);
PWM_Start();
PWM_WriteCompare2(0);
CyPins_SetPinDriveMode(SW_USER, CY_PINS_DM_RES_UP);
Bootloadable_SET_RUN_TYPE(0); // do not force bootloader
while(1)
{
PWM_WriteCompare1(16);
CyDelay(250);
PWM_WriteCompare1(64);
if (CyPins_ReadPin(SW_USER) == 0)
{
CyDelay(200); // allow yser to release btn, to not go into bootloader
CySoftwareReset();
}
CyDelay(400);
if (CyPins_ReadPin(SW_USER) == 0)
{
CyDelay(200); // allow yser to release btn, to not go into bootloader
CySoftwareReset();
}
}
#endif
}
示例6: run
void run()
{
ADC_SAR_Seq_1_Start();
ADC_SAR_Seq_1_StartConvert();
initPSoCWiFi(SSID,PASS,DevKitIP);
for(;;)
{
struct updateParameters values = getValues();
struct responses received = sendSensorData(values);
ID = received.ID;
wantedMoisture = received.moisture;
wantedRotate = received.rotate;
if(wantedMoisture >= values.currentMoisture)
{
start();
CyDelay(1000);
stop();
}
rotate(wantedRotate);
CyDelay(6000); //10 min delay
}
}
示例7: main
int main()
{
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
CYGlobalIntEnable; /* Uncomment this line to enable global interrupts. */
IDAC8_1_Start();
IDAC8_2_Start();
CyDelay(1000);
//Control_Reg_StimSel_Write(STIM_POS);
for(;;)
{
IDAC8_1_SetValue(DAC_V1); //set vdac
Control_Reg_StimSel_Write(STIM_POS); //switch mux
CyDelay(PERIOD_P1);
IDAC8_1_SetValue(0); //set vdac
Control_Reg_StimSel_Write(STIM_GROUND); //switch mux
CyDelay(PERIOD_DELAY);
IDAC8_2_SetValue(DAC_V2); //set vdac
Control_Reg_StimSel_Write(STIM_NEG); //switch mux
CyDelay(PERIOD_P2);
IDAC8_2_SetValue(0); //set vdac
Control_Reg_StimSel_Write(STIM_GROUND); //switch mux
CyDelay(PERIOD_INTERVAL);
LED_B_Write(~LED_B_Read()); //Toggle LED
}
}
示例8: error
WEAK void error(const char* format, ...) {
#if DEVICE_STDIO_MESSAGES
va_list arg;
va_start(arg, format);
vfprintf(stderr, format, arg);
va_end(arg);
#endif
#ifndef EMUNO
PWM_Start();
PWM_WriteCompare2(64);
CyDelay(200);
PWM_WriteCompare2(0);
CyDelay(600);
PWM_WriteCompare2(64);
CyDelay(200);
PWM_WriteCompare2(0);
exit(1);
#else
printf("EMUNO HALT!");
while(1);
#endif
// Bootloadable_SET_RUN_TYPE(Bootloadable_START_APP);
// CySoftwareReset();
}
示例9: MagReadByte
/*Requires Delay after call*/
uint8 MagReadByte(uint8 registerAddress, uint8 *readPtr)
{
/* Pointer to the register address */
//uint8 *writePtr = ®isterAddress;/* changed writeptr to ®isterAddress*/
uint8 i2c_status = I2C_MasterClearStatus();
//LCD_ClearDisplay();
LCD_Position(1,7);
LCD_PrintInt8(i2c_status);
I2C_MasterClearReadBuf();
I2C_MasterClearWriteBuf();
/* Start the I2C transmission for a read */
uint8 status = I2C_MasterWriteBuf(SLAVE_ADDRESS, ®isterAddress, 1, I2C_MODE_NO_STOP);
/*wait for the tranmission to finish */
while (I2C_MasterStatus() && !I2C_MSTAT_WR_CMPLT){}
/* Needed because of some bug in the psoc I2C tramission */
CyDelay(1);
/* read a byte using I2C */
//return I2C_MasterReadBuf(SLAVE_ADDRESS, readPtr, 1, I2C_MODE_REPEAT_START);
//or TO ENSURE READ IS COMPLETE BEFORE ADDITIONAL CODE EXECUTED
status |= I2C_MasterReadBuf(SLAVE_ADDRESS,readPtr , 1, I2C_MODE_REPEAT_START);
while (I2C_MasterStatus() && !I2C_MSTAT_RD_CMPLT){}
CyDelay(1); //Needed because of some bug in the psoc I2C tramission
return status;
}
示例10: main
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
DisplayStart();
Display("System init...");
RTC_WDT_Init();
InitNetwork();
Display("Sync time...");
uint8_t number = 0;
while((result = NTPsync()) != TIME_SYNC_OK)
{
char buf[10];
sprintf(buf, "Sync time -%d", number++);
LCD_Position(0,0);
LCD_PrintString(buf);
CyDelay(500);
}
Display("Sync ok ");
CyDelay(4*TIMEOUT_USER_READ_INFO);
for(;;)
{
DisplayRealTime();
CyDelay(500);
}
}
示例11: OUT_OnOff
void OUT_OnOff(int pin, int len)
{
switch(pin) {
case 1:
OUT_1_Write( ! OUT_1_Read() );
CyDelay( len );
break;
case 2:
OUT_2_Write( ! OUT_2_Read() );
CyDelay( len );
break;
default:
break;
}//switch(pin)
}//void OUT_OnOff(int, int)
示例12: main
int main()
{
char uartBuffer[80];
char lcdBuffer[16];
UART_1_Start();
UART_1_UartPutString("Sequencer Board Test\r\n");
// Sequence Boardをリセット
Pin_I2C_Reset_Write(0u);
CyDelay(1);
Pin_I2C_Reset_Write(1u);
/* Init I2C */
I2CM_Start();
CyDelay(1500);
CyGlobalIntEnable;
LCD_Init();
LCD_Clear();
LCD_Puts("Sequencer Board");
CyDelay(1000);
for(;;)
{
if (readSequencerBoard() == I2C_TRANSFER_CMPLT) {
sprintf(uartBuffer, "%d %d %d %d %d %d ",
sequencerRdBuffer[0],
sequencerRdBuffer[1],
sequencerRdBuffer[2],
sequencerRdBuffer[3],
sequencerRdBuffer[4],
sequencerRdBuffer[5]
);
UART_1_UartPutString(uartBuffer);
}
else {
UART_1_UartPutString("I2C Master Sequencer Read Error.\r\n");
}
if (writeSequencerBoard() == I2C_TRANSFER_CMPLT) {
sprintf(uartBuffer, "%d\r\n", sequencerWrBuffer[0]);
UART_1_UartPutString(uartBuffer);
}
else {
UART_1_UartPutString("I2C Master Sequencer Write Error.\r\n");
}
sprintf(lcdBuffer, "%d", sequencerWrBuffer[0]);
LCD_Clear();
LCD_Puts(lcdBuffer);
sequencerWrBuffer[0] = inc_within_uint8(sequencerWrBuffer[0], 16, 0);
CyDelay(125);
}
}
示例13: blink_LED
uint8 blink_LED(uint8 n_blinks) {
uint8 k;
for (k = 0; k < n_blinks; k++) {
LED_Write(1u);
CyDelay(200u);
LED_Write(0u);
CyDelay(200u);
}
}
示例14: Sparkler
void Sparkler ( uint16 runtime, int fade_amount , int num_sparkles ,char white )
{
int x,j;
led_color temp;
// length of time to run
for(x = 0; x <= runtime ; x++)
{
if(fade_amount ) {
// Fade strip
FadeStrip( StripLights_MIN_X, StripLights_MAX_X , fade_amount );
} else {
StripLights_MemClear(0);
}
// draw in same place 8 times
for ( j = 0 ; j < num_sparkles ;j++ ){
temp.c.r = calculate_sparkle( j );
if (white ) {
temp.c.g = temp.c.b = temp.c.r;
} else {
temp.c.g = calculate_sparkle( j );
temp.c.b = calculate_sparkle( j );
}
// draw a pixel
StripLights_Pixel(rand()%StripLights_MAX_X, 0, temp.rgb );
}
// strip ready?
while( StripLights_Ready() == 0);
//push current data to led strip
StripLights_Trigger(1);
CyDelay( 3 );
}
if( fade_amount ) {
// fade at end
for(x = 0; x <= 200 ; x++)
{
// Fade strip
FadeStrip( StripLights_MIN_X, StripLights_MAX_X , fade_amount );
// strip ready?
while( StripLights_Ready() == 0);
//push current data to led strip
StripLights_Trigger(1);
CyDelay( 3 );
}
}
}
示例15: dynamixelRelayTest
// an automated test that toggles the relay for the dynamixels
void dynamixelRelayTest() {
while(1) {
CyDelay(5000);
TOGGLE_LED0;
dynamixel_relay_Write(0);
CyDelay(5000);
TOGGLE_LED0;
dynamixel_relay_Write(1);
}
}