mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Continued development on STM32L152 demo.
This commit is contained in:
parent
7243d65797
commit
9c507b93d7
|
@ -72,7 +72,7 @@
|
|||
#define configCPU_CLOCK_HZ ( 32000000UL )
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 10 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
|
@ -80,6 +80,7 @@
|
|||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configQUEUE_REGISTRY_SIZE 1
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
|
@ -100,25 +101,34 @@ to exclude the API function. */
|
|||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 4 /* 32 priority levels */
|
||||
#define configPRIO_BITS 4 /* 15 priority levels */
|
||||
#endif
|
||||
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
|
||||
//#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 15
|
||||
|
||||
/* The lowest priority. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( 15 << (8 - configPRIO_BITS) )
|
||||
//#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
/* Priority 5, or 160 as only the top three bits are implemented. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( 5 << (8 - configPRIO_BITS) )
|
||||
//#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* The lowest priority. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 255
|
||||
/* Priority 5, or 160 as only the top three bits are implemented. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 255
|
||||
|
||||
|
||||
/* Prevent the following definitions being included when FreeRTOSConfig.h
|
||||
is included from an asm file. */
|
||||
#ifdef __ICCARM__
|
||||
#include "stm32l1xx_tim.h"
|
||||
extern void vConfigureTimerForRunTimeStats( void );
|
||||
unsigned long ulGetRunTimeStatsCounterValue( void );
|
||||
extern unsigned long ulTIM6_OverflowCount;
|
||||
#endif /* __ICCARM__ */
|
||||
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeStatsCounterValue()
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ( ( ulTIM6_OverflowCount << 16UL ) | ( unsigned long ) TIM6->CNT )
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
|
|
@ -1753,6 +1753,9 @@
|
|||
</group>
|
||||
<group>
|
||||
<name>Standard_Demo_Code</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Common\Minimal\comtest.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>
|
||||
</file>
|
||||
|
@ -1791,6 +1794,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_usart.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\system_and_ST_code\startup_stm32l1xx_md.s</name>
|
||||
|
@ -1808,6 +1814,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\ParTest.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\serial.c</name>
|
||||
</file>
|
||||
</project>
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "partest.h"
|
||||
#include "flash.h"
|
||||
#include "dynamic.h"
|
||||
#include "comtest2.h"
|
||||
|
||||
/* ST driver includes. */
|
||||
#include "stm32l1xx_usart.h"
|
||||
|
@ -73,6 +74,7 @@
|
|||
|
||||
#define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainLCD_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
|
||||
#define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
|
||||
#define mainLCD_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2 )
|
||||
|
||||
|
@ -85,6 +87,14 @@
|
|||
#define mainMESSAGE_BUTTON_SEL ( 5 )
|
||||
#define mainMESSAGE_STATUS ( 6 )
|
||||
|
||||
/* Baud rate used by the comtest tasks. */
|
||||
#define mainCOM_TEST_BAUD_RATE ( 9600 )
|
||||
|
||||
/* The LED used by the comtest tasks. See the comtest.c file for more
|
||||
information. */
|
||||
#define mainCOM_TEST_LED ( 3 )
|
||||
|
||||
|
||||
/*
|
||||
* System configuration is performed prior to main() being called, this function
|
||||
* configures the peripherals used by the demo application.
|
||||
|
@ -118,6 +128,7 @@ void main( void )
|
|||
xTaskCreate( vTempTask, ( signed char * ) "Temp", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||
vStartDynamicPriorityTasks();
|
||||
vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
|
||||
vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
|
||||
|
||||
vTaskStartScheduler();
|
||||
}
|
||||
|
@ -125,7 +136,7 @@ void main( void )
|
|||
for( ;; );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
unsigned long ulTempArray[ 10 ], ulx = 0;
|
||||
|
||||
static void prvLCDTask( void *pvParameters )
|
||||
{
|
||||
xQueueMessage xReceivedMessage;
|
||||
|
@ -133,6 +144,12 @@ long lLine = Line1;
|
|||
const long lFontHeight = (((sFONT *)LCD_GetFont())->Height);
|
||||
static char cBuffer[ 256 ];
|
||||
|
||||
/* This function is the only function that uses printf(). If printf() is
|
||||
used from any other function then some sort of mutual exclusion on stdout
|
||||
will be necessary. */
|
||||
|
||||
printf( "%d bytes of heap space remain unallocated\n", xPortGetFreeHeapSize() );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );
|
||||
|
@ -153,7 +170,7 @@ static char cBuffer[ 256 ];
|
|||
break;
|
||||
case mainMESSAGE_BUTTON_RIGHT : sprintf( cBuffer, "Button right = %d", xReceivedMessage.lMessageValue );
|
||||
break;
|
||||
case mainMESSAGE_BUTTON_SEL : printf( "\nTask\t Abs Time\t %%Time\n*****************************************\n" );
|
||||
case mainMESSAGE_BUTTON_SEL : printf( "\nTask\t Abs Time\t %%Time\n*****************************************" );
|
||||
vTaskGetRunTimeStats( ( signed char * ) cBuffer );
|
||||
printf( cBuffer );
|
||||
|
||||
|
@ -199,6 +216,11 @@ long lHigherPriorityTaskWoken = pdFALSE; /* Not used in this case as this is the
|
|||
xStatusMessage.lMessageValue = pdFAIL;
|
||||
}
|
||||
|
||||
if( xAreComTestTasksStillRunning() != pdPASS )
|
||||
{
|
||||
xStatusMessage.lMessageValue = pdFAIL;
|
||||
}
|
||||
|
||||
xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken );
|
||||
ulCounter = 0;
|
||||
}
|
||||
|
@ -228,6 +250,8 @@ xQueueMessage xMessage;
|
|||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
|
||||
|
||||
/* Initialise the LEDs. */
|
||||
vParTestInitialise();
|
||||
|
||||
|
@ -245,19 +269,6 @@ static void prvSetupHardware( void )
|
|||
configMAX_SYSCALL_INTERRUPT_PRIORITY() value set in FreeRTOSConfig.h. */
|
||||
STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );
|
||||
|
||||
#if 0
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
|
||||
USART_InitStructure.USART_BaudRate = 115200;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
STM_EVAL_COMInit( COM1, &USART_InitStructure );
|
||||
#endif
|
||||
|
||||
/* Initialize the LCD */
|
||||
STM32L152_LCD_Init();
|
||||
|
||||
|
@ -287,14 +298,13 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
|||
|
||||
/* Only interrupt on overflow events. */
|
||||
TIM6->CR1 |= TIM_CR1_URS;
|
||||
//TIM6->CR1 &= (uint16_t)~((uint16_t)TIM_CR1_URS);
|
||||
|
||||
TIM_ITConfig( TIM6, TIM_IT_Update, ENABLE );
|
||||
|
||||
/* Enable the TIM6 gloabal Interrupt */
|
||||
NVIC_InitStructure.NVIC_IRQChannel = TIM6_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0f;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0f;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_LOWEST_INTERRUPT_PRIORITY;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; /* Not used as 4 bits are used for the pre-emption priority. */
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
|
||||
TIM_ClearITPendingBit( TIM6, TIM_IT_Update );
|
||||
|
@ -303,18 +313,6 @@ NVIC_InitTypeDef NVIC_InitStructure;
|
|||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
unsigned long ulGetRunTimeStatsCounterValue( void )
|
||||
{
|
||||
unsigned long ulReturn;
|
||||
|
||||
TIM6->CR1 &= (uint16_t)(~((uint16_t)TIM_CR1_CEN));
|
||||
ulReturn = ( ( ulTIM6_OverflowCount << 16UL ) | ( unsigned long ) TIM6->CNT );
|
||||
TIM6->CR1 |= TIM_CR1_CEN;
|
||||
|
||||
return ulReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void TIM6_IRQHandler( void )
|
||||
{
|
||||
if( TIM_GetITStatus( TIM6, TIM_IT_Update) != RESET)
|
||||
|
@ -323,5 +321,15 @@ void TIM6_IRQHandler( void )
|
|||
TIM_ClearITPendingBit( TIM6, TIM_IT_Update );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
for( ;; );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
230
Demo/Cortex_STM32L152_IAR/serial.c
Normal file
230
Demo/Cortex_STM32L152_IAR/serial.c
Normal file
|
@ -0,0 +1,230 @@
|
|||
/*
|
||||
FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* If you are: *
|
||||
* *
|
||||
* + New to FreeRTOS, *
|
||||
* + Wanting to learn FreeRTOS or multitasking in general quickly *
|
||||
* + Looking for basic training, *
|
||||
* + Wanting to improve your FreeRTOS skills and productivity *
|
||||
* *
|
||||
* then take a look at the FreeRTOS books - available as PDF or paperback *
|
||||
* *
|
||||
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* A pdf reference manual is also available. Both are usually delivered *
|
||||
* to your inbox within 20 minutes to two hours when purchased between 8am *
|
||||
* and 8pm GMT (although please allow up to 24 hours in case of *
|
||||
* exceptional circumstances). Thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
***NOTE*** The exception to the GPL is included to allow you to distribute
|
||||
a combined work that includes FreeRTOS without being obliged to provide the
|
||||
source code for proprietary components outside of the FreeRTOS kernel.
|
||||
FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
||||
contact details.
|
||||
|
||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
||||
critical systems.
|
||||
|
||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
||||
licensing and training services.
|
||||
*/
|
||||
|
||||
/*
|
||||
BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER FOR UART0.
|
||||
*/
|
||||
|
||||
/* Scheduler includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
#include "comtest2.h"
|
||||
|
||||
/* Library includes. */
|
||||
#include "stm32l152_eval.h"
|
||||
|
||||
/* Demo application includes. */
|
||||
#include "serial.h"
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Misc defines. */
|
||||
#define serINVALID_QUEUE ( ( xQueueHandle ) 0 )
|
||||
#define serNO_BLOCK ( ( portTickType ) 0 )
|
||||
#define serTX_BLOCK_TIME ( 40 / portTICK_RATE_MS )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The queue used to hold received characters. */
|
||||
static xQueueHandle xRxedChars;
|
||||
static xQueueHandle xCharsForTx;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* See the serial2.h header file.
|
||||
*/
|
||||
xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
|
||||
{
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
xComPortHandle xReturn;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
|
||||
/* Create the queues used to hold Rx/Tx characters. */
|
||||
xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
||||
xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
|
||||
|
||||
/* If the queue/semaphore was created correctly then setup the serial port
|
||||
hardware. */
|
||||
if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) )
|
||||
{
|
||||
USART_InitStructure.USART_BaudRate = ulWantedBaud;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
/* The Eval board COM2 is being used, which in reality is the STM32
|
||||
USART3. */
|
||||
STM_EVAL_COMInit( COM2, &USART_InitStructure );
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; /* Not used as 4 bits are used for the pre-emption priority. */;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init( &NVIC_InitStructure );
|
||||
USART_ITConfig( USART3, USART_IT_RXNE, ENABLE );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = ( xComPortHandle ) 0;
|
||||
}
|
||||
|
||||
/* This demo file only supports a single port but we have to return
|
||||
something to comply with the standard demo header file. */
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE xSerialGetChar( xComPortHandle pxPort, signed portCHAR *pcRxedChar, portTickType xBlockTime )
|
||||
{
|
||||
/* The port handle is not required as this driver only supports one port. */
|
||||
( void ) pxPort;
|
||||
|
||||
/* Get the next character from the buffer. Return false if no characters
|
||||
are available, or arrive before xBlockTime expires. */
|
||||
if( xQueueReceive( xRxedChars, pcRxedChar, xBlockTime ) )
|
||||
{
|
||||
return pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return pdFALSE;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vSerialPutString( xComPortHandle pxPort, const signed portCHAR * const pcString, unsigned portSHORT usStringLength )
|
||||
{
|
||||
signed portCHAR *pxNext;
|
||||
|
||||
/* A couple of parameters that this port does not use. */
|
||||
( void ) usStringLength;
|
||||
( void ) pxPort;
|
||||
|
||||
/* NOTE: This implementation does not handle the queue being full as no
|
||||
block time is used! */
|
||||
|
||||
/* The port handle is not required as this driver only supports UART1. */
|
||||
( void ) pxPort;
|
||||
|
||||
/* Send each character in the string, one at a time. */
|
||||
pxNext = ( signed portCHAR * ) pcString;
|
||||
while( *pxNext )
|
||||
{
|
||||
xSerialPutChar( pxPort, *pxNext, serNO_BLOCK );
|
||||
pxNext++;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
signed portBASE_TYPE xSerialPutChar( xComPortHandle pxPort, signed portCHAR cOutChar, portTickType xBlockTime )
|
||||
{
|
||||
signed portBASE_TYPE xReturn;
|
||||
|
||||
if( xQueueSend( xCharsForTx, &cOutChar, xBlockTime ) == pdPASS )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
USART_ITConfig( USART3, USART_IT_TXE, ENABLE );
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFAIL;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vSerialClose( xComPortHandle xPort )
|
||||
{
|
||||
/* Not supported as not required by the demo application. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void USART3_IRQHandler( void )
|
||||
{
|
||||
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||
portCHAR cChar;
|
||||
|
||||
if( USART_GetITStatus( USART3, USART_IT_TXE ) == SET )
|
||||
{
|
||||
/* The interrupt was caused by the THR becoming empty. Are there any
|
||||
more characters to transmit? */
|
||||
if( xQueueReceiveFromISR( xCharsForTx, &cChar, &xHigherPriorityTaskWoken ) == pdTRUE )
|
||||
{
|
||||
/* A character was retrieved from the queue so can be sent to the
|
||||
THR now. */
|
||||
USART_SendData( USART3, cChar );
|
||||
}
|
||||
else
|
||||
{
|
||||
USART_ITConfig( USART3, USART_IT_TXE, DISABLE );
|
||||
}
|
||||
}
|
||||
|
||||
if( USART_GetITStatus( USART3, USART_IT_RXNE ) == SET )
|
||||
{
|
||||
cChar = USART_ReceiveData( USART3 );
|
||||
xQueueSendFromISR( xRxedChars, &cChar, &xHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
|
||||
<Column0>295</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
|
||||
<Column0>279</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>
|
||||
</Workspace>
|
||||
<Disassembly>
|
||||
<PreferedWindows>
|
||||
|
@ -32,11 +32,11 @@
|
|||
<CodeCovShow>1</CodeCovShow>
|
||||
<InstrProfShow>1</InstrProfShow>
|
||||
</Disassembly>
|
||||
<Watch><Format><struct_types/><watch_formats/></Format><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>125</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3></Watch><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>208</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3></QuickWatch><TerminalIO><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><InputSource>1</InputSource><InputMode>10</InputMode><Filename>$PROJ_DIR$\TermIOInput.txt</Filename><InputEcho>1</InputEcho><ShowReset>0</ShowReset></TerminalIO><TASKVIEW><Column0>200</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>150</Column6></TASKVIEW><QUEUEVIEW><Column0>300</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6></QUEUEVIEW><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register></Static>
|
||||
<Watch><Format><struct_types/><watch_formats><Fmt><Key>{W}Watch-0:tmppre</Key><Value>1</Value></Fmt></watch_formats></Format><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>151</Column0><Column1>148</Column1><Column2>100</Column2><Column3>100</Column3></Watch><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><Column0>208</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3></QuickWatch><TerminalIO><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><InputSource>1</InputSource><InputMode>10</InputMode><Filename>$PROJ_DIR$\TermIOInput.txt</Filename><InputEcho>1</InputEcho><ShowReset>0</ShowReset></TerminalIO><TASKVIEW><Column0>200</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>150</Column6></TASKVIEW><QUEUEVIEW><Column0>300</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6></QUEUEVIEW><Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><CallStack><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ViewArgs>1</ViewArgs></CallStack></Static>
|
||||
<Windows>
|
||||
|
||||
|
||||
<Wnd6>
|
||||
<Wnd1>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Identity>TabID-15530-21362</Identity>
|
||||
|
@ -44,24 +44,24 @@
|
|||
<Factory>Workspace</Factory>
|
||||
<Session>
|
||||
|
||||
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>
|
||||
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source/Portable</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library/misc.c</ExpandedNode></NodeDict></Session>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<SelectedTab>0</SelectedTab></Wnd6><Wnd7><Tabs><Tab><Identity>TabID-10464-23570</Identity><TabName>Tasks</TabName><Factory>TASKVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd7><Wnd8><Tabs><Tab><Identity>TabID-31438-23586</Identity><TabName>Queues</TabName><Factory>QUEUEVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd8><Wnd9><Tabs><Tab><Identity>TabID-18392-8256</Identity><TabName>Terminal I/O</TabName><Factory>TerminalIO</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd9></Windows>
|
||||
<SelectedTab>0</SelectedTab></Wnd1><Wnd2><Tabs><Tab><Identity>TabID-10464-23570</Identity><TabName>Tasks</TabName><Factory>TASKVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd2><Wnd4><Tabs><Tab><Identity>TabID-31438-23586</Identity><TabName>Queues</TabName><Factory>QUEUEVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd4><Wnd0><Tabs><Tab><Identity>TabID-15541-875</Identity><TabName>Terminal I/O</TabName><Factory>TerminalIO</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd0></Windows>
|
||||
<Editor>
|
||||
|
||||
|
||||
|
||||
|
||||
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>139</YPos><SelStart>6109</SelStart><SelEnd>6109</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>168</YPos><SelStart>7156</SelStart><SelEnd>7156</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\flash.c</Filename><XPos>0</XPos><YPos>131</YPos><SelStart>5825</SelStart><SelEnd>5825</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>105</YPos><SelStart>5546</SelStart><SelEnd>5576</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>1589</YPos><SelStart>50344</SelStart><SelEnd>50344</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</Filename><XPos>0</XPos><YPos>121</YPos><SelStart>4800</SelStart><SelEnd>4800</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\dynamic.c</Filename><XPos>0</XPos><YPos>225</YPos><SelStart>11355</SelStart><SelEnd>11355</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\inc\stm32l1xx_tim.h</Filename><XPos>0</XPos><YPos>583</YPos><SelStart>24547</SelStart><SelEnd>24547</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c</Filename><XPos>0</XPos><YPos>1744</YPos><SelStart>61786</SelStart><SelEnd>61788</SelEnd></Tab><ActiveTab>8</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>305</YPos><SelStart>11633</SelStart><SelEnd>11633</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\serial.c</Filename><XPos>0</XPos><YPos>95</YPos><SelStart>5372</SelStart><SelEnd>5372</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>102</YPos><SelStart>4609</SelStart><SelEnd>4609</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\ParTest.c</Filename><XPos>0</XPos><YPos>47</YPos><SelStart>3862</SelStart><SelEnd>3862</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>86</YPos><SelStart>4824</SelStart><SelEnd>4840</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\list.c</Filename><XPos>40</XPos><YPos>136</YPos><SelStart>7024</SelStart><SelEnd>7024</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>315</YPos><SelStart>11570</SelStart><SelEnd>11570</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>125</YPos><SelStart>6023</SelStart><SelEnd>6023</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\comtest.c</Filename><XPos>0</XPos><YPos>146</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\misc.c</Filename><XPos>0</XPos><YPos>117</YPos><SelStart>4483</SelStart><SelEnd>4483</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\CMSIS\CM3\DeviceSupport\ST\STM32L1xx\stm32l1xx.h</Filename><XPos>0</XPos><YPos>89</YPos><SelStart>4251</SelStart><SelEnd>4251</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Positions>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88><Toolbar-04c87bf8><key>debuggergui.enu1</key></Toolbar-04c87bf8></Sizes></Row0><Row1><Sizes><Toolbar-06a0c250><key>armjlink.enu1</key></Toolbar-06a0c250></Sizes></Row1></Top><Left><Row0><Sizes><Wnd6><Rect><Top>-2</Top><Left>-2</Left><Bottom>600</Bottom><Right>369</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>220833</sizeVertCX><sizeVertCY>613035</sizeVertCY></Rect></Wnd6></Sizes></Row0></Left><Right><Row0><Sizes><Wnd9><Rect><Top>-2</Top><Left>-2</Left><Bottom>600</Bottom><Right>467</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>279167</sizeVertCX><sizeVertCY>613035</sizeVertCY></Rect></Wnd9></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd7><Rect><Top>-2</Top><Left>-2</Left><Bottom>243</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>245</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>249491</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd7></Sizes></Row0><Row1><Sizes><Wnd8><Rect><Top>241</Top><Left>-2</Left><Bottom>314</Bottom><Right>1682</Right><x>-2</x><y>241</y><xscreen>1684</xscreen><yscreen>73</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>74338</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd8></Sizes></Row1></Bottom><Float><Sizes/></Float></Positions>
|
||||
<Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88><Toolbar-0a5af640><key>debuggergui.enu1</key></Toolbar-0a5af640></Sizes></Row0><Row1><Sizes><Toolbar-068cd630><key>armjlink.enu1</key></Toolbar-068cd630></Sizes></Row1></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>682</Bottom><Right>369</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>220833</sizeVertCX><sizeVertCY>696538</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>682</Bottom><Right>435</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>260119</sizeVertCX><sizeVertCY>696538</sizeVertCY></Rect></Wnd0></Sizes></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>161</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>163</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>165988</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd2></Sizes></Row0><Row1><Sizes><Wnd4><Rect><Top>159</Top><Left>-2</Left><Bottom>232</Bottom><Right>1682</Right><x>-2</x><y>159</y><xscreen>1684</xscreen><yscreen>73</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>74338</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd4></Sizes></Row1></Bottom><Float><Sizes/></Float></Positions>
|
||||
</Desktop>
|
||||
</Project>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[DebugChecksum]
|
||||
Checksum=-1294035724
|
||||
Checksum=317489748
|
||||
[DisAssemblyWindow]
|
||||
NumStates=_ 1
|
||||
State 1=_ 1
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log></Static>
|
||||
<Windows>
|
||||
|
||||
<Wnd0>
|
||||
<Wnd2>
|
||||
<Tabs>
|
||||
<Tab>
|
||||
<Identity>TabID-27630-4718</Identity>
|
||||
|
@ -25,24 +25,24 @@
|
|||
<Factory>Workspace</Factory>
|
||||
<Session>
|
||||
|
||||
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/Standard_Demo_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>
|
||||
<NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/Standard_Demo_Code</ExpandedNode></NodeDict></Session>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>
|
||||
<SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>
|
||||
<Editor>
|
||||
|
||||
|
||||
|
||||
|
||||
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>139</YPos><SelStart>6109</SelStart><SelEnd>6109</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>168</YPos><SelStart>7156</SelStart><SelEnd>7156</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\flash.c</Filename><XPos>0</XPos><YPos>131</YPos><SelStart>5825</SelStart><SelEnd>5825</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>105</YPos><SelStart>5546</SelStart><SelEnd>5576</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>1589</YPos><SelStart>50344</SelStart><SelEnd>50344</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</Filename><XPos>0</XPos><YPos>121</YPos><SelStart>4800</SelStart><SelEnd>4800</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\dynamic.c</Filename><XPos>0</XPos><YPos>225</YPos><SelStart>11355</SelStart><SelEnd>11355</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\inc\stm32l1xx_tim.h</Filename><XPos>0</XPos><YPos>583</YPos><SelStart>24547</SelStart><SelEnd>24547</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_tim.c</Filename><XPos>0</XPos><YPos>1744</YPos><SelStart>61786</SelStart><SelEnd>61788</SelEnd></Tab><ActiveTab>8</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>305</YPos><SelStart>11633</SelStart><SelEnd>11633</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\serial.c</Filename><XPos>0</XPos><YPos>95</YPos><SelStart>5372</SelStart><SelEnd>5372</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>102</YPos><SelStart>4609</SelStart><SelEnd>4609</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\ParTest.c</Filename><XPos>0</XPos><YPos>47</YPos><SelStart>3862</SelStart><SelEnd>3862</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>86</YPos><SelStart>4824</SelStart><SelEnd>4840</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\list.c</Filename><XPos>40</XPos><YPos>136</YPos><SelStart>7024</SelStart><SelEnd>7024</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>315</YPos><SelStart>11570</SelStart><SelEnd>11570</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>125</YPos><SelStart>6023</SelStart><SelEnd>6023</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\comtest.c</Filename><XPos>0</XPos><YPos>146</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\misc.c</Filename><XPos>0</XPos><YPos>117</YPos><SelStart>4483</SelStart><SelEnd>4483</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\CMSIS\CM3\DeviceSupport\ST\STM32L1xx\stm32l1xx.h</Filename><XPos>0</XPos><YPos>89</YPos><SelStart>4251</SelStart><SelEnd>4251</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>
|
||||
<Positions>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>438</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>261905</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
|
||||
<Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>438</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>261905</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>
|
||||
</Desktop>
|
||||
</Workspace>
|
||||
|
||||
|
|
|
@ -0,0 +1,399 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l1xx_usart.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0RC1
|
||||
* @date 07/02/2010
|
||||
* @brief This file contains all the functions prototypes for the USART
|
||||
* firmware library.
|
||||
******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32L1xx_USART_H
|
||||
#define __STM32L1xx_USART_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l1xx.h"
|
||||
|
||||
/** @addtogroup STM32L1xx_StdPeriph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup USART
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief USART Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t USART_BaudRate; /*!< This member configures the USART communication baud rate.
|
||||
The baud rate is computed using the following formula:
|
||||
- IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))
|
||||
- FractionalDivider = ((IntegerDivider - ((u32) IntegerDivider)) * 16) + 0.5 */
|
||||
|
||||
uint16_t USART_WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
|
||||
This parameter can be a value of @ref USART_Word_Length */
|
||||
|
||||
uint16_t USART_StopBits; /*!< Specifies the number of stop bits transmitted.
|
||||
This parameter can be a value of @ref USART_Stop_Bits */
|
||||
|
||||
uint16_t USART_Parity; /*!< Specifies the parity mode.
|
||||
This parameter can be a value of @ref USART_Parity
|
||||
@note When parity is enabled, the computed parity is inserted
|
||||
at the MSB position of the transmitted data (9th bit when
|
||||
the word length is set to 9 data bits; 8th bit when the
|
||||
word length is set to 8 data bits). */
|
||||
|
||||
uint16_t USART_Mode; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
|
||||
This parameter can be a value of @ref USART_Mode */
|
||||
|
||||
uint16_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabled
|
||||
or disabled.
|
||||
This parameter can be a value of @ref USART_Hardware_Flow_Control */
|
||||
} USART_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @brief USART Clock Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t USART_Clock; /*!< Specifies whether the USART clock is enabled or disabled.
|
||||
This parameter can be a value of @ref USART_Clock */
|
||||
|
||||
uint16_t USART_CPOL; /*!< Specifies the steady state value of the serial clock.
|
||||
This parameter can be a value of @ref USART_Clock_Polarity */
|
||||
|
||||
uint16_t USART_CPHA; /*!< Specifies the clock transition on which the bit capture is made.
|
||||
This parameter can be a value of @ref USART_Clock_Phase */
|
||||
|
||||
uint16_t USART_LastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
|
||||
data bit (MSB) has to be output on the SCLK pin in synchronous mode.
|
||||
This parameter can be a value of @ref USART_Last_Bit */
|
||||
} USART_ClockInitTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \
|
||||
((PERIPH) == USART2) || \
|
||||
((PERIPH) == USART3))
|
||||
|
||||
/** @defgroup USART_Word_Length
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_WordLength_8b ((uint16_t)0x0000)
|
||||
#define USART_WordLength_9b ((uint16_t)0x1000)
|
||||
|
||||
#define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \
|
||||
((LENGTH) == USART_WordLength_9b))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Stop_Bits
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_StopBits_1 ((uint16_t)0x0000)
|
||||
#define USART_StopBits_0_5 ((uint16_t)0x1000)
|
||||
#define USART_StopBits_2 ((uint16_t)0x2000)
|
||||
#define USART_StopBits_1_5 ((uint16_t)0x3000)
|
||||
#define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \
|
||||
((STOPBITS) == USART_StopBits_0_5) || \
|
||||
((STOPBITS) == USART_StopBits_2) || \
|
||||
((STOPBITS) == USART_StopBits_1_5))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Parity
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_Parity_No ((uint16_t)0x0000)
|
||||
#define USART_Parity_Even ((uint16_t)0x0400)
|
||||
#define USART_Parity_Odd ((uint16_t)0x0600)
|
||||
#define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \
|
||||
((PARITY) == USART_Parity_Even) || \
|
||||
((PARITY) == USART_Parity_Odd))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Mode
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_Mode_Rx ((uint16_t)0x0004)
|
||||
#define USART_Mode_Tx ((uint16_t)0x0008)
|
||||
#define IS_USART_MODE(MODE) ((((MODE) & (uint16_t)0xFFF3) == 0x00) && ((MODE) != (uint16_t)0x00))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Hardware_Flow_Control
|
||||
* @{
|
||||
*/
|
||||
#define USART_HardwareFlowControl_None ((uint16_t)0x0000)
|
||||
#define USART_HardwareFlowControl_RTS ((uint16_t)0x0100)
|
||||
#define USART_HardwareFlowControl_CTS ((uint16_t)0x0200)
|
||||
#define USART_HardwareFlowControl_RTS_CTS ((uint16_t)0x0300)
|
||||
#define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\
|
||||
(((CONTROL) == USART_HardwareFlowControl_None) || \
|
||||
((CONTROL) == USART_HardwareFlowControl_RTS) || \
|
||||
((CONTROL) == USART_HardwareFlowControl_CTS) || \
|
||||
((CONTROL) == USART_HardwareFlowControl_RTS_CTS))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Clock
|
||||
* @{
|
||||
*/
|
||||
#define USART_Clock_Disable ((uint16_t)0x0000)
|
||||
#define USART_Clock_Enable ((uint16_t)0x0800)
|
||||
#define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \
|
||||
((CLOCK) == USART_Clock_Enable))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Clock_Polarity
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_CPOL_Low ((uint16_t)0x0000)
|
||||
#define USART_CPOL_High ((uint16_t)0x0400)
|
||||
#define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Clock_Phase
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_CPHA_1Edge ((uint16_t)0x0000)
|
||||
#define USART_CPHA_2Edge ((uint16_t)0x0200)
|
||||
#define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Last_Bit
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_LastBit_Disable ((uint16_t)0x0000)
|
||||
#define USART_LastBit_Enable ((uint16_t)0x0100)
|
||||
#define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \
|
||||
((LASTBIT) == USART_LastBit_Enable))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Interrupt_definition
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_IT_PE ((uint16_t)0x0028)
|
||||
#define USART_IT_TXE ((uint16_t)0x0727)
|
||||
#define USART_IT_TC ((uint16_t)0x0626)
|
||||
#define USART_IT_RXNE ((uint16_t)0x0525)
|
||||
#define USART_IT_IDLE ((uint16_t)0x0424)
|
||||
#define USART_IT_LBD ((uint16_t)0x0846)
|
||||
#define USART_IT_CTS ((uint16_t)0x096A)
|
||||
#define USART_IT_ERR ((uint16_t)0x0060)
|
||||
#define USART_IT_ORE ((uint16_t)0x0360)
|
||||
#define USART_IT_NE ((uint16_t)0x0260)
|
||||
#define USART_IT_FE ((uint16_t)0x0160)
|
||||
#define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
|
||||
((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
|
||||
((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
|
||||
((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR))
|
||||
#define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
|
||||
((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
|
||||
((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
|
||||
((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \
|
||||
((IT) == USART_IT_NE) || ((IT) == USART_IT_FE))
|
||||
#define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
|
||||
((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_DMA_Requests
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_DMAReq_Tx ((uint16_t)0x0080)
|
||||
#define USART_DMAReq_Rx ((uint16_t)0x0040)
|
||||
#define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFF3F) == 0x00) && ((DMAREQ) != (uint16_t)0x00))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_WakeUp_methods
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_WakeUp_IdleLine ((uint16_t)0x0000)
|
||||
#define USART_WakeUp_AddressMark ((uint16_t)0x0800)
|
||||
#define IS_USART_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \
|
||||
((WAKEUP) == USART_WakeUp_AddressMark))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_LIN_Break_Detection_Length
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_LINBreakDetectLength_10b ((uint16_t)0x0000)
|
||||
#define USART_LINBreakDetectLength_11b ((uint16_t)0x0020)
|
||||
#define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \
|
||||
(((LENGTH) == USART_LINBreakDetectLength_10b) || \
|
||||
((LENGTH) == USART_LINBreakDetectLength_11b))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_IrDA_Low_Power
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_IrDAMode_LowPower ((uint16_t)0x0004)
|
||||
#define USART_IrDAMode_Normal ((uint16_t)0x0000)
|
||||
#define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \
|
||||
((MODE) == USART_IrDAMode_Normal))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Flags
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define USART_FLAG_CTS ((uint16_t)0x0200)
|
||||
#define USART_FLAG_LBD ((uint16_t)0x0100)
|
||||
#define USART_FLAG_TXE ((uint16_t)0x0080)
|
||||
#define USART_FLAG_TC ((uint16_t)0x0040)
|
||||
#define USART_FLAG_RXNE ((uint16_t)0x0020)
|
||||
#define USART_FLAG_IDLE ((uint16_t)0x0010)
|
||||
#define USART_FLAG_ORE ((uint16_t)0x0008)
|
||||
#define USART_FLAG_NE ((uint16_t)0x0004)
|
||||
#define USART_FLAG_FE ((uint16_t)0x0002)
|
||||
#define USART_FLAG_PE ((uint16_t)0x0001)
|
||||
#define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PE) || ((FLAG) == USART_FLAG_TXE) || \
|
||||
((FLAG) == USART_FLAG_TC) || ((FLAG) == USART_FLAG_RXNE) || \
|
||||
((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_LBD) || \
|
||||
((FLAG) == USART_FLAG_CTS) || ((FLAG) == USART_FLAG_ORE) || \
|
||||
((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE))
|
||||
|
||||
#define IS_USART_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFC9F) == 0x00) && ((FLAG) != (uint16_t)0x00))
|
||||
|
||||
#define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x003D0901))
|
||||
#define IS_USART_ADDRESS(ADDRESS) ((ADDRESS) <= 0xF)
|
||||
#define IS_USART_DATA(DATA) ((DATA) <= 0x1FF)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void USART_DeInit(USART_TypeDef* USARTx);
|
||||
void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct);
|
||||
void USART_StructInit(USART_InitTypeDef* USART_InitStruct);
|
||||
void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct);
|
||||
void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct);
|
||||
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState);
|
||||
void USART_DMACmd(USART_TypeDef* USARTx, uint16_t USART_DMAReq, FunctionalState NewState);
|
||||
void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address);
|
||||
void USART_WakeUpConfig(USART_TypeDef* USARTx, uint16_t USART_WakeUp);
|
||||
void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, uint16_t USART_LINBreakDetectLength);
|
||||
void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
|
||||
uint16_t USART_ReceiveData(USART_TypeDef* USARTx);
|
||||
void USART_SendBreak(USART_TypeDef* USARTx);
|
||||
void USART_SetGuardTime(USART_TypeDef* USARTx, uint8_t USART_GuardTime);
|
||||
void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler);
|
||||
void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
void USART_IrDAConfig(USART_TypeDef* USARTx, uint16_t USART_IrDAMode);
|
||||
void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState);
|
||||
FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint16_t USART_FLAG);
|
||||
void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG);
|
||||
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT);
|
||||
void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32L1xx_USART_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,995 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32l1xx_usart.c
|
||||
* @author MCD Application Team
|
||||
* @version V1.0.0RC1
|
||||
* @date 07/02/2010
|
||||
* @brief This file provides all the USART firmware functions.
|
||||
******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2010 STMicroelectronics</center></h2>
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32l1xx_usart.h"
|
||||
#include "stm32l1xx_rcc.h"
|
||||
|
||||
/** @addtogroup STM32L1xx_StdPeriph_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USART
|
||||
* @brief USART driver modules
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!< USART CR1 register clear Mask ((~(uint16_t)0xE9F3)) */
|
||||
#define CR1_CLEAR_MASK ((uint16_t)(USART_CR1_M | USART_CR1_PCE | \
|
||||
USART_CR1_PS | USART_CR1_TE | \
|
||||
USART_CR1_RE))
|
||||
|
||||
/*!< USART CR2 register clock bits clear Mask ((~(uint16_t)0xF0FF)) */
|
||||
#define CR2_CLOCK_CLEAR_MASK ((uint16_t)(USART_CR2_CLKEN | USART_CR2_CPOL | \
|
||||
USART_CR2_CPHA | USART_CR2_LBCL))
|
||||
|
||||
/*!< USART CR3 register clear Mask ((~(uint16_t)0xFCFF)) */
|
||||
#define CR3_CLEAR_MASK ((uint16_t)(USART_CR3_RTSE | USART_CR3_CTSE))
|
||||
|
||||
/*!< USART Interrupts mask */
|
||||
#define IT_MASK ((uint16_t)0x001F)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USART_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the USARTx peripheral registers to their default reset values.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values: USART1, USART2 or USART3.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_DeInit(USART_TypeDef* USARTx)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
|
||||
if (USARTx == USART1)
|
||||
{
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
|
||||
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE);
|
||||
}
|
||||
else if (USARTx == USART2)
|
||||
{
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (USARTx == USART3)
|
||||
{
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, ENABLE);
|
||||
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART3, DISABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the USARTx peripheral according to the specified
|
||||
* parameters in the USART_InitStruct .
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_InitStruct: pointer to a USART_InitTypeDef structure
|
||||
* that contains the configuration information for the specified USART peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct)
|
||||
{
|
||||
uint32_t tmpreg = 0x00, apbclock = 0x00;
|
||||
uint32_t integerdivider = 0x00;
|
||||
uint32_t fractionaldivider = 0x00;
|
||||
RCC_ClocksTypeDef RCC_ClocksStatus;
|
||||
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_BAUDRATE(USART_InitStruct->USART_BaudRate));
|
||||
assert_param(IS_USART_WORD_LENGTH(USART_InitStruct->USART_WordLength));
|
||||
assert_param(IS_USART_STOPBITS(USART_InitStruct->USART_StopBits));
|
||||
assert_param(IS_USART_PARITY(USART_InitStruct->USART_Parity));
|
||||
assert_param(IS_USART_MODE(USART_InitStruct->USART_Mode));
|
||||
assert_param(IS_USART_HARDWARE_FLOW_CONTROL(USART_InitStruct->USART_HardwareFlowControl));
|
||||
|
||||
/*---------------------------- USART CR2 Configuration -----------------------*/
|
||||
tmpreg = USARTx->CR2;
|
||||
/* Clear STOP[13:12] bits */
|
||||
tmpreg &= (uint32_t)~((uint32_t)USART_CR2_STOP);
|
||||
|
||||
/* Configure the USART Stop Bits, Clock, CPOL, CPHA and LastBit ------------*/
|
||||
/* Set STOP[13:12] bits according to USART_StopBits value */
|
||||
tmpreg |= (uint32_t)USART_InitStruct->USART_StopBits;
|
||||
|
||||
/* Write to USART CR2 */
|
||||
USARTx->CR2 = (uint16_t)tmpreg;
|
||||
|
||||
/*---------------------------- USART CR1 Configuration -----------------------*/
|
||||
tmpreg = USARTx->CR1;
|
||||
/* Clear M, PCE, PS, TE and RE bits */
|
||||
tmpreg &= (uint32_t)~((uint32_t)CR1_CLEAR_MASK);
|
||||
|
||||
/* Configure the USART Word Length, Parity and mode ----------------------- */
|
||||
/* Set the M bits according to USART_WordLength value */
|
||||
/* Set PCE and PS bits according to USART_Parity value */
|
||||
/* Set TE and RE bits according to USART_Mode value */
|
||||
tmpreg |= (uint32_t)USART_InitStruct->USART_WordLength | USART_InitStruct->USART_Parity |
|
||||
USART_InitStruct->USART_Mode;
|
||||
|
||||
/* Write to USART CR1 */
|
||||
USARTx->CR1 = (uint16_t)tmpreg;
|
||||
|
||||
/*---------------------------- USART CR3 Configuration -----------------------*/
|
||||
tmpreg = USARTx->CR3;
|
||||
/* Clear CTSE and RTSE bits */
|
||||
tmpreg &= (uint32_t)~((uint32_t)CR3_CLEAR_MASK);
|
||||
|
||||
/* Configure the USART HFC -------------------------------------------------*/
|
||||
/* Set CTSE and RTSE bits according to USART_HardwareFlowControl value */
|
||||
tmpreg |= USART_InitStruct->USART_HardwareFlowControl;
|
||||
|
||||
/* Write to USART CR3 */
|
||||
USARTx->CR3 = (uint16_t)tmpreg;
|
||||
|
||||
/*---------------------------- USART BRR Configuration -----------------------*/
|
||||
/* Configure the USART Baud Rate -------------------------------------------*/
|
||||
RCC_GetClocksFreq(&RCC_ClocksStatus);
|
||||
if (USARTx == USART1)
|
||||
{
|
||||
apbclock = RCC_ClocksStatus.PCLK2_Frequency;
|
||||
}
|
||||
else
|
||||
{
|
||||
apbclock = RCC_ClocksStatus.PCLK1_Frequency;
|
||||
}
|
||||
|
||||
/* Determine the integer part */
|
||||
if ((USARTx->CR1 & USART_CR1_OVER8) != 0)
|
||||
{
|
||||
/* Integer part computing in case Oversampling mode is 8 Samples */
|
||||
integerdivider = ((25 * apbclock) / (2 * (USART_InitStruct->USART_BaudRate)));
|
||||
}
|
||||
else /* if ((USARTx->CR1 & CR1_OVER8_Set) == 0) */
|
||||
{
|
||||
/* Integer part computing in case Oversampling mode is 16 Samples */
|
||||
integerdivider = ((25 * apbclock) / (4 * (USART_InitStruct->USART_BaudRate)));
|
||||
}
|
||||
tmpreg = (integerdivider / 100) << 4;
|
||||
|
||||
/* Determine the fractional part */
|
||||
fractionaldivider = integerdivider - (100 * (tmpreg >> 4));
|
||||
|
||||
/* Implement the fractional part in the register */
|
||||
if ((USARTx->CR1 & USART_CR1_OVER8) != 0)
|
||||
{
|
||||
tmpreg |= ((((fractionaldivider * 8) + 50) / 100)) & ((uint8_t)0x07);
|
||||
}
|
||||
else /* if ((USARTx->CR1 & CR1_OVER8_Set) == 0) */
|
||||
{
|
||||
tmpreg |= ((((fractionaldivider * 16) + 50) / 100)) & ((uint8_t)0x0F);
|
||||
}
|
||||
|
||||
/* Write to USART BRR */
|
||||
USARTx->BRR = (uint16_t)tmpreg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fills each USART_InitStruct member with its default value.
|
||||
* @param USART_InitStruct: pointer to a USART_InitTypeDef structure
|
||||
* which will be initialized.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_StructInit(USART_InitTypeDef* USART_InitStruct)
|
||||
{
|
||||
/* USART_InitStruct members default value */
|
||||
USART_InitStruct->USART_BaudRate = 9600;
|
||||
USART_InitStruct->USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStruct->USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStruct->USART_Parity = USART_Parity_No ;
|
||||
USART_InitStruct->USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
USART_InitStruct->USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the USARTx peripheral Clock according to the
|
||||
* specified parameters in the USART_ClockInitStruct .
|
||||
* @param USARTx: where x can be 1, 2, 3 to select the USART peripheral.
|
||||
* @param USART_ClockInitStruct: pointer to a USART_ClockInitTypeDef
|
||||
* structure that contains the configuration information for the specified
|
||||
* USART peripheral.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct)
|
||||
{
|
||||
uint32_t tmpreg = 0x00;
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
|
||||
assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
|
||||
assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
|
||||
assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
|
||||
|
||||
/*---------------------------- USART CR2 Configuration -----------------------*/
|
||||
tmpreg = USARTx->CR2;
|
||||
/* Clear CLKEN, CPOL, CPHA and LBCL bits */
|
||||
tmpreg &= (uint32_t)~((uint32_t)CR2_CLOCK_CLEAR_MASK);
|
||||
/* Configure the USART Clock, CPOL, CPHA and LastBit ------------*/
|
||||
/* Set CLKEN bit according to USART_Clock value */
|
||||
/* Set CPOL bit according to USART_CPOL value */
|
||||
/* Set CPHA bit according to USART_CPHA value */
|
||||
/* Set LBCL bit according to USART_LastBit value */
|
||||
tmpreg |= (uint32_t)USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
|
||||
USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit;
|
||||
/* Write to USART CR2 */
|
||||
USARTx->CR2 = (uint16_t)tmpreg;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fills each USART_ClockInitStruct member with its default value.
|
||||
* @param USART_ClockInitStruct: pointer to a USART_ClockInitTypeDef
|
||||
* structure which will be initialized.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct)
|
||||
{
|
||||
/* USART_ClockInitStruct members default value */
|
||||
USART_ClockInitStruct->USART_Clock = USART_Clock_Disable;
|
||||
USART_ClockInitStruct->USART_CPOL = USART_CPOL_Low;
|
||||
USART_ClockInitStruct->USART_CPHA = USART_CPHA_1Edge;
|
||||
USART_ClockInitStruct->USART_LastBit = USART_LastBit_Disable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the specified USART peripheral.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the USARTx peripheral.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the selected USART by setting the UE bit in the CR1 register */
|
||||
USARTx->CR1 |= USART_CR1_UE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the selected USART by clearing the UE bit in the CR1 register */
|
||||
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_UE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the specified USART interrupts.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_IT: specifies the USART interrupt sources to be enabled or disabled.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_IT_CTS: CTS change interrupt (not available for UART4 and UART5)
|
||||
* @arg USART_IT_LBD: LIN Break detection interrupt
|
||||
* @arg USART_IT_TXE: Tansmit Data Register empty interrupt
|
||||
* @arg USART_IT_TC: Transmission complete interrupt
|
||||
* @arg USART_IT_RXNE: Receive Data register not empty interrupt
|
||||
* @arg USART_IT_IDLE: Idle line detection interrupt
|
||||
* @arg USART_IT_PE: Parity Error interrupt
|
||||
* @arg USART_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
|
||||
* @param NewState: new state of the specified USARTx interrupts.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ITConfig(USART_TypeDef* USARTx, uint16_t USART_IT, FunctionalState NewState)
|
||||
{
|
||||
uint32_t usartreg = 0x00, itpos = 0x00, itmask = 0x00;
|
||||
uint32_t usartxbase = 0x00;
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_CONFIG_IT(USART_IT));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
usartxbase = (uint32_t)USARTx;
|
||||
|
||||
/* Get the USART register index */
|
||||
usartreg = (((uint8_t)USART_IT) >> 0x05);
|
||||
|
||||
/* Get the interrupt position */
|
||||
itpos = USART_IT & IT_MASK;
|
||||
itmask = (((uint32_t)0x01) << itpos);
|
||||
|
||||
if (usartreg == 0x01) /* The IT is in CR1 register */
|
||||
{
|
||||
usartxbase += 0x0C;
|
||||
}
|
||||
else if (usartreg == 0x02) /* The IT is in CR2 register */
|
||||
{
|
||||
usartxbase += 0x10;
|
||||
}
|
||||
else /* The IT is in CR3 register */
|
||||
{
|
||||
usartxbase += 0x14;
|
||||
}
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
*(__IO uint32_t*)usartxbase |= itmask;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(__IO uint32_t*)usartxbase &= ~itmask;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART’s DMA interface.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_DMAReq: specifies the DMA request.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg USART_DMAReq_Tx: USART DMA transmit request
|
||||
* @arg USART_DMAReq_Rx: USART DMA receive request
|
||||
* @param NewState: new state of the DMA Request sources.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @note The DMA mode is not available for UART5.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_DMACmd(USART_TypeDef* USARTx, uint16_t USART_DMAReq, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_DMAREQ(USART_DMAReq));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the DMA transfer for selected requests by setting the DMAT and/or
|
||||
DMAR bits in the USART CR3 register */
|
||||
USARTx->CR3 |= USART_DMAReq;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the DMA transfer for selected requests by clearing the DMAT and/or
|
||||
DMAR bits in the USART CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~USART_DMAReq;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the address of the USART node.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_Address: Indicates the address of the USART node.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_ADDRESS(USART_Address));
|
||||
|
||||
/* Clear the USART address */
|
||||
USARTx->CR2 &= (uint16_t)~((uint16_t)USART_CR2_ADD);
|
||||
/* Set the USART address node */
|
||||
USARTx->CR2 |= USART_Address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Selects the USART WakeUp method.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_WakeUp: specifies the USART wakeup method.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_WakeUp_IdleLine: WakeUp by an idle line detection
|
||||
* @arg USART_WakeUp_AddressMark: WakeUp by an address mark
|
||||
* @retval None
|
||||
*/
|
||||
void USART_WakeUpConfig(USART_TypeDef* USARTx, uint16_t USART_WakeUp)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_WAKEUP(USART_WakeUp));
|
||||
|
||||
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_WAKE);
|
||||
USARTx->CR1 |= USART_WakeUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines if the USART is in mute mode or not.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the USART mute mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the USART mute mode by setting the RWU bit in the CR1 register */
|
||||
USARTx->CR1 |= USART_CR1_RWU;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the USART mute mode by clearing the RWU bit in the CR1 register */
|
||||
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_RWU);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the USART LIN Break detection length.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_LINBreakDetectLength: specifies the LIN break detection length.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_LINBreakDetectLength_10b: 10-bit break detection
|
||||
* @arg USART_LINBreakDetectLength_11b: 11-bit break detection
|
||||
* @retval None
|
||||
*/
|
||||
void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, uint16_t USART_LINBreakDetectLength)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_LIN_BREAK_DETECT_LENGTH(USART_LINBreakDetectLength));
|
||||
|
||||
USARTx->CR2 &= (uint16_t)~((uint16_t)USART_CR2_LBDL);
|
||||
USARTx->CR2 |= USART_LINBreakDetectLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART’s LIN mode.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the USART LIN mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the LIN mode by setting the LINEN bit in the CR2 register */
|
||||
USARTx->CR2 |= USART_CR2_LINEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the LIN mode by clearing the LINEN bit in the CR2 register */
|
||||
USARTx->CR2 &= (uint16_t)~((uint16_t)USART_CR2_LINEN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transmits single data through the USARTx peripheral.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param Data: the data to transmit.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SendData(USART_TypeDef* USARTx, uint16_t Data)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_DATA(Data));
|
||||
|
||||
/* Transmit Data */
|
||||
USARTx->DR = (Data & (uint16_t)0x01FF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the most recent received data by the USARTx peripheral.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @retval The received data.
|
||||
*/
|
||||
uint16_t USART_ReceiveData(USART_TypeDef* USARTx)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
|
||||
/* Receive Data */
|
||||
return (uint16_t)(USARTx->DR & (uint16_t)0x01FF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transmits break characters.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SendBreak(USART_TypeDef* USARTx)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
|
||||
/* Send break characters */
|
||||
USARTx->CR1 |= USART_CR1_SBK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the specified USART guard time.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_GuardTime: specifies the guard time.
|
||||
* @note The guard time bits are not available for UART4 and UART5.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SetGuardTime(USART_TypeDef* USARTx, uint8_t USART_GuardTime)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
|
||||
/* Clear the USART Guard time */
|
||||
USARTx->GTPR &= USART_GTPR_PSC;
|
||||
/* Set the USART guard time */
|
||||
USARTx->GTPR |= (uint16_t)((uint16_t)USART_GuardTime << 0x08);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the system clock prescaler.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_Prescaler: specifies the prescaler clock.
|
||||
* @note The function is used for IrDA mode with UART4 and UART5.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
|
||||
/* Clear the USART prescaler */
|
||||
USARTx->GTPR &= USART_GTPR_GT;
|
||||
/* Set the USART prescaler */
|
||||
USARTx->GTPR |= USART_Prescaler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART’s Smart Card mode.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the Smart Card mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @note The Smart Card mode is not available for UART4 and UART5.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the SC mode by setting the SCEN bit in the CR3 register */
|
||||
USARTx->CR3 |= USART_CR3_SCEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the SC mode by clearing the SCEN bit in the CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_SCEN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables NACK transmission.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the NACK transmission.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @note The Smart Card mode is not available for UART4 and UART5.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the NACK transmission by setting the NACK bit in the CR3 register */
|
||||
USARTx->CR3 |= USART_CR3_NACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the NACK transmission by clearing the NACK bit in the CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_NACK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART’s Half Duplex communication.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the USART Communication.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the Half-Duplex mode by setting the HDSEL bit in the CR3 register */
|
||||
USARTx->CR3 |= USART_CR3_HDSEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the Half-Duplex mode by clearing the HDSEL bit in the CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_HDSEL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART's 8x oversampling mode.
|
||||
* @param USARTx: Select the USART or the UART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2, USART3.
|
||||
* @param NewState: new state of the USART 8x oversampling mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
*
|
||||
* @note
|
||||
* This function has to be called before calling USART_Init()
|
||||
* function in order to have correct baudrate Divider value.
|
||||
* @retval : None
|
||||
*/
|
||||
void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the 8x Oversampling mode by setting the OVER8 bit in the CR1 register */
|
||||
USARTx->CR1 |= USART_CR1_OVER8;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the 8x Oversampling mode by clearing the OVER8 bit in the CR1 register */
|
||||
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_OVER8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART's one bit sampling methode.
|
||||
* @param USARTx: Select the USART or the UART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2, USART3.
|
||||
* @param NewState: new state of the USART one bit sampling methode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval : None
|
||||
*/
|
||||
void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the one bit method by setting the ONEBITE bit in the CR3 register */
|
||||
USARTx->CR3 |= USART_CR3_ONEBIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable tthe one bit method by clearing the ONEBITE bit in the CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_ONEBIT);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the USART’s IrDA interface.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_IrDAMode: specifies the IrDA mode.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_IrDAMode_LowPower
|
||||
* @arg USART_IrDAMode_Normal
|
||||
* @retval None
|
||||
*/
|
||||
void USART_IrDAConfig(USART_TypeDef* USARTx, uint16_t USART_IrDAMode)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_IRDA_MODE(USART_IrDAMode));
|
||||
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_IRLP);
|
||||
USARTx->CR3 |= USART_IrDAMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the USART’s IrDA interface.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param NewState: new state of the IrDA mode.
|
||||
* This parameter can be: ENABLE or DISABLE.
|
||||
* @retval None
|
||||
*/
|
||||
void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_FUNCTIONAL_STATE(NewState));
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the IrDA mode by setting the IREN bit in the CR3 register */
|
||||
USARTx->CR3 |= USART_CR3_IREN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the IrDA mode by clearing the IREN bit in the CR3 register */
|
||||
USARTx->CR3 &= (uint16_t)~((uint16_t)USART_CR3_IREN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether the specified USART flag is set or not.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_FLAG: specifies the flag to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_FLAG_CTS: CTS Change flag
|
||||
* @arg USART_FLAG_LBD: LIN Break detection flag
|
||||
* @arg USART_FLAG_TXE: Transmit data register empty flag
|
||||
* @arg USART_FLAG_TC: Transmission Complete flag
|
||||
* @arg USART_FLAG_RXNE: Receive data register not empty flag
|
||||
* @arg USART_FLAG_IDLE: Idle Line detection flag
|
||||
* @arg USART_FLAG_ORE: OverRun Error flag
|
||||
* @arg USART_FLAG_NE: Noise Error flag
|
||||
* @arg USART_FLAG_FE: Framing Error flag
|
||||
* @arg USART_FLAG_PE: Parity Error flag
|
||||
* @retval The new state of USART_FLAG (SET or RESET).
|
||||
*/
|
||||
FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint16_t USART_FLAG)
|
||||
{
|
||||
FlagStatus bitstatus = RESET;
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_FLAG(USART_FLAG));
|
||||
|
||||
if ((USARTx->SR & USART_FLAG) != (uint16_t)RESET)
|
||||
{
|
||||
bitstatus = SET;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitstatus = RESET;
|
||||
}
|
||||
return bitstatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears the USARTx's pending flags.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_FLAG: specifies the flag to clear.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg USART_FLAG_CTS: CTS Change flag.
|
||||
* @arg USART_FLAG_LBD: LIN Break detection flag.
|
||||
* @arg USART_FLAG_TC: Transmission Complete flag.
|
||||
* @arg USART_FLAG_RXNE: Receive data register not empty flag.
|
||||
*
|
||||
* @note
|
||||
* - PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
|
||||
* error) and IDLE (Idle line detected) flags are cleared by software
|
||||
* sequence: a read operation to USART_SR register (USART_GetFlagStatus())
|
||||
* followed by a read operation to USART_DR register (USART_ReceiveData()).
|
||||
* - RXNE flag can be also cleared by a read to the USART_DR register
|
||||
* (USART_ReceiveData()).
|
||||
* - TC flag can be also cleared by software sequence: a read operation to
|
||||
* USART_SR register (USART_GetFlagStatus()) followed by a write operation
|
||||
* to USART_DR register (USART_SendData()).
|
||||
* - TXE flag is cleared only by a write to the USART_DR register
|
||||
* (USART_SendData()).
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG)
|
||||
{
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_CLEAR_FLAG(USART_FLAG));
|
||||
|
||||
USARTx->SR = (uint16_t)~USART_FLAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Checks whether the specified USART interrupt has occurred or not.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_IT: specifies the USART interrupt source to check.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_IT_CTS: CTS change interrupt
|
||||
* @arg USART_IT_LBD: LIN Break detection interrupt
|
||||
* @arg USART_IT_TXE: Tansmit Data Register empty interrupt
|
||||
* @arg USART_IT_TC: Transmission complete interrupt
|
||||
* @arg USART_IT_RXNE: Receive Data register not empty interrupt
|
||||
* @arg USART_IT_IDLE: Idle line detection interrupt
|
||||
* @arg USART_IT_ORE: OverRun Error interrupt
|
||||
* @arg USART_IT_NE: Noise Error interrupt
|
||||
* @arg USART_IT_FE: Framing Error interrupt
|
||||
* @arg USART_IT_PE: Parity Error interrupt
|
||||
* @retval The new state of USART_IT (SET or RESET).
|
||||
*/
|
||||
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT)
|
||||
{
|
||||
uint32_t bitpos = 0x00, itmask = 0x00, usartreg = 0x00;
|
||||
ITStatus bitstatus = RESET;
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_GET_IT(USART_IT));
|
||||
|
||||
/* Get the USART register index */
|
||||
usartreg = (((uint8_t)USART_IT) >> 0x05);
|
||||
/* Get the interrupt position */
|
||||
itmask = USART_IT & IT_MASK;
|
||||
itmask = (uint32_t)0x01 << itmask;
|
||||
|
||||
if (usartreg == 0x01) /* The IT is in CR1 register */
|
||||
{
|
||||
itmask &= USARTx->CR1;
|
||||
}
|
||||
else if (usartreg == 0x02) /* The IT is in CR2 register */
|
||||
{
|
||||
itmask &= USARTx->CR2;
|
||||
}
|
||||
else /* The IT is in CR3 register */
|
||||
{
|
||||
itmask &= USARTx->CR3;
|
||||
}
|
||||
|
||||
bitpos = USART_IT >> 0x08;
|
||||
bitpos = (uint32_t)0x01 << bitpos;
|
||||
bitpos &= USARTx->SR;
|
||||
if ((itmask != (uint16_t)RESET)&&(bitpos != (uint16_t)RESET))
|
||||
{
|
||||
bitstatus = SET;
|
||||
}
|
||||
else
|
||||
{
|
||||
bitstatus = RESET;
|
||||
}
|
||||
|
||||
return bitstatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears the USARTx’s interrupt pending bits.
|
||||
* @param USARTx: Select the USART peripheral.
|
||||
* This parameter can be one of the following values:
|
||||
* USART1, USART2 or USART3.
|
||||
* @param USART_IT: specifies the interrupt pending bit to clear.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg USART_IT_CTS: CTS change interrupt
|
||||
* @arg USART_IT_LBD: LIN Break detection interrupt
|
||||
* @arg USART_IT_TC: Transmission complete interrupt.
|
||||
* @arg USART_IT_RXNE: Receive Data register not empty interrupt.
|
||||
*
|
||||
* @note
|
||||
* - PE (Parity error), FE (Framing error), NE (Noise error), ORE (OverRun
|
||||
* error) and IDLE (Idle line detected) pending bits are cleared by
|
||||
* software sequence: a read operation to USART_SR register
|
||||
* (USART_GetITStatus()) followed by a read operation to USART_DR register
|
||||
* (USART_ReceiveData()).
|
||||
* - RXNE pending bit can be also cleared by a read to the USART_DR register
|
||||
* (USART_ReceiveData()).
|
||||
* - TC pending bit can be also cleared by software sequence: a read
|
||||
* operation to USART_SR register (USART_GetITStatus()) followed by a write
|
||||
* operation to USART_DR register (USART_SendData()).
|
||||
* - TXE pending bit is cleared only by a write to the USART_DR register
|
||||
* (USART_SendData()).
|
||||
* @retval None
|
||||
*/
|
||||
void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT)
|
||||
{
|
||||
uint16_t bitpos = 0x00, itmask = 0x00;
|
||||
/* Check the parameters */
|
||||
assert_param(IS_USART_ALL_PERIPH(USARTx));
|
||||
assert_param(IS_USART_CLEAR_IT(USART_IT));
|
||||
|
||||
bitpos = USART_IT >> 0x08;
|
||||
itmask = ((uint16_t)0x01 << (uint16_t)bitpos);
|
||||
USARTx->SR = (uint16_t)~itmask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
|
|
@ -9,7 +9,7 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF;
|
|||
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x300;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue