GithubHelp home page GithubHelp logo

Comments (2)

DeqingSun avatar DeqingSun commented on June 19, 2024

After some poking around it seems
QTOUCH_PTC->BURSTMODE.reg = 0xA4; is the cause of trouble.

So after change measureRaw to this, it seems OK.

uint16_t Adafruit_CPlay_FreeTouch::measureRaw(void) {
  if (yline == -1) 
    return -1;

  runInStandby(true);
  enablePTC(true);
  // check if in progress
  // set up NVIC if using INT (we're not)
  enableWCOint(false);
  clearWCOintFlag();
  clearEOCintFlag();
  // enable_eoc_int(); // not using irq (for now)

  // set up pin!
  //Serial.print("Y Line #"); Serial.println(yline);
  selectYLine();
  // set up sense resistor
  setSeriesResistor(seriesres);
  // set up prescalar
  setOversampling(oversample);
  // set up freq hopping
  setFreqHopping(freqhop, hops);
  // set up compensation cap + int (?) cap
  setCompCap(compcap);
  setIntCap(intcap);
    uint32_t BURSTMODE_REG_BACKUP = QTOUCH_PTC->BURSTMODE.reg;

  QTOUCH_PTC->BURSTMODE.reg = 0xA4;

  sync_config();

    uint16_t result = startPtcAcquire();
    
    QTOUCH_PTC->BURSTMODE.reg = BURSTMODE_REG_BACKUP;
    
    sync_config();
    
  return result;
}

Basically I backup QTOUCH_PTC->BURSTMODE.reg and restore its value after startPtcAcquire . It seems to work. I have no idea what I'm doing and I didn't find any document about the BURSTMODE register.

from adafruit_circuitplayground.

ladyada avatar ladyada commented on June 19, 2024

there's no documentation - we reverse engineered it from decompiling, so not surprising theres bugs :) can you please submit a PR?

from adafruit_circuitplayground.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.