Skip to content

Commit

Permalink
can run by using queue
Browse files Browse the repository at this point in the history
  • Loading branch information
shin21 committed Apr 18, 2014
1 parent ae77189 commit b79f05c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CORTEX_M4F_STM32F407ZG-SK/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000000 )
#define configTICK_RATE_HZ ( ( TickType_t ) 100000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 75 * 1024 ) )
Expand Down
36 changes: 17 additions & 19 deletions CORTEX_M4F_STM32F407ZG-SK/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,45 +137,43 @@ void USART(void)
}


portTickType oneS = 1000000;
portTickType oneS = 100000;

uint32_t snd = 1;
uint32_t rcv = 0;
uint32_t line = 1111111111;
uint32_t snd = 0;

uint32_t rcv = 999;
uint32_t base = 0;

void QTask1( void* pvParameters )
{

while( 1 ){
if( xQueueSend( MsgQueue, ( uint32_t* )&snd, 0 ) == pdPASS ){
// xQueueSend( MsgQueue, ( uint32_t* )&snd, 0 );
snd++;
}

snd++;
}
}

void QTask2( void* pvParameters )
{
uint32_t base = 1;
while( 1 ){
if( xQueueReceive( MsgQueue, &rcv, 100/portTICK_RATE_MS ) == pdPASS && rcv == base)
{
// STM_EVAL_LEDToggle( LED3 );
itoa(rcv, 10);
if( xQueueReceive( MsgQueue, &rcv, 100 ) == pdPASS && rcv == base){
base++;
}
}
}

void Task3( void* pvParameters )
{
vTaskDelay( oneS );
vTaskDelay( 2 );
while(1){
itoa(line, 10);
USART1_puts("-----------------\r\n");
USART1_puts("snd: ");
itoa(snd, 10);
itoa(line, 10);
USART1_puts("rcv: ");
itoa(rcv, 10);
USART1_puts("base: ");
itoa(base, 10);

while(1){
STM_EVAL_LEDToggle(LED3);
vTaskDelay( oneS );
Expand All @@ -189,10 +187,10 @@ int main( void )
Init();
USART();

MsgQueue = xQueueCreate( 5000 , sizeof( uint32_t ) );
MsgQueue = xQueueCreate( 10000 , sizeof( uint32_t ) );

// xTaskCreate( QTask1, (signed char*)"Task1", 128, NULL, tskIDLE_PRIORITY+1, NULL );
// xTaskCreate( QTask2, (signed char*)"Task2", 128, NULL, tskIDLE_PRIORITY+1, NULL );
xTaskCreate( QTask1, (signed char*)"Task1", 128, NULL, tskIDLE_PRIORITY+1, NULL );
xTaskCreate( QTask2, (signed char*)"Task2", 128, NULL, tskIDLE_PRIORITY+1, NULL );
xTaskCreate( Task3, (signed char*)"Task3", 128, NULL, tskIDLE_PRIORITY+3, NULL );

vTaskStartScheduler();
Expand Down

0 comments on commit b79f05c

Please sign in to comment.