electro-smith / json2daisy

Utility for converting JSON board definitions into valid, libDaisy compatible C++ board support files
MIT License
6 stars 2 forks source link

Bug: mpr121 pin setup incorrect #18

Open dromer opened 9 months ago

dromer commented 9 months ago

When using a setup like:

    "parents": {
        "mpr121_driver": {
            "component": "Mpr121",
            "pin": {
              "scl": 11,
              "sda": 12
            }
        }
    },

We get compile errors like:

HeavyDaisy_Untitled.hpp:63:45: error: no match for 'operator=' (operand types are 'daisy::Pin' and 'dsy_gpio_pin')
   63 |     mpr121_driver_config.scl = som.GetPin(11);
      |                                             ^

Coming from this line in the component defs: https://github.com/electro-smith/json2daisy/blob/main/src/json2daisy/resources/component_defs.json#L558

I wonder if it would make sense to have the i2c setup for the mpr121 sensors more like the other i2c peripherals and delegate this to an i2c parent config.

dromer commented 9 months ago

So this is apparently because of the migration to Pin config and phasing out of dsy_gpi_pin and GetPin() functionality.

It would be good to make sure that json2daisy is all set for this deprecation as right now the use of GetPin() is quite wide-spread in the header template and component_defs.json.

For instance: https://github.com/electro-smith/json2daisy/blob/main/src/json2daisy/templates/daisy.h#L221-L225

stephenhensley commented 9 months ago

@dromer thanks for the report. I agree, I think migrating everything to use the modern Pin config sooner than later is important.

I'll try to slot this into our team's schedule in the next few weeks. This should be almost, if not entirely, and under-the-hood refactor, and I don't think would require any changes to existing json config files.

dromer commented 3 months ago

I'll try to slot this into our team's schedule in the next few weeks.

Any progress on this? Would be nice to have json2daisy setup for the "proper" way to address pins.