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