Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[p2][photon2] Add VBAT_MEAS pin and charging indication pin for Photon2 #2482

Merged
merged 3 commits into from
Jul 20, 2022

Conversation

YutingYou
Copy link
Contributor

Problem

This PR is to add VBAT_MEAS and charging pin to P2 pinmap.

  • VBAT_MEAS is an ADC-dedicated pin, it can measure the input voltage with 5V tolerance,
  • Charging pin is only used on Lightcycle

Solution

Add VBAT_MEAS as the A6 pin, note that the reference voltage is 5V instead of 3.3V

Steps to Test

  1. Re-compile and download bootloader/system-part1/user-app
  2. Measure different voltage with A6 pin

Example App

#include "Particle.h"

SYSTEM_MODE(MANUAL);

Serial1LogHandler log(115200, LOG_LEVEL_ALL);

void setup() {
}

void loop() {
    int value = analogRead(A6);
    Log.info("A6 value: %d, volt: %f", value, value / 4096.0 * 5.0);

    int A0Value = analogRead(A0);
    Log.info("A0 Value: %d, volt: %f", A0Value, A0Value / 4096.0 * 3.3);
    delay(1000);
}

References

Links to the Community, Docs, Other Issues, etc..


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

hal/src/rtl872x/gpio_hal.cpp Outdated Show resolved Hide resolved
Use Photon 2 name
@tstellanova tstellanova added the ready to merge PR has been reviewed and tested label Jul 20, 2022
@tstellanova tstellanova changed the title Add VBAT_MEAS pin and charging pin [p2][photon2] Add VBAT_MEAS pin and charging pin Jul 20, 2022
@tstellanova tstellanova changed the title [p2][photon2] Add VBAT_MEAS pin and charging pin [p2][photon2] Add VBAT_MEAS pin and charging indication pin for Photon2 Jul 20, 2022
@tstellanova tstellanova merged commit c96bc2c into develop Jul 20, 2022
@tstellanova tstellanova deleted the fix/vbat-meas-pin branch July 20, 2022 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge PR has been reviewed and tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants