Coder Social home page Coder Social logo

hw i2c & sensor module about lua-rtos-esp32 HOT 3 CLOSED

loboris avatar loboris commented on May 13, 2024
hw i2c & sensor module

from lua-rtos-esp32.

Comments (3)

jolivepetrus avatar jolivepetrus commented on May 13, 2024

Hi loboris,

We will create a new branch for give support to i2c in Lua RTOS. I took a look at your proposal for i2c driver and I have some comments about it:

  • Lua platform folder will be disappear in the future

  • Drivers in Lua RTOS are intended to have all the intelligence for allow simple Lua modules, and in the future for other programming languages.

  • Drivers lock those resources they need via driver_lock function. For example, if a driver need 2 pins that pins are lock by the driver. If later, if another driver lock resource locked previously by another driver an error is raised.

  • Lua modules take care about errors raised by drivers and an exeption is generated to the user if a driver error is raised. Lock resources are important for us because they avoid programming errors from the blockly environment.

The ADC driver is a good example for know more about this.

from lua-rtos-esp32.

loboris avatar loboris commented on May 13, 2024

Thanks for your comments, especially about driver_lock function, I've somehow missed it.

from lua-rtos-esp32.

jolivepetrus avatar jolivepetrus commented on May 13, 2024

You have i2c driver and i2c Lua module in master branch see commit bb446ad
.
We have to write the wiki for this module, but you have an example in (https://github.com/whitecatboard/Lua-RTOS-ESP32/blob/master/components/spiffs_image/image/examples/lua/i2c.lua).

For sensors we are thinking about a more elaborate strategy that fits better with our educational perpectives. Some ideas about that:

  • Sensors are things that use drivers, so it would be better to put them in another folder

  • Is possible to have a Lua module that encapsulates generic sensor behavior, such as filters for reduce noise, ...

  • We are think in something like:

    instance1 = sensor. BME280(i2c.I2C0, address, speed, sda, scl)
    instance1:read()
    ...

    instance2 = sensor.TMP36(adc.ADC0, adc.ADC_CH6)
    instance2:read()
    ...

from lua-rtos-esp32.

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.