Improve the BoardDriver build test, check for mismatches board hardware support macros or missing driver macros.

pull/1469/head
Dean Camera 12 years ago
parent c8f2269804
commit 85a0e75c60

@ -57,6 +57,8 @@
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
#define BOARD_DUMMY_BUTTONS_IMPLEMENTATION
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */

@ -52,33 +52,35 @@
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
#define BOARD_DUMMY_DATAFLASH_IMPLEMENTATION
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
#define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all Dataflashes
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
#define DATAFLASH_CHIPCS_MASK 0
#define DATAFLASH_CHIPCS_DDR 0
#define DATAFLASH_CHIPCS_PORT 0
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
#define DATAFLASH_TOTALCHIPS 1 // TODO: Replace with the number of Dataflashes on the board, max 2
#define DATAFLASH_TOTALCHIPS 1
/** Mask for no dataflash chip selected. */
#define DATAFLASH_NO_CHIP 0
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 // TODO: Replace with mask with the pin attached to the first Dataflash /CS set
#define DATAFLASH_CHIP1 0
/** Mask for the second dataflash chip selected. */
#define DATAFLASH_CHIP2 // TODO: Replace with mask with the pin attached to the second Dataflash /CS set
#define DATAFLASH_CHIP2 0
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
#define DATAFLASH_PAGE_SIZE 0
/** Total number of pages inside each of the board's dataflash ICs. */
#define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs
#define DATAFLASH_PAGES 0
/* Inline Functions: */
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.

@ -57,22 +57,24 @@
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
#endif
#define BOARD_DUMMY_JOYSTICK_IMPLEMENTATION
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
#define JOY_LEFT // TODO: Add mask to indicate joystick left position here
#define JOY_LEFT 0
/** Mask for the joystick being pushed in the right direction. */
#define JOY_RIGHT // TODO: Add mask to indicate joystick right position here
#define JOY_RIGHT 0
/** Mask for the joystick being pushed in the upward direction. */
#define JOY_UP // TODO: Add mask to indicate joystick up position here
#define JOY_UP 0
/** Mask for the joystick being pushed in the downward direction. */
#define JOY_DOWN // TODO: Add mask to indicate joystick down position here
#define JOY_DOWN 0
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
#define JOY_PRESS 0
/* Inline Functions: */
#if !defined(__DOXYGEN__)

@ -57,6 +57,8 @@
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
#endif
#define BOARD_DUMMY_LEDS_IMPLEMENTATION
/* Public Interface - May be used in end-application: */
/* Macros: */
/** LED mask for the first LED on the board. */

@ -35,6 +35,22 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
#if defined(BOARD_HAS_BUTTONS) == defined(BOARD_DUMMY_BUTTONS_IMPLEMENTATION)
#error Mismatch between BOARD_HAS_BUTTONS and implementation.
#endif
#if defined(BOARD_HAS_DATAFLASH) == defined(BOARD_DUMMY_DATAFLASH_IMPLEMENTATION)
#error Mismatch between BOARD_HAS_DATAFLASH and implementation.
#endif
#if defined(BOARD_HAS_LEDS) == defined(BOARD_DUMMY_LEDS_IMPLEMENTATION)
#error Mismatch between BOARD_HAS_LEDS and implementation.
#endif
#if defined(BOARD_HAS_JOYSTICK) == defined(BOARD_DUMMY_JOYSTICK_IMPLEMENTATION)
#error Mismatch between BOARD_HAS_JOYSTICK and implementation.
#endif
int main(void)
{
uint_reg_t Dummy;
@ -42,6 +58,8 @@ int main(void)
/* =============================
* Buttons Compile Check
* ============================= */
// cppcheck-suppress redundantAssignment
Dummy = BUTTONS_BUTTON1;
Buttons_Init();
// cppcheck-suppress redundantAssignment
Dummy = Buttons_GetStatus();
@ -50,6 +68,8 @@ int main(void)
/* =============================
* Dataflash Compile Check
* ============================= */
// cppcheck-suppress redundantAssignment
Dummy = DATAFLASH_TOTALCHIPS + DATAFLASH_NO_CHIP + DATAFLASH_CHIP1 + DATAFLASH_PAGE_SIZE + DATAFLASH_PAGES;
Dataflash_Init();
Dataflash_TransferByte(0);
Dataflash_SendByte(0);
@ -57,7 +77,7 @@ int main(void)
Dummy = Dataflash_ReceiveByte();
// cppcheck-suppress redundantAssignment
Dummy = Dataflash_GetSelectedChip();
Dataflash_SelectChip(0);
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_DeselectChip();
Dataflash_SelectChipFromPage(0);
Dataflash_ToggleSelectedChipCS();
@ -67,6 +87,8 @@ int main(void)
/* =============================
* LEDs Compile Check
* ============================= */
// cppcheck-suppress redundantAssignment
Dummy = LEDS_LED1 + LEDS_LED2 + LEDS_LED3 + LEDS_LED4;
LEDs_Init();
LEDs_TurnOnLEDs(LEDS_ALL_LEDS);
LEDs_TurnOffLEDs(LEDS_ALL_LEDS);
@ -80,6 +102,8 @@ int main(void)
/* =============================
* Joystick Compile Check
* ============================= */
// cppcheck-suppress redundantAssignment
Dummy = JOY_LEFT + JOY_RIGHT + JOY_UP + JOY_DOWN + JOY_PRESS;
Joystick_Init();
// cppcheck-suppress redundantAssignment
Dummy = Joystick_GetStatus();

Loading…
Cancel
Save