<?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; Topic: Accessing registers</title>
		<link>http://forums.leaflabs.com/topic.php?id=268</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:24:24 +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?topic=268" rel="self" type="application/rss+xml" />

		<item>
			<title>poslathian on "Accessing registers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=268#post-2084</link>
			<pubDate>Wed, 27 Oct 2010 19:57:14 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">2084@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;We do not strictly adhere to this, but I wouldnt be surprised if it were true. We usually try and use the register names from the documentation - not the STPerihLib. In general, for peripherals, we use the struct trick, but there are some places (in the bootloader and in the USB related code) where a quick write to a system or control register happens as a one off via #define, this is something that needs to be more strictly standardized, but I dont know of any glaring exceptions off the top of my head.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Accessing registers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=268#post-2079</link>
			<pubDate>Wed, 27 Oct 2010 19:03:11 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">2079@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;UPVOTE!&#60;/p&#62;
&#60;p&#62;poslathian - Does LeafLabs code always use the same register names as ST use in their documentation?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Accessing registers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=268#post-2066</link>
			<pubDate>Wed, 27 Oct 2010 13:56:12 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">2066@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;We dont expose the raw registers in the wirish library, but we do touch them all over in libmaple. Feel free to take a look at the code there to see &#34;our&#34; way of doing things. There are many alternatives for direct register access on Maple. &#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The simplest thing to do when starting from scratch is:&#60;br /&#62;
1) identify the register address (32 bit number) from the st documentation&#60;br /&#62;
2) #define SOMEREG 0x12345678&#60;br /&#62;
3) *(uint32*)(SOMEREG) = 0xWhatever&#60;br /&#62;
or&#60;br /&#62;
3) uint32 myNum = *(uint32*)(SOMEREG)&#60;/p&#62;
&#60;p&#62;The next best thing to do is to use structs to wrap large peripherals together like the GPIO example you described. &#60;/p&#62;
&#60;p&#62;Probably the thing you want to do is to include the appropriate libmaple file and reference our definitions. For example:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#include &#38;quot;spi.h&#38;quot;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;will give you access to things like:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;SPI-&#38;gt;CR1 = blah;
or blah = SPI-&#38;gt;CRCPR;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;libmaple doesnt current expose the i2c registers, because hw i2c isnt in the library yet. Feel free to jack whatever you like out of:&#60;br /&#62;
&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/i2c/libmaple/i2c.h&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/i2c/libmaple/i2c.h&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;which was a prototype from a while back. &#60;/p&#62;
&#60;p&#62;This is a good question in general, if people would like more documentation on this issue, upvote here
&#60;/p&#62;</description>
		</item>
		<item>
			<title>General Tree on "Accessing registers"</title>
			<link>http://forums.leaflabs.com/topic.php?id=268#post-2055</link>
			<pubDate>Wed, 27 Oct 2010 08:33:30 +0000</pubDate>
			<dc:creator>General Tree</dc:creator>
			<guid isPermaLink="false">2055@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi everyone.&#60;/p&#62;
&#60;p&#62;I just started working with maple, and i cant seem to figure out how i can refer to the register of the Chip. In arduino, you just had to write down the mane of the register, something like:&#60;/p&#62;
&#60;p&#62;DDRB=0x01;&#60;br /&#62;
PORTB=0x01;&#60;/p&#62;
&#60;p&#62;In maple, however, when i try to write the names of the registers, as mentioned in the official STM32F103 reference manual, the compiler says they are not defined.&#60;/p&#62;
&#60;p&#62;After searching the forum, i found out how to refer to the GPIO registers, e.g:&#60;br /&#62;
(GPIO_BASE)-&#38;gt;ODR = 0x01;&#60;br /&#62;
but i couldn't find any documentation about the full list of &#34;names&#34; for all the registers.&#60;br /&#62;
More specifically, i'm trying to set up an I2C network, without using the library functions provided, and i can't access the relevant registers.&#60;/p&#62;
&#60;p&#62;Any help finding the full list of these register names will be much appreciated!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
