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

Trying out software cap-sense #1038

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Trying out software cap-sense #1038

wants to merge 5 commits into from

Conversation

mmoskal
Copy link
Member

@mmoskal mmoskal commented Dec 13, 2019

This is raw, low-level API. To be tested and higher level ones to be built.

@mmoskal mmoskal requested a review from pelikhan April 24, 2020 01:44
@mmoskal mmoskal marked this pull request as ready for review April 24, 2020 01:45
// other chips to be tested
pin->setDigitalValue(1);
pin->getDigitalValue(PullMode::None);
sleep_us(50);
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a bootloader variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

probably, let me actually see if I can do this in TS

@mmoskal mmoskal marked this pull request as draft April 24, 2020 02:16
@mmoskal
Copy link
Member Author

mmoskal commented Apr 24, 2020

Can be done in TS, probably need to drop this PR.

let v = 0
let t = 0

function cap(p:PwmPin) {
    p.digitalWrite(true)
    p.setPull(PinPullMode.PullNone)
    p.digitalRead()
    control.waitMicros(50)
    return p.analogRead()
}

game.onPaint(() => {
    let n= control.millis()
    if (n-t>400) {
        t=n
        v=cap(pins.P0)
    }
    screen.print("v:" + v, 3, 3, 3)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants