mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Add new header files.
This commit is contained in:
parent
156aa31a45
commit
3afbce77f3
2 changed files with 110 additions and 0 deletions
57
macros.h
Normal file
57
macros.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* File: macros.h
|
||||
* Author: AJK
|
||||
*
|
||||
* Created on September 23, 2013, 12:31 AM
|
||||
*/
|
||||
|
||||
#ifndef MACROS_H
|
||||
#define MACROS_H
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HANDY MACROS
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
|
||||
#ifndef __BYTE_GRABBING_DEFINED__
|
||||
#define __BYTE_GRABBING_DEFINED__ 1
|
||||
#ifdef BROKEN_OPTIMIZER_LITTLE_ENDIAN
|
||||
// Note: Use this if your compiler generates horrible assembler!
|
||||
#define BGRAB0(__usi__) (((uint8_t *)&(__usi__))[0])
|
||||
#define BGRAB1(__usi__) (((uint8_t *)&(__usi__))[1])
|
||||
#define BGRAB2(__usi__) (((uint8_t *)&(__usi__))[2])
|
||||
#define BGRAB3(__usi__) (((uint8_t *)&(__usi__))[3])
|
||||
#define BGRAB4(__usi__) (((uint8_t *)&(__usi__))[4])
|
||||
#define BGRAB5(__usi__) (((uint8_t *)&(__usi__))[5])
|
||||
#define BGRAB6(__usi__) (((uint8_t *)&(__usi__))[6])
|
||||
#define BGRAB7(__usi__) (((uint8_t *)&(__usi__))[7])
|
||||
#else
|
||||
// Note: The cast alone to uint8_t is actually enough.
|
||||
// GCC throws out the "& 0xff", and the size is no different.
|
||||
// Some compilers need it.
|
||||
#define BGRAB0(__usi__) ((uint8_t)((__usi__) & 0xff ))
|
||||
#define BGRAB1(__usi__) ((uint8_t)(((__usi__) >> 8) & 0xff))
|
||||
#define BGRAB2(__usi__) ((uint8_t)(((__usi__) >> 16) & 0xff))
|
||||
#define BGRAB3(__usi__) ((uint8_t)(((__usi__) >> 24) & 0xff))
|
||||
#define BGRAB4(__usi__) ((uint8_t)(((__usi__) >> 32) & 0xff))
|
||||
#define BGRAB5(__usi__) ((uint8_t)(((__usi__) >> 40) & 0xff))
|
||||
#define BGRAB6(__usi__) ((uint8_t)(((__usi__) >> 48) & 0xff))
|
||||
#define BGRAB7(__usi__) ((uint8_t)(((__usi__) >> 56) & 0xff))
|
||||
#endif
|
||||
#define BOVER1(__usi__) ((uint16_t)(__usi__) << 8)
|
||||
#define BOVER2(__usi__) ((uint32_t)(__usi__) << 16)
|
||||
#define BOVER3(__usi__) ((uint32_t)(__usi__) << 24)
|
||||
#define BOVER4(__usi__) ((uint64_t)(__usi__) << 32)
|
||||
#define BOVER5(__usi__) ((uint64_t)(__usi__) << 40)
|
||||
#define BOVER6(__usi__) ((uint64_t)(__usi__) << 48)
|
||||
#define BOVER7(__usi__) ((uint64_t)(__usi__) << 56)
|
||||
|
||||
// These are the smallest and fastest ways I have found so far in pure C/C++.
|
||||
#define BMAKE16(__usc1__,__usc0__) ((uint16_t)((uint16_t)(__usc0__) | (uint16_t)BOVER1(__usc1__)))
|
||||
#define BMAKE32(__usc3__,__usc2__,__usc1__,__usc0__) ((uint32_t)((uint32_t)(__usc0__) | (uint32_t)BOVER1(__usc1__) | (uint32_t)BOVER2(__usc2__) | (uint32_t)BOVER3(__usc3__)))
|
||||
#define BMAKE64(__usc7__,__usc6__,__usc5__,__usc4__,__usc3__,__usc2__,__usc1__,__usc0__) ((uint64_t)((uint64_t)__usc0__ | (uint64_t)BOVER1(__usc1__) | (uint64_t)BOVER2(__usc2__) | (uint64_t)BOVER3(__usc3__) | (uint64_t)BOVER4(__usc4__) | (uint64_t)BOVER5(__usc5__) | (uint64_t)BOVER6(__usc6__) | (uint64_t)BOVER1(__usc7__)))
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MACROS_H */
|
||||
|
53
settings.h
Normal file
53
settings.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* File: settings.h
|
||||
* Author: AJK
|
||||
*
|
||||
* Created on September 23, 2013, 12:00 AM
|
||||
*/
|
||||
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// CORE
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//#define BOARD_BLACK_WIDDOW
|
||||
// uncomment to activate
|
||||
//#define DEBUG_USB_HOST
|
||||
|
||||
#ifndef USB_HOST_SERIAL
|
||||
#define USB_HOST_SERIAL Serial
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// MASS STORAGE
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
|
||||
// Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
|
||||
// Each LUN needs ~13 bytes to be able to track the state of each unit.
|
||||
#ifndef MASS_MAX_SUPPORTED_LUN
|
||||
#define MASS_MAX_SUPPORTED_LUN 8
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AUTOMATIC Settings
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(ARDUINO) && ARDUINO >=100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
||||
#define BOARD_TEENSY_PLUS_PLUS
|
||||
#endif
|
||||
|
||||
#endif /* SETTINGS_H */
|
||||
|
Loading…
Reference in a new issue