Changed computation for current output
authorTom Knot <tomasknot@gmail.com>
Wed, 4 Jul 2018 13:03:14 +0000 (15:03 +0200)
committerTom Knot <tomasknot@gmail.com>
Wed, 4 Jul 2018 13:03:14 +0000 (15:03 +0200)
modules/unipi/src/unipi_spi.c
version.txt

index d143b02e3f0d37352d2edc41106ee5582c3acd1b..7ee1a0fe4aff32156d5df3c7ad7001181ebd819d 100644 (file)
@@ -641,13 +641,13 @@ void neuronspi_spi_iio_stm_ao_set_current(struct iio_dev *indio_dev, struct iio_
        regmap_read(n_spi->reg_map, n_spi->regstart_table->vref_inp, &stm_v_inp_ref);
        regmap_read(n_spi->reg_map, n_spi->regstart_table->stm_ao_curr_err, &stm_i_err);
        regmap_read(n_spi->reg_map, n_spi->regstart_table->stm_ao_curr_off, &stm_i_off);
-       stm_true_ref = ((u64)stm_v_int_ref) * (330000 + stm_i_err);
-       stm_v_inp_ref = stm_v_inp_ref * 10000;
-       stm_true_val = (stm_true_val * 10000) - stm_i_off;
+       stm_true_ref = ((u64)stm_v_int_ref) * (330000 + stm_i_err) * 100;
+       stm_v_inp_ref = stm_v_inp_ref * 1000;
+       stm_true_val = ((stm_true_val * 10000) - stm_i_off) * 4095;
        do_div(stm_true_ref, stm_v_inp_ref);
-       do_div(stm_true_ref, 4095);
        stm_v_inp_ref = stm_true_ref;
        do_div(stm_true_val, stm_v_inp_ref);
+       do_div(stm_true_val, 10000);
        if (stm_true_val > 4095) stm_true_val = 4095;
        regmap_write(n_spi->reg_map, n_spi->regstart_table->stm_ao_val_reg, (unsigned int)stm_true_val);
 }
index 62893fc23a9d616f2dfbb4ab0924c23d5f1b8cbe..2f28b68a699e5103c7dac19c662a41e1703ea730 100644 (file)
@@ -1 +1 @@
-Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:80(7ebe7c2) LatestCommit:Wed Jul 4 14:56:23 CEST 2018
+Repository:neuron-kernel ActiveBranch:[uart_timeout] PrecedingRelease:v.0.12 PrecedingRevision:81(9d17667) LatestCommit:Wed Jul 4 15:03:14 CEST 2018