123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #include "hal.h"
- #include "ch.h"
- THD_WORKING_AREA(waThread1, 128);
- THD_FUNCTION(Thread1, arg) {
- (void)arg;
- while (true) {
- palTogglePad(IOPORT2, PORTB_LED1);
- chThdSleepMilliseconds(500);
- }
- }
- THD_WORKING_AREA(waThread2, 128);
- THD_FUNCTION(Thread2, arg) {
- (void)arg;
-
- sdStart(&SD1, NULL);
- while (true) {
- chnWrite(&SD1, (const uint8_t *)"Hello World!\r\n", 14);
- chThdSleepMilliseconds(2000);
- }
- }
- THD_TABLE_BEGIN
- THD_TABLE_ENTRY(waThread1, "blinker", Thread1, NULL)
- THD_TABLE_ENTRY(waThread2, "hello", Thread2, NULL)
- THD_TABLE_END
- int main(void) {
-
- halInit();
- chSysInit();
-
- while (true) {
- }
- }
|