本文整理匯總了C++中DelayInit函數的典型用法代碼示例。如果您正苦於以下問題:C++ DelayInit函數的具體用法?C++ DelayInit怎麽用?C++ DelayInit使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DelayInit函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: CONSOLE_Parse
/////////////////////////////////////////////////////////////////////////////
// Parser
/////////////////////////////////////////////////////////////////////////////
s32 CONSOLE_Parse(mios32_midi_port_t port, u8 byte)
{
// temporary change debug port (will be restored at the end of this function)
mios32_midi_port_t prev_debug_port = MIOS32_MIDI_DebugPortGet();
MIOS32_MIDI_DebugPortSet(port);
if( byte == '\r' ) {
// ignore
} else if( byte == '\n' ) {
// example for parsing the command:
char *separators = " \t";
char *brkt;
char *parameter;
if( (parameter = strtok_r(line_buffer, separators, &brkt)) ) {
if( strcmp(parameter, "help") == 0 ) {
MIOS32_MIDI_SendDebugMessage("Welcome to " MIOS32_LCD_BOOT_MSG_LINE1 "!");
MIOS32_MIDI_SendDebugMessage("Following commands are available:");
MIOS32_MIDI_SendDebugMessage(" reset: clears the current measurements\n");
MIOS32_MIDI_SendDebugMessage(" help: this page\n");
} else if( strcmp(parameter, "reset") == 0 ) {
MIOS32_IRQ_Disable();
u8 including_min_max = 1;
DelayInit(&d_tick, including_min_max);
DelayInit(&d_measure, including_min_max);
DelayInit(&d_beat, including_min_max);
midi_clock_ctr = 0;
total_delay = 0;
MIOS32_IRQ_Enable();
MIOS32_MIDI_SendDebugMessage("Measurements have been cleared!\n");
} else {
MIOS32_MIDI_SendDebugMessage("Unknown command - type 'help' to list available commands!\n");
}
}
line_ix = 0;
} else if( line_ix < (STRING_MAX-1) ) {
line_buffer[line_ix++] = byte;
line_buffer[line_ix] = 0;
}
// restore debug port
MIOS32_MIDI_DebugPortSet(prev_debug_port);
return 0; // no error
}
示例2: main
int main(void)
{
uint8_t last_sec;
RTC_CalanderTypeDef RTC_Calander1;
//初始化係統時鍾 使用外部50M晶振 PLL倍頻到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
UART_printf("RTC TEST\r\n");
RTC_Init();
//可以設置時間
RTC_Calander1.Hour = 10;
RTC_Calander1.Minute = 57;
RTC_Calander1.Second = 58;
RTC_Calander1.Month = 10;
RTC_Calander1.Date = 10;
RTC_Calander1.Year = 2013;
//RTC_SetCalander(&RTC_Calander1);
NVIC_EnableIRQ(RTC_IRQn);
while(1)
{
RTC_GetCalander(&RTC_Calander1); //讀取時間
if(last_sec != RTC_Calander1.Second)
{
UART_printf("%d-%d-%d %d:%d:%d\r\n", RTC_Calander1.Year, RTC_Calander1.Month, RTC_Calander1.Date, RTC_Calander1.Hour, RTC_Calander1.Minute, RTC_Calander1.Second);
last_sec = RTC_Calander1.Second;
}
}
}
示例3: main
int main(void)
{
//使用USB 必須CoreClock = 96M
uint8_t usb_hid_send_buf[8] ={0,0,0,0,0,0};
uint8_t usb_hid_rec_buf[8];
uint8_t usb_hid_rec_cnt = 0; //接收幀計數
SystemClockSetup(ClockSource_EX50M,CoreClock_96M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
KBI_Init(KBI_PinLookup_CHK60EVB, kNumOfKEY);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
DisplayCPUInfo();
UART_printf("Waitting for USB connect ...\r\n");
USB_Init(); //初始化USB設備
USB_WaitDeviceEnumed(); //等待USB枚舉成功
UART_printf("USB connected!\r\n");
while(1)
{
KBI_Scan();
usb_hid_send_buf[0] = KBI_GetKeyValue(kKEY1);
usb_hid_send_buf[1] = KBI_GetKeyValue(kKEY2);
USB_HID_SendData(usb_hid_send_buf,8); //發送數據
if(USB_HID_RecData(usb_hid_rec_buf) != 0) //接收到了數據
{
LED_Ctrl(kLED1, (usb_hid_rec_buf[0]&0x01)>>0);
LED_Ctrl(kLED2, (usb_hid_rec_buf[0]&0x02)>>1);
usb_hid_rec_cnt++;
UART_printf("USB HID Data Received\r\n");
}
HID_Proc(); //執行HID進程
DelayMs(KBI_SCAN_PERIOD_IN_US/1000); //延時
}
示例4: main
int main(void)
{
//定義串口初始化結構
UART_InitTypeDef UART_InitStruct1;
//初始化係統時鍾 使用外部50M晶振 PLL倍頻到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
//初始化LED
LED_Init(LED_PinLookup_CHKATOM, kNumOfLED);
//KBI 初始化
KBI_Init(KBI_PinLookup_CHKATOM, kNumOfKEY);
UART_InitStruct1.UARTxMAP = UART4_RX_C14_TX_C15; //UART4模塊 映射引腳:PTC14 PTC15
UART_InitStruct1.UART_BaudRate = 115200; //波特率 115200
UART_Init(&UART_InitStruct1); //初始化串口
//開啟發送中斷功能
UART_ITConfig(UART4,UART_IT_TDRE,ENABLE);
//接通NVIC上對應串口中斷線
NVIC_EnableIRQ(UART4_RX_TX_IRQn);
//開始中斷發送
UART_SendDataInt(UART4,gTestBuffer,sizeof(gTestBuffer));
//等待中斷發送完成
while(UART_TxIntStruct1.IsComplete == FALSE);
while(1)
{
LED_Toggle(kLED1);
DelayMs(500);
}
}
示例5: main
int main(void)
{
uint8_t ch;
//定義串口初始化結構
UART_InitTypeDef UART_InitStruct1;
//初始化係統時鍾 使用外部50M晶振 PLL倍頻到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
//初始化LED
LED_Init(LED_PinLookup_CHKATOM, kNumOfLED);
//KBI 初始化
KBI_Init(KBI_PinLookup_CHKATOM, kNumOfKEY);
UART_InitStruct1.UARTxMAP = UART4_RX_C14_TX_C15; //UART4模塊 映射引腳:PTC14 PTC15
UART_InitStruct1.UART_BaudRate = 115200; //波特率 115200
UART_Init(&UART_InitStruct1); //初始化串口
while(1)
{
//接收成功
if(UART_ReceiveData(UART4, &ch) == TRUE)
{
//echo
UART_SendData(UART4, ch);
}
}
}
示例6: main
int main(void)
{
uint32_t LPTM_Value = 0;
LPTM_InitTypeDef LPTM_InitStruct1;
FTM_InitTypeDef FTM_InitStruct1;
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
DisplayCPUInfo();
//在PC3上產生 1KHz 占空比50%的 方波
FTM_InitStruct1.Frequency = 1000;
FTM_InitStruct1.FTMxMAP = FTM0_CH3_PC4;
FTM_InitStruct1.FTM_Mode = FTM_Mode_EdgeAligned;
FTM_InitStruct1.InitalDuty = 5000;
FTM_Init(&FTM_InitStruct1);
//開啟PTC5上的脈衝計數引腳
LPTM_InitStruct1.LPTMxMap = LPTM_CH2_PC5;
LPTM_InitStruct1.LPTM_InitCompareValue = 200; //在脈衝計數模式下無意義
LPTM_InitStruct1.LPTM_Mode = LPTM_Mode_PC_FALLING; //下降沿觸發計數
LPTM_Init(&LPTM_InitStruct1);
while(1)
{
//讀取脈衝技術值
LPTM_Value = LPTM_GetTimerCounterValue(LPTMR0);
//清空技術值
LPTM_ResetTimeCounter(LPTMR0);
UART_printf("LPTMR:%dHz\r\n", LPTM_Value);
DelayMs(1000);
}
}
示例7: main
int main(void)
{
uint32_t i;
DelayInit();
GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP);
UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
printf("SD test\r\n");
printf("please insert SD card...\r\n");
//SD卡模塊快速初始化,設置速度為20000000
SD_QuickInit(20000000);
//獲取SD卡的容量
printf("SD size:%dMB\r\n", SD_GetSizeInMB());
/* 讀取0扇區數據,每一個扇區512字節 */
SD_ReadSingleBlock(0, sd_buffer);
/* 打印0扇區數據 */
printf("sectoer 0 data:\r\n");
for(i = 0; i < 512; i++)
{
printf("0x%02X ", sd_buffer[i]);
}
while(1)
{
//小燈閃爍
GPIO_ToggleBit(HW_GPIOE, 6);
DelayMs(500);
}
}
示例8: main
int main(void)
{
DelayInit();
GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP); /* LED */
GPIO_QuickInit(HW_GPIOE, 26, kGPIO_Mode_IPU); /* KEY */
UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
/* 初始化看門狗 */
WDOG_InitTypeDef WDOG_InitStruct1;
WDOG_InitStruct1.windowInMs = 0;
WDOG_InitStruct1.mode = kWDOG_Mode_Normal; //設置看門狗處於正常工作模式
WDOG_InitStruct1.timeOutInMs = 2000; /* 時限 2000MS : 2000MS 內沒有喂狗則複位 */
WDOG_Init(&WDOG_InitStruct1);
printf("WDOG test start!\r\n");
printf("press KEY1 to feed dog within 2S or system with reset!\r\n");
/* 點亮LED 然後熄滅 指示係統運行從新上電運行 */
GPIO_WriteBit(HW_GPIOE, 6, 0);
DelayMs(200);
GPIO_WriteBit(HW_GPIOE, 6, 1);
while(1)
{
if(GPIO_ReadBit(HW_GPIOE, 26) == 0) /* 按鍵被按下 */
{
/* 喂狗 防止複位 */
printf("wdog feed! we have 2s\r\n");
WDOG_Refresh(); //喂狗
DelayMs(100);
}
DelayMs(10);
}
}
示例9: main
int main(void)
{
DelayInit();
// Initialize timer interrupt
TIM2_INT_Init();
// Initialize LED matrix GPIO pin
LedMatrixInit();
while (1)
{
// Display heart symbol
for (row = 0; row <= 7; row++)
{
buffer[row] = heart_symbol[row];
}
DelayMs(1000);
// Clear display
for (row = 0; row <= 7; row++)
{
buffer[row] = 0x00;
}
DelayMs(1000);
}
}
示例10: main
int main(void)
{
uint8_t i;
//初始化係統時鍾 使用外部50M晶振 PLL倍頻到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
//初始化LED
LED_Init(LED_PinLookup_CHKATOM, kNumOfLED);
//KBI 初始化
KBI_Init(KBI_PinLookup_CHKATOM, kNumOfKEY);
//閃燈 製造複位效果
for(i = 0; i < 10; i++)
{
LED_Toggle(kLED1);
DelayMs(50);
}
//初始化看門狗 如果1000MS 內沒有喂狗則 複位
WDOG_Init(1000);
while(1)
{
KBI_Scan();
if((KBI_GetKeyState(kKEY1) == kKBI_SINGLE))
{
//如果案件按下 喂狗:
WDOG_Feed();
}
//掃描間隔延時
DelayMs(KBI_SCAN_PERIOD_IN_US/1000);
}
}
示例11: main
int main(void)
{
uint32_t instance; /*存放 UART 的模塊號 */
DelayInit();
DelayMs(10);
GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP);
/* 初始化UART 使用快速初始化方式 波特率 115200 其他配置默認 返回初始化後 UART的模塊號 */
instance = UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
/* 當使用串口初始化後 printf 被默認連接到第一個被初始化的串口上*/
printf("UART%d OK! Hello Kinetis\r\n", instance);
while(1)
{
/* 串口 按字節發送 數據 注意 HW_UART0必須是已經初始化過的模塊 否則 將產生錯誤*/
UART_WriteByte(instance, 'h');
UART_WriteByte(instance, 'e');
UART_WriteByte(instance, 'l');
UART_WriteByte(instance, 'l');
UART_WriteByte(instance, 'o');
UART_WriteByte(instance, '\r');
UART_WriteByte(instance, '\n');
/* 閃爍小燈 */
GPIO_ToggleBit(HW_GPIOE, 6);
DelayMs(500);
}
}
示例12: main
int main(void)
{
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
DisplayCPUInfo();
GUI_Init(&CHGUI_InitStruct1);
GUI_SetFontFormName("FONT_CourierNew");
while(1)
{
GUI_GotoXY(0, 0);
GUI_TOUCH_GetState(&State);
//打印物理AD坐標
GUI_printf("Phy:X:%04d Y:%04d\r\n", GUI_TOUCH_GetxPhys(), GUI_TOUCH_GetyPhys());
//打印邏輯AD坐標
GUI_printf("Log:X:%04d Y:%04d\r\n", State.x, State.y);
GUI_printf("State:%01d\r\n", State.Pressed);
//LCD 畫筆跟蹤
GUI_DrawPoint(State.x, State.y);
DelayMs(10);
//GUI 觸摸屏處理函數 每10MS調用一次
GUI_TOUCH_Exec();
}
}
示例13: main
int main(void)
{
//初始化係統時鍾 使用外部50M晶振 PLL倍頻到100M
SystemClockSetup(ClockSource_EX50M,CoreClock_100M);
DelayInit();
//初始化LED
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
//KBI 初始化
KBI_Init(KBI_PinLookup_CHK60EVB, kNumOfKEY);
while(1)
{
//掃描按鍵
KBI_Scan();
if(KBI_GetKeyState(kKEY1) == kKBI_SINGLE)
{
LED_Toggle(kLED1);
}
if(KBI_GetKeyState(kKEY1) == kKBI_LONG)
{
LED_Toggle(kLED2);
}
//掃描間隔延時
DelayMs(KBI_SCAN_PERIOD_IN_US/1000);
}
}
示例14: main
/*
實驗名稱:WDOG窗口看門狗
實驗平台:渡鴉開發板
板載芯片:MK60DN512ZVQ10
實驗效果:開啟看門狗的窗口模式,必須在規定的時間範圍內喂狗,否則芯片複位
*/
int main(void)
{
DelayInit();
GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP); /* LED */
UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);
/* 初始化看門狗 */
WDOG_InitTypeDef WDOG_InitStruct1 = {0};
WDOG_InitStruct1.mode = kWDOG_Mode_Window; //設置看門狗為窗口模式
WDOG_InitStruct1.windowInMs = 1000; /* 開窗時間 設置為窗體模式後 喂狗必須在 看門狗開始計時後 1000 - 2000 MS內完成 多了少了都複位 比普通看門狗嚴格*/
WDOG_InitStruct1.timeOutInMs = 2000; /* 時限 2000MS : 2000MS 內沒有喂狗則複位 */
WDOG_Init(&WDOG_InitStruct1);
printf("\r\nSYSTEM RESET!!!!!!!%d\r\n", WDOG_GetResetCounter());
printf("press any character to feed dog feed, must be in windows time\r\n");
static uint32_t i;
uint16_t ch;
while(1)
{
if(UART_ReadByte(HW_UART0, &ch) == 0)
{
printf("wdog feed succ!\r\n");
WDOG_Refresh(); //喂狗
i = 0;
}
printf("cnt:i:%d\r", i++);
DelayMs(100);
GPIO_ToggleBit(HW_GPIOE, 6);
}
}
示例15: main
int main(void)
{
//使用USB 必須CoreClock = 96M
uint8_t FnKey = 0;
uint8_t Keybuf[6] = {0,0,0,0,0,0};
SystemClockSetup(ClockSource_EX50M,CoreClock_96M);
DelayInit();
LED_Init(LED_PinLookup_CHK60EVB, kNumOfLED);
KBI_Init(KBI_PinLookup_CHK60EVB, kNumOfKEY);
UART_DebugPortInit(UART4_RX_C14_TX_C15, 115200);
DisplayCPUInfo();
UART_printf("Waitting for USB connect ...\r\n");
USB_Init(); //初始化USB設備
USB_WaitDeviceEnumed(); //等待USB枚舉成功
UART_printf("USB connected!\r\n");
while(1)
{
KBI_Scan();
if(KBI_GetKeyState(kKEY1) == kKBI_SINGLE)
{
Keybuf[0] = 4; //A 的USBHIDKeyCode
USB_HID_SetKeyBoard(FnKey,Keybuf);
}
if(KBI_GetKeyState(kKEY2) == kKBI_SINGLE)
{
Keybuf[0] = 5; //A 的USBHIDKeyCode
USB_HID_SetKeyBoard(FnKey,Keybuf);
}
HID_Proc(); //執行HID進程
DelayMs(KBI_SCAN_PERIOD_IN_US/1000); //延時
}
}