summaryrefslogtreecommitdiffstats
path: root/libk8055/libk8055.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-03-01 10:37:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-03-01 10:37:03 +0100
commit685999a84dad1fa51e28eb8c676e53fb3a856375 (patch)
treea8255b12b359eef55332ee00ba14a35e93f87040 /libk8055/libk8055.c
parent4ac9d96b5ca74c03020282d1c486e0eecad58d73 (diff)
downloadk8055-685999a84dad1fa51e28eb8c676e53fb3a856375.zip
k8055-685999a84dad1fa51e28eb8c676e53fb3a856375.tar.gz
set k8055_read and k8055_write public, add data_in access functions
Diffstat (limited to 'libk8055/libk8055.c')
-rw-r--r--libk8055/libk8055.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c
index 6d85c06..536507e 100644
--- a/libk8055/libk8055.c
+++ b/libk8055/libk8055.c
@@ -99,13 +99,7 @@
#define USB_TIMEOUT 20
#define K8055_ERROR -1
-#define DIGITAL_INP_OFFSET 0
-#define DIGITAL_OUT_OFFSET 1
-#define ANALOG_1_OFFSET 2
-#define ANALOG_2_OFFSET 3
-#define COUNTER_1_OFFSET 4
-#define COUNTER_2_OFFSET 6
-
+#define CMD_OFFSET 0
#define CMD_RESET 0x00
#define CMD_SET_DEBOUNCE_1 0x01
#define CMD_SET_DEBOUNCE_2 0x01
@@ -117,7 +111,7 @@
static int debug = 0;
/* Actual read of data from the device endpoint, retry READ_RETRY times if not responding ok */
-static int k8055_read( struct k8055_dev* dev ) {
+int k8055_read( struct k8055_dev* dev ) {
if( dev->dev_no==0 ) return K8055_ERROR;
for( int i=0; i<READ_RETRY; i++ ) {
int read_status = usb_interrupt_read( dev->device_handle, USB_INP_EP, ( char* )dev->data_in, PACKET_LEN, USB_TIMEOUT );
@@ -128,7 +122,7 @@ static int k8055_read( struct k8055_dev* dev ) {
}
/* Actual write of data to the device endpont, retry WRITE_RETRY times if not reponding correctly */
-static int k8055_write( struct k8055_dev* dev ) {
+int k8055_write( struct k8055_dev* dev ) {
if( dev->dev_no == 0 ) return K8055_ERROR;
for( int i=0; i<WRITE_RETRY; i++ ) {
int write_status = usb_interrupt_write( dev->device_handle, USB_OUT_EP, ( char* )dev->data_out, PACKET_LEN, USB_TIMEOUT );