SHARE
TWEET

Axoloti spi1config object

a guest Jun 17th, 2019 6 in 243 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <axoObject id="gpio/spi/spi1config" uuid="dfb0e9b4-7362-431e-aadc-4dfc87d9d35d">
  2.    <sDescription>Configures a SPI interface via SPI driver 1. Pin mapping: PA15=NSS PB3=SCK PB4=MISO PB5=MOSI</sDescription>
  3.    <author>Johannes Taelman</author>
  4.    <license>BSD</license>
  5.    <inlets/>
  6.    <outlets/>
  7.    <displays/>
  8.    <params/>
  9.    <attribs>
  10.       <combo name="clock_polarity">
  11.          <MenuEntries>
  12.             <string>CPOL=0</string>
  13.             <string>CPOL=1</string>
  14.          </MenuEntries>
  15.          <CEntries>
  16.             <string> </string>
  17.             <string>|SPI_CR1_CPOL</string>
  18.          </CEntries>
  19.       </combo>
  20.       <combo name="clock_phase">
  21.          <MenuEntries>
  22.             <string>CPHA=0</string>
  23.             <string>CPHA=1</string>
  24.          </MenuEntries>
  25.          <CEntries>
  26.             <string> </string>
  27.             <string>|SPI_CR1_CPHA</string>
  28.          </CEntries>
  29.       </combo>
  30.       <combo name="baudrate">
  31.          <MenuEntries>
  32.             <string>FPCLK/2</string>
  33.             <string>FPCLK/4</string>
  34.             <string>FPCLK/8</string>
  35.             <string>FPCLK/16</string>
  36.             <string>FPCLK/32</string>
  37.             <string>FPCLK/64</string>
  38.             <string>FPCLK/128</string>
  39.             <string>FPCLK/256</string>
  40.          </MenuEntries>
  41.          <CEntries>
  42.             <string>|(0&lt;&lt;3)</string>
  43.             <string>|(1&lt;&lt;3)</string>
  44.             <string>|(2&lt;&lt;3)</string>
  45.             <string>|(3&lt;&lt;3)</string>
  46.             <string>|(4&lt;&lt;3)</string>
  47.             <string>|(5&lt;&lt;3)</string>
  48.             <string>|(6&lt;&lt;3)</string>
  49.             <string>|(7&lt;&lt;3)</string>
  50.          </CEntries>
  51.       </combo>
  52.       <combo name="format">
  53.          <MenuEntries>
  54.             <string>MSB first</string>
  55.             <string>LSB first</string>
  56.          </MenuEntries>
  57.          <CEntries>
  58.             <string> </string>
  59.             <string>|SPI_CR1_LSBFIRST</string>
  60.          </CEntries>
  61.       </combo>
  62.    </attribs>
  63.    <depends>
  64.       <depend>SPID2</depend>
  65.       <depend>SPID1</depend>
  66.    </depends>
  67.    <code.init><![CDATA[// setup the pins
  68. palSetPadMode(GPIOA, 15, PAL_MODE_OUTPUT_PUSHPULL);// NSS
  69. palSetPadMode(GPIOB, 3, PAL_MODE_ALTERNATE(5));// SCK
  70. palSetPadMode(GPIOB, 4, PAL_MODE_ALTERNATE(5));// MISO
  71. palSetPadMode(GPIOB, 5, PAL_MODE_ALTERNATE(5));// MOSI
  72.  
  73. static const SPIConfig spi1cfg =
  74.    {NULL, GPIOA, 15, 0 attr_clock__polarity attr_clock__phase attr_baudrate attr_format};
  75.  
  76.  
  77. spiStart(&SPID1, &spi1cfg);]]></code.init>
  78.    <code.dispose><![CDATA[spiStop(&SPID1);
  79.  
  80. palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_ANALOG);
  81. palSetPadMode(GPIOB, 3, PAL_MODE_INPUT_ANALOG);
  82. palSetPadMode(GPIOB, 4, PAL_MODE_INPUT_ANALOG);
  83. palSetPadMode(GPIOB, 5, PAL_MODE_INPUT_ANALOG);]]></code.dispose>
  84. </axoObject>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top