Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

#include <RTE_Components.

h>

#include <cmsis_os2.h>

#include <stm32f4xx.h>

#include <Board_LED.h>

#include <rtx_os.h>

void thread1 (void *argument);

void thread2 (void *argument);

static osThreadId_t mainID;

static osThreadId_t id1;

static osThreadId_t id2;

//static uint64_t thread1_stk_1[64];

//static osRtxThread_t thread1_tcb;

/*static const osThreadAttr_t thread1_attr = {

.name="aza",

//.attr_bits=1,

.cb_mem=NULL,

.stack_mem=0,

//.stack_size = sizeof(thread1_stk_1),

.priority=osPriorityNormal

};

*/

/*static const osThreadAttr_t thread1_attr = {

.priority=osPriorityAboveNormal};*/

/*static const osThreadAttr_t thread2_attr = {

.priority=osPriorityNormal};*/

__NO_RETURN void thread1 (void *argument)

{(void)argument;

LED_Initialize();

for (;;) {

LED_On(0);

osDelay(500U);
LED_Off(0);

osDelay(500U);

//LED_Initialize(); LED_On(0); osDelay(1000U); LED_Off(0); osDelay(1000U);

}}

__NO_RETURN void thread2 (void *argument){

(void)argument;

LED_Initialize();

for (;;) {

LED_On(1);

osDelay(500U);

LED_Off(1);

osDelay(500U);

// LED_Initialize(); LED_On(1); osDelay(1000U); LED_Off(1); osDelay(1000U);

}}

int main (void) {

osKernelInitialize(); // mainID=osThreadGetId();

mainID=osThreadGetId();

osThreadSetPriority(mainID,osPriorityAboveNormal);

id1=osThreadNew(thread1,NULL,NULL);

id2 = osThreadNew(thread2, NULL,NULL);//&thread2_attr);

//osThreadTerminate(id1);

osThreadTerminate(mainID);

osThreadSetPriority(id1,osPriorityAboveNormal);

osThreadSetPriority(id2,osPriorityAboveNormal);

osKernelStart();

You might also like