forked from nuttx/nuttx-update
Cosmetic changes from review of last 2 PRs.
This commit is contained in:
parent
cabb529c48
commit
96b6bf92a3
2 changed files with 28 additions and 17 deletions
|
@ -151,8 +151,7 @@ int stm32_rgbled_setup(void)
|
|||
|
||||
info.frequency = 100;
|
||||
|
||||
#ifdef CONFIG_PWM_MULTICHAN
|
||||
|
||||
#ifdef CONFIG_PWM_MULTICHAN
|
||||
/* Setup the duty cycle and channel for red */
|
||||
|
||||
i = 0;
|
||||
|
@ -174,7 +173,8 @@ int stm32_rgbled_setup(void)
|
|||
}
|
||||
|
||||
/* Start the timer used for red, and any other colors that are
|
||||
* sourced on a different channel of the same timer */
|
||||
* sourced on a different channel of the same timer.
|
||||
*/
|
||||
|
||||
ledr->ops->start(ledr, &info);
|
||||
|
||||
|
@ -184,21 +184,23 @@ int stm32_rgbled_setup(void)
|
|||
{
|
||||
info.channels[i].channel = 0;
|
||||
}
|
||||
|
||||
/* If the green timer is not the same as the red timer, then set it up. */
|
||||
|
||||
/* If the green timer is not the same as the red timer, then set it
|
||||
* up.
|
||||
*/
|
||||
|
||||
if (RGBLED_GPWMTIMER != RGBLED_RPWMTIMER)
|
||||
{
|
||||
i = 0;
|
||||
info.channels[i++].channel = RGBLED_GPWMCHANNEL;
|
||||
|
||||
|
||||
/* If the blue timer uses the same timer and the green */
|
||||
|
||||
if (RGBLED_GPWMTIMER == RGBLED_BPWMTIMER)
|
||||
{
|
||||
info.channels[i++].channel = RGBLED_BPWMCHANNEL;
|
||||
}
|
||||
|
||||
|
||||
/* Start green timer (and maybe blue) */
|
||||
|
||||
ledg->ops->start(ledg, &info);
|
||||
|
@ -211,9 +213,12 @@ int stm32_rgbled_setup(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* If the blue timer is different than the red and the green, it must be setup seperately */
|
||||
/* If the blue timer is different than the red and the green, it must
|
||||
* be setup separately.
|
||||
*/
|
||||
|
||||
if (RGBLED_BPWMTIMER != RGBLED_RPWMTIMER && RGBLED_BPWMTIMER != RGBLED_GPWMTIMER)
|
||||
if (RGBLED_BPWMTIMER != RGBLED_RPWMTIMER &&
|
||||
RGBLED_BPWMTIMER != RGBLED_GPWMTIMER)
|
||||
{
|
||||
info.channels[0].channel = RGBLED_BPWMCHANNEL;
|
||||
ledb->ops->start(ledb, &info);
|
||||
|
@ -228,7 +233,9 @@ int stm32_rgbled_setup(void)
|
|||
/* Register the RGB LED diver at "/dev/rgbled0" */
|
||||
|
||||
#ifdef CONFIG_PWM_MULTICHAN
|
||||
ret = rgbled_register("/dev/rgbled0", ledr, ledg, ledb, RGBLED_RPWMCHANNEL, RGBLED_GPWMCHANNEL, RGBLED_BPWMCHANNEL);
|
||||
ret = rgbled_register("/dev/rgbled0", ledr, ledg, ledb,
|
||||
RGBLED_RPWMCHANNEL, RGBLED_GPWMCHANNEL,
|
||||
RGBLED_BPWMCHANNEL);
|
||||
#else
|
||||
ret = rgbled_register("/dev/rgbled0", ledr, ledg, ledb);
|
||||
#endif
|
||||
|
|
|
@ -156,8 +156,8 @@ static const struct file_operations g_ina3221fops =
|
|||
****************************************************************************/
|
||||
|
||||
static int ina3221_access(FAR struct ina3221_dev_s *priv,
|
||||
uint8_t start_register_address, bool reading,
|
||||
FAR uint8_t* register_value, uint8_t data_length)
|
||||
uint8_t start_register_address, bool reading,
|
||||
FAR uint8_t* register_value, uint8_t data_length)
|
||||
{
|
||||
struct i2c_msg_s msg[I2C_NOSTARTSTOP_MSGS];
|
||||
int ret;
|
||||
|
@ -185,7 +185,7 @@ static int ina3221_access(FAR struct ina3221_dev_s *priv,
|
|||
}
|
||||
|
||||
static int ina3221_read16(FAR struct ina3221_dev_s *priv, uint8_t regaddr,
|
||||
FAR uint16_t* regvalue)
|
||||
FAR uint16_t* regvalue)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
|
@ -200,7 +200,7 @@ static int ina3221_read16(FAR struct ina3221_dev_s *priv, uint8_t regaddr,
|
|||
}
|
||||
|
||||
static int ina3221_write16(FAR struct ina3221_dev_s *priv, uint8_t regaddr,
|
||||
FAR uint16_t regvalue)
|
||||
FAR uint16_t regvalue)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
|
@ -237,7 +237,8 @@ static int ina3221_readpower(FAR struct ina3221_dev_s *priv,
|
|||
{
|
||||
/* Read the raw bus voltage */
|
||||
|
||||
ret = ina3221_read16(priv, (INA3221_REG_CH1_BUS_VOLTAGE << i), ®);
|
||||
ret = ina3221_read16(priv, (INA3221_REG_CH1_BUS_VOLTAGE << i),
|
||||
®);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: ina3221_read16 failed: %d\n", ret);
|
||||
|
@ -251,7 +252,8 @@ static int ina3221_readpower(FAR struct ina3221_dev_s *priv,
|
|||
|
||||
/* Read the raw shunt voltage */
|
||||
|
||||
ret = ina3221_read16(priv, (INA3221_REG_CH1_SHUNT_VOLTAGE << i), ®);
|
||||
ret = ina3221_read16(priv, (INA3221_REG_CH1_SHUNT_VOLTAGE << i),
|
||||
®);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: ina3221_read16 failed: %d\n", ret);
|
||||
|
@ -296,6 +298,7 @@ static int ina3221_open(FAR struct file *filep)
|
|||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct ina3221_dev_s *priv = inode->i_private;
|
||||
|
||||
UNUSED(priv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -312,6 +315,7 @@ static int ina3221_close(FAR struct file *filep)
|
|||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct ina3221_dev_s *priv = inode->i_private;
|
||||
|
||||
UNUSED(priv);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -323,7 +327,7 @@ static ssize_t ina3221_read(FAR struct file *filep, FAR char *buffer,
|
|||
size_t buflen)
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct ina3221_dev_s *priv = inode->i_private;
|
||||
FAR struct ina3221_dev_s *priv = inode->i_private;
|
||||
FAR struct ina3221_s *ptr;
|
||||
ssize_t nsamples;
|
||||
int i;
|
||||
|
|
Loading…
Reference in a new issue