Firmware for the remote control translator
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

main.c 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Remote Control Translator Firmware
  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..2016 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. #include "ch_test.h"
  33. /*
  34. * Green LED blinker thread, times are in milliseconds.
  35. */
  36. static THD_WORKING_AREA(waThread1, 128);
  37. static THD_FUNCTION(Thread1, arg) {
  38. (void)arg;
  39. chRegSetThreadName("blinker");
  40. while (true) {
  41. palClearPad(GPIOC, GPIOC_LED);
  42. chThdSleepMilliseconds(500);
  43. palSetPad(GPIOC, GPIOC_LED);
  44. chThdSleepMilliseconds(500);
  45. }
  46. }
  47. /*
  48. * Application entry point.
  49. */
  50. int main(void) {
  51. /*
  52. * System initializations.
  53. * - HAL initialization, this also initializes the configured device drivers
  54. * and performs the board-specific initializations.
  55. * - Kernel initialization, the main() function becomes a thread and the
  56. * RTOS is active.
  57. */
  58. halInit();
  59. chSysInit();
  60. /*
  61. * Activates the serial driver 2 using the driver default configuration.
  62. */
  63. sdStart(&SD2, NULL);
  64. /*
  65. * Creates the blinker thread.
  66. */
  67. chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  68. /*
  69. * Normal main() thread activity, in this demo it does nothing except
  70. * sleeping in a loop and check the button state.
  71. */
  72. while (true) {
  73. //if (!palReadPad(GPIOC, GPIOC_BUTTON))
  74. // test_execute((BaseSequentialStream *)&SD2);
  75. chThdSleepMilliseconds(500);
  76. }
  77. }