Skip to content

docs: Expand README for bq27441 driver.#221

Merged
nedseb merged 2 commits intomainfrom
bq27441-expend-readme
Mar 23, 2026
Merged

docs: Expand README for bq27441 driver.#221
nedseb merged 2 commits intomainfrom
bq27441-expend-readme

Conversation

@Charly-sketch
Copy link
Copy Markdown
Contributor

Closes #190
Parent issue #194


Title: Expand bq27441 README with full documentation

Description:

The bq27441 README was minimal and only contained a title and a basic mpremote command.
This PR expands it to match the level of detail of other drivers like ism330dl and wsen-hids.

Changes

  • Added Features section (voltage, SoC, capacity, current, power, SoH, temperature)

  • Added I2C Address section (default 0x55)

  • Added Basic Usage example (init + voltage + SoC reading)

  • Added complete API documentation:

    • measurements
    • configuration
    • power management
    • device info
  • Added Examples section with existing scripts

  • Added Notes about battery requirement (device only responds when battery is connected)

Notes

  • Default battery capacity documented (650 mAh)
  • Documentation aligned with repository standards

Checklist

  • README expanded with all required sections
  • All public methods documented
  • Battery requirement clearly mentioned

Copy link
Copy Markdown
Contributor

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonne base — le Basic Usage est correct et la structure est claire. Cependant il manque une part significative de l'API publique.

Méthodes publiques manquantes

Le driver expose environ 40 méthodes publiques. Le README n'en documente qu'une vingtaine. Il manque notamment :

Seal/Unseal :

  • sealed() — check if device is sealed
  • seal() — seal the device
  • unseal() — unseal for configuration

GPOUT getters :

  • gpout_polarity() — lire la polarité actuelle
  • gpout_function() — lire la fonction actuelle
  • configure_gpout_input() / configure_gpout_output() — configuration GPIO

Seuils getters :

  • soc1_set_threshold() / soc1_clear_threshold()
  • socf_set_threshold() / socf_clear_threshold()

Flags et delta :

  • soc_flag() / socf_flag() — flags de statut batterie
  • soci_delta() / set_soci_delta() — delta pour l'interrupt SoC

Config avancée :

  • op_config() / write_op_config() — registre de configuration

Même si ces méthodes sont avancées, elles doivent au minimum être listées dans une section "Advanced API" pour que l'utilisateur sache qu'elles existent.

Enums non documentés

current(type), soc(type), soh(type), temperature(type) prennent des enums en paramètre. Quelles sont les valeurs possibles ? Regarde dans const.py les classes CurrentMeasureType, SocMeasureType, SohMeasureType, TempMeasureType et liste les options. Exemple :

# Current types
bq.current(BQ27441.CurrentMeasureType.AVG)
bq.current(BQ27441.CurrentMeasureType.STBY)
bq.current(BQ27441.CurrentMeasureType.MAX)

Contenu manquant

  • Pas de section "Sensor Specifications" — Ajoute un tableau avec le composant (BQ27441-G1A), tension supportée, précision de mesure SoC, etc.
  • set_capacity(mAh) — exemple manquant — Tu mentionnes que la capacité par défaut est 650 mAh mais tu ne montres pas comment la configurer. Un exemple avec enter_config / set_capacity / exit_config serait utile.

Détails

  • Trailing whitespace après "Arduino Library)." (ligne 3) et "650 mAh (configurable)" (dans Notes)
  • Cohérence section I²C Address — La puce * **Default address:** \0x55`` mélange les styles. Aligne-toi sur le format des autres README.

Rappel

Ouvre device.py et vérifie que chaque méthode def qui ne commence pas par _ est documentée dans le README. C'est le critère de complétude.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expands the bq27441 driver README from a minimal stub into a full, driver-style documentation page to match other libraries in the repository and close docs harmonization gaps.

Changes:

  • Added new README sections: Features, I2C address, Basic Usage, API reference, Examples, and Notes.
  • Documented the driver’s public measurement/config/power/info methods and added an example mpremote invocation.
  • Added operational notes (battery required for I²C response, default design capacity).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/bq27441/README.md Outdated
# MicroPython BQ27441 Library

This library is a port of the [SparkFun BQ27441-G1A LiPo Fuel Gauge Arduino Library](https://github.com/sparkfun/SparkFun_BQ27441_Arduino_Library).
This library is a port of the [SparkFun BQ27441-G1A LiPo Fuel Gauge Arduino Library](https://github.com/sparkfun/SparkFun_BQ27441_Arduino_Library).
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line ends with trailing whitespace, which can create unintended Markdown hard line breaks and makes diffs noisy. Please remove the trailing space.

Copilot uses AI. Check for mistakes.
Comment thread lib/bq27441/README.md Outdated
* power management (shutdown / wake-up)
* GPOUT interrupt configuration (SOC_INT / BAT_LOW)

# I2C Address
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other driver READMEs (e.g., ISM330DL/WSEN-HIDS), consider using the same section title spelling: “I²C Address” rather than “I2C Address”.

Suggested change
# I2C Address
# I²C Address

Copilot uses AI. Check for mistakes.
Comment thread lib/bq27441/README.md Outdated
Comment on lines +54 to +56
* `current_average()` — average current
* `current(type)` — current (AVG, STBY, MAX)

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs for current(type) suggest passing values like “AVG/STBY/MAX”, but in code the method expects the CurrentMeasureType constants (and they are not exported from bq27441.__init__). Please document the correct import/usage (e.g., from bq27441.device import CurrentMeasureType) or export these enums from the package so the README examples match the public API.

Copilot uses AI. Check for mistakes.
Comment thread lib/bq27441/README.md Outdated
Comment on lines +61 to +86
* `capacity(type)` — advanced capacity readings

### Charge & Health

* `state_of_charge()` — battery level (%)
* `soc(type)` — filtered / unfiltered SoC
* `state_of_health()` — battery health (%)
* `soh(type)` — detailed SoH

### Temperature

* `temperature(type)` — battery or internal temperature

## Configuration

* `set_capacity(mAh)` — set battery design capacity
* `enter_config(user_control)` — enter config mode
* `exit_config(resim=True)` — exit config mode

### GPOUT / Alerts

* `set_gpout_function(type)` — SOC_INT or BAT_LOW
* `set_gpout_polarity(active_high)`
* `set_soc1_thresholds(set, clear)`
* `set_socf_thresholds(set, clear)`
* `pulse_gpout()`
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to current(), several APIs here take typed constants (e.g., capacity(...), soc(...), soh(...), temperature(...), set_gpout_function(...)) but the README doesn’t indicate what values to pass or how to import the corresponding *MeasureType / GpoutFunctionType classes. Please update the docs to reference the actual constants and their import path, otherwise these signatures are hard to use correctly.

Copilot uses AI. Check for mistakes.
Comment thread lib/bq27441/README.md Outdated

### Temperature

* `temperature(type)` — battery or internal temperature
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temperature(type) is documented as “battery or internal temperature”, but the driver returns the raw register value directly (no °C conversion). Please clarify the returned units/format and (if needed) show how to convert it, so users don’t assume the result is already in degrees.

Copilot uses AI. Check for mistakes.
Comment thread lib/bq27441/README.md Outdated
# Notes

* The **BQ27441 requires a connected LiPo battery** to respond on I²C
* Default design capacity is **650 mAh** (configurable)
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace at end of line; please remove to avoid unintended Markdown formatting and keep diffs clean.

Copilot uses AI. Check for mistakes.
@nedseb
Copy link
Copy Markdown
Contributor

nedseb commented Mar 23, 2026

README réécrit en 86d8c1f pour traiter tous les commentaires :

Revue :

  1. ~15 méthodes manquantes — Toutes documentées : GPOUT (getters + setters + thresholds + flags + delta), seal/unseal, op_config, configure_gpout_input/output
  2. Enums non documentés — Section "Advanced Measurements with Type Constants" avec imports explicites et tous les variants pour CurrentMeasureType, CapacityMeasureType, SocMeasureType, SohMeasureType, TempMeasureType, GpoutFunctionType
  3. Section Sensor Specifications — Ajoutée (BQ27441-G1A, I²C, 0x55, 2.5-4.5V, 650 mAh)
  4. set_capacity() exemple — Ajouté dans la section Configuration avec enter_config/exit_config
  5. Trailing whitespace — Supprimé

Copilot :

  1. Trailing whitespace (lignes 3 et 121) — Supprimé
  2. "I2C Address" → "I²C Address" — Intégré dans le tableau des specs
  3. Import path des enums — Documenté explicitement (from bq27441.device import CurrentMeasureType, ...)
  4. Enums pour capacity/soc/soh/temperature/gpout — Tous documentés avec exemples
  5. temperature() unités — Précisé : raw register value en 0.1 K, formule de conversion fournie

Prête à merger.

@nedseb nedseb merged commit fff0977 into main Mar 23, 2026
3 checks passed
@nedseb nedseb deleted the bq27441-expend-readme branch March 23, 2026 16:04
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Expand README for bq27441 driver.

3 participants