mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
I/O Expander: Fix some bad macros, make naming consisted
This commit is contained in:
committed by
Gregory Nutt
parent
2de5be34e5
commit
2b05f3e830
@@ -72,26 +72,23 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int pca9555_direction (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_direction(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
uint8_t pin, int dir);
|
int dir);
|
||||||
static int pca9555_option (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_option(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
uint8_t pin, int opt, void *val);
|
int opt, void *val);
|
||||||
static int pca9555_write (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_writepin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
uint8_t pin, bool value);
|
bool value);
|
||||||
static int pca9555_readpin (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_readpin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
uint8_t pin, FAR bool *value);
|
FAR bool *value);
|
||||||
static int pca9555_readbuf (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_readbuf(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
uint8_t pin, FAR bool *value);
|
FAR bool *value);
|
||||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||||
static int pca9555_multiwrite (FAR struct ioexpander_dev_s *dev,
|
static int pca9555_multiwritepin(FAR struct ioexpander_dev_s *dev,
|
||||||
FAR uint8_t *pins, FAR bool *values,
|
FAR uint8_t *pins, FAR bool *values, int count);
|
||||||
int count);
|
|
||||||
static int pca9555_multireadpin(FAR struct ioexpander_dev_s *dev,
|
static int pca9555_multireadpin(FAR struct ioexpander_dev_s *dev,
|
||||||
FAR uint8_t *pins, FAR bool *values,
|
FAR uint8_t *pins, FAR bool *values, int count);
|
||||||
int count);
|
|
||||||
static int pca9555_multireadbuf(FAR struct ioexpander_dev_s *dev,
|
static int pca9555_multireadbuf(FAR struct ioexpander_dev_s *dev,
|
||||||
FAR uint8_t *pins, FAR bool *values,
|
FAR uint8_t *pins, FAR bool *values, int count);
|
||||||
int count);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -115,11 +112,11 @@ static const struct ioexpander_ops_s g_pca9555_ops =
|
|||||||
{
|
{
|
||||||
pca9555_direction,
|
pca9555_direction,
|
||||||
pca9555_option,
|
pca9555_option,
|
||||||
pca9555_write,
|
pca9555_writepin,
|
||||||
pca9555_readpin,
|
pca9555_readpin,
|
||||||
pca9555_readbuf,
|
pca9555_readbuf,
|
||||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||||
pca9555_multiwrite,
|
pca9555_multiwritepin,
|
||||||
pca9555_multireadpin,
|
pca9555_multireadpin,
|
||||||
pca9555_multireadbuf,
|
pca9555_multireadbuf,
|
||||||
#endif
|
#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:
|
* Description:
|
||||||
* See include/nuttx/ioexpander/ioexpander.h
|
* See include/nuttx/ioexpander/ioexpander.h
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int pca9555_write(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
static int pca9555_writepin(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
bool value)
|
bool value)
|
||||||
{
|
{
|
||||||
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
||||||
return pca9555_setbit(pca->i2c, PCA9555_REG_OUTPUT, pin, value);
|
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:
|
* Description:
|
||||||
* See include/nuttx/ioexpander/ioexpander.h
|
* See include/nuttx/ioexpander/ioexpander.h
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int pca9555_multiwrite(FAR struct ioexpander_dev_s *dev,
|
static int pca9555_multiwritepin(FAR struct ioexpander_dev_s *dev,
|
||||||
FAR uint8_t *pins, FAR bool *values,
|
FAR uint8_t *pins, FAR bool *values,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
FAR struct pca9555_dev_s *pca = (FAR struct pca9555_dev_s *)dev;
|
||||||
uint8_t addr = PCA9555_REG_OUTPUT;
|
uint8_t addr = PCA9555_REG_OUTPUT;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/ioexpander/ioexpander.h
|
* 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>
|
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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))
|
#define IOEXP_SETOPTION(dev,pin,opt,val) ((dev)->ops->ioe_option(dev,pin,opt,val))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: IOEXP_WRITE
|
* Name: IOEXP_WRITEPIN
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the pin level. Required.
|
* Set the pin level. Required.
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: IOEXP_MULTIWRITE
|
* Name: IOEXP_MULTIWRITEPIN
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Set the pin level for multiple pins. This routine may be faster than
|
* Set the pin level for multiple pins. This routine may be faster than
|
||||||
@@ -237,14 +237,14 @@ struct ioexpander_ops_s
|
|||||||
int direction);
|
int direction);
|
||||||
CODE int (*ioe_option)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
CODE int (*ioe_option)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
int opt, void *val);
|
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);
|
bool value);
|
||||||
CODE int (*ioe_readpin)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
CODE int (*ioe_readpin)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
bool *value);
|
bool *value);
|
||||||
CODE int (*ioe_readbuf)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
CODE int (*ioe_readbuf)(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||||
bool *value);
|
bool *value);
|
||||||
#ifdef CONFIG_IOEXPANDER_MULTIPIN
|
#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);
|
uint8_t *pins, bool *values, int count);
|
||||||
CODE int (*ioe_multireadpin)(FAR struct ioexpander_dev_s *dev,
|
CODE int (*ioe_multireadpin)(FAR struct ioexpander_dev_s *dev,
|
||||||
uint8_t *pins, bool *values, int count);
|
uint8_t *pins, bool *values, int count);
|
||||||
|
|||||||
Reference in New Issue
Block a user