main.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. ChibiOS - Copyright (C) 2017 Theodore Ateba
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #include "hal.h"
  14. #include "ch.h"
  15. /*
  16. * @brief LED blinker thread.
  17. */
  18. THD_WORKING_AREA(waThread1, 32);
  19. THD_FUNCTION(Thread1, arg) {
  20. (void)arg;
  21. while (true) {
  22. palSetPad(IOPORT5, PORTE_LED);
  23. chThdSleepMilliseconds(1000);
  24. palClearPad(IOPORT5, PORTE_LED);
  25. chThdSleepMilliseconds(1000);
  26. }
  27. }
  28. /*
  29. * Threads static table, one entry per thread. The number of entries must
  30. * match NIL_CFG_NUM_THREADS.
  31. */
  32. THD_TABLE_BEGIN
  33. THD_TABLE_ENTRY(waThread1, "blinker", Thread1, NULL)
  34. THD_TABLE_END
  35. /*
  36. * Application entry point.
  37. */
  38. int main(void) {
  39. /*
  40. * System initializations.
  41. * - HAL initialization, this also initializes the configured device drivers
  42. * and performs the board-specific initializations.
  43. * - Kernel initialization, the main() function becomes a thread and the
  44. * RTOS is active.
  45. */
  46. halInit();
  47. chSysInit();
  48. /* This is now the idle thread loop, you may perform here a low priority
  49. task but you must never try to sleep or wait in this loop. Note that
  50. this tasks runs at the lowest priority level so any instruction added
  51. here will be executed after all other tasks have been started.
  52. */
  53. while (true) {
  54. }
  55. }