xiaoxiang781216 commented on code in PR #20379: URL: https://github.com/apache/nuttx/pull/20379#discussion_r4118348942
########## drivers/sensors/ina226_uorb.c: ########## @@ -0,0 +1,563 @@ +/**************************************************************************** + * drivers/sensors/ina226_uorb.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <errno.h> +#include <stdint.h> +#include <string.h> + +#include <nuttx/i2c/i2c_master.h> +#include <nuttx/kmalloc.h> +#include <nuttx/nuttx.h> +#include <nuttx/sensors/ina226.h> +#include <nuttx/sensors/sensor.h> +#include <nuttx/wqueue.h> +#include <nuttx/debug.h> + +#if defined(CONFIG_SENSORS_INA226) && defined(CONFIG_SENSORS_INA226_UORB) Review Comment: remove ########## drivers/sensors/ina226_uorb.c: ########## @@ -0,0 +1,563 @@ +/**************************************************************************** + * drivers/sensors/ina226_uorb.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <errno.h> +#include <stdint.h> +#include <string.h> + +#include <nuttx/i2c/i2c_master.h> +#include <nuttx/kmalloc.h> +#include <nuttx/nuttx.h> +#include <nuttx/sensors/ina226.h> +#include <nuttx/sensors/sensor.h> +#include <nuttx/wqueue.h> +#include <nuttx/debug.h> + +#if defined(CONFIG_SENSORS_INA226) && defined(CONFIG_SENSORS_INA226_UORB) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_INA226_I2C_FREQUENCY +# define CONFIG_INA226_I2C_FREQUENCY 400000 +#endif + +/* The bus voltage register counts 1.25mV a step, and the shunt voltage + * register counts 2.5uV a step and is signed, because a part watching a + * rail that can be fed from either end has to say which way the current + * is going. + */ + +#define INA226_BUS_UV_PER_LSB 1250 +#define INA226_SHUNT_NV_PER_LSB 2500 + +/* A reading every tenth of a second by default: slow enough not to sit on + * the bus, quick enough to see a board change what it is doing. + */ + +#define INA226_DEFAULT_INTERVAL 100000 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct ina226_dev_uorb_s; + +/* One published quantity. Each carries a way back to the device, since + * the framework hands the lower half back and nothing else. + */ + +struct ina226_topic_s +{ + struct sensor_lowerhalf_s lower; + FAR struct ina226_dev_uorb_s *dev; + uint32_t interval; /* What this topic asked for */ Review Comment: align each fields -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
