aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-05-19 21:49:36 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-05-19 21:49:36 +0200
commit2bb012d4cbff052ff186c82cc2269b2362118972 (patch)
tree24fe391ddc37a88dae958e039666be1e18e70c66 /LUFA/Drivers
parent654baf7d609963cf25da328f2b3fc8ced0eaf68a (diff)
downloadlufa-2bb012d4cbff052ff186c82cc2269b2362118972.tar.gz
lufa-2bb012d4cbff052ff186c82cc2269b2362118972.tar.bz2
lufa-2bb012d4cbff052ff186c82cc2269b2362118972.zip
Add stub functions to all board drivers, so that demos can be compiled with BOARD=NONE.
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r--LUFA/Drivers/Board/Buttons.h10
-rw-r--r--LUFA/Drivers/Board/Dataflash.h18
-rw-r--r--LUFA/Drivers/Board/Joystick.h20
3 files changed, 36 insertions, 12 deletions
diff --git a/LUFA/Drivers/Board/Buttons.h b/LUFA/Drivers/Board/Buttons.h
index 5c9cd75d5..9e319359a 100644
--- a/LUFA/Drivers/Board/Buttons.h
+++ b/LUFA/Drivers/Board/Buttons.h
@@ -68,13 +68,13 @@
* \code
* // Initialize the button driver before first use
* Buttons_Init();
- *
+ *
* printf("Waiting for button press...\r\n");
- *
+ *
* // Loop until a board button has been pressed
* uint8_t ButtonPress;
* while (!(ButtonPress = Buttons_GetStatus())) {};
- *
+ *
* // Display which button was pressed (assuming two board buttons)
* printf("Button pressed: %s\r\n", (ButtonPress == BUTTONS_BUTTON1) ? "Button 1" : "Button 2");
* \endcode
@@ -92,7 +92,9 @@
#include "../../Common/Common.h"
#if (BOARD == BOARD_NONE)
- #error The Board Buttons driver cannot be used if the makefile BOARD option is not set.
+ #define BUTTONS_BUTTON1 0
+ static inline void Buttons_Init(void) {};
+ static inline uint_reg_t Buttons_GetStatus(void) { return 0; };
#elif (BOARD == BOARD_USBKEY)
#include "AVR8/USBKEY/Buttons.h"
#elif (BOARD == BOARD_STK525)
diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h
index cc4aa2ee2..7b99371ed 100644
--- a/LUFA/Drivers/Board/Dataflash.h
+++ b/LUFA/Drivers/Board/Dataflash.h
@@ -220,7 +220,23 @@
/* Includes: */
#if (BOARD == BOARD_NONE)
- #error The Board Dataflash driver cannot be used if the makefile BOARD option is not set.
+ #define DATAFLASH_TOTALCHIPS 0
+ #define DATAFLASH_NO_CHIP 0
+ #define DATAFLASH_CHIP1 0
+ #define DATAFLASH_PAGE_SIZE 0
+ #define DATAFLASH_PAGES 0
+ static inline void Dataflash_Init(void) {};
+ static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) { return 0; };
+ static inline void Dataflash_SendByte(const uint8_t Byte) {};
+ static inline uint8_t Dataflash_ReceiveByte(void) { return 0; };
+ static inline uint8_t Dataflash_GetSelectedChip(void) { return 0; };
+ static inline void Dataflash_SelectChip(const uint8_t ChipMask) {};
+ static inline void Dataflash_DeselectChip(void) {};
+ static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress) {};
+ static inline void Dataflash_ToggleSelectedChipCS(void) {};
+ static inline void Dataflash_WaitWhileBusy(void) {};
+ static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
+ const uint16_t BufferByte) {};
#elif (BOARD == BOARD_USBKEY)
#include "AVR8/USBKEY/Dataflash.h"
#elif (BOARD == BOARD_STK525)
diff --git a/LUFA/Drivers/Board/Joystick.h b/LUFA/Drivers/Board/Joystick.h
index e39c225e4..c3b306e06 100644
--- a/LUFA/Drivers/Board/Joystick.h
+++ b/LUFA/Drivers/Board/Joystick.h
@@ -67,22 +67,22 @@
* \code
* // Initialize the board Joystick driver before first use
* Joystick_Init();
- *
+ *
* printf("Waiting for joystick movement...\r\n");
- *
+ *
* // Loop until a the joystick has been moved
* uint8_t JoystickMovement;
* while (!(JoystickMovement = Joystick_GetStatus())) {};
- *
+ *
* // Display which direction the joystick was moved in
* printf("Joystick moved:\r\n");
- *
+ *
* if (JoystickMovement & (JOY_UP | JOY_DOWN))
* printf("%s ", (JoystickMovement & JOY_UP) ? "Up" : "Down");
- *
+ *
* if (JoystickMovement & (JOY_LEFT | JOY_RIGHT))
* printf("%s ", (JoystickMovement & JOY_LEFT) ? "Left" : "Right");
- *
+ *
* if (JoystickMovement & JOY_PRESS)
* printf("Pressed");
* \endcode
@@ -100,7 +100,13 @@
#include "../../Common/Common.h"
#if (BOARD == BOARD_NONE)
- #error The Board Joystick driver cannot be used if the makefile BOARD option is not set.
+ #define JOY_UP 0
+ #define JOY_DOWN 0
+ #define JOY_LEFT 0
+ #define JOY_RIGHT 0
+ #define JOY_PRESS 0
+ static inline void Joystick_Init(void) {};
+ static inline uint_reg_t Joystick_GetStatus(void) { return 0; };
#elif (BOARD == BOARD_USBKEY)
#include "AVR8/USBKEY/Joystick.h"
#elif (BOARD == BOARD_STK525)