PD Buddy Sink Firmware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
  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 "ch.h"
  14. #include "hal.h"
  15. /*
  16. * LED blinker thread, times are in milliseconds.
  17. */
  18. static THD_WORKING_AREA(waThread1, 128);
  19. static THD_FUNCTION(Thread1, arg) {
  20. (void)arg;
  21. // chRegSetThreadName("blinker1");
  22. while (true) {
  23. palClearLine(LINE_LED);
  24. chThdSleepMilliseconds(125);
  25. palSetLine(LINE_LED);
  26. chThdSleepMilliseconds(125);
  27. }
  28. }
  29. /*
  30. * Application entry point.
  31. */
  32. int main(void) {
  33. /*
  34. * System initializations.
  35. * - HAL initialization, this also initializes the configured device drivers
  36. * and performs the board-specific initializations.
  37. * - Kernel initialization, the main() function becomes a thread and the
  38. * RTOS is active.
  39. */
  40. halInit();
  41. chSysInit();
  42. /*
  43. * Creates the blinker thread.
  44. */
  45. chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  46. /*
  47. * Normal main() thread activity, in this demo it does nothing except
  48. * sleeping in a loop and check the button state, when the button is
  49. * pressed the test procedure is launched with output on the serial
  50. * driver 1.
  51. */
  52. while (true) {
  53. chThdSleepMilliseconds(500);
  54. }
  55. }