chibiosでLチカの練習
#include "ch.h"
#include "hal.h"
#define CONSOLE_WA_SIZE THD_WORKING_AREA_SIZE(4096)
#define cputs(msg) chMsgSend(cdtp, (msg_t) msg)
static thread_t * cdtp;
static THD_FUNCTION(console_thread, arg)
{
(void) arg;
while (!chThdShouldTerminateX())
{
thread_t * tp = chMsgWait();
puts((char *) chMsgGet(tp));
fflush(stdout);
chMsgRelease(tp, MSG_OK);
}
}
int main(void)
{
halInit();
chSysInit();
cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO, console_thread, NULL);
while (!chThdShouldTerminateX())
{
cputs("green on");
chThdSleepMilliseconds(500);
cputs("green off");
cputs("yellow on");
chThdSleepMilliseconds(500);
cputs("yellow off");
cputs("red on");
chThdSleepMilliseconds(500);
cputs("red off");
}
return 0;
}
Author And Source
この問題について(chibiosでLチカの練習), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/4d6aa9bfcca10db89f43著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .