What is the preferred method to implement channel interrupts in XC?
The usb audio firmware uses a macro called set_interrupt_handler defined in interrupt.h. Interrupt.h seems to be found only in the audio firmware. I was unable to get it to work in a non-audio project on a U6 processor.
Is there another, documented way for a handler to be run when a chanend receives a message?
channel interrupts
-
- Experienced Member
- Posts: 94
- Joined: Sun Feb 10, 2013 4:47 am
-
- XCore Expert
- Posts: 589
- Joined: Wed Feb 29, 2012 10:03 am
The best way to wait for events on a channel is by using the select statement. You can wait on channel to read the date from the channel but this blocks until there is some data in the channel.
Have a look at he following examples for more details:
while(1)
{
select
{
case c:> data:
//do something
break;
//wait for some other events
}
}
while(1)
{
c:> data; //blocks until there is some data available in the channel
}
Have a look at he following examples for more details:
while(1)
{
select
{
case c:> data:
//do something
break;
//wait for some other events
}
}
while(1)
{
c:> data; //blocks until there is some data available in the channel
}