Skip to content

Commit 4e56f6c

Browse files
committed
shell: Update charge limit unit
Charge limit unit has changed from milliampere to microampere in npmx. Change shell command accordingly. Signed-off-by: Audun Korneliussen <[email protected]>
1 parent 6f34a3b commit 4e56f6c

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ For the user's convenience, this repository includes also a variety of sample ap
1111

1212
## Supported devices
1313
- nPM1300
14+
- nPM1304
1415

1516
## How to use
1617

drivers/npmx/shell/charger.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ npmx_charger_t *charger_instance_get(const struct shell *shell)
1717
}
1818

1919
static bool charger_charging_current_set_helper(const struct shell *shell,
20-
npmx_charger_t *charger_instance, uint16_t current,
21-
uint16_t *p_charging_current)
20+
npmx_charger_t *charger_instance, uint32_t current,
21+
uint32_t *p_charging_current)
2222
{
2323
npmx_error_t err_code = npmx_charger_charging_current_set(charger_instance, current);
2424
if (!check_error_code(shell, err_code)) {
@@ -58,16 +58,16 @@ static int cmd_charger_charging_current_set(const struct shell *shell, size_t ar
5858
}
5959

6060
if (!range_check(shell, args_info.arg[0].result.uvalue,
61-
NPM_BCHARGER_CHARGING_CURRENT_MIN_MA, NPM_BCHARGER_CHARGING_CURRENT_MAX_MA,
61+
NPM_BCHARGER_CHARGING_CURRENT_MIN_UA, NPM_BCHARGER_CHARGING_CURRENT_MAX_UA,
6262
"charging current")) {
6363
return 0;
6464
}
6565

66-
uint16_t charging_current_ma = (uint16_t)args_info.arg[0].result.uvalue;
67-
uint16_t current_actual;
68-
if (charger_charging_current_set_helper(shell, charger_instance, charging_current_ma,
66+
uint32_t charging_current_ua = (uint32_t)args_info.arg[0].result.uvalue;
67+
uint32_t current_actual;
68+
if (charger_charging_current_set_helper(shell, charger_instance, charging_current_ua,
6969
&current_actual)) {
70-
print_success(shell, current_actual, UNIT_TYPE_MILLIAMPERE);
70+
print_success(shell, current_actual, UNIT_TYPE_MICROAMPERE);
7171
}
7272
return 0;
7373
}
@@ -82,15 +82,15 @@ static int cmd_charger_charging_current_get(const struct shell *shell, size_t ar
8282
return 0;
8383
}
8484

85-
uint16_t charging_current_ma;
85+
uint32_t charging_current_ua;
8686
npmx_error_t err_code =
87-
npmx_charger_charging_current_get(charger_instance, &charging_current_ma);
87+
npmx_charger_charging_current_get(charger_instance, &charging_current_ua);
8888
if (!check_error_code(shell, err_code)) {
8989
print_get_error(shell, "charging current");
9090
return 0;
9191
}
9292

93-
print_value(shell, charging_current_ma, UNIT_TYPE_MILLIAMPERE);
93+
print_value(shell, charging_current_ua, UNIT_TYPE_MICROAMPERE);
9494
return 0;
9595
}
9696

@@ -270,8 +270,7 @@ static int cmd_charger_discharging_current_set(const struct shell *shell, size_t
270270

271271
const uint16_t allowed_values[] = NPM_BCHARGER_DISCHARGING_CURRENTS_MA;
272272
int32_t allowed_min = allowed_values[0];
273-
int32_t allowed_max = ARRAY_SIZE(allowed_values) > 1 ?
274-
allowed_values[ARRAY_SIZE(allowed_values) - 1] : allowed_values[0];
273+
int32_t allowed_max = allowed_values[ARRAY_SIZE(allowed_values) - 1];
275274

276275
if (!range_check(shell, args_info.arg[0].result.uvalue,
277276
allowed_min, allowed_max, "discharging current")) {

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ manifest:
2121
projects:
2222
- name: npmx
2323
path: modules/npmx
24-
revision: v1.0.1
24+
revision: 3312e7763c8f9c1651bfdf996c6b581f79b6bdcf
2525
- name: zephyr
2626
revision: v3.3.0
2727
import: true

0 commit comments

Comments
 (0)