lpfk_open now calls lpfk_enable.

Tue, 26 Aug 2008 18:45:10 +0100

author
Philip Pemberton <philpem@philpem.me.uk>
date
Tue, 26 Aug 2008 18:45:10 +0100
changeset 2
071056e12321
parent 1
3e775df109e6
child 3
93f5d26366ad

lpfk_open now calls lpfk_enable.
also made LPFK_CTX the first parameter in all functions (for consistency)

include/liblpfk.h file | annotate | diff | revisions
src/liblpfk.c file | annotate | diff | revisions
     1.1 diff -r 3e775df109e6 -r 071056e12321 include/liblpfk.h
     1.2 --- a/include/liblpfk.h	Tue Aug 26 13:18:18 2008 +0100
     1.3 +++ b/include/liblpfk.h	Tue Aug 26 18:45:10 2008 +0100
     1.4 @@ -70,7 +70,7 @@
     1.5  	LPFK_E_NOT_PRESENT,			///< LPFK not present on specified port.
     1.6  	LPFK_E_COMMS,				///< Communication error.
     1.7  	LPFK_E_PARAM,				///< Invalid function parameter.
     1.8 -	LPFK_E_NOT_ENABLED			///< Attempt to read key when LPFK disabled
     1.9 +LPFK_E_NOT_ENABLED			///< Attempt to read key when LPFK disabled
    1.10  };
    1.11  
    1.12  /**
    1.13 @@ -82,7 +82,7 @@
    1.14   * @return	LPFK_E_OK on success, LPFK_E_PORT_OPEN if port could not be
    1.15   * 			opened, LPFK_E_NOT_PRESENT if no LPFK present on specified port.
    1.16   */
    1.17 -int lpfk_open(const char *port, LPFK_CTX *ctx);
    1.18 +int lpfk_open(LPFK_CTX *ctx, const char *port);
    1.19  
    1.20  /**
    1.21   * @brief	Close the LPFK.
    1.22 @@ -97,7 +97,7 @@
    1.23   * @param	val		true to enable the LPFK's keys, false to disable.
    1.24   * @return	LPFK_E_OK on success, LPFK_E_COMMS on comms error.
    1.25   */
    1.26 -int lpfk_enable(LPFK_CTX *ctx, int val);
    1.27 +int lpfk_enable(LPFK_CTX *ctx, const int val);
    1.28  
    1.29  /**
    1.30   * @brief	Set or clear an LED in the cached LED mask buffer.
     2.1 diff -r 3e775df109e6 -r 071056e12321 src/liblpfk.c
     2.2 --- a/src/liblpfk.c	Tue Aug 26 13:18:18 2008 +0100
     2.3 +++ b/src/liblpfk.c	Tue Aug 26 18:45:10 2008 +0100
     2.4 @@ -57,7 +57,7 @@
     2.5  #include "liblpfk.h"
     2.6  
     2.7  /* lpfk_open {{{ */
     2.8 -int lpfk_open(const char *port, LPFK_CTX *ctx)
     2.9 +int lpfk_open(LPFK_CTX *ctx, const char *port)
    2.10  {
    2.11  	struct termios newtio;
    2.12  	int status;
    2.13 @@ -148,9 +148,8 @@
    2.14  		ctx->led_mask = 0;
    2.15  		ctx->fd = fd;
    2.16  
    2.17 -		// Enable the LPFK
    2.18 -		write(fd, "\x08", 1);
    2.19 -		ctx->enabled = true;
    2.20 +		// Disable LPFK keyboard scanning
    2.21 +		lpfk_enable(ctx, false);
    2.22  
    2.23  		// Return OK status
    2.24  		return LPFK_E_OK;