PD Buddy Sink Firmware
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * PD Buddy - USB Power Delivery for everyone
  3. * Copyright (C) 2017 Clayton G. Hobbs <clay@lakeserv.net>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /*
  19. ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
  20. Licensed under the Apache License, Version 2.0 (the "License");
  21. you may not use this file except in compliance with the License.
  22. You may obtain a copy of the License at
  23. http://www.apache.org/licenses/LICENSE-2.0
  24. Unless required by applicable law or agreed to in writing, software
  25. distributed under the License is distributed on an "AS IS" BASIS,
  26. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  27. See the License for the specific language governing permissions and
  28. limitations under the License.
  29. */
  30. #include "ch.h"
  31. #include "hal.h"
  32. /*
  33. * LED blinker thread, times are in milliseconds.
  34. */
  35. static THD_WORKING_AREA(waThread1, 128);
  36. static THD_FUNCTION(Thread1, arg) {
  37. (void)arg;
  38. // chRegSetThreadName("blinker1");
  39. while (true) {
  40. palClearLine(LINE_LED);
  41. chThdSleepMilliseconds(125);
  42. palSetLine(LINE_LED);
  43. chThdSleepMilliseconds(125);
  44. }
  45. }
  46. /*
  47. * Application entry point.
  48. */
  49. int main(void) {
  50. /*
  51. * System initializations.
  52. * - HAL initialization, this also initializes the configured device drivers
  53. * and performs the board-specific initializations.
  54. * - Kernel initialization, the main() function becomes a thread and the
  55. * RTOS is active.
  56. */
  57. halInit();
  58. chSysInit();
  59. /*
  60. * Creates the blinker thread.
  61. */
  62. chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  63. /*
  64. * Normal main() thread activity, in this demo it does nothing except
  65. * sleeping in a loop and check the button state, when the button is
  66. * pressed the test procedure is launched with output on the serial
  67. * driver 1.
  68. */
  69. while (true) {
  70. chThdSleepMilliseconds(500);
  71. }
  72. }