libretiny-eu / libretiny

PlatformIO development platform for IoT modules
http://docs.libretiny.eu/
MIT License
401 stars 59 forks source link

[beken-72xx] Improve ddev ADC support #220

Closed szupi-ipuzs closed 9 months ago

szupi-ipuzs commented 10 months ago

One of the users reported issue esphome/issues#5201 with ADC on BK7231N, so I took a look at the code and found something that could be related. I don't own any N device with ADC, so cannot really test this. But I have checked my T devices with this fix and the ADC still works there.

kuba2k2 commented 10 months ago

The whole "ddev" layer adds so much boilerplate and lowers performance... too bad most functions handling the "requests" are static. I wish we could just #define static ; or something haha

szupi-ipuzs commented 10 months ago

I wish we could just #define static ; or something haha

That would be really confusing :) But I don't understand the problem - why can't we ditch these functions and create a nice wrapper that would operate on registers directly? Is it simply too much work or is there something missing?

kuba2k2 commented 10 months ago

Of course we can. This is just too much work for a single person :)

Ultimately (in distant future) I would like to have LibreTiny C APIs (not Arduino APIs) around all peripherals that are now Arduino-only, such as GPIO, ADC, PWM, I2C, SPI, Wi-Fi.

The existing Arduino implementations would then be moved to "components" (similar to those in esp-idf, structured like the lt_*.c files now) in the C API. The Arduino APIs would only be a thin wrapper around the C API.

Those "components" would then use plain register access, slowly getting rid of parts of the vendor SDKs. But those are dreams only :smile:

szupi-ipuzs commented 10 months ago

Too much work for a single person who does it in their free time and not for money. That's true. But it's good you have dreams, because it means the software you create is (or will be) well-thought and structured, unlike some others I have seen. Let's just hope tuya doesn't soon switch their products to yet another chip family - with yet uglier sdks :)

kuba2k2 commented 10 months ago

Too much work for a single person who does it in their free time and not for money.

Yup, that's me :smile:

We still have a few more chip families to add...