Getting around "multiple slave functions in interface are not supported"

If you have a simple question and just want an answer.
Post Reply
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Getting around "multiple slave functions in interface are not supported"

Post by RitchRock »

In my project I have a userInterface() task that is essentially a button handler / debouncer. It notifies another task, dspMixer(), when Button 1 is pressed and dspMixer() changes the DSP mode. dspMixer() in turn clears the notification right away and the the userinterface() task sets LED indication. This all works well.

Next, I want my userinterface() task to notify a different task when, say, button 2 is pressed. This is where I am running into problems. I am getting the error that "multiple slave functions in interface are not supported", which yes, does make sense.

Is there a way for a server to only let certain clients know when the button they care about has been pressed? I see the example in the programming guide where the server selects over different client events, but not the other way around, which *I think* is what I'm after.


User avatar
CousinItt
Respected Member
Posts: 360
Joined: Wed May 31, 2017 6:55 pm

Post by CousinItt »

It sounds like you might want to look at an array of interfaces, with each client using one element of the array, and then each client could register the buttons they're interested in with the server.

HTH
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

I see - one slave function that notifies different clients in the array depending on which button is pressed. Then, the different clients could have different [[clears_notification]] functions. I'll give it try.

C
User avatar
CousinItt
Respected Member
Posts: 360
Joined: Wed May 31, 2017 6:55 pm

Post by CousinItt »

Several of the xmos libraries use interface arrays (e.g. lib_gpio, lib_i2c) so their code might provide inspiration. See also section 2.2.5 in the xmos programming guide.

In your case I was thinking of an array of something like this:

Code: Select all

typedef interface button_interface
{
   [[notification]] slave void event(void);	// a button has been pressed
   [[clears_notification]] button_status get_buttons(void); // get info on which button(s) triggered the notification
   void config_button(button_config_info bc);  // tell the server which buttons are of interest
} button_interface;
Post Reply