Skip to content

Using Wire with multiple devices #17

Description

@ttlappalainen

Tanks for the great enchances. That solved my problem with my 1-wire library, which needs to run i2c tasks under isr (callbacks).

Now I have questions. Basically I build classes, which are independent of each other. So then they does not know about others and their use of wire.

The first problem is that each device class has its own initialization for Wire. So each of them will call begin, which causes situation that several device classes may call begin. So is there reliable way to check that has begin has been called and that it matches the request the other device will use?

1-wire runs with isr, when task has been started. Others normally as blocked but can also use irs in future. So do have any way to mark wire "locked" for some system? So if I start 1-wire tasks, I should have a way to tell that this Wire is now locked for me (e.g. pointer of callback handler). Then if other class tries to use it, it needs to wait until other class has finished its tasks.

Currently I have both problems by having own Wire extension, which just adds functionality. But if there is currently no functions for above, would it be possible to add functionality to your extension?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions