亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.c

?? 最新版FreeRTOS, 包擴多種開發平臺的移植
?? C
字號:
/*
	FreeRTOS.org V4.1.1 - Copyright (C) 2003-2006 Richard Barry.

	This file is part of the FreeRTOS.org distribution.

	FreeRTOS.org is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	FreeRTOS.org is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with FreeRTOS.org; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	A special exception to the GPL can be applied should you wish to distribute
	a combined work that includes FreeRTOS.org, without being obliged to provide
	the source code for any proprietary components.  See the licensing section 
	of http://www.FreeRTOS.org for full details of how and when the exception
	can be applied.

	***************************************************************************
	See http://www.FreeRTOS.org for documentation, latest information, license 
	and contact details.  Please ensure to read the configuration and relevant 
	port sections of the online documentation.
	***************************************************************************
*/


/*
 * This is a mini co-routine demo for the Rowley CrossFire LM3S102 development
 * board.  It makes use of the boards tri-colour LED and analogue input.
 *
 * Four co-routines are created - an 'I2C' co-routine and three 'flash'
 * co-routines.
 *
 * The I2C co-routine triggers an ADC conversion then blocks on a queue to 
 * wait for the conversion result - which it receives on the queue directly
 * from the I2C interrupt service routine.  The conversion result is then
 * scalled to a delay period.  The I2C interrupt then wakes each of the 
 * flash co-routines before itself delaying for the calculated period and
 * then repeating the whole process.
 *
 * When woken by the I2C co-routine the flash co-routines each block for 
 * a given period, illuminate an LED for a fixed period, then go back to
 * sleep to wait for the next cycle.  The uxIndex parameter of the flash
 * co-routines is used to ensure that each flashes a different LED, and that
 * the delay periods are such that the LED's get flashed in sequence.
 */


/* Scheduler include files. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "croutine.h"

/* Demo application include files. */
#include "partest.h"

/* Library include files. */
#include "DriverLib.h"

/* States of the I2C master interface. */
#define mainI2C_IDLE       0
#define mainI2C_READ_1     1
#define mainI2C_READ_2     2
#define mainI2C_READ_DONE  3

#define mainZERO_LENGTH 0

/* Address of the A2D IC on the CrossFire board. */
#define mainI2CAddress	0x4D

/* The queue used to send data from the I2C ISR to the co-routine should never
contain more than one item as the same co-routine is used to trigger the I2C
activity. */
#define mainQUEUE_LENGTH 1

/* The CrossFire board contains a tri-colour LED. */
#define mainNUM_LEDs	3

/* The I2C co-routine has a higher priority than the flash co-routines.  This
is not really necessary as when the I2C co-routine is active the other 
co-routines are delaying. */
#define mainI2c_CO_ROUTINE_PRIORITY 1


/* The current state of the I2C master. */
static volatile unsigned portBASE_TYPE uxState = mainI2C_IDLE;

/* The delay period derived from the A2D value. */
static volatile portBASE_TYPE uxDelay = 250;

/* The queue used to communicate between the I2C interrupt and the I2C 
co-routine. */
static xQueueHandle xADCQueue;

/* The queue used to synchronise the flash co-routines. */
static xQueueHandle xDelayQueue;

/*
 * Sets up the PLL, I2C and GPIO used by the demo.
 */
static void prvSetupHardware( void );

/* The co-routines as described at the top of the file. */
static void vI2CCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );
static void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex );

/*-----------------------------------------------------------*/

int main( void )
{
unsigned portBASE_TYPE uxCoRoutine;

	/* Setup all the hardware used by this demo. */
	prvSetupHardware();

	/* Create the queue used to communicate between the ISR and I2C co-routine.
	This can only ever contain one value. */
	xADCQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( portTickType ) );

	/* Create the queue used to synchronise the flash co-routines.  The queue
	is used to trigger three tasks, but is for synchronisation only and does
	not pass any data.  It therefore has three position each of zero length. */
	xDelayQueue = xQueueCreate( mainNUM_LEDs, mainZERO_LENGTH );

	/* Create the co-routine that initiates the i2c. */
	xCoRoutineCreate( vI2CCoRoutine, mainI2c_CO_ROUTINE_PRIORITY, 0 );

	/* Create the flash co-routines. */
	for( uxCoRoutine = 0; uxCoRoutine < mainNUM_LEDs; uxCoRoutine++ )
	{
		xCoRoutineCreate( vFlashCoRoutine, tskIDLE_PRIORITY, uxCoRoutine );        
	}

	/* Start the scheduler.  From this point on the co-routines should 
	execute. */
	vTaskStartScheduler();

	/* Should not get here unless we did not have enough memory to start the
	scheduler. */
	for( ;; );
	return 0;
}
/*-----------------------------------------------------------*/

static void prvSetupHardware( void )
{
	/* Setup the PLL. */
	SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ );

	/* Enable the I2C used to read the pot. */
	SysCtlPeripheralEnable( SYSCTL_PERIPH_I2C );
	SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOB );
	GPIOPinTypeI2C( GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3 );

	/* Initialize the I2C master. */
	I2CMasterInit( I2C_MASTER_BASE, pdFALSE );
	
	/* Enable the I2C master interrupt. */
	I2CMasterIntEnable( I2C_MASTER_BASE );
    IntEnable( INT_I2C );

	/* Initialise the hardware used to talk to the LED's. */
	vParTestInitialise();
}
/*-----------------------------------------------------------*/

static void vI2CCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
{
portTickType xADCResult;
static portBASE_TYPE xResult = 0, xMilliSecs, xLED;

	crSTART( xHandle );

	for( ;; )
	{
		/* Start the I2C off to read the ADC. */
		uxState = mainI2C_READ_1;
		I2CMasterSlaveAddrSet( I2C_MASTER_BASE, mainI2CAddress, pdTRUE );		
		I2CMasterControl( I2C_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START );

		/* Wait to receive the conversion result. */
		crQUEUE_RECEIVE( xHandle, xADCQueue, &xADCResult, portMAX_DELAY, &xResult );

		/* Scale the result to give a useful range of values for a visual 
		demo. */
		xADCResult >>= 2;
		xMilliSecs = xADCResult / portTICK_RATE_MS;

		/* The delay is split between the four co-routines so they remain in
		synch. */
		uxDelay = xMilliSecs / ( mainNUM_LEDs + 1 );

		/* Trigger each of the flash co-routines. */
		for( xLED = 0; xLED < mainNUM_LEDs; xLED++ )
		{
			crQUEUE_SEND( xHandle, xDelayQueue, &xLED, 0, &xResult );
		}

		/* Wait for the full delay time then start again.  This delay is long 
		enough to ensure the flash co-routines have done their thing and gone
		back to sleep. */
		crDELAY( xHandle, xMilliSecs );
	}

	crEND();
}
/*-----------------------------------------------------------*/

static void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
{
portBASE_TYPE xResult, xNothing;

	crSTART( xHandle );

	for( ;; )
	{
		/* Wait for start of next round. */
		crQUEUE_RECEIVE( xHandle, xDelayQueue, &xNothing, portMAX_DELAY, &xResult );

		/* Wait until it is this co-routines turn to flash. */
		crDELAY( xHandle, uxDelay * uxIndex );

		/* Turn on the LED for a fixed period. */
		vParTestSetLED( uxIndex, pdTRUE );
		crDELAY( xHandle, uxDelay );
		vParTestSetLED( uxIndex, pdFALSE );

		/* Go back and wait for the next round. */
	}

	crEND();
}
/*-----------------------------------------------------------*/

void vI2C_ISR(void)
{
static portTickType xReading;

	/* Clear the interrupt. */
	I2CMasterIntClear( I2C_MASTER_BASE );

	/* Determine what to do based on the current uxState. */
	switch (uxState)
	{
		case mainI2C_IDLE:		break;
	
		case mainI2C_READ_1:	/* Read ADC result high byte. */
								xReading = I2CMasterDataGet( I2C_MASTER_BASE );
								xReading <<= 8;
		
								/* Continue the burst read. */
								I2CMasterControl( I2C_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT );
								uxState = mainI2C_READ_2;
								break;
	
		case mainI2C_READ_2:	/* Read ADC result low byte. */
								xReading |= I2CMasterDataGet( I2C_MASTER_BASE );								
			
								/* Finish the burst read. */
								I2CMasterControl( I2C_MASTER_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH );
								uxState = mainI2C_READ_DONE;
								break;
			
		case mainI2C_READ_DONE:	/* Complete. */
								I2CMasterDataGet( I2C_MASTER_BASE );
								uxState = mainI2C_IDLE;

								/* Send the result to the co-routine. */
                                crQUEUE_SEND_FROM_ISR( xADCQueue, &xReading, pdFALSE );
								break;
	}
}
/*-----------------------------------------------------------*/

void vApplicationIdleHook( void )
{
	for( ;; )
	{
		vCoRoutineSchedule();
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久电影| 精品国产第一区二区三区观看体验| 精品久久久影院| 亚洲黄色尤物视频| 国产精品18久久久久| 欧美三级日韩三级| 中文字幕亚洲欧美在线不卡| 欧美aaa在线| 欧美挠脚心视频网站| 亚洲欧洲成人精品av97| 精品一区二区三区香蕉蜜桃 | 黄页网站大全一区二区| 欧美亚洲国产一区在线观看网站| 日本一区二区成人| 国产乱码精品一区二区三区忘忧草 | 中文字幕第一区| 激情综合网最新| 欧美一级日韩不卡播放免费| 亚洲嫩草精品久久| 99综合电影在线视频| 国产午夜精品在线观看| 九色综合狠狠综合久久| 在线成人av影院| 亚洲.国产.中文慕字在线| 91色在线porny| 国产精品久久99| 粉嫩aⅴ一区二区三区四区五区| 精品国精品国产| 老司机一区二区| 欧美一级欧美一级在线播放| 亚洲第一久久影院| 欧美日韩在线播放三区四区| 一区二区三区在线不卡| 91蜜桃婷婷狠狠久久综合9色| 国产精品欧美一区喷水| 成人免费观看男女羞羞视频| 国产欧美一区视频| 国产精品中文有码| 国产婷婷色一区二区三区在线| 久久99日本精品| 精品国产乱码久久久久久闺蜜| 久久狠狠亚洲综合| 日韩精品一区二区三区四区视频| 裸体一区二区三区| 精品999在线播放| 国产精品一二三| 国产欧美日本一区视频| 成人午夜在线视频| 亚洲视频一二三| 欧美性猛片xxxx免费看久爱| 亚洲国产精品久久不卡毛片| 精品视频全国免费看| 丝袜美腿成人在线| 欧美成人精精品一区二区频| 国产一区二区三区在线看麻豆| 国产日韩欧美麻豆| 97久久精品人人爽人人爽蜜臀| 亚洲欧美另类小说视频| 色综合久久中文字幕| 亚洲福中文字幕伊人影院| 91精品一区二区三区久久久久久| 看电视剧不卡顿的网站| 久久免费视频色| 99国产一区二区三精品乱码| 亚洲午夜影视影院在线观看| 欧美精品电影在线播放| 久草精品在线观看| 亚洲欧洲色图综合| 欧美日韩一级大片网址| 精品一区二区三区在线视频| 国产精品久久久久影院亚瑟| 色综合一个色综合亚洲| 婷婷丁香久久五月婷婷| 337p粉嫩大胆色噜噜噜噜亚洲| 岛国精品在线播放| 夜夜揉揉日日人人青青一国产精品 | 同产精品九九九| 精品美女被调教视频大全网站| 成人影视亚洲图片在线| 一二三四社区欧美黄| 欧美大黄免费观看| 99麻豆久久久国产精品免费优播| 亚洲午夜精品在线| 日韩美一区二区三区| 成年人国产精品| 日韩精品亚洲专区| 中文字幕乱码日本亚洲一区二区| 欧美三区免费完整视频在线观看| 久久99在线观看| 亚洲三级久久久| 日韩一级二级三级| 99久久99久久精品国产片果冻| 视频在线观看国产精品| 欧美激情艳妇裸体舞| 欧美精选午夜久久久乱码6080| 国产精品一区专区| 亚洲大片在线观看| 国产精品你懂的| 日韩精品中文字幕一区二区三区| 99久久伊人久久99| 久久爱www久久做| 一区二区免费视频| 国产精品午夜在线观看| 欧美电影在哪看比较好| 白白色亚洲国产精品| 免费欧美在线视频| 一区2区3区在线看| 国产欧美视频一区二区三区| 欧美在线视频日韩| 成人午夜免费视频| 久久国产夜色精品鲁鲁99| 一区二区三区在线观看视频| 国产亚洲va综合人人澡精品| 91精品国产高清一区二区三区蜜臀 | 亚洲精品亚洲人成人网| 久久品道一品道久久精品| 欧美群妇大交群中文字幕| 91在线免费看| 国产成人啪免费观看软件| 日本一区中文字幕| 亚洲主播在线播放| 国产精品美女一区二区三区| 精品入口麻豆88视频| 欧美日韩在线不卡| 日本道精品一区二区三区| 国产成人夜色高潮福利影视| 免费日本视频一区| 天天亚洲美女在线视频| 亚洲精品乱码久久久久| 国产精品欧美极品| 久久精品在线观看| 欧美精品一区二区久久久| 91精品国产综合久久香蕉麻豆| 色94色欧美sute亚洲线路一ni | 成人性生交大片免费看中文 | 亚洲嫩草精品久久| 国产精品久久免费看| 久久久www成人免费毛片麻豆| 日韩视频免费观看高清完整版在线观看| 欧美伊人久久久久久久久影院| 一本一道综合狠狠老| 成年人网站91| 不卡的av网站| jizz一区二区| 成人av网址在线观看| 成人小视频在线| 成人国产电影网| 成人av电影在线播放| 国产·精品毛片| 风间由美一区二区三区在线观看| 国产一区二区不卡在线| 国产精品888| 大胆欧美人体老妇| 成人性视频免费网站| 成人av免费网站| 97精品久久久午夜一区二区三区| 波多野结衣91| 91亚洲精品久久久蜜桃| 91美女蜜桃在线| 在线国产电影不卡| 欧洲精品在线观看| 欧美日韩激情在线| 91精品国产综合久久香蕉的特点 | 日韩久久免费av| 精品电影一区二区三区| 精品久久久久久久久久久院品网 | 欧美一区日韩一区| 日韩欧美一级在线播放| 日韩欧美亚洲另类制服综合在线| 日韩精品中文字幕在线一区| 久久综合色综合88| 国产精品情趣视频| 一区二区三区国产| 日韩中文字幕亚洲一区二区va在线 | 中文字幕av一区 二区| 国产精品乱码久久久久久 | 欧美大片一区二区| 国产欧美日韩综合精品一区二区| 国产精品美女久久久久久久| 亚洲婷婷国产精品电影人久久| 亚洲黄色录像片| 日本不卡一区二区三区高清视频| 九色porny丨国产精品| 国产成人精品在线看| 99精品偷自拍| 717成人午夜免费福利电影| 欧美精品一区二区三区久久久| 国产精品免费看片| 亚洲成人资源网| 国模一区二区三区白浆| 成人白浆超碰人人人人| 欧美日韩一区二区三区四区| 日韩一区二区在线观看| 欧美激情一区二区| 亚洲国产日韩a在线播放性色| 麻豆精品在线看| av网站一区二区三区| 在线播放欧美女士性生活| 久久理论电影网| 亚洲一区二区在线观看视频|