Test.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2018.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaims all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. #include <LUFA/Common/Common.h>
  27. #include <LUFA/Drivers/Board/Board.h>
  28. #include <LUFA/Drivers/Board/Buttons.h>
  29. #include <LUFA/Drivers/Board/Dataflash.h>
  30. #include <LUFA/Drivers/Board/LEDs.h>
  31. #include <LUFA/Drivers/Board/Joystick.h>
  32. #if defined(BOARD_HAS_BUTTONS) == defined(BOARD_DUMMY_BUTTONS_IMPLEMENTATION)
  33. #error Mismatch between BOARD_HAS_BUTTONS and implementation.
  34. #endif
  35. #if defined(BOARD_HAS_DATAFLASH) == defined(BOARD_DUMMY_DATAFLASH_IMPLEMENTATION)
  36. #error Mismatch between BOARD_HAS_DATAFLASH and implementation.
  37. #endif
  38. #if defined(BOARD_HAS_LEDS) == defined(BOARD_DUMMY_LEDS_IMPLEMENTATION)
  39. #error Mismatch between BOARD_HAS_LEDS and implementation.
  40. #endif
  41. #if defined(BOARD_HAS_JOYSTICK) == defined(BOARD_DUMMY_JOYSTICK_IMPLEMENTATION)
  42. #error Mismatch between BOARD_HAS_JOYSTICK and implementation.
  43. #endif
  44. int main(void)
  45. {
  46. uint_reg_t Dummy;
  47. /* =============================
  48. * Buttons Compile Check
  49. * ============================= */
  50. // cppcheck-suppress redundantAssignment
  51. Dummy = BUTTONS_BUTTON1;
  52. Buttons_Init();
  53. // cppcheck-suppress redundantAssignment
  54. Dummy = Buttons_GetStatus();
  55. Buttons_Disable();
  56. /* =============================
  57. * Dataflash Compile Check
  58. * ============================= */
  59. // cppcheck-suppress redundantAssignment
  60. Dummy = DATAFLASH_TOTALCHIPS + DATAFLASH_NO_CHIP + DATAFLASH_CHIP1 + DATAFLASH_PAGE_SIZE + DATAFLASH_PAGES;
  61. Dataflash_Init();
  62. Dataflash_TransferByte(0);
  63. Dataflash_SendByte(0);
  64. // cppcheck-suppress redundantAssignment
  65. Dummy = Dataflash_ReceiveByte();
  66. // cppcheck-suppress redundantAssignment
  67. Dummy = Dataflash_GetSelectedChip();
  68. Dataflash_SelectChip(DATAFLASH_CHIP1);
  69. Dataflash_DeselectChip();
  70. Dataflash_SelectChipFromPage(0);
  71. Dataflash_ToggleSelectedChipCS();
  72. Dataflash_WaitWhileBusy();
  73. Dataflash_SendAddressBytes(0, 0);
  74. /* =============================
  75. * LEDs Compile Check
  76. * ============================= */
  77. // cppcheck-suppress redundantAssignment
  78. Dummy = LEDS_LED1 + LEDS_LED2 + LEDS_LED3 + LEDS_LED4;
  79. LEDs_Init();
  80. LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
  81. LEDs_TurnOffLEDs(LEDS_ALL_LEDS);
  82. LEDs_SetAllLEDs(LEDS_ALL_LEDS);
  83. LEDs_ChangeLEDs(LEDS_ALL_LEDS, LEDS_NO_LEDS);
  84. LEDs_ToggleLEDs(LEDS_ALL_LEDS);
  85. // cppcheck-suppress redundantAssignment
  86. Dummy = LEDs_GetLEDs();
  87. LEDs_Disable();
  88. /* =============================
  89. * Joystick Compile Check
  90. * ============================= */
  91. // cppcheck-suppress redundantAssignment
  92. Dummy = JOY_LEFT + JOY_RIGHT + JOY_UP + JOY_DOWN + JOY_PRESS;
  93. Joystick_Init();
  94. // cppcheck-suppress redundantAssignment
  95. Dummy = Joystick_GetStatus();
  96. Joystick_Disable();
  97. (void)Dummy;
  98. }