<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; User Favorites: feurig</title>
		<link><a href='http://forums.leaflabs.com/profile.php?id=4345'>4345</a></link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:03:02 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?profile=4345" rel="self" type="application/rss+xml" />

		<item>
			<title>phisatho on "SPI Interrups"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1483#post-9862</link>
			<pubDate>Fri, 23 Mar 2012 15:14:22 +0000</pubDate>
			<dc:creator>phisatho</dc:creator>
			<guid isPermaLink="false">9862@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Shouldn't this be added to Wiki?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>richiereynolds on "SPI Interrups"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1483#post-9840</link>
			<pubDate>Tue, 20 Mar 2012 15:15:25 +0000</pubDate>
			<dc:creator>richiereynolds</dc:creator>
			<guid isPermaLink="false">9840@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thankyou &#60;strong&#62;very&#60;/strong&#62; much, works a treat!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "SPI Interrups"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1483#post-9837</link>
			<pubDate>Tue, 20 Mar 2012 02:25:00 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">9837@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;hi,&#60;/p&#62;
&#60;p&#62;calling &#60;code&#62;spi_irq_enable()&#60;/code&#62; as you have done enables both the interrupt line (in the NVIC) and the SPI RX not empty interrupt. however, the vector table entry for SPI2 doesn't point to anything useful by default, as libmaple doesn't (currently) provide an interrupt handler for the SPI peripherals. as you guessed, you need to register an interrupt handler yourself. you can do this by declaring a function named &#60;code&#62;__irq_spi2&#60;/code&#62;, with C linkage, like so:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;extern &#38;quot;C&#38;quot; void __irq_spi2(void) {
    // your SPI2 handler code goes here
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;the linker looks for a function with this name, and will cause it to be used as the SPI2 IRQ handler if it's defined. note that the extern &#34;C&#34; is mandatory -- you must give this function C linkage, or its name will go through C++ name mangling, and the linker won't pick up on it.&#60;/p&#62;
&#60;p&#62;hope this helps!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>richiereynolds on "SPI Interrups"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1483#post-9186</link>
			<pubDate>Sat, 17 Mar 2012 06:48:12 +0000</pubDate>
			<dc:creator>richiereynolds</dc:creator>
			<guid isPermaLink="false">9186@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello, I'm using the maple as a slave SPI receiver. I want to trigger an interrupt routine when data is received but can't quite work out how to do it, can anyone help?&#60;/p&#62;
&#60;p&#62;I've done this:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
HardwareSPI(2) spi;&#60;br /&#62;
setup()&#60;br /&#62;
{&#60;br /&#62;
    spi.beginSlave();&#60;br /&#62;
    spi_irq_enable(SPI2, SPI_RXNE_INTERRUPT);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void handleSpi()&#60;br /&#62;
{&#60;br /&#62;
    byte b = spi.read();&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
&#60;/code&#62;&#60;br /&#62;
So my question is how do I set up my &#60;code&#62;handleSpi&#60;/code&#62; as the interrupt handler?&#60;br /&#62;
In the header files I've traced through and found that the &#60;code&#62;nvic_irq_num&#60;/code&#62; for SPI2 is &#60;code&#62;NVIC_SPI2 = 36&#60;/code&#62; but I don't know how to use that to set up an interrupt. Is that even relevant?&#60;/p&#62;
&#60;p&#62;Thanks for any help!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
