diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-02-24 23:54:04 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-02-24 23:54:04 +0100 |
commit | 32f31edba463e3be5f53c8e7d5e51d0d79092e44 (patch) | |
tree | 652e6d979b02f198f3a58d9b0f1e7d4cb6ce8aec | |
parent | 5b5507574b49110b68839ac26975d33b9483a9fc (diff) | |
download | k8055-32f31edba463e3be5f53c8e7d5e51d0d79092e44.zip k8055-32f31edba463e3be5f53c8e7d5e51d0d79092e44.tar.gz |
check init_usb
-rw-r--r-- | libk8055/libk8055.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index 7b87e73..fe885f2 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -45,7 +45,7 @@ +---+---+---+---+---+---+---+---+ |CMD|DIG|An1|An2|Rs1|Rs2|Dbv|Dbv| +---+---+---+---+---+---+---+---+ - CMD = Command + CMD = Command DIG = Digital output bitmask An1 = Analog output 1 value, 0-255 An2 = Analog output 2 value, 0-255 @@ -133,21 +133,18 @@ struct k8055_dev { static struct k8055_dev k8055d[K8055_MAX_DEV]; static struct k8055_dev *curr_dev; -/* char* device_id[]; */ - /* Initialize the usb library - only once */ -static void init_usb(void) -{ - static int Done = 0; /* Only need to do this once */ - if (!Done) - { +static void init_usb(void) { + static int init_done = 0; + if (!init_done) { usb_init(); usb_find_busses(); usb_find_devices(); busses = usb_get_busses(); - Done = 1; + init_done = 1; } } + /* Actual read of data from the device endpoint, retry 3 times if not responding ok */ static int ReadK8055Data(void) { |