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

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

?? main.c

?? MCS-51的一個Free小型操作系統,在KeilC中下編譯工作
?? C
字號:
/*
	FreeRTOS.org V4.1.3 - 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一区二区三区免费野_久草精品视频
ww久久中文字幕| 在线亚洲+欧美+日本专区| 色综合久久综合网欧美综合网| 在线这里只有精品| 日韩视频国产视频| 中文字幕 久热精品 视频在线| 一区二区不卡在线播放| 老司机一区二区| 99国产欧美另类久久久精品| 91精品国产综合久久福利 | 日韩成人伦理电影在线观看| 精品一区二区久久| 99精品视频在线免费观看| 777奇米成人网| 国产精品三级久久久久三级| 午夜电影一区二区三区| 高清免费成人av| 欧美日韩免费在线视频| 久久精品一区二区三区四区| 一区二区三区蜜桃网| 久久国产乱子精品免费女| 91免费小视频| 久久久久久久久久久久久夜| 亚洲国产综合视频在线观看| 国产精品996| 3atv一区二区三区| 亚洲人成伊人成综合网小说| 狠狠网亚洲精品| 欧洲一区在线电影| 国产日韩v精品一区二区| 日韩影院精彩在线| 91在线小视频| 2024国产精品| 日韩 欧美一区二区三区| 色婷婷综合久久久| 久久久精品2019中文字幕之3| 天使萌一区二区三区免费观看| av一区二区久久| xfplay精品久久| 舔着乳尖日韩一区| 色狠狠色狠狠综合| 国产精品你懂的在线| 精品在线亚洲视频| 欧美一区二区三区在线观看 | 99久久精品国产一区| 2023国产精品视频| 美女网站在线免费欧美精品| 91福利视频网站| 亚洲私人影院在线观看| 国产精品1区二区.| 精品欧美一区二区在线观看| 五月天一区二区三区| 一本久道久久综合中文字幕 | 欧美日韩一本到| 亚洲男人天堂av| av中文字幕一区| 国产精品国产三级国产aⅴ入口 | 国产喂奶挤奶一区二区三区| 琪琪久久久久日韩精品| 欧美日韩一卡二卡三卡| 一区二区在线观看av| 99久久综合99久久综合网站| 欧美国产激情二区三区| 国产白丝精品91爽爽久久| 久久影院午夜片一区| 国产一区欧美一区| 欧美精品一区二区在线播放| 另类小说综合欧美亚洲| 欧美大白屁股肥臀xxxxxx| 日韩精品亚洲专区| 3atv一区二区三区| 免费国产亚洲视频| 日韩小视频在线观看专区| 蜜桃av一区二区在线观看| 欧美xxxxxxxxx| 精品午夜久久福利影院| 久久女同精品一区二区| 国产福利一区二区三区视频在线 | 黄网站免费久久| 久久蜜桃av一区精品变态类天堂| 九九国产精品视频| 久久精品男人的天堂| 福利一区在线观看| 国产精品拍天天在线| 91亚洲男人天堂| 亚洲午夜一区二区| 6080午夜不卡| 国产一区中文字幕| 国产精品入口麻豆九色| av成人免费在线观看| 一区二区三区视频在线看| 欧美日韩三级在线| 免费在线观看精品| 国产日韩欧美综合在线| 91小宝寻花一区二区三区| 亚洲一区二区三区中文字幕| 欧美丝袜丝交足nylons图片| 奇米一区二区三区av| 久久免费看少妇高潮| 97国产精品videossex| 香蕉成人啪国产精品视频综合网 | 狠狠色丁香婷综合久久| 国产婷婷色一区二区三区在线| 99久久精品免费观看| 亚洲成av人影院在线观看网| 日韩精品中文字幕一区| 成人午夜激情影院| 亚洲综合图片区| 欧美一区二区在线观看| 国产aⅴ精品一区二区三区色成熟| 亚洲精品伦理在线| 日韩欧美成人午夜| 成人午夜精品在线| 日韩中文字幕区一区有砖一区 | 久久精品国产一区二区| 国产亚洲精品中文字幕| 在线精品视频一区二区三四 | 久久精品视频在线看| 97久久精品人人做人人爽50路| 视频一区视频二区中文字幕| 久久久久久97三级| 欧美亚洲丝袜传媒另类| 国内精品自线一区二区三区视频| 亚洲男同性视频| 精品久久久久久无| 91色在线porny| 久久99久久99| 一区二区三区在线观看视频| 欧美精品一区二区在线观看| 在线观看成人小视频| 国产精品18久久久久久久久 | 日韩一区国产二区欧美三区| 99久久婷婷国产精品综合| 麻豆精品一区二区三区| 亚洲精品成人在线| 成人av电影免费观看| 免费精品视频最新在线| 亚洲欧美日韩系列| 欧美精品一区二区在线观看| 欧美日精品一区视频| 成人网在线播放| 久久精品国产精品亚洲综合| 亚洲一区二区在线播放相泽| 国产视频一区二区在线观看| 欧美一区二区三区四区久久| 色88888久久久久久影院按摩| 国产精一区二区三区| 日本不卡视频一二三区| 亚洲免费高清视频在线| 国产日韩综合av| 日韩一级高清毛片| 在线观看视频一区二区欧美日韩| 国产成人精品1024| 久久国产精品第一页| 亚洲成人av在线电影| 亚洲欧美在线视频观看| 日本一二三不卡| 久久久夜色精品亚洲| 精品日韩成人av| 日韩三级在线免费观看| 欧美日韩一级二级三级| 色老头久久综合| av电影在线观看不卡| 高清视频一区二区| 国产一区二区免费在线| 日欧美一区二区| 丝袜国产日韩另类美女| 亚洲小少妇裸体bbw| 一区二区三区高清| 亚洲摸摸操操av| 亚洲蜜臀av乱码久久精品| 亚洲欧美综合色| 亚洲欧洲韩国日本视频| 亚洲欧洲精品一区二区三区 | 成人污视频在线观看| 国产成人免费av在线| 国内精品免费**视频| 久久91精品国产91久久小草| 捆绑调教美女网站视频一区| 美洲天堂一区二卡三卡四卡视频| 日本欧美一区二区三区乱码| 日本在线不卡视频| 蜜臀av在线播放一区二区三区| 日本怡春院一区二区| 蜜桃久久久久久| 精品一区二区三区视频| 久久成人免费网| 国产呦萝稀缺另类资源| 国产99久久久国产精品免费看| 国产91精品免费| 99久久精品费精品国产一区二区| 91美女视频网站| 欧美性欧美巨大黑白大战| 欧美精品在线一区二区三区| 666欧美在线视频| 精品久久久久一区二区国产| 久久久久久久久久看片| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 美女视频黄 久久| 三级在线观看一区二区|