test.c 620 B

123456789101112131415161718192021222324252627
  1. #include "ch.h"
  2. #include "hal.h"
  3. #include "test.h"
  4. /*
  5. * This is a periodic thread that does absolutely nothing except flashing
  6. * a LED.
  7. */
  8. static THD_WORKING_AREA(waThread1, 128);
  9. static THD_FUNCTION(Thread1, arg) {
  10. (void)arg;
  11. chRegSetThreadName("blinker");
  12. while (true) {
  13. palSetPad(GPIOD, GPIOD_LED3); /* Orange. */
  14. chThdSleepMilliseconds(500);
  15. palClearPad(GPIOD, GPIOD_LED3); /* Orange. */
  16. chThdSleepMilliseconds(500);
  17. }
  18. }
  19. void testInit(void)
  20. {
  21. /*
  22. * Creates the example thread.
  23. */
  24. chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  25. }