Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/adc/adc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <zephyr/drivers/adc.h>

int adc_gain_invert(enum adc_gain gain,
int32_t *value)
int64_t *value)
{

Check notice on line 11 in drivers/adc/adc_common.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/adc/adc_common.c:11 -int adc_gain_invert(enum adc_gain gain, - int64_t *value) +int adc_gain_invert(enum adc_gain gain, int64_t *value)
struct gain_desc {
uint8_t mul;
uint8_t div;
Expand Down
2 changes: 1 addition & 1 deletion drivers/adc/adc_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static int adc_emul_get_chan_value(struct adc_emul_data *data,
{
struct adc_emul_chan_cfg *chan_cfg = &data->chan_cfg[chan];
uint32_t input_mV;
uint32_t ref_v;
uint64_t ref_v;
uint64_t temp; /* Temporary 64 bit value prevent overflows */
int err = 0;

Expand Down
6 changes: 3 additions & 3 deletions include/zephyr/drivers/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
* @retval -EINVAL if the gain could not be interpreted
*/
int adc_gain_invert(enum adc_gain gain,
int32_t *value);
int64_t *value);

Check notice on line 75 in include/zephyr/drivers/adc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/drivers/adc.h:75 -int adc_gain_invert(enum adc_gain gain, - int64_t *value); +int adc_gain_invert(enum adc_gain gain, int64_t *value);
/** @brief ADC references. */
enum adc_reference {
ADC_REF_VDD_1, /**< VDD. */
Expand Down Expand Up @@ -880,12 +880,12 @@
uint8_t resolution,
int32_t *valp)
{
int32_t adc_mv = *valp * ref_mv;
int64_t adc_mv = ((uint64_t) *valp) * ref_mv;
int ret = adc_gain_invert(gain, &adc_mv);

if (ret == 0) {
*valp = (adc_mv >> resolution);
*valp = (uint32_t) (adc_mv >> resolution);
}

Check notice on line 888 in include/zephyr/drivers/adc.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/drivers/adc.h:888 - int64_t adc_mv = ((uint64_t) *valp) * ref_mv; + int64_t adc_mv = ((uint64_t)*valp) * ref_mv; int ret = adc_gain_invert(gain, &adc_mv); if (ret == 0) { - *valp = (uint32_t) (adc_mv >> resolution); + *valp = (uint32_t)(adc_mv >> resolution);

return ret;
}
Expand Down
Loading