Coder Social home page Coder Social logo

Comments (8)

sosandroid avatar sosandroid commented on September 2, 2024 1

Juste pour info, j'avais fait une autre Lib qui supportait I2C et SPI en même temps. Cela peut servir d'inspiration : https://github.com/sosandroid/AnalogDevice_AD5161

from fram_mb85rc_i2c.

sosandroid avatar sosandroid commented on September 2, 2024

Hi, at this time no plan to support SPI.
However, I can support you if you try to do it

from fram_mb85rc_i2c.

christophepersoz avatar christophepersoz commented on September 2, 2024

Hi,

Thanks a lot for the answer. I'm currently making a version for SPI chips, with less functionality and forked from the I2C version - here. At this time it's ok, but I will tell you if I need help ;)
Thanks a lot.

from fram_mb85rc_i2c.

christophepersoz avatar christophepersoz commented on September 2, 2024

Hello sosandroid,

I'm currently working on the SPI version of those chip. The lib works well, but I would like to simplify it and change the Overloading syntax into a Template. By doing that I, and maybe you too, have only have one write/read function whatever the value you want to write byte, half word, long. The idea is to have a something like this :

// Inside the .h

template <typename T>
void _readT(T *value) { *value = SPI.tranfer(0); } // maybe that can works too with Wire.transmission

class FRAM_MB85RS_SPI
{
  public:
    boolean read (uint32_t address, T *value);
    // ....

  private:
   //...
}

// Inside the .cpp
boolean FRAM_MB85RS_SPI::read(uint32_t address, T *value)
{
    if (address >= _maxaddress)
        return false;
    
#ifdef SER_OUT
    Serial.print("Read address : ");
    Serial.println(address, BIN);
#endif

    _csASSERT();
        SPI.transfer(FRAM_READ);
        _setMemAddr(& address);
        _readT<uint8_t>(*value);
    _csRELEASE();
    
    return true;
}

The point is that I'm a bit lost and I don't have a clue how can I insert a template inside the class.
If you are interested and if you know how to do, maybe you could help me to achieve that ?

The example above doesn't compile and create error on build.

Thanks in advance for your answer

from fram_mb85rc_i2c.

sosandroid avatar sosandroid commented on September 2, 2024

Hi,
I never worked with templates.
I quick search lead me to issues using Templates with the Arduino Builder such as this one : arduino/arduino-builder#182 (comment)

from fram_mb85rc_i2c.

christophepersoz avatar christophepersoz commented on September 2, 2024

This SPI lib I made works well, I would just like to minimize the size of the lib in memory by creating something more versatile without adding too much lines of code. Template seems the solution, but hard to figure it out.

from fram_mb85rc_i2c.

christophepersoz avatar christophepersoz commented on September 2, 2024

Hello,
Here the link for the library I created for the SPI FRAM version and based on your work for the I2C FRAM.
Even if I changed a lot of stuff, removed the ERROR management, which wasn't needed for my own use, functions, etc. the architecture remain the same.

I hope it could be useful for the community.

On GitHub - FRAM_MB85RS_SPI
On GitHub.io page - FRAM_MB85RS_SPI

Thanks for your work!

from fram_mb85rc_i2c.

sosandroid avatar sosandroid commented on September 2, 2024

Just added a crosslink on top of the Readme file to point out this SPI version.
Thank for the sharing

from fram_mb85rc_i2c.

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.