@@ -135,33 +135,48 @@ def is_acin_present(self) -> bool:
135135
136136 @property
137137 def acin_voltage (self ) -> float :
138- """ACIN voltage in V"""
138+ """ACIN line actual voltage in V
139+
140+ In order to be able to read this voltage ADCs must be enable via :py:attr:`all_adc_enabled`
141+ """
139142 return 1.7 * self ._read_register12 (0x56 ) / 1000.0
140143
141144 @property
142145 def acin_current (self ) -> float :
143- """ACIN current in mA"""
146+ """ACIN input line actual current in mA
147+
148+ In order to be able to read this current ADCs must be enable via :py:attr:`all_adc_enabled`
149+ """
144150 return 0.625 * self ._read_register12 (0x58 )
145151
146152 @property
147153 def is_vbus_present (self ) -> bool :
148- """True when voltage is present on the VBUS input line"""
154+ """True when voltage is present on the VBUS power input line"""
149155 reg_val = self ._read_register8 (_AXP192_INPUT_POWER_STATE )
150156 return (reg_val & _AXP192_INPUT_POWER_STATE_VBUS_IS_PRESENT ) != 0
151157
152158 @property
153159 def vbus_voltage (self ) -> float :
154- """VBUS voltage in V"""
160+ """VBUS input line actual voltage in V
161+
162+ In order to be able to read this voltage ADCs must be enable via :py:attr:`all_adc_enabled`
163+ """
155164 return 1.7 * self ._read_register12 (0x5A ) / 1000.0
156165
157166 @property
158167 def vbus_current (self ) -> float :
159- """VBUS current in mA"""
168+ """VBUS power input line actual current in mA
169+
170+ In order to be able to read this current ADCs must be enable via :py:attr:`all_adc_enabled`
171+ """
160172 return 0.375 * self ._read_register12 (0x5C )
161173
162174 @property
163175 def aps_voltage (self ) -> float :
164- """APS voltage in V"""
176+ """APS (internal power supply) actual voltage in V
177+
178+ In order to be able to read this voltage ADCs must be enable via :py:attr:`all_adc_enabled`
179+ """
165180 return 1.4 * self ._read_register12 (0x7E ) / 1000.0
166181
167182 @property
@@ -172,13 +187,13 @@ def is_battery_connected(self) -> bool:
172187
173188 @property
174189 def is_battery_charging (self ) -> bool :
175- """True when the battery is charging"""
190+ """True when the battery is connected to AXP192 and is charging"""
176191 reg_val = self ._read_register8 (_AXP192_POWER_CHARGE_STATUS )
177192 return (reg_val & _AXP192_POWER_CHARGE_STATUS_CHARGING ) != 0
178193
179194 @property
180195 def battery_charging_enabled (self ) -> bool :
181- """Enable/disable the tattery charging"""
196+ """Enable/disable the battery charging"""
182197 reg_val = self ._read_register8 (_AXP192_CHARGING_CTRL1 )
183198 return (reg_val & _AXP192_CHARGING_CTRL1_ENABLE ) != 0
184199
@@ -198,27 +213,47 @@ def battery_charging_enabled(self, enabled: bool) -> None:
198213
199214 @property
200215 def battery_voltage (self ) -> float :
201- """Battery voltage in V"""
216+ """Battery voltage in V
217+
218+ In order to be able to read this voltage ADCs must be enable via :py:attr:`all_adc_enabled`
219+ Return 0 if no battery is connected to AXP192
220+ """
202221 return 0.0011 * self ._read_register12 (0x78 )
203222
204223 @property
205224 def battery_charge_current (self ) -> float :
206- """Battery charging current in mA"""
225+ """Battery charging current in mA
226+
227+ In order to be able to read this current ADCs must be enable via :py:attr:`all_adc_enabled`
228+ Return 0 if no battery is connected to AXP192
229+ """
207230 return 0.5 * self ._read_register12 (0x7A )
208231
209232 @property
210233 def battery_discharge_current (self ) -> float :
211- """Battery discharging current in mA"""
234+ """Battery discharging current in mA
235+
236+ In order to be able to read this current ADCs must be enable via :py:attr:`all_adc_enabled`
237+ Return 0 if no battery is connected to AXP192
238+ """
212239 return 0.5 * self ._read_register12 (0x7C )
213240
214241 @property
215242 def battery_ouput_power (self ) -> float :
216- """Battery istantaneous ouput power in W"""
243+ """Battery istantaneous ouput power in mW
244+
245+ In order to be able to read this power ADCs must be enable via :py:attr:`all_adc_enabled`
246+ Return 0 if no battery is connected to AXP192
247+ """
217248 return 1.1 * 0.5 * self ._read_register24 (0x70 ) / 1000
218249
219250 @property
220251 def battery_level (self ) -> float :
221- """Battery level in range 0-100%"""
252+ """Battery level in range 0-100%
253+
254+ In order to be able to read this power ADCs must be enable via :py:attr:`all_adc_enabled`
255+ Return 0 if no battery is connected to AXP192
256+ """
222257 bat_voltage = self .battery_voltage
223258 bat_chg_current = self .battery_charge_current
224259 vmin = self .battery_switch_off_voltage
@@ -258,25 +293,27 @@ def battery_charge_target_voltage(self) -> float:
258293 def all_adc_enabled (self ) -> bool :
259294 """Enable/disable all AXP192 ADCs of register 0x82
260295
261- +-----------------------+
262- | Register 0x82 ADCs |
263- +=======================+
264- | Battery voltage ADC |
265- +-----------------------+
266- | Battery current ADC |
267- +-----------------------+
268- | ACIN voltage ADC |
269- +-----------------------+
270- | ACIN Current ADC |
271- +-----------------------+
272- | VBUS voltage ADC |
273- +-----------------------+
274- | VBUS Current ADC |
275- +-----------------------+
276- | APS Voltage ADC |
277- +-----------------------+
278- | TS pin ADC function |
279- +-----------------------+
296+ +-----------------------+------------------------------------------+
297+ | Register 0x82 ADCs | AXP192 Property |
298+ +=======================+==========================================+
299+ | Battery voltage ADC | :py:attr:`battery_voltage` |
300+ +-----------------------+------------------------------------------+
301+ | Battery current ADC | :py:attr:`battery_charge_current` |
302+ | | |
303+ | | :py:attr:`battery_discharge_current` |
304+ +-----------------------+------------------------------------------+
305+ | ACIN voltage ADC | :py:attr:`acin_voltage` |
306+ +-----------------------+------------------------------------------+
307+ | ACIN Current ADC | :py:attr:`acin_current` |
308+ +-----------------------+------------------------------------------+
309+ | VBUS voltage ADC | :py:attr:`vbus_voltage` |
310+ +-----------------------+------------------------------------------+
311+ | VBUS Current ADC | :py:attr:`vbus_current` |
312+ +-----------------------+------------------------------------------+
313+ | APS Voltage ADC | :py:attr:`aps_voltage` |
314+ +-----------------------+------------------------------------------+
315+ | TS pin ADC function | |
316+ +-----------------------+------------------------------------------+
280317 """
281318 return self ._read_register8 (_AXP192_ADC_ENABLE_1 ) == 0xFF
282319
@@ -294,7 +331,6 @@ def power_key_was_pressed(self) -> Tuple[bool, bool]:
294331 """Power key pressed status
295332
296333 :returns: Two booleans: Power key is short press and power key is long press
297- :rtype: tuple(bool, bool)
298334 """
299335 reg_val = self ._read_register8 (_AXP192_IRQ_3_STATUS )
300336 short_press = (reg_val & _AXP192_IRQ_3_STATUS_PEK_SHORT_PRESS ) != 0
@@ -504,7 +540,6 @@ def _is_gpio_floating(self, gpio_num: int) -> bool:
504540
505541 :param int gpio_num: Number of the GPIO to check. Allowed values: 0, 1 or 2
506542 :returns: True is the GPIO is in floating pin mode
507- :rtype: bool
508543 """
509544 self .__validate_gpio_num (gpio_num )
510545 if 0 <= gpio_num <= 2 :
@@ -530,7 +565,6 @@ def _is_gpio_output_low(self, gpio_num: int) -> bool:
530565
531566 :param int gpio_num: Number of the GPIO to check. Allowed values: 0, 1 or 2
532567 :returns: True is the GPIO is in low output mode
533- :rtype: bool
534568 """
535569 self .__validate_gpio_num (gpio_num )
536570 if 0 <= gpio_num <= 2 :
@@ -569,7 +603,6 @@ def _get_gpio_ldo_voltage_out(self, gpio_num: int) -> float:
569603
570604 :param int gpio_num: Number of the GPIO to check. Allowed value: 0
571605 :returns: GPIO output voltage in V
572- :rtype: float
573606 """
574607 if not self ._is_gpio_ldo_voltage_out (gpio_num ):
575608 return 0
@@ -586,7 +619,6 @@ def _is_gpio_ldo_voltage_out(self, gpio_num: int) -> bool:
586619
587620 :param int gpio_num: Number of the GPIO to check. Allowed value: 0
588621 :returns: True when GPIO is in LDO voltage output mode
589- :rtype: bool
590622 """
591623 self .__validate_gpio_num (gpio_num )
592624 if gpio_num == 0 :
@@ -627,7 +659,6 @@ def _get_gpio_pwm_out(self, gpio_num: int) -> int:
627659
628660 :param int gpio_num: Number of the GPIO to check. Allowed values: 1, 2
629661 :returns: PWM duty_cyle in range 0-255. Returns 0 if the GPIO isn't in PWM output mode
630- :rtype: int
631662 """
632663 self .__validate_gpio_num (gpio_num )
633664 if 1 <= gpio_num <= 2 :
@@ -646,7 +677,6 @@ def _is_gpio_pwm_out(self, gpio_num: int) -> bool:
646677
647678 :param int gpio_num: Number of the GPIO to check. Allowed values: 1, 2
648679 :returns: True when GPIO is in PWM output mode
649- :rtype: bool
650680 """
651681 self .__validate_gpio_num (gpio_num )
652682 if 1 <= gpio_num <= 2 :
@@ -732,7 +762,6 @@ def _read_register8(self, register: int) -> int:
732762
733763 :param int register: Register number. Allowed range: 0-255
734764 :returns: The register value
735- :rtype: int
736765 """
737766 in_buf = bytearray (1 )
738767 out_buf = bytearray (1 )
@@ -749,7 +778,6 @@ def _read_register12(self, register: int) -> int:
749778
750779 :param int register: Register number. Allowed range: 0-255
751780 :returns: The register value
752- :rtype: int
753781 """
754782 in_buf = bytearray (2 )
755783 out_buf = bytearray (1 )
@@ -766,7 +794,6 @@ def _read_register24(self, register: int) -> int:
766794
767795 :param int register: Register number. Allowed range: 0-255
768796 :returns: The register value
769- :rtype: int
770797 """
771798 in_buf = bytearray (3 )
772799 out_buf = bytearray (1 )
0 commit comments