forked from nuttx/nuttx-update
I/O Expander: Fix some bad macros, make naming consisted
This commit is contained in:
parent
2de5be34e5
commit
2b05f3e830
2 changed files with 28 additions and 31 deletions
|
@ -72,26 +72,23 @@
|
|||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int pca9555_direction (FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t pin, int dir);
|
||||
static int pca9555_option (FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t pin, int opt, void *val);
|
||||
static int pca9555_write (FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t pin, bool value);
|
||||
static int pca9555_readpin (FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t pin, FAR bool *value);
|
||||
static int pca9555_readbuf (FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t pin, FAR bool *value);
|
||||
static int pca9555_direction(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
int dir);
|
||||
static int pca9555_option(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
int opt, void *val);
|
||||
static int pca9555_writepin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool value);
|
||||
static int pca9555_readpin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
FAR bool *value);
|
||||
static int pca9555_readbuf(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
FAR bool *value);
|
||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||
static int pca9555_multiwrite (FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values,
|
||||
int count);
|
||||
static int pca9555_multiwritepin(FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values, int count);
|
||||
static int pca9555_multireadpin(FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values,
|
||||
int count);
|
||||
FAR uint8_t *pins, FAR bool *values, int count);
|
||||
static int pca9555_multireadbuf(FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values,
|
||||
int count);
|
||||
FAR uint8_t *pins, FAR bool *values, int count);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -115,11 +112,11 @@ static const struct ioexpander_ops_s g_pca9555_ops =
|
|||
{
|
||||
pca9555_direction,
|
||||
pca9555_option,
|
||||
pca9555_write,
|
||||
pca9555_writepin,
|
||||
pca9555_readpin,
|
||||
pca9555_readbuf,
|
||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||
pca9555_multiwrite,
|
||||
pca9555_multiwritepin,
|
||||
pca9555_multireadpin,
|
||||
pca9555_multireadbuf,
|
||||
#endif
|
||||
|
@ -245,15 +242,15 @@ static int pca9555_option(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pca9555_write
|
||||
* Name: pca9555_writepin
|
||||
*
|
||||
* Description:
|
||||
* See include/nuttx/ioexpander/ioexpander.h
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int pca9555_write(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool value)
|
||||
static int pca9555_writepin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool value)
|
||||
{
|
||||
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
||||
return pca9555_setbit(pca->i2c, PCA9555_REG_OUTPUT, pin, value);
|
||||
|
@ -339,16 +336,16 @@ static int pca9555_getmultibits(FAR struct i2c_dev_s *i2c, uint8_t addr,
|
|||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pca9555_multiwrite
|
||||
* Name: pca9555_multiwritepin
|
||||
*
|
||||
* Description:
|
||||
* See include/nuttx/ioexpander/ioexpander.h
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int pca9555_multiwrite(FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values,
|
||||
int count)
|
||||
static int pca9555_multiwritepin(FAR struct ioexpander_dev_s *dev,
|
||||
FAR uint8_t *pins, FAR bool *values,
|
||||
int count)
|
||||
{
|
||||
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
||||
uint8_t addr = PCA9555_REG_OUTPUT;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* include/nuttx/ioexpander/ioexpander.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -104,7 +104,7 @@
|
|||
#define IOEXP_SETOPTION(dev,pin,opt,val) ((dev)->ops->ioe_option(dev,pin,opt,val))
|
||||
|
||||
/****************************************************************************
|
||||
* Name: IOEXP_WRITE
|
||||
* Name: IOEXP_WRITEPIN
|
||||
*
|
||||
* Description:
|
||||
* Set the pin level. Required.
|
||||
|
@ -164,7 +164,7 @@
|
|||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||
|
||||
/****************************************************************************
|
||||
* Name: IOEXP_MULTIWRITE
|
||||
* Name: IOEXP_MULTIWRITEPIN
|
||||
*
|
||||
* Description:
|
||||
* Set the pin level for multiple pins. This routine may be faster than
|
||||
|
@ -237,14 +237,14 @@ struct ioexpander_ops_s
|
|||
int direction);
|
||||
CODE int (*ioe_option)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
int opt, void *val);
|
||||
CODE int (*ioe_write)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
CODE int (*ioe_writepin)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool value);
|
||||
CODE int (*ioe_readpin)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool *value);
|
||||
CODE int (*ioe_readbuf)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
bool *value);
|
||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||
CODE int (*ioe_multiwrite)(FAR struct ioexpander_dev_s *dev,
|
||||
CODE int (*ioe_multiwritepin)(FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t *pins, bool *values, int count);
|
||||
CODE int (*ioe_multireadpin)(FAR struct ioexpander_dev_s *dev,
|
||||
uint8_t *pins, bool *values, int count);
|
||||
|
|
Loading…
Reference in a new issue