This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit bb0a5dea46897e5a466929fcf25c794605dfd8e4
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Sat May 18 16:55:19 2024 +0200

    sensors/ina219: Fix voltage calculation
    
    For voltage calculation wrong bit was tested to see if
    range is 16 or 32V.
    
    This could resulted in incorrect value being computed
    depending if BRNG bit was matching bit from BG.
    
    mcu/pic32: Add minimal boot code
    
    There is special flash area dedicated to bootloader (0xbfc00000-0xbfc0FF00).
    Code from this area is execute first.
    This is where mcuboot is placed.
    
    It is possible to build application elf that provides minimal
    code that jumps to normal flash area dedicated for applications.
    The elf generated this way can then easyly be used in MPLAB X ide
    instead of command line gdb.
    
    When syscfg has MCU_NO_BOOTLOADER_BUILD set to 1
    additional section is generated that goes to bootloader area of MCU.
    
    mcu/pic32: Add minimal boot code
    
    There is special flash area dedicated to bootloader (0xbfc00000-0xbfc0FF00).
    Code from this area is execute first.
    This is where mcuboot is placed.
    
    It is possible to build application elf that provides minimal
    code that jumps to normal flash area dedicated for applications.
    The elf generated this way can then easyly be used in MPLAB X ide
    instead of command line gdb.
    
    When syscfg has MCU_NO_BOOTLOADER_BUILD set to 1
    additional section is generated that goes to bootloader area of MCU.
---
 hw/drivers/sensors/ina219/src/ina219.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/drivers/sensors/ina219/src/ina219.c 
b/hw/drivers/sensors/ina219/src/ina219.c
index ab058f314..2bc16391b 100644
--- a/hw/drivers/sensors/ina219/src/ina219.c
+++ b/hw/drivers/sensors/ina219/src/ina219.c
@@ -206,7 +206,7 @@ ina219_read_bus_voltage(struct ina219_dev *ina219, uint16_t 
*voltage, bool *conv
 
     rc = ina219_read_bus_voltage_reg(ina219, &v);
     if (rc == SYS_EOK) {
-        if (ina219->config_reg & INA219_CONF_REG_PG_Msk) {
+        if (ina219->config_reg & INA219_CONF_REG_BRNG_Msk) {
             *voltage = (v >> 3) * INA219_BUS_VOLTAGE_32V_LSB;
         } else {
             *voltage = (v >> 3) * INA219_BUS_VOLTAGE_16V_LSB;

Reply via email to