mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-05-04 06:33:03 +00:00
Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMouse demos (thanks to Brian Dickman).
Capitolised the "Descriptor_Search" and "Descriptor_Search_Comp" prefixes of the values in the DSearch_Return_ErrorCodes_t and DSearch_Comp_Return_ErrorCodes_t enums. Minor documentation improvements.
This commit is contained in:
@@ -52,6 +52,9 @@
|
||||
* - Removed "Host_" section of the function names in ConfigDescriptor.h, as most of the routines can now be used in device mode on the
|
||||
* device descriptor
|
||||
* - Renamed functions in the HID parser to have a "USB_" prefix and the acronym "HID" in the name
|
||||
* - Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMouse demos (thanks to Brian Dickman)
|
||||
* - Capitolised the "Descriptor_Search" and "Descriptor_Search_Comp" prefixes of the values in the DSearch_Return_ErrorCodes_t and
|
||||
* DSearch_Comp_Return_ErrorCodes_t enums
|
||||
*
|
||||
*
|
||||
* \section Sec_ChangeLog090401 Version 090401
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void HWB_Init(void)
|
||||
{
|
||||
// TODO: Initialize the appropriate port pin as an input here, with pullup
|
||||
// TODO: Initialize the appropriate port pin as an input here, with pull-up
|
||||
}
|
||||
|
||||
static inline bool HWB_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Determines the currently selected dataflash chip.
|
||||
*
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
/** Maximum returnable temperature from the Temperature_GetTemperature() function. */
|
||||
#define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET)
|
||||
|
||||
/* Psuedo-Functions: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Initializes the temperature sensor driver, including setting up the appropriate ADC channel.
|
||||
* This must be called before any other temperature sensor routines.
|
||||
|
||||
@@ -62,32 +62,7 @@
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Initializes the ADC, ready for conversions. This must be called before any other ADC operations.
|
||||
* The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and
|
||||
* prescaler masks.
|
||||
*/
|
||||
#define ADC_Init(mode) MACROS{ ADCSRA = ((1 << ADEN) | mode); }MACROE
|
||||
|
||||
/** Turns off the ADC. If this is called, any further ADC operations will require a call to the
|
||||
* ADC_Init() macro before the ADC can be used again.
|
||||
*/
|
||||
#define ADC_Off() MACROS{ ADCSRA = 0; }MACROE
|
||||
|
||||
/** Indicates if the ADC is enabled. This macro will return boolean true if the ADC subsystem is
|
||||
* currently enabled, or false otherwise.
|
||||
*/
|
||||
#define ADC_GetStatus() ((ADCSRA & (1 << ADEN)) ? true : false)
|
||||
|
||||
/** Indicates if the current ADC conversion is completed, or still in progress. This returns boolean
|
||||
* false if the reading is still taking place, or true if the conversion is complete and ready to be
|
||||
* read out with ADC_GetResult().
|
||||
*/
|
||||
#define ADC_IsReadingComplete() (!(ADCSRA & (1 << ADSC)))
|
||||
|
||||
/** Returns the result of the last conversion, as a 16-bit wide integer. */
|
||||
#define ADC_GetResult() ADC
|
||||
|
||||
/* Macros: */
|
||||
/** Reference mask, for using the voltage present at the AVR's AREF pin for the ADC reference. */
|
||||
#define ADC_REFERENCE_AREF 0
|
||||
|
||||
@@ -134,6 +109,51 @@
|
||||
/** Sets the ADC input clock to prescale by a factor of 128 the AVR's system clock. */
|
||||
#define ADC_PRESCALE_128 ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0))
|
||||
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Initializes the ADC, ready for conversions. This must be called before any other ADC operations.
|
||||
* The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and
|
||||
* prescaler masks.
|
||||
*
|
||||
* \param Mode Mask of ADC settings, including adjustment, prescale, mode and reference
|
||||
*/
|
||||
static inline void ADC_Init(uint8_t Mode);
|
||||
|
||||
/** Turns off the ADC. If this is called, any further ADC operations will require a call to
|
||||
* ADC_Init() before the ADC can be used again.
|
||||
*/
|
||||
static inline void ADC_Off(void);
|
||||
|
||||
/** Indicates if the ADC is currently enabled.
|
||||
*
|
||||
* \return Boolean true if the ADC subsystem is currently enabled, false otherwise.
|
||||
*/
|
||||
static inline bool ADC_GetStatus(void);
|
||||
|
||||
/** Indicates if the current ADC conversion is completed, or still in progress.
|
||||
*
|
||||
* \return Boolean false if the reading is still taking place, or true if the conversion is
|
||||
* complete and ready to be read out with ADC_GetResult()
|
||||
*/
|
||||
static inline bool ADC_IsReadingComplete(void);
|
||||
|
||||
/** Retrieves the conversion value of the last completed ADC conversion.
|
||||
*
|
||||
* \return The result of the last ADC conversion
|
||||
*/
|
||||
static inline uint16_t ADC_GetResult(void);
|
||||
#else
|
||||
#define ADC_Init(mode) MACROS{ ADCSRA = ((1 << ADEN) | mode); }MACROE
|
||||
|
||||
#define ADC_Off() MACROS{ ADCSRA = 0; }MACROE
|
||||
|
||||
#define ADC_GetStatus() ((ADCSRA & (1 << ADEN)) ? true : false)
|
||||
|
||||
#define ADC_IsReadingComplete() (!(ADCSRA & (1 << ADSC)))
|
||||
|
||||
#define ADC_GetResult() ADC
|
||||
#endif
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Configures the given ADC channel, ready for ADC conversions. This function sets the
|
||||
* associated port pin as an input and disables the digital portion of the I/O to reduce
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
*/
|
||||
#define SERIAL_2X_UBBRVAL(baud) (((F_CPU / 8) / baud) - 1)
|
||||
|
||||
/* Psuedo-Functions: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Indicates whether a character has been received through the USART.
|
||||
*
|
||||
|
||||
@@ -125,9 +125,9 @@ uint8_t USB_GetNextDescriptorComp_P(uint16_t* BytesRem, uint8_t** CurrConfigLoc,
|
||||
|
||||
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
|
||||
|
||||
if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != Descriptor_Search_NotFound)
|
||||
if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound)
|
||||
{
|
||||
if (ErrorCode == Descriptor_Search_Fail)
|
||||
if (ErrorCode == DESCRIPTOR_SEARCH_Fail)
|
||||
{
|
||||
*CurrConfigLoc = PrevDescLoc;
|
||||
*BytesRem = PrevBytesRem;
|
||||
@@ -137,5 +137,5 @@ uint8_t USB_GetNextDescriptorComp_P(uint16_t* BytesRem, uint8_t** CurrConfigLoc,
|
||||
}
|
||||
}
|
||||
|
||||
return Descriptor_Search_Comp_EndOfDescriptor;
|
||||
return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
*/
|
||||
#define DESCRIPTOR_COMPARATOR(name) uint8_t DCOMP_##name (void* const CurrentDescriptor)
|
||||
|
||||
/* Psuedo-Functions: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Searches for the next descriptor in the given configuration descriptor using a premade comparator
|
||||
* function. The routine updates the position and remaining configuration descriptor bytes values
|
||||
@@ -146,9 +146,9 @@
|
||||
* DESCRIPTOR_COMPARATOR(EndpointSearcher)
|
||||
* {
|
||||
* if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
|
||||
* return Descriptor_Search_Found;
|
||||
* return DESCRIPTOR_SEARCH_Found;
|
||||
* else
|
||||
* return Descriptor_Search_NotFound;
|
||||
* return DESCRIPTOR_SEARCH_NotFound;
|
||||
* }
|
||||
*
|
||||
* //...
|
||||
@@ -169,18 +169,18 @@
|
||||
/** Enum for return values of a descriptor comparator made with DESCRIPTOR_COMPARATOR. */
|
||||
enum DSearch_Return_ErrorCodes_t
|
||||
{
|
||||
Descriptor_Search_Found = 0, /**< Current descriptor matches comparator criteria. */
|
||||
Descriptor_Search_Fail = 1, /**< No further descriptor could possibly match criteria, fail the search. */
|
||||
Descriptor_Search_NotFound = 2, /**< Current descriptor does not match comparator criteria. */
|
||||
DESCRIPTOR_SEARCH_Found = 0, /**< Current descriptor matches comparator criteria. */
|
||||
DESCRIPTOR_SEARCH_Fail = 1, /**< No further descriptor could possibly match criteria, fail the search. */
|
||||
DESCRIPTOR_SEARCH_NotFound = 2, /**< Current descriptor does not match comparator criteria. */
|
||||
};
|
||||
|
||||
/** Enum for return values of USB_GetNextDescriptorComp(). */
|
||||
enum DSearch_Comp_Return_ErrorCodes_t
|
||||
{
|
||||
Descriptor_Search_Comp_Found = 0, /**< Configuration descriptor now points to descriptor which matches
|
||||
DESCRIPTOR_SEARCH_COMP_Found = 0, /**< Configuration descriptor now points to descriptor which matches
|
||||
* search criteria of the given comparator function. */
|
||||
Descriptor_Search_Comp_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
|
||||
Descriptor_Search_Comp_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */
|
||||
DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
|
||||
DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */
|
||||
};
|
||||
|
||||
/* Function Prototypes: */
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "HIDParser.h"
|
||||
|
||||
uint8_t ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_ReportInfo_t* const ParserData)
|
||||
uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_ReportInfo_t* const ParserData)
|
||||
{
|
||||
HID_StateTable_t StateTable[HID_STATETABLE_STACK_DEPTH];
|
||||
HID_StateTable_t* CurrStateTable = &StateTable[0];
|
||||
@@ -275,7 +275,7 @@ uint8_t ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID_Rep
|
||||
return HID_PARSE_Successful;
|
||||
}
|
||||
|
||||
bool GetReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem)
|
||||
bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const ReportItem)
|
||||
{
|
||||
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
|
||||
uint16_t CurrentBit = ReportItem->BitOffset;
|
||||
@@ -303,7 +303,7 @@ bool GetReportItemInfo(const uint8_t* ReportData, HID_ReportItem_t* const Report
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetReportItemInfo(uint8_t* ReportData, const HID_ReportItem_t* ReportItem)
|
||||
void USB_SetHIDReportItemInfo(uint8_t* ReportData, const HID_ReportItem_t* ReportItem)
|
||||
{
|
||||
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
|
||||
uint16_t CurrentBit = ReportItem->BitOffset;
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
/** \ingroup Group_USB
|
||||
* @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks
|
||||
*
|
||||
* Macros and enums for the stream callback routines in Endpoint.h and Pipe.c. This module contains the
|
||||
* code required to easily set up stream callback functions which can be used to force early abort of a
|
||||
* stream read/write process.
|
||||
* Macros and enums for the stream callback routines. This module contains the code required to easily set up
|
||||
* stream callback functions which can be used to force early abort of a stream read/write process.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
/** Indicates if the USB interface is currently suspended by the host when in device mode. When suspended,
|
||||
* the device should consume minimal power, and cannot communicate to the host. If Remote Wakeup is
|
||||
* supported by the device and USB_RemoteWakeupEnabled is true, suspension can be terminated by the device
|
||||
* by issuing a Remote Wakup request.
|
||||
* by issuing a Remote Wakeup request.
|
||||
*
|
||||
* \note This global is only present if the user application can be a USB device.
|
||||
*
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
*/
|
||||
#define USB_DEVICE_OPT_FULLSPEED (0 << 0)
|
||||
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Sends a Remote Wakeup request to the host. This signals to the host that the device should
|
||||
* be taken out of suspended mode, and communications should resume.
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
*/
|
||||
#define ENDPOINT_INT_OUT UEIENX, (1 << RXOUTE), UEINTX, (1 << RXOUTI)
|
||||
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Indicates the number of bytes currently stored in the current endpoint's selected bank.
|
||||
*
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
#define HOST_DEVICE_SETTLE_DELAY_MS 1500
|
||||
#endif
|
||||
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.
|
||||
* USB bus resets leave the default control pipe configured (if already configured).
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
*/
|
||||
#define USB_OTG_STP_DATA 0
|
||||
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Initiate a Host Negotiation Protocol request. This indicates to the other connected device
|
||||
* that the device wishes to change device/host roles.
|
||||
|
||||
@@ -242,7 +242,7 @@
|
||||
*/
|
||||
#define PIPE_INT_STALL UPIENX, (1 << RXSTALLE), UPINTX, (1 << RXSTALLI)
|
||||
|
||||
/* Psuedo-Function Macros: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Indicates the number of bytes currently stored in the current pipes's selected bank.
|
||||
*
|
||||
@@ -367,7 +367,7 @@
|
||||
*
|
||||
* \see Pipe_GetErrorFlags() macro for information on retrieving the exact error flag.
|
||||
*
|
||||
* \return Boolean true if an error has ocurred on the selected pipe, false otherwise
|
||||
* \return Boolean true if an error has occurred on the selected pipe, false otherwise
|
||||
*/
|
||||
static inline bool Pipe_IsError(void);
|
||||
|
||||
@@ -379,7 +379,7 @@
|
||||
/** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This
|
||||
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.
|
||||
*
|
||||
* \return Mask comprising of PIPE_ERRORFLAG_* bits indicating what error has ocurred on the selected pipe
|
||||
* \return Mask comprising of PIPE_ERRORFLAG_* bits indicating what error has occurred on the selected pipe
|
||||
*/
|
||||
static inline uint8_t Pipe_GetErrorFlags(void);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* on the new endpoint management macros.
|
||||
* - The Endpoint_ReadWriteAllowed() macro has been renamed to Endpoint_IsReadWriteAllowed() to be more consistent with the rest of
|
||||
* the API naming scheme.
|
||||
* - The Endpoint_IsSetupINReady() and Endpoint_IsOutReceived() macros have been renamed to Endpoint_IsINReady() and
|
||||
* - The Endpoint_IsSetupINReady() and Endpoint_IsSetupOutReceived() macros have been renamed to Endpoint_IsINReady() and
|
||||
* Endpoint_IsOUTReceived() respectively.
|
||||
* - The Endpoint_IsSetupReceived() macro has been renamed to Endpoint_IsSETUPReceived().
|
||||
* - The Endpoint_ClearSetupReceived() macro has been renamed to Endpoint_ClearControlSETUP().
|
||||
@@ -60,7 +60,8 @@
|
||||
* - Functions in the ConfigDescriptor.h header file no longer have "Host_" as part of their names.
|
||||
* - The ProcessHIDReport() has been renamed to USB_ProcessHIDReport(), GetReportItemInfo() has been renamed to USB_GetHIDReportItemInfo()
|
||||
* and SetReportItemInfo() has been renamed to USB_GetHIDReportItemInfo().
|
||||
*
|
||||
* - The values of the DSearch_Return_ErrorCodes_t and DSearch_Comp_Return_ErrorCodes_t enums have had their respective "Descriptor_Search"
|
||||
* and "Descriptor_Search_Comp" prefixes changed to all caps.
|
||||
*
|
||||
* \section Sec_Migration090401 Migrating from 090209 to 090401
|
||||
*
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
/** Task status mode constant, for passing to Scheduler_SetTaskMode() or Scheduler_SetGroupTaskMode(). */
|
||||
#define TASK_STOP false
|
||||
|
||||
/* Psuedo-Functions: */
|
||||
/* Pseudo-Function Macros: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Starts the scheduler in its infinite loop, executing running tasks. This should be placed at the end
|
||||
* of the user application's main() function, as it can never return to the calling function.
|
||||
|
||||
Reference in New Issue
Block a user