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

Difference from V1 - Default pull mode of V2 P3,4,6,7,10 after display.disable() is None #391

Open
martinwork opened this issue Nov 7, 2023 · 0 comments

Comments

@martinwork
Copy link
Collaborator

martinwork commented Nov 7, 2023

Apparent pull mode of P3,4,6,7,10 after display.disable()

  • V1 = down
  • V2 = none

To see if mode is down or none connect a dangling lead to e.g. P3. Universal hex test-pin3.hex.zip outputs display pin values, without setting pull.

With the code below, DMESG enabled, and DMESG("setPull %p = %d", this, (int) pullMode); added to setPull, I see the output below.
https://github.com/lancaster-university/codal-nrf52/blob/84b1aeec870addcfb6027a924dbfe83f1f10c6db/source/NRF52Pin.cpp#L701

The only setPulls after disabling the display are for P0,P1,P2,P9. It seems the display pins are already configured as digital inputs, so return here
https://github.com/lancaster-university/codal-nrf52/blob/84b1aeec870addcfb6027a924dbfe83f1f10c6db/source/NRF52Pin.cpp#L279
but in any case their pullMode member is None because of this

col1.setPull(PullMode::None);

and
matrixMap.columnPins[col]->getDigitalValue(PullMode::None);

When the pull mode is none, all display pins show the same value when one pin is connected.

0 0x20002638
1 0x20002650
2 0x20002668
3 0x20002680
4 0x20002698
6 0x200026C8
7 0x200026E0
9 0x20002710
10 0x20002728
setPull 0x20002638 = 1
setPull 0x20002650 = 1
setPull 0x20002668 = 1
setPull 0x20002710 = 1
0,0,0,1,1,1,1,0,1
0,0,0,1,1,1,1,0,1
0,0,0,1,1,1,1,0,1
0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0
#include "MicroBit.h"
#include "codaldmesg.h"

#ifndef MICROBIT_CODAL
#ifdef CODAL_CONFIG_H
#define MICROBIT_CODAL 1
#else
#define MICROBIT_CODAL 0
#endif
#endif

MicroBit uBit;

#if MICROBIT_CODAL
#define mypullNONE PullMode::None
#define mypullDOWN PullMode::Down
#else
#define mypullNONE PullNone
#define mypullDOWN PullDown
#endif

#undef MYPULL
//#define MYPULL mypullNONE
//#define MYPULL mypullDOWN

void forever()
{
  uBit.display.disable();

//#ifdef MYPULL
//  uBit.io.P3.setPull( MYPULL);
//  uBit.io.P4.setPull( MYPULL);
//  uBit.io.P6.setPull( MYPULL);
//  uBit.io.P7.setPull( MYPULL);
//  uBit.io.P9.setPull( MYPULL);
//  uBit.io.P10.setPull( MYPULL);
//#endif

  DMESG( "0 %p", &uBit.io.P0);
  DMESG( "1 %p", &uBit.io.P1);
  DMESG( "2 %p", &uBit.io.P2);
  DMESG( "3 %p", &uBit.io.P3);
  DMESG( "4 %p", &uBit.io.P4);
  DMESG( "6 %p", &uBit.io.P6);
  DMESG( "7 %p", &uBit.io.P7);
  DMESG( "9 %p", &uBit.io.P9);
  DMESG( "10 %p", &uBit.io.P10);

  while (true)
  {
    ManagedString str;
    str = str + ManagedString( (int) uBit.io.P0.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P1.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P2.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P3.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P4.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P6.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P7.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P9.getDigitalValue()) + ",";
    str = str + ManagedString( (int) uBit.io.P10.getDigitalValue());
    DMESG( str.toCharArray());
    uBit.sleep(100);
  }
}

int main()
{
    uBit.init();

    create_fiber( forever);
    release_fiber();
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants