⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb.h

📁 这是nrf24lu1的无线鼠标源代码,应用平台是keil c
💻 H
字号:
/** @file
 *
 * This file contain definitions related to the USB-controller and internal structures
 * 
 * @author Ken A. Redergaard
 */

#ifndef __NRF24LU1__
#define __NRF24LU1__

#include <stdint.h>

#include "hal_usb.h"
#include "usb_map.h"

#define USB_ENDPOINT_IN_COUNT  5
#define USB_ENDPOINT_OUT_COUNT 5

#define USB_EP0_HSNAK() do { i_usb.map->ep0cs = 0x02; } while(0)
#define USB_EP0_STALL() do { i_usb.map->ep0cs = 0x11; } while(0) // Set both DSTALL and STALL when we want to stall a request during a SETUP transaction
#define USB_EP0_DSTALL() do { i_usb.map->ep0cs |= 0x10; } while(0)

#define INT_SUDAV    0x00
#define INT_SOF      0x04
#define INT_SUTOK    0x08
#define INT_SUSPEND  0x0C
#define INT_USBRESET 0x10
#define INT_EP0IN    0x18
#define INT_EP0OUT   0x1C
#define INT_EP1IN    0x20
#define INT_EP1OUT   0x24
#define INT_EP2IN    0x28
#define INT_EP2OUT   0x2C
#define INT_EP3IN    0x30
#define INT_EP3OUT   0x34
#define INT_EP4IN    0x38
#define INT_EP4OUT   0x3C
#define INT_EP5IN    0x40
#define INT_EP5OUT   0x44

#define BM_REQUEST_TYPE  0
#define B_REQUEST        1
#define W_VALUE          2
#define W_INDEX          4
#define W_LENGTH         6

typedef struct {
    uint8_t* data_ptr;
    uint16_t data_size;
    uint16_t pkt_size;
} packetizer_t;

typedef struct {
    usb_map_t xdata* map;
    packetizer_t packetizer;
    hal_usb_cb_endpoint_t endpoint_in_isr[USB_ENDPOINT_IN_COUNT];
    hal_usb_cb_endpoint_t endpoint_out_isr[USB_ENDPOINT_OUT_COUNT];
} usb_t;

#endif // __NRF24LU1__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -