淺析STM32之usbh_def.H

【溫故而知新】類似文章淺析USB HID ReportDesc (HID報告描述符)

現在將en.stm32cubef1\STM32Cube_FW_F1_V1.4.0\Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_def.H

/********************************************************************************* @file    usbh_def.h* @author  MCD Application Team* @version V3.2.2* @date    07-July-2015* @brief   Definitions used in the USB host library******************************************************************************* @attention** <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>** Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2** 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.********************************************************************************//* Define to prevent recursive  ----------------------------------------------*/
#ifndef  USBH_DEF_H
#define  USBH_DEF_H#ifdef __cplusplusextern "C" {
#endif/* Includes ------------------------------------------------------------------*/
#include "usbh_conf.h"/** @addtogroup USBH_LIB* @{*//** @addtogroup USBH_LIB_CORE
* @{
*//** @defgroup USBH_DEF* @brief This file is includes USB descriptors* @{*/ #ifndef NULL
#define NULL  0
#endif#ifndef FALSE
#define FALSE 0
#endif#ifndef TRUE
#define TRUE  1
#endif#define ValBit(VAR,POS)                               (VAR & (1 << POS))
#define SetBit(VAR,POS)                               (VAR |= (1 << POS))
#define ClrBit(VAR,POS)                               (VAR &= ((1 << POS)^255))#define  LE16(addr)             (((uint16_t)(*((uint8_t *)(addr))))\+ (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))#define  LE16S(addr)              (uint16_t)(LE16((addr)))#define  LE32(addr)              ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \(((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \(((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16) + \(((uint32_t)(*(((uint8_t *)(addr)) + 3))) << 24)))#define  LE64(addr)              ((((uint64_t)(*(((uint8_t *)(addr)) + 0))) + \(((uint64_t)(*(((uint8_t *)(addr)) + 1))) <<  8) +\(((uint64_t)(*(((uint8_t *)(addr)) + 2))) << 16) +\(((uint64_t)(*(((uint8_t *)(addr)) + 3))) << 24) +\(((uint64_t)(*(((uint8_t *)(addr)) + 4))) << 32) +\(((uint64_t)(*(((uint8_t *)(addr)) + 5))) << 40) +\(((uint64_t)(*(((uint8_t *)(addr)) + 6))) << 48) +\(((uint64_t)(*(((uint8_t *)(addr)) + 7))) << 56)))#define  LE24(addr)              ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \(((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \(((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16)))#define  LE32S(addr)              (int32_t)(LE32((addr)))#define  USB_LEN_DESC_HDR                               0x02
#define  USB_LEN_DEV_DESC                               0x12
#define  USB_LEN_CFG_DESC                               0x09
#define  USB_LEN_IF_DESC                                0x09
#define  USB_LEN_EP_DESC                                0x07
#define  USB_LEN_OTG_DESC                               0x03
#define  USB_LEN_SETUP_PKT                              0x08/* bmRequestType :D7 Data Phase Transfer Direction  */
#define  USB_REQ_DIR_MASK                               0x80
#define  USB_H2D                                        0x00
#define  USB_D2H                                        0x80/* bmRequestType D6..5 Type */
#define  USB_REQ_TYPE_STANDARD                          0x00
#define  USB_REQ_TYPE_CLASS                             0x20
#define  USB_REQ_TYPE_VENDOR                            0x40
#define  USB_REQ_TYPE_RESERVED                          0x60/* bmRequestType D4..0 Recipient */
#define  USB_REQ_RECIPIENT_DEVICE                       0x00
#define  USB_REQ_RECIPIENT_INTERFACE                    0x01
#define  USB_REQ_RECIPIENT_ENDPOINT                     0x02
#define  USB_REQ_RECIPIENT_OTHER                        0x03/* Table 9-4. Standard Request Codes  */
/* bRequest , Value */
#define  USB_REQ_GET_STATUS                             0x00
#define  USB_REQ_CLEAR_FEATURE                          0x01
#define  USB_REQ_SET_FEATURE                            0x03
#define  USB_REQ_SET_ADDRESS                            0x05
#define  USB_REQ_GET_DESCRIPTOR                         0x06
#define  USB_REQ_SET_DESCRIPTOR                         0x07
#define  USB_REQ_GET_CONFIGURATION                      0x08
#define  USB_REQ_SET_CONFIGURATION                      0x09
#define  USB_REQ_GET_INTERFACE                          0x0A
#define  USB_REQ_SET_INTERFACE                          0x0B
#define  USB_REQ_SYNCH_FRAME                            0x0C/* Table 9-5. Descriptor Types of USB Specifications */
#define  USB_DESC_TYPE_DEVICE                              1
#define  USB_DESC_TYPE_CONFIGURATION                       2
#define  USB_DESC_TYPE_STRING                              3
#define  USB_DESC_TYPE_INTERFACE                           4
#define  USB_DESC_TYPE_ENDPOINT                            5
#define  USB_DESC_TYPE_DEVICE_QUALIFIER                    6
#define  USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION           7
#define  USB_DESC_TYPE_INTERFACE_POWER                     8
#define  USB_DESC_TYPE_HID                                 0x21
#define  USB_DESC_TYPE_HID_REPORT                          0x22#define USB_DEVICE_DESC_SIZE                               18
#define USB_CONFIGURATION_DESC_SIZE                        9
#define USB_HID_DESC_SIZE                                  9
#define USB_INTERFACE_DESC_SIZE                            9
#define USB_ENDPOINT_DESC_SIZE                             7/* Descriptor Type and Descriptor Index  */
/* Use the following values when calling the function USBH_GetDescriptor  */
#define  USB_DESC_DEVICE                    ((USB_DESC_TYPE_DEVICE << 8) & 0xFF00)
#define  USB_DESC_CONFIGURATION             ((USB_DESC_TYPE_CONFIGURATION << 8) & 0xFF00)
#define  USB_DESC_STRING                    ((USB_DESC_TYPE_STRING << 8) & 0xFF00)
#define  USB_DESC_INTERFACE                 ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
#define  USB_DESC_ENDPOINT                  ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
#define  USB_DESC_DEVICE_QUALIFIER          ((USB_DESC_TYPE_DEVICE_QUALIFIER << 8) & 0xFF00)
#define  USB_DESC_OTHER_SPEED_CONFIGURATION ((USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION << 8) & 0xFF00)
#define  USB_DESC_INTERFACE_POWER           ((USB_DESC_TYPE_INTERFACE_POWER << 8) & 0xFF00)
#define  USB_DESC_HID_REPORT                ((USB_DESC_TYPE_HID_REPORT << 8) & 0xFF00)
#define  USB_DESC_HID                       ((USB_DESC_TYPE_HID << 8) & 0xFF00)#define  USB_EP_TYPE_CTRL                               0x00
#define  USB_EP_TYPE_ISOC                               0x01
#define  USB_EP_TYPE_BULK                               0x02
#define  USB_EP_TYPE_INTR                               0x03#define  USB_EP_DIR_OUT                                 0x00
#define  USB_EP_DIR_IN                                  0x80
#define  USB_EP_DIR_MSK                                 0x80  #ifndef USBH_MAX_PIPES_NBR#define USBH_MAX_PIPES_NBR                             15                                                
#endif /* USBH_MAX_PIPES_NBR */#define USBH_DEVICE_ADDRESS_DEFAULT                     0
#define USBH_MAX_ERROR_COUNT                            2
#define USBH_DEVICE_ADDRESS                             1/*** @}*/ #define USBH_CONFIGURATION_DESCRIPTOR_SIZE (USB_CONFIGURATION_DESC_SIZE \+ USB_INTERFACE_DESC_SIZE\+ (USBH_MAX_NUM_ENDPOINTS * USB_ENDPOINT_DESC_SIZE))#define CONFIG_DESC_wTOTAL_LENGTH (ConfigurationDescriptorData.ConfigDescfield.\ConfigurationDescriptor.wTotalLength)typedef union
{uint16_t w;struct BW{uint8_t msb;uint8_t lsb;}bw;
}
uint16_t_uint8_t;typedef union _USB_Setup
{uint32_t d8[2];struct _SetupPkt_Struc{uint8_t           bmRequestType;uint8_t           bRequest;uint16_t_uint8_t  wValue;uint16_t_uint8_t  wIndex;uint16_t_uint8_t  wLength;} b;
} 
USB_Setup_TypeDef;  typedef  struct  _DescHeader 
{uint8_t  bLength;       uint8_t  bDescriptorType;
} 
USBH_DescHeader_t;typedef struct _DeviceDescriptor
{uint8_t   bLength;uint8_t   bDescriptorType;uint16_t  bcdUSB;        /* USB Specification Number which device complies too */uint8_t   bDeviceClass;uint8_t   bDeviceSubClass; uint8_t   bDeviceProtocol;/* If equal to Zero, each interface specifies its own classcode if equal to 0xFF, the class code is vendor specified.Otherwise field is valid Class Code.*/uint8_t   bMaxPacketSize;uint16_t  idVendor;      /* Vendor ID (Assigned by USB Org) */uint16_t  idProduct;     /* Product ID (Assigned by Manufacturer) */uint16_t  bcdDevice;     /* Device Release Number */uint8_t   iManufacturer;  /* Index of Manufacturer String Descriptor */uint8_t   iProduct;       /* Index of Product String Descriptor */uint8_t   iSerialNumber;  /* Index of Serial Number String Descriptor */uint8_t   bNumConfigurations; /* Number of Possible Configurations */
}
USBH_DevDescTypeDef;typedef struct _EndpointDescriptor
{uint8_t   bLength;uint8_t   bDescriptorType;uint8_t   bEndpointAddress;   /* indicates what endpoint this descriptor is describing */uint8_t   bmAttributes;       /* specifies the transfer type. */uint16_t  wMaxPacketSize;    /* Maximum Packet Size this endpoint is capable of sending or receiving */  uint8_t   bInterval;          /* is used to specify the polling interval of certain transfers. */
}
USBH_EpDescTypeDef;typedef struct _InterfaceDescriptor
{uint8_t bLength;uint8_t bDescriptorType;uint8_t bInterfaceNumber;uint8_t bAlternateSetting;    /* Value used to select alternative setting */uint8_t bNumEndpoints;        /* Number of Endpoints used for this interface */uint8_t bInterfaceClass;      /* Class Code (Assigned by USB Org) */uint8_t bInterfaceSubClass;   /* Subclass Code (Assigned by USB Org) */uint8_t bInterfaceProtocol;   /* Protocol Code */uint8_t iInterface;           /* Index of String Descriptor Describing this interface */USBH_EpDescTypeDef               Ep_Desc[USBH_MAX_NUM_ENDPOINTS];   
}
USBH_InterfaceDescTypeDef;typedef struct _ConfigurationDescriptor
{uint8_t   bLength;uint8_t   bDescriptorType;uint16_t  wTotalLength;        /* Total Length of Data Returned */uint8_t   bNumInterfaces;       /* Number of Interfaces */uint8_t   bConfigurationValue;  /* Value to use as an argument to select this configuration*/uint8_t   iConfiguration;       /*Index of String Descriptor Describing this configuration */uint8_t   bmAttributes;         /* D7 Bus Powered , D6 Self Powered, D5 Remote Wakeup , D4..0 Reserved (0)*/uint8_t   bMaxPower;            /*Maximum Power Consumption */USBH_InterfaceDescTypeDef        Itf_Desc[USBH_MAX_NUM_INTERFACES];
}
USBH_CfgDescTypeDef;/* Following USB Host status */
typedef enum 
{USBH_OK   = 0,USBH_BUSY,USBH_FAIL,USBH_NOT_SUPPORTED,USBH_UNRECOVERED_ERROR,USBH_ERROR_SPEED_UNKNOWN,
}USBH_StatusTypeDef;/** @defgroup USBH_CORE_Exported_Types* @{*/typedef enum 
{USBH_SPEED_HIGH  = 0,USBH_SPEED_FULL  = 1,USBH_SPEED_LOW   = 2,  }USBH_SpeedTypeDef;/* Following states are used for gState */
typedef enum 
{HOST_IDLE =0,HOST_DEV_WAIT_FOR_ATTACHMENT,  HOST_DEV_ATTACHED,HOST_DEV_DISCONNECTED,  HOST_DETECT_DEVICE_SPEED,HOST_ENUMERATION,HOST_CLASS_REQUEST,  HOST_INPUT,HOST_SET_CONFIGURATION,HOST_CHECK_CLASS,HOST_CLASS,HOST_SUSPENDED,HOST_ABORT_STATE,  
}HOST_StateTypeDef;  /* Following states are used for EnumerationState */
typedef enum 
{ENUM_IDLE = 0,ENUM_GET_FULL_DEV_DESC,ENUM_SET_ADDR,ENUM_GET_CFG_DESC,ENUM_GET_FULL_CFG_DESC,ENUM_GET_MFC_STRING_DESC,ENUM_GET_PRODUCT_STRING_DESC,ENUM_GET_SERIALNUM_STRING_DESC,
} ENUM_StateTypeDef;  /* Following states are used for CtrlXferStateMachine */
typedef enum 
{CTRL_IDLE =0,CTRL_SETUP,CTRL_SETUP_WAIT,CTRL_DATA_IN,CTRL_DATA_IN_WAIT,CTRL_DATA_OUT,CTRL_DATA_OUT_WAIT,CTRL_STATUS_IN,CTRL_STATUS_IN_WAIT,CTRL_STATUS_OUT,CTRL_STATUS_OUT_WAIT,CTRL_ERROR,CTRL_STALLED,CTRL_COMPLETE    
}CTRL_StateTypeDef;  /* Following states are used for RequestState */
typedef enum 
{CMD_IDLE =0,CMD_SEND,CMD_WAIT
} CMD_StateTypeDef;  typedef enum {USBH_URB_IDLE = 0,USBH_URB_DONE,USBH_URB_NOTREADY,USBH_URB_NYET,  USBH_URB_ERROR,USBH_URB_STALL
}USBH_URBStateTypeDef;typedef enum
{USBH_PORT_EVENT = 1,  USBH_URB_EVENT,USBH_CONTROL_EVENT,    USBH_CLASS_EVENT,     USBH_STATE_CHANGED_EVENT,   
}
USBH_OSEventTypeDef;/* Control request structure */
typedef struct 
{uint8_t               pipe_in; uint8_t               pipe_out; uint8_t               pipe_size;  uint8_t               *buff;uint16_t              length;uint16_t              timer;  USB_Setup_TypeDef     setup;CTRL_StateTypeDef     state;  uint8_t               errorcount;  } USBH_CtrlTypeDef;/* Attached device structure */
typedef struct
{
#if (USBH_KEEP_CFG_DESCRIPTOR == 1)  uint8_t                           CfgDesc_Raw[USBH_MAX_SIZE_CONFIGURATION];
#endif  uint8_t                           Data[USBH_MAX_DATA_BUFFER];uint8_t                           address;uint8_t                           speed;__IO uint8_t                      is_connected;    uint8_t                           current_interface;   USBH_DevDescTypeDef               DevDesc;USBH_CfgDescTypeDef               CfgDesc; }USBH_DeviceTypeDef;struct _USBH_HandleTypeDef;/* USB Host Class structure */
typedef struct 
{const char          *Name;uint8_t              ClassCode;  USBH_StatusTypeDef  (*Init)        (struct _USBH_HandleTypeDef *phost);USBH_StatusTypeDef  (*DeInit)      (struct _USBH_HandleTypeDef *phost);USBH_StatusTypeDef  (*Requests)    (struct _USBH_HandleTypeDef *phost);  USBH_StatusTypeDef  (*BgndProcess) (struct _USBH_HandleTypeDef *phost);USBH_StatusTypeDef  (*SOFProcess) (struct _USBH_HandleTypeDef *phost);  void*                pData;
} USBH_ClassTypeDef;/* USB Host handle structure */
typedef struct _USBH_HandleTypeDef
{__IO HOST_StateTypeDef     gState;       /*  Host State Machine Value */ENUM_StateTypeDef     EnumState;    /* Enumeration state Machine */CMD_StateTypeDef      RequestState;       USBH_CtrlTypeDef      Control;USBH_DeviceTypeDef    device;USBH_ClassTypeDef*    pClass[USBH_MAX_NUM_SUPPORTED_CLASS];USBH_ClassTypeDef*    pActiveClass;uint32_t              ClassNumber;uint32_t              Pipes[15];__IO uint32_t         Timer;uint8_t               id;  void*                 pData;                  void                 (* pUser )(struct _USBH_HandleTypeDef *pHandle, uint8_t id);#if (USBH_USE_OS == 1)osMessageQId          os_event;   osThreadId            thread; 
#endif  } USBH_HandleTypeDef;#if  defined ( __GNUC__ )#ifndef __weak#define __weak   __attribute__((weak))#endif /* __weak */#ifndef __packed#define __packed __attribute__((__packed__))#endif /* __packed */
#endif /* __GNUC__ */#ifdef __cplusplus
}
#endif#endif /* USBH_DEF_H *//************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
View Code

?

現在我們先看看 USBH_DevDescTypeDef結構體

/* Attached device structure */
typedef struct
{
#if (USBH_KEEP_CFG_DESCRIPTOR == 1)  uint8_t                           CfgDesc_Raw[USBH_MAX_SIZE_CONFIGURATION];
#endif  uint8_t                           Data[USBH_MAX_DATA_BUFFER];uint8_t                           address;uint8_t                           speed;__IO uint8_t                      is_connected;    uint8_t                           current_interface;   USBH_DevDescTypeDef               DevDesc; USBH_CfgDescTypeDef               CfgDesc; }USBH_DeviceTypeDef;

?

在看 USBH_DevDescTypeDef DevDesc之前我們先看 Universal Serial Bus Specification Revision 2.0

Table 9-8. Standard Device Descriptor

會發現USBH_DevDescTypeDef DevDesc就是上面的表格

typedef struct _DeviceDescriptor
{uint8_t   bLength;uint8_t   bDescriptorType;uint16_t  bcdUSB;        /* USB Specification Number which device complies too */uint8_t   bDeviceClass;uint8_t   bDeviceSubClass; uint8_t   bDeviceProtocol;/* If equal to Zero, each interface specifies its own classcode if equal to 0xFF, the class code is vendor specified.Otherwise field is valid Class Code.*/uint8_t   bMaxPacketSize;uint16_t  idVendor;      /* Vendor ID (Assigned by USB Org) */uint16_t  idProduct;     /* Product ID (Assigned by Manufacturer) */uint16_t  bcdDevice;     /* Device Release Number */uint8_t   iManufacturer;  /* Index of Manufacturer String Descriptor */uint8_t   iProduct;       /* Index of Product String Descriptor */uint8_t   iSerialNumber;  /* Index of Serial Number String Descriptor */uint8_t   bNumConfigurations; /* Number of Possible Configurations */
}
USBH_DevDescTypeDef;

在看 USBH_CfgDescTypeDef CfgDesc;之前我們看看

Table 9-10. Standard Configuration Descriptor

?

?

但是我們USBH_CfgDescTypeDef CfgDesc中多了USBH_InterfaceDescTypeDef??????? Itf_Desc[USBH_MAX_NUM_INTERFACES]

typedef struct _ConfigurationDescriptor
{
? uint8_t?? bLength;
? uint8_t?? bDescriptorType;
? uint16_t? wTotalLength;??????? /* Total Length of Data Returned */
? uint8_t?? bNumInterfaces;?????? /* Number of Interfaces */
? uint8_t?? bConfigurationValue;? /* Value to use as an argument to select this configuration*/
? uint8_t?? iConfiguration;?????? /*Index of String Descriptor Describing this configuration */
? uint8_t?? bmAttributes;???????? /* D7 Bus Powered , D6 Self Powered, D5 Remote Wakeup , D4..0 Reserved (0)*/
? uint8_t?? bMaxPower;??????????? /*Maximum Power Consumption */
? USBH_InterfaceDescTypeDef??????? Itf_Desc[USBH_MAX_NUM_INTERFACES];
}
USBH_CfgDescTypeDef;

?我們繼續翻書

Table 9-12. Standard Interface Descriptor

我們會發現USBH_InterfaceDescTypeDef中有多了 USBH_EpDescTypeDef Ep_Desc[USBH_MAX_NUM_ENDPOINTS];

typedef struct _InterfaceDescriptor
{uint8_t bLength;uint8_t bDescriptorType;uint8_t bInterfaceNumber;uint8_t bAlternateSetting;    /* Value used to select alternative setting */uint8_t bNumEndpoints;        /* Number of Endpoints used for this interface */uint8_t bInterfaceClass;      /* Class Code (Assigned by USB Org) */uint8_t bInterfaceSubClass;   /* Subclass Code (Assigned by USB Org) */uint8_t bInterfaceProtocol;   /* Protocol Code */uint8_t iInterface;           /* Index of String Descriptor Describing this interface */USBH_EpDescTypeDef               Ep_Desc[USBH_MAX_NUM_ENDPOINTS];   
}
USBH_InterfaceDescTypeDef;

?還是老規則先翻書

Table 9-13. Standard Endpoint Descriptor

typedef struct _EndpointDescriptor
{uint8_t   bLength;uint8_t   bDescriptorType;uint8_t   bEndpointAddress;   /* indicates what endpoint this descriptor is describing */uint8_t   bmAttributes;       /* specifies the transfer type. */uint16_t  wMaxPacketSize;    /* Maximum Packet Size this endpoint is capable of sending or receiving */  uint8_t   bInterval;          /* is used to specify the polling interval of certain transfers. */
}
USBH_EpDescTypeDef;

?

其實上面的描述符

?

?

?

?

?

?

轉載于:https://www.cnblogs.com/libra13179/p/7219891.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/391967.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391967.shtml
英文地址,請注明出處:http://en.pswp.cn/news/391967.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

spring—依賴注入

依賴注入&#xff08;Dependency Injection&#xff09; 它是 Spring 框架核心 IOC 的具體實現。 在編寫程序時&#xff0c;通過控制反轉&#xff0c;把對象的創建交給了 Spring&#xff0c;但是代碼中不可能出現沒有依賴的情況。 IOC 解耦只是降低他們的依賴關系&#xff0c;…

C# (類型、對象、線程棧和托管堆)在運行時的相互關系

在介紹運行時的關系之前,先從一些計算機基礎只是入手,如下圖: 該圖展示了已加載CLR的一個windows進程,該進程可能有多個線程,線程創建時會分配到1MB的棧空間.棧空間用于向方法傳遞實參,方法定義的局部變量也在實參上,上圖的右側展示了線程的棧內存,棧從高位內存地址向地位內存地…

2019-08-01 紀中NOIP模擬賽B組

T1 [JZOJ2642] 游戲 題目描述 Alice和Bob在玩一個游戲&#xff0c;游戲是在一個N*N的矩陣上進行的&#xff0c;每個格子上都有一個正整數。當輪到Alice/Bob時&#xff0c;他/她可以選擇最后一列或最后一行&#xff0c;并將其刪除&#xff0c;但必須保證選擇的這一行或這一列所有…

knn分類 knn_關于KNN的快速小課程

knn分類 knnAs the title says, here is a quick little lesson on how to construct a simple KNN model in SciKit-Learn. I will be using this dataset. It contains information on students’ academic performance.就像標題中所說的&#xff0c;這是關于如何在SciKit-Le…

spring—配置數據源

數據源&#xff08;連接池&#xff09;的作用 數據源(連接池)是提高程序性能如出現的 事先實例化數據源&#xff0c;初始化部分連接資源 使用連接資源時從數據源中獲取 使用完畢后將連接資源歸還給數據源 常見的數據源(連接池)&#xff1a;DBCP、C3P0、BoneCP、Druid等 開發步…

大型網站系統與Java中間件實踐pdf

下載地址&#xff1a;網盤下載 基本介紹 編輯內容簡介 到底是本什么書&#xff0c;擁有這樣一份作序推薦人列表&#xff1a;阿里集團章文嵩博士|新浪TimYang|去哪網吳永強|丁香園馮大輝|蘑菇街岳旭強|途牛湯崢嶸|豆瓣洪強寧|某電商陳皓/林昊…… 這本書出自某電商技術部總監之手…

office漏洞利用--獲取shell

環境&#xff1a; kali系統&#xff0c; windows系統 流程&#xff1a; 在kali系統生成利用文件&#xff0c; kali系統下監聽本地端口&#xff0c; windows系統打開doc文件&#xff0c;即可中招 第一種利用方式&#xff0c; 適合測試用&#xff1a; 從git下載代碼&#xff1a; …

pandas之DataFrame合并merge

一、merge merge操作實現兩個DataFrame之間的合并&#xff0c;類似于sql兩個表之間的關聯查詢。merge的使用方法及參數解釋如下&#xff1a; pd.merge(left, right, onNone, howinner, left_onNone, right_onNone, left_indexFalse, right_indexFalse,    sortFalse, suffi…

typescript_如何掌握高級TypeScript模式

typescriptby Pierre-Antoine Mills皮埃爾安托萬米爾斯(Pierre-Antoine Mills) 如何掌握高級TypeScript模式 (How to master advanced TypeScript patterns) 了解如何為咖喱和Ramda創建類型 (Learn how to create types for curry and Ramda) Despite the popularity of curry…

html函數splice,js數組的常用函數(slice()和splice())和js引用的三種方法總結—2019年1月16日...

總結&#xff1a;slice()和splice()slice(參數1,參數2)可以查找數組下對應的數據&#xff0c;參數1為起始位置&#xff0c;參數2為結束位置&#xff0c;參數2可以為負數&#xff0c;-1對應的是從后向前數的第一個數值。splice()可以進行增刪改查數據操作&#xff0c;splice(參數…

leetcode 643. 子數組最大平均數 I(滑動窗口)

給定 n 個整數&#xff0c;找出平均數最大且長度為 k 的連續子數組&#xff0c;并輸出該最大平均數。 示例&#xff1a; 輸入&#xff1a;[1,12,-5,-6,50,3], k 4 輸出&#xff1a;12.75 解釋&#xff1a;最大平均數 (12-5-650)/4 51/4 12.75 代碼 class Solution {publ…

python ==字符串

字符串類型(str)&#xff1a; 包含在引號&#xff08;單&#xff0c;雙&#xff0c;三&#xff09;里面&#xff0c;由一串字符組成。 用途&#xff1a;姓名&#xff0c;性別&#xff0c;地址&#xff0c;學歷&#xff0c;密碼 Name ‘zbk’ 取值: 首先要明確&#xff0c;字符…

認證鑒權與API權限控制在微服務架構中的設計與實現(一)

作者&#xff1a; [Aoho’s Blog] 引言&#xff1a; 本文系《認證鑒權與API權限控制在微服務架構中的設計與實現》系列的第一篇&#xff0c;本系列預計四篇文章講解微服務下的認證鑒權與API權限控制的實現。 1. 背景 最近在做權限相關服務的開發&#xff0c;在系統微服務化后&a…

mac下完全卸載程序的方法

在國外網上看到的&#xff0c;覺得很好&#xff0c;不僅可以長卸載的知識&#xff0c;還對mac系統有更深的認識。比如偏好設置文件&#xff0c;我以前設置一個程序壞了&#xff0c;打不開了&#xff0c;怎么重裝都打不開&#xff0c;后來才知道系統還保留著原來的偏好設置文件。…

機器學習集群_機器學習中的多合一集群技術在無監督學習中應該了解

機器學習集群Clustering algorithms are a powerful technique for machine learning on unsupervised data. The most common algorithms in machine learning are hierarchical clustering and K-Means clustering. These two algorithms are incredibly powerful when appli…

自考本科計算機要學什么,計算機自考本科需要考哪些科目

高科技發展時代&#xff0c;怎離得開計算機技術&#xff1f;小學生都要學編程了&#xff0c;未來趨勢一目了然&#xff0c;所以如今在考慮提升學歷的社會成人&#xff0c;多半也青睞于計算機專業&#xff0c;那么計算機自考本科需要考哪些科目&#xff1f;難不難&#xff1f;自…

審查指南 最新版本_代碼審查-最終指南

審查指南 最新版本by Assaf Elovic通過阿薩夫埃洛維奇 代碼審查-最終指南 (Code Review — The Ultimate Guide) 構建團隊代碼審查流程的終極指南 (The ultimate guide for building your team’s code review process) After conducting hundreds of code reviews, leading R…

非對稱加密

2019獨角獸企業重金招聘Python工程師標準>>> 概念 非對稱加密算法需要兩個密鑰&#xff1a;公鑰&#xff08;publickey&#xff09;和私鑰&#xff08;privatekey&#xff09;。公鑰與私鑰是一對&#xff0c;如果用公鑰對數據進行加密&#xff0c;只有用對應的私…

管理Sass項目文件結構

http://www.w3cplus.com/preprocessor/architecture-sass-project.html 編輯推薦&#xff1a; 掘金是一個高質量的技術社區&#xff0c;從 CSS 到 Vue.js&#xff0c;性能優化到開源類庫&#xff0c;讓你不錯過前端開發的每一個技術干貨。 點擊鏈接查看最新前端內容&#xff0c…

Spring—注解開發

Spring原始注解 Spring是輕代碼而重配置的框架&#xff0c;配置比較繁重&#xff0c;影響開發效率&#xff0c;所以注解開發是一種趨勢&#xff0c;注解代替xml配置文 件可以簡化配置&#xff0c;提高開發效率。 Component 使用在類上用于實例化BeanController 使用在web層類…