summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-07-08 23:20:16 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-07-08 23:22:53 +0200
commite61ed66174df0bf889586c757aa6a9d23d9401c0 (patch)
tree7b7b2d030f94fa2967d8ac960ae450e4fe8bfc5f /include
parent27fe98f2d60d28153dfc10452b40664fc1e2ac66 (diff)
downloadsecure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.tar.gz
secure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.tar.bz2
secure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.zip
refactor: use enum instead of #define: USBH_ENDPOINT_TYPE and USBH_SPEED
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/driver/usbh_device_driver.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/driver/usbh_device_driver.h b/include/driver/usbh_device_driver.h
index 137b39b..3a4fbe3 100644
--- a/include/driver/usbh_device_driver.h
+++ b/include/driver/usbh_device_driver.h
@@ -30,15 +30,18 @@
BEGIN_DECLS
-#define USBH_EPTYP_CONTROL (0)
-#define USBH_EPTYP_ISOCHRONOUS (1)
-#define USBH_EPTYP_BULK (2)
-#define USBH_EPTYP_INTERRUPT (3)
-
-#define USBH_SPEED_FULL (0)
-#define USBH_SPEED_LOW (1)
-#define USBH_SPEED_HIGH (2)
+enum USBH_ENDPOINT_TYPE {
+ USBH_ENDPOINT_TYPE_CONTROL = 0,
+ USBH_ENDPOINT_TYPE_ISOCHRONOUS = 1,
+ USBH_ENDPOINT_TYPE_BULK = 2,
+ USBH_ENDPOINT_TYPE_INTERRUPT = 3,
+};
+enum USBH_SPEED {
+ USBH_SPEED_FULL = 0,
+ USBH_SPEED_LOW = 1,
+ USBH_SPEED_HIGH = 2,
+};
enum USBH_PACKET_CALLBACK_STATUS {
USBH_PACKET_CALLBACK_STATUS_OK = 0,
@@ -56,7 +59,7 @@ enum USBH_POLL_STATUS {
struct _usbh_device {
uint16_t packet_size_max0;
int8_t address;
- uint8_t speed; // (USBH_SPEED_*)
+ enum USBH_SPEED speed; // (USBH_SPEED_*)
uint8_t state; // for enumeration purposes
uint8_t toggle0;
const usbh_dev_driver_t *drv;
@@ -80,7 +83,7 @@ struct _usbh_packet {
uint8_t endpoint_type; // Endpoint type (see USBH_EPTYP_*)
uint8_t endpoint_address; // Endpoint number 0..15
uint16_t endpoint_size_max; // Max packet size for an endpoint
- uint8_t speed; // (USBH_SPEED_*)
+ enum USBH_SPEED speed; // (USBH_SPEED_*)
uint8_t *toggle;
usbh_packet_callback_t callback;
void *callback_arg;
@@ -92,9 +95,9 @@ struct _usbh_driver {
void (*write)(void *drvdata, const usbh_packet_t *packet);
void (*read)(void *drvdata, usbh_packet_t *packet);
enum USBH_POLL_STATUS (*poll)(void *drvdata, uint32_t time_curr_us);
- uint8_t (*root_speed)(void *drvdata);
// Pointer to Low-level driver data
+ enum USBH_SPEED (*root_speed)(void *drvdata);
void *driver_data;
};
typedef struct _usbh_driver usbh_driver_t;