You are reading a single comment by @fanoush and its replies. Click here to read the full conversation.
  • Honestly, not sure why it's doing that

    As for i2c for some reason it did not work with I2C2. It did work however with I2C1. So I2C2.setup({scl:13, sda:14, bitrate:400000}) did nothing, I did also break into debugger after that and HW registers were still at default values for both TWI ports. I2C1.setup({scl:13, sda:14, bitrate:400000}) however did work and when using I2C1 for scannig the bus I got exceptions except 0x1F address which was expected. There should be KX022 accelometer. BTW is there some Espruino module for this one? I see it was mentioned in this thread but I don't see it here https://github.com/espruino/EspruinoDocs­/tree/master/devices

    but why not just look at the PCB (or even the manufacturer's docs) to try and find out what the I2C parts are then try and look at those addresses?

    Because I wanted to test i2c functionality - scanning the bus looks like good test.

    As for the negated button - it doesn't work. It is still as before - returning false when pressed and true otherwise and BTN1 gives

    >BTN1.getInfo()
    ={ 
      port: "D", 
      num: 30, channel: 6, 
      functions: {  }
     }
    >BTN1.getMode()
    ="input_pulldown"
    

    so the line

      pinutils.findpin(pins, "PD30", True)["functions"]["NEGATED"]=0;
    

    seems to have no effect. I did find it used in boards/NRF52832DK.py in same way.

    gen/platform_config.h has

    [#define](https://forum.espruino.com/sea­rch/?q=%23define) BTN1_PININDEX 30/* D30 */
    [#define](https://forum.espruino.com/sea­rch/?q=%23define) BTN1_ONSTATE 1
    [#define](https://forum.espruino.com/sea­rch/?q=%23define) BTN1_PINSTATE JSHPINSTATE_GPIO_IN_PULLDOWN
    
    

    EDIT:
    oh, there is scripts/build_pininfo.py which is using NEGATED and then there is build_platform_config.py which tests for "inverted". And no code to automagicaly negate pulldown to pullup.

    EDIT2:
    however gen/jspininfo.c contains

    /* PD30 */ { JSH_PORTD|JSH_PIN_NEGATED, JSH_PIN0+30, JSH_ANALOG_NONE, { 0 } },
    

    so the 'NEGATED" works after all? but it still returned true when not pressed

About

Avatar for fanoush @fanoush started