/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers * * Copyright ©2019 Dmitry Filimonchuk * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _USB_HID_POWER_DEVICES_H_ #define _USB_HID_POWER_DEVICES_H_ /**\ingroup USB_HID * \addtogroup USB_HID_POWER HID Usage Tables for Power Devices. * \brief Contains USB HID Usage tables definitions for HID Power Devices. * \details This module based on * + [Universal Serial Bus Usage Tables for HID Power Devices. Release 1.0](https://usb.org/sites/default/files/documents/pdcv10.pdf) * @{ */ /** * Name | Physical Unit | HID unit | HID unit code | HID unit exponent | HID size * -----------------|---------------|----------|---------------|-------------------|--------- * AC voltage | Volt | Volt | 0x00F0D121 | 7 | 8 * AC current | centiAmp | Amp | 0x00100001 | -2 | 16 * Frequency | Hertz | Hertz | 0xF001 | 0 | 8 * DC voltage | centiVolt | Volt | 0x00F0D121 | 5 | 16 * Time | second | s | 0x1001 | 0 | 16 * DC current | centiAmp | Amp | 0x00100001 | -2 | 16 * Power | VA or W | VA or W | 0xD121 | 7 | 16 * Temperature | K degree | K degree | 0x00010001 | 0 | 16 * Battery capacity | AmpSec | AmpSec | 0x00101001 | 0 | 24 * */ /**\name Measures and Physical Units ant it's exponents in Reports according to this table.*/ //@{ /**AC voltage unit code. Volt.*/ #define HID_POWER_UNIT_AC_VOLTAGE 0x67, 0x21, 0xD1, 0xF0, 0x00, 0x55, 0x07 /**AC current unit code. centiAmpere.*/ #define HID_POWER_UNIT_AC_CURRENT 0x67, 0x01, 0x00, 0x10, 0x00, 0x55, 0xFE /**Frequency unit code. Hertz.*/ #define HID_POWER_UNIT_FREQUENCY 0x66, 0x01, 0xF0, 0x55, 0x00 /**DC voltage unit code. Volt.*/ #define HID_POWER_UNIT_DC_VOLTAGE 0x67, 0x21, 0xD1, 0xF0, 0x00, 0x55, 0x07 /**Time unit code. Second.*/ #define HID_POWER_UNIT_TIME 0x66, 0x01, 0x10, 0x55, 0x00 /**DC current unit code. centiAmpere.*/ #define HID_POWER_UNIT_DC_CURRENT 0x67, 0x01, 0x00, 0x10, 0x00, 0x55, 0xFE /**Power unic code. Watt.*/ #define HID_POWER_UNIT_POWER 0x66, 0x21, 0xD1, 0x55, 0x07 /**Temperature unit code. K degree.*/ #define HID_POWER_UNIT_TEMPERATURE 0x67, 0x01, 0x00, 0x01, 0x00, 0x55, 0x00 /**Battery capacity unit code. AmpSec.*/ #define HID_POWER_UNIT_BATTERY_CAPACITY 0x67, 0x01, 0x10, 0x10, 0x00, 0x55, 0x00 //@} /** Macro to encode battery manufacturing date. * \param y Year [1980 - 2108] * \param m Month [1 - 12] * \param d Day [1 - 31] */ #define BATTERY_MGF_DATE(y,m,d) (((((y) - 1980) & 0x7F) << 9) + (((m) & 0x0F) << 5) + ((d) & 0x1F)) /** \addtogroup HID_POWER_DEVICE Power Device Page */ //@{ #define HID_POWER_PAGE 0x84 /**