From 32f31edba463e3be5f53c8e7d5e51d0d79092e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 24 Feb 2011 23:54:04 +0100 Subject: check init_usb --- libk8055/libk8055.c | 15 ++++++--------- 1 file 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) { -- cgit v1.1-2-g2b99