Documentation: I2S, SDIO, and some others

This commit is contained in:
Daniel Fekete 2017-05-06 14:56:11 +02:00
parent e4a8fdfeb0
commit f54327339f
23 changed files with 1170 additions and 62 deletions

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>
@ -203,7 +215,7 @@
<li><a href="#analogwriteresolution">analogWriteResolution()</a></li> <li><a href="#analogwriteresolution">analogWriteResolution()</a></li>
<li><a href="#attachinterrupt">attachInterrupt(...);</a></li> <li><a href="#void-attachinterruptuint8_t-callback-int-mode">void attachInterrupt(uint8_t, callback, int mode);</a></li>
<li><a href="#predefined-pin-constants">Predefined pin constants</a></li> <li><a href="#predefined-pin-constants">Predefined pin constants</a></li>
@ -321,11 +333,14 @@ void loop() {
} }
</code></pre> </code></pre>
<h4 id="attachinterrupt"><strong><code>attachInterrupt(...);</code></strong></h4> <h4 id="void-attachinterruptuint8_t-callback-int-mode"><strong><code>void attachInterrupt(uint8_t, callback, int mode);</code></strong></h4>
<p>TODO not yet implemented</p> <p>Setup callback on the specified pin. Mode can be:
<em> CHANGE: When pin changes from LOW to HIGH, or HIGH to LOW, the callback will be called.
</em> RISING: When pin changes from LOW to HIGH the callback will be called.
* FALLING: When pin changes from HIGH to LOW, the callback will be called.</p>
<p>Same pins from different ports cannot be used. For exaple PA3 and PB3 cannot be used as interrupt simultaneously.</p>
<h3 id="predefined-pin-constants">Predefined pin constants</h3> <h3 id="predefined-pin-constants">Predefined pin constants</h3>
<p>The following constants are defined in the variant.h file for each variant: <p>The following constants are defined in the variant.h file for each variant:</p>
TODO not all implemented</p>
<table> <table>
<thead> <thead>
<tr> <tr>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>
@ -164,7 +176,7 @@
</a> </a>
</li> </li>
<li > <li >
<a rel="prev" href="../uart/"> <a rel="prev" href="../i2s/">
Next <i class="fa fa-arrow-right"></i> Next <i class="fa fa-arrow-right"></i>
</a> </a>
</li> </li>

311
docs/i2s/index.html Normal file
View File

@ -0,0 +1,311 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>I2S - STM32GENERIC</title>
<link href="../css/bootstrap-custom.min.css" rel="stylesheet">
<link href="../css/font-awesome-4.0.3.css" rel="stylesheet">
<link rel="stylesheet" href="../css/highlight.css">
<link href="../css/base.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../js/jquery-1.10.2.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>
<script src="../js/highlight.pack.js"></script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">STM32GENERIC</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="..">Installation</a>
</li>
<li >
<a href="../upload/">Uploading</a>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../menu_options/">Menu options</a>
</li>
<li >
<a href="../arduino_api/">Arduino API</a>
</li>
<li >
<a href="../spi/">SPI</a>
</li>
<li >
<a href="../i2c/">I2C</a>
</li>
<li class="active">
<a href="./">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li >
<a href="../uart/">Serial UART</a>
</li>
<li >
<a href="../usb_cdc/">Serial USB</a>
</li>
<li >
<a href="../stm32_hal/">STM32 HAL</a>
</li>
</ul>
</li>
<li >
<a href="../libraries/">Libraries</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">STM32 Boards <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../boards/">Boards list</a>
</li>
<li >
<a href="../add_board/">Adding a board</a>
</li>
<li >
<a href="../test/">Testing a board</a>
</li>
</ul>
</li>
<li >
<a href="../about/">About</a>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
<li >
<a rel="next" href="../i2c/">
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="prev" href="../sdio/">
Next <i class="fa fa-arrow-right"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="main active"><a href="#i2s">I2S</a></li>
<li class="main "><a href="#this-library-is-in-beta-and-the-api-implementation-is-subject-to-change">This library is in beta, and the API / implementation is subject to change!</a></li>
<li><a href="#i2sclassspi_typedef-instance">I2SClass(SPI_TypeDef *instance);</a></li>
<li><a href="#i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck">I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);</a></li>
<li><a href="#i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck-uint8_t-mck">I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck, uint8_t mck);</a></li>
<li><a href="#uint8_t-i2sclassbegini2s_mode_t-mode-uint32_t-samplerate-uint8_t-bitspersample">uint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);</a></li>
<li><a href="#writeuint16_t-data">write(uint16_t data);</a></li>
<li><a href="#write32uint32_t-data">write32(uint32_t data);</a></li>
<li><a href="#writeuint16_t-data-uint16_t-size">write(uint16_t *data, uint16_t size);</a></li>
<li><a href="#writeuint32_t-data-uint16_t-size">write(uint32_t *data, uint16_t size);</a></li>
<li><a href="#stm32setsduint8_t-pin">stm32SetSD(uint8_t pin);</a></li>
<li><a href="#stm32setwduint8_t-pin">stm32SetWD(uint8_t pin);</a></li>
<li><a href="#stm32setckuint8_t-pin">stm32SetCK(uint8_t pin);</a></li>
<li><a href="#stm32setmckuint8_t-pin">stm32SetMCK(uint8_t pin);</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<h2 id="i2s">I2S</h2>
<p>Not to be confused with <a href="../i2c/">I2C</a>, is a protocol for connecting to audio devices.</p>
<h2 id="this-library-is-in-beta-and-the-api-implementation-is-subject-to-change"><strong>This library is in beta, and the API / implementation is subject to change!</strong></h2>
<p>To use this library, include it in your code:</p>
<pre><code class="c++">#include &quot;I2S.h&quot;
I2SClass i2s(...);
</code></pre>
<h4 id="i2sclassspi_typedef-instance"><strong><code>I2SClass(SPI_TypeDef *instance);</code></strong></h4>
<p>Construct I2S that will be connected to the specified I2S instance on chip.</p>
<p>The board default pins will be used for sd/ws/ck. mck will not be used.</p>
<h4 id="i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck"><strong><code>I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);</code></strong></h4>
<p>Construct I2S that will be connected to the specified I2S instance on chip.</p>
<p>The specified pins will be used for sd/ws/ck. mck will not be used.</p>
<h4 id="i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck-uint8_t-mck"><strong><code>I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck, uint8_t mck);</code></strong></h4>
<p>Construct I2S that will be connected to the specified I2S instance on chip.</p>
<p>The specified pins will be used for sd/ws/ck/mck.</p>
<h4 id="uint8_t-i2sclassbegini2s_mode_t-mode-uint32_t-samplerate-uint8_t-bitspersample"><strong><code>uint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);</code></strong></h4>
<p>Configure the pins, and the parameters for the connection.</p>
<ul>
<li>mode: one of I2S_PHILIPS_MODE,I2S_RIGHT_JUSTIFIED_MODE, I2S_LEFT_JUSTIFIED_MODE</li>
<li>sampleRate: between 8000 and 96000</li>
<li>bitsPerSample: 16, 24 or 32</li>
</ul>
<h4 id="writeuint16_t-data"><strong><code>write(uint16_t data);</code></strong></h4>
<p>Send 16 bit data. <strong>Currently in blocking mode</strong></p>
<h4 id="write32uint32_t-data"><strong><code>write32(uint32_t data);</code></strong></h4>
<p>Send 32 bit data. <strong>Currently in blocking mode</strong></p>
<h4 id="writeuint16_t-data-uint16_t-size"><strong><code>write(uint16_t *data, uint16_t size);</code></strong></h4>
<p>Send 16 bit data. <strong>Currently in blocking mode</strong></p>
<h4 id="writeuint32_t-data-uint16_t-size"><strong><code>write(uint32_t *data, uint16_t size);</code></strong></h4>
<p>Send 32 bit data. <strong>Currently in blocking mode</strong></p>
<h4 id="stm32setsduint8_t-pin"><strong><code>stm32SetSD(uint8_t pin);</code></strong></h4>
<p>Set the alternative SD pin used by this I2S.</p>
<p><strong>This method must be called before begin()!</strong></p>
<h4 id="stm32setwduint8_t-pin"><strong><code>stm32SetWD(uint8_t pin);</code></strong></h4>
<p>Set the alternative WD pin used by this I2S.</p>
<p><strong>This method must be called before begin()!</strong></p>
<h4 id="stm32setckuint8_t-pin"><strong><code>stm32SetCK(uint8_t pin);</code></strong></h4>
<p>Set the alternative CK pin used by this I2S.</p>
<p><strong>This method must be called before begin()!</strong></p>
<h4 id="stm32setmckuint8_t-pin"><strong><code>stm32SetMCK(uint8_t pin);</code></strong></h4>
<p>Set the alternative MCK pin used by this I2S.</p>
<p><strong>This method must be called before begin()!</strong></p></div>
</div>
<footer class="col-md-12">
<hr>
<center>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</center>
</footer>
<script>var base_url = '..';</script>
<script data-main="../mkdocs/js/search.js" src="../mkdocs/js/require.js"></script>
<script src="../js/base.js"></script>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="exampleModalLabel">Search</h4>
</div>
<div class="modal-body">
<p>
From here you can search these documents. Enter
your search terms below.
</p>
<form role="form">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -89,6 +89,18 @@
<li >
<a href="i2s/">I2S</a>
</li>
<li >
<a href="sdio/">SDIO</a>
</li>
<li > <li >
<a href="uart/">Serial UART</a> <a href="uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -72,7 +72,7 @@
}, },
{ {
"location": "/arduino_api/", "location": "/arduino_api/",
"text": "Overview\n\n\n\n\nSTM32GENERIC uses standard C and C++, so control sturctures (if, for), data types(int, long), syntax, etc... work as expected.\n\n\nNon microcontroller-specific Arduino utility functions such as isLowerCase(), bitRead() etc... also work.\n\n\nAll non-standard functions are prefixed with \nstm32XXXX()\n\n\n\n\nuint32_t millis();\n\n\nReturns the milliseconds since the microcontroller started. Overflows in 50 days.\n\n\nuint32_t micros();\n\n\nReturns the microseconds since the microcontroller started. Overflows in 70 minutes.\n\n\ndelay(uint32_t millis);\n\n\nDelays the execution by the given milliseconds.\n\n\ndelayMicroseconds(uint32_t micros);\n\n\nDelays the execution by the given microseconds.\n\n\n\n\nExample: Print the milliseconds on \nSerial\n, every second:\n\n\n\n\nvoid setup() {\n Serial.begin(9600);\n}\nvoid loop() {\n Serial.println(millis());\n delay(1000);\n}\n\n\n\n\n\n\nUses STM32 SysTick, set to interrupt 1ms intervals.\n\n\n\n\nNaming the pins in code:\n\n\n\n\nSTM32 chip pins have names: \nPA0\n, \nPA1\n...\n\n\nOn some boards (Nucleo, Maple), there are numbers / alternative names next to the pin: \n1\n, \nRX\n, \nA0\n.\n\n\nPredefined constants\n for primary LED, SPI, Serial, I2C are defined in the variant file for the specific board.\n\n\n\n\nGenerally you should stick to naming the pin the same as they appear on the board to reduce confusion. If on the board you see ABC, use digitalWrite(ABC, HIGH);\n\n\npinMode(uint8_t pin, uint8_t mode);\n\n\nSets the pin for digital reading / writing\n\n\n\n\n\n\n\n\nMode\n\n\nMeaning\n\n\n\n\n\n\n\n\n\n\nOUTPUT\n\n\n0V - 3.3V\n\n\n\n\n\n\nINPUT\n\n\nThe pin does not have a pull down or pull up resistor\n\n\n\n\n\n\nINPUT_PULLUP\n\n\nWeak pull up resistor to default to HIGH if the pin is not connected to anything\n\n\n\n\n\n\nINPUT_PULLDOWN\n\n\nWeak pull down resistor to default to LOW if the pin is not connected to anything\n\n\n\n\n\n\n\n\npinMode() is needed for digitalRead() and digitalWrite() functions.\n\n\nThe system automatically sets the pinMode when using a peripheral library like analogRead(), analogWrite(), \nSPI\n or \nI2C\n, so you don't have to.\n\n\ndigitalRead(uint8_t pin);\n\n\nRead the voltage level on the specified pin. Returns LOW(0) if it is 0V, HIGH(1) if it is 3.3V\n\n\nAll pins can be used as digital input.\n\n\nNot all pins are 5V tolerant. Please check the chip reference manual \nPinouts and pin description\n section.\n\n\ndigitalWrite(uint8_t pin, uint8_t value);\n\n\nIf value if LOW(0), sets the pin to 0V. If value is HIGH(1), 3.3V.\n\nAll pins can be used as digital output.\n\n\n\n\nExample: Blink the \nLED\n on the board:\n\n\n\n\nvoid setup() {\n pinMode(LED_BUILTIN, OUTPUT);\n}\n\nvoid loop() {\n digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));\n delay(1000);\n}\n\n\n\n\nint analogRead(uint8_t pin);\n\n\nRead the voltage level on the pin, and map the 0..3.3V range to 0..1023 range by default.\n\n\nNot all pins can be used as analog input!\n Please check the \nBoards page\n.\n\n\nanalogReadResolution()\n\n\nTODO not yet implemented\n\n\nanalogWrite(uint8_t pin, int value)\n\n\nSet PWM to the specified pin.\n\n\nAll pins can be used as analog/PWM output.\n\n\n\n\nUses the TIM2 clock interrupt with software PWM implementation to allow PWM on all pins.\n\n\n\n\nanalogWriteResolution()\n\n\nTODO not yet implemented\n\n\n\n\nExample: Dim the LED based on the voltage value on PA0\n\n\n\n\nvoid loop() {\n analogWrite(LED_BUILTIN, analogRead(PA0));\n delay(10);\n}\n\n\n\n\nattachInterrupt(...);\n\n\nTODO not yet implemented\n\n\nPredefined pin constants\n\n\nThe following constants are defined in the variant.h file for each variant:\nTODO not all implemented\n\n\n\n\n\n\n\n\nConstant\n\n\nMeaning\n\n\n\n\n\n\n\n\n\n\nLED_BUILTIN\n\n\nThe primary LED on board, if there is any\n\n\n\n\n\n\nSTM32_LED_BUILTIN_ACTIVE_LOW\n\n\nIf set, the onboard LED lights up when output is set to LOW\n\n\n\n\n\n\nMOSI\n\n\nMOSI pin of the first \nSPI\n\n\n\n\n\n\nMISO\n\n\nMISO pin of the first \nSPI\n\n\n\n\n\n\nSCK\n\n\nSCK pin of the first \nSPI\n\n\n\n\n\n\nSDA\n\n\nSDA pin of the first \nI2C\n\n\n\n\n\n\nSCL\n\n\nSCL pin of the first \nI2C", "text": "Overview\n\n\n\n\nSTM32GENERIC uses standard C and C++, so control sturctures (if, for), data types(int, long), syntax, etc... work as expected.\n\n\nNon microcontroller-specific Arduino utility functions such as isLowerCase(), bitRead() etc... also work.\n\n\nAll non-standard functions are prefixed with \nstm32XXXX()\n\n\n\n\nuint32_t millis();\n\n\nReturns the milliseconds since the microcontroller started. Overflows in 50 days.\n\n\nuint32_t micros();\n\n\nReturns the microseconds since the microcontroller started. Overflows in 70 minutes.\n\n\ndelay(uint32_t millis);\n\n\nDelays the execution by the given milliseconds.\n\n\ndelayMicroseconds(uint32_t micros);\n\n\nDelays the execution by the given microseconds.\n\n\n\n\nExample: Print the milliseconds on \nSerial\n, every second:\n\n\n\n\nvoid setup() {\n Serial.begin(9600);\n}\nvoid loop() {\n Serial.println(millis());\n delay(1000);\n}\n\n\n\n\n\n\nUses STM32 SysTick, set to interrupt 1ms intervals.\n\n\n\n\nNaming the pins in code:\n\n\n\n\nSTM32 chip pins have names: \nPA0\n, \nPA1\n...\n\n\nOn some boards (Nucleo, Maple), there are numbers / alternative names next to the pin: \n1\n, \nRX\n, \nA0\n.\n\n\nPredefined constants\n for primary LED, SPI, Serial, I2C are defined in the variant file for the specific board.\n\n\n\n\nGenerally you should stick to naming the pin the same as they appear on the board to reduce confusion. If on the board you see ABC, use digitalWrite(ABC, HIGH);\n\n\npinMode(uint8_t pin, uint8_t mode);\n\n\nSets the pin for digital reading / writing\n\n\n\n\n\n\n\n\nMode\n\n\nMeaning\n\n\n\n\n\n\n\n\n\n\nOUTPUT\n\n\n0V - 3.3V\n\n\n\n\n\n\nINPUT\n\n\nThe pin does not have a pull down or pull up resistor\n\n\n\n\n\n\nINPUT_PULLUP\n\n\nWeak pull up resistor to default to HIGH if the pin is not connected to anything\n\n\n\n\n\n\nINPUT_PULLDOWN\n\n\nWeak pull down resistor to default to LOW if the pin is not connected to anything\n\n\n\n\n\n\n\n\npinMode() is needed for digitalRead() and digitalWrite() functions.\n\n\nThe system automatically sets the pinMode when using a peripheral library like analogRead(), analogWrite(), \nSPI\n or \nI2C\n, so you don't have to.\n\n\ndigitalRead(uint8_t pin);\n\n\nRead the voltage level on the specified pin. Returns LOW(0) if it is 0V, HIGH(1) if it is 3.3V\n\n\nAll pins can be used as digital input.\n\n\nNot all pins are 5V tolerant. Please check the chip reference manual \nPinouts and pin description\n section.\n\n\ndigitalWrite(uint8_t pin, uint8_t value);\n\n\nIf value if LOW(0), sets the pin to 0V. If value is HIGH(1), 3.3V.\n\nAll pins can be used as digital output.\n\n\n\n\nExample: Blink the \nLED\n on the board:\n\n\n\n\nvoid setup() {\n pinMode(LED_BUILTIN, OUTPUT);\n}\n\nvoid loop() {\n digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));\n delay(1000);\n}\n\n\n\n\nint analogRead(uint8_t pin);\n\n\nRead the voltage level on the pin, and map the 0..3.3V range to 0..1023 range by default.\n\n\nNot all pins can be used as analog input!\n Please check the \nBoards page\n.\n\n\nanalogReadResolution()\n\n\nTODO not yet implemented\n\n\nanalogWrite(uint8_t pin, int value)\n\n\nSet PWM to the specified pin.\n\n\nAll pins can be used as analog/PWM output.\n\n\n\n\nUses the TIM2 clock interrupt with software PWM implementation to allow PWM on all pins.\n\n\n\n\nanalogWriteResolution()\n\n\nTODO not yet implemented\n\n\n\n\nExample: Dim the LED based on the voltage value on PA0\n\n\n\n\nvoid loop() {\n analogWrite(LED_BUILTIN, analogRead(PA0));\n delay(10);\n}\n\n\n\n\nvoid attachInterrupt(uint8_t, callback, int mode);\n\n\nSetup callback on the specified pin. Mode can be: \n\n CHANGE: When pin changes from LOW to HIGH, or HIGH to LOW, the callback will be called. \n\n RISING: When pin changes from LOW to HIGH the callback will be called.\n* FALLING: When pin changes from HIGH to LOW, the callback will be called.\n\n\nSame pins from different ports cannot be used. For exaple PA3 and PB3 cannot be used as interrupt simultaneously.\n\n\nPredefined pin constants\n\n\nThe following constants are defined in the variant.h file for each variant:\n\n\n\n\n\n\n\n\nConstant\n\n\nMeaning\n\n\n\n\n\n\n\n\n\n\nLED_BUILTIN\n\n\nThe primary LED on board, if there is any\n\n\n\n\n\n\nSTM32_LED_BUILTIN_ACTIVE_LOW\n\n\nIf set, the onboard LED lights up when output is set to LOW\n\n\n\n\n\n\nMOSI\n\n\nMOSI pin of the first \nSPI\n\n\n\n\n\n\nMISO\n\n\nMISO pin of the first \nSPI\n\n\n\n\n\n\nSCK\n\n\nSCK pin of the first \nSPI\n\n\n\n\n\n\nSDA\n\n\nSDA pin of the first \nI2C\n\n\n\n\n\n\nSCL\n\n\nSCL pin of the first \nI2C",
"title": "Arduino API" "title": "Arduino API"
}, },
{ {
@ -136,18 +136,18 @@
"title": "analogWriteResolution()" "title": "analogWriteResolution()"
}, },
{ {
"location": "/arduino_api/#attachinterrupt", "location": "/arduino_api/#void-attachinterruptuint8_t-callback-int-mode",
"text": "TODO not yet implemented", "text": "Setup callback on the specified pin. Mode can be: CHANGE: When pin changes from LOW to HIGH, or HIGH to LOW, the callback will be called. RISING: When pin changes from LOW to HIGH the callback will be called.\n* FALLING: When pin changes from HIGH to LOW, the callback will be called. Same pins from different ports cannot be used. For exaple PA3 and PB3 cannot be used as interrupt simultaneously.",
"title": "attachInterrupt(...);" "title": "void attachInterrupt(uint8_t, callback, int mode);"
}, },
{ {
"location": "/arduino_api/#predefined-pin-constants", "location": "/arduino_api/#predefined-pin-constants",
"text": "The following constants are defined in the variant.h file for each variant:\nTODO not all implemented Constant Meaning LED_BUILTIN The primary LED on board, if there is any STM32_LED_BUILTIN_ACTIVE_LOW If set, the onboard LED lights up when output is set to LOW MOSI MOSI pin of the first SPI MISO MISO pin of the first SPI SCK SCK pin of the first SPI SDA SDA pin of the first I2C SCL SCL pin of the first I2C", "text": "The following constants are defined in the variant.h file for each variant: Constant Meaning LED_BUILTIN The primary LED on board, if there is any STM32_LED_BUILTIN_ACTIVE_LOW If set, the onboard LED lights up when output is set to LOW MOSI MOSI pin of the first SPI MISO MISO pin of the first SPI SCK SCK pin of the first SPI SDA SDA pin of the first I2C SCL SCL pin of the first I2C",
"title": "Predefined pin constants" "title": "Predefined pin constants"
}, },
{ {
"location": "/spi/", "location": "/spi/",
"text": "SPI\n\n\nTo use the hardware SPI, include it in your code:\n\n\n#include \nSPI.h\n\n\n\n\n\nThe first SPI object is explicitly created, and is connected to the SPI1 instance.\n\n\nPlease check your board documentation to see which pins is SPI connected to by default.\n\n\nTo use additional SPI, use the constructors to create your object, or the stm32SetInstance() method.\n\n\nSPIClass(SPI_TypeDef *instance)\n\n\nCreate a SPI object that is connected to the instance, on the default mosi/miso/sck. \nTo avoid confusion, it is better to use the constructor below with implicit pins.\n\n\nSPIClass(SPI_TypeDef *instance, uint8_t mosi, uint8_t miso, uint8_t sck)\n\n\nCreate a SPI object that is connected to the instance, on the specified mosi/miso/sck pins.\n\n\nPlease check the documentation of the chip to see which pins can be used.\n\n\n\n\nExample: set up SPI2\n\n\n\n\nSPIClass SPI_2(SPI2, mosi, iso, sck);\nvoid setup() {\n SPI_2.begin();\n}\n\n\n\n\n\nbegin()\n\n\nEnables SPI on the pins\n\n\nend()\n\n\nDisables SPI on the pins\n\n\nbeginTransaction(SPISettings settings);\n\n\nInitializes SPI with the provided \nSPISettings mySetting(speedMaximum, dataOrder, dataMode)\n parameters.\n\n\n\n\n\n\n\n\nParameter\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nspeedMaximum\n\n\nThe maximum speed requested\n\n\n\n\n\n\ndataOrder\n\n\nMSBFIRST\n, \nLSBFIRST\n\n\n\n\n\n\ndataMode\n\n\nSPI_MODE0\n, \nSPI_MODE1\n, \nSPI_MODE2\n, or \nSPI_MODE3\n\n\n\n\n\n\n\n\nExample:\n\n\nSPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));\n\n\n\n\nTODO disable interrupt in pin if \nusingInterrupt\n was used\n\n\nendTransaction();\n\n\nTODO enable interrupt in pin if \nusingInterrupt\n was used\n\n\ntransfer(...);\n\n\nTODO write doc\n\n\ntransfer16(...);\n\n\nTODO write doc\n\n\ntransfer(...);\n\n\nTODO write doc\n\n\nusingInterrupt();\n\n\nTODO not yet implemented\n\n\ntransfer(...);\n\n\nTODO write doc\n\n\nstm32SetMOSI(uint8_t pin);\n\n\nSet the MOSI pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetMISO(uint8_t pin);\n\n\nSet the alternative MISO pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetSCK(uint8_t pin);\n\n\nSet the alternative SCK pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetInstance(SPI_TypeDef *instance);\n\n\nSet the alternative SPI instance (SPI1/SPI2/...) used by this object.\n\n\nThis method must be called before begin()!\n\n\n\n\nExample: If you want to use a library that has hardcoded \nSPI\n in it, but you want to use SPI2:\n\n\n\n\n#include \nSPI.h\n\n\nvoid setup() {\n SPI.stm32SetInstance(SPI2);\n SPI.stm32SetMOSI(mosi);\n SPI.stm32SetMISO(miso);\n SPI.stm32SetSCK(sck);\n ...\n library.begin();\n}", "text": "SPI\n\n\nTo use the hardware SPI, include it in your code:\n\n\n#include \nSPI.h\n\n\n\n\n\nThe first SPI object is explicitly created, and is connected to the SPI1 instance.\n\n\nPlease check your board documentation to see which pins is SPI connected to by default.\n\n\nTo use additional SPI, use the constructors to create your object, or the stm32SetInstance() method.\n\n\nSPIClass(SPI_TypeDef *instance)\n\n\nCreate a SPI object that is connected to the instance, on the default mosi/miso/sck. \nTo avoid confusion, it is better to use the constructor below with implicit pins.\n\n\nSPIClass(SPI_TypeDef *instance, uint8_t mosi, uint8_t miso, uint8_t sck)\n\n\nCreate a SPI object that is connected to the instance, on the specified mosi/miso/sck pins.\n\n\nPlease check the documentation of the chip to see which pins can be used.\n\n\n\n\nExample: set up SPI2\n\n\n\n\nSPIClass SPI_2(SPI2, mosi, iso, sck);\nvoid setup() {\n SPI_2.begin();\n}\n\n\n\n\n\nbegin()\n\n\nEnables SPI on the pins\n\n\nend()\n\n\nDisables SPI on the pins\n\n\nbeginTransaction(SPISettings settings);\n\n\nInitializes SPI with the provided \nSPISettings mySetting(speedMaximum, dataOrder, dataMode)\n parameters.\n\n\n\n\n\n\n\n\nParameter\n\n\nDescription\n\n\n\n\n\n\n\n\n\n\nspeedMaximum\n\n\nThe maximum speed requested\n\n\n\n\n\n\ndataOrder\n\n\nMSBFIRST\n, \nLSBFIRST\n\n\n\n\n\n\ndataMode\n\n\nSPI_MODE0\n, \nSPI_MODE1\n, \nSPI_MODE2\n, or \nSPI_MODE3\n\n\n\n\n\n\n\n\nExample:\n\n\nSPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));\n\n\n\n\nTODO disable interrupt in pin if \nusingInterrupt\n was used\n\n\nendTransaction();\n\n\nTODO enable interrupt in pin if \nusingInterrupt\n was used\n\n\nuint8_t transfer(uint8_t data);\n\n\nSend a 8 bits on SPI, and return the received 8 bit data.\n\n\nuint16_t transfer16(uint16_t data);\n\n\nSend a 16 bits on SPI, and return the received 16 bit data.\n\n\ntransfer(uint8_t *buf, size_t count);\n\n\nSend the data in the buffer. The received data is stored in the same buffer.\n\n\nusingInterrupt();\n\n\nTODO not yet implemented\n\n\nuint8_t dmaSend(uint8_t *transmitBuf, uint16_t length, bool minc = true);\n\n\nSend data using DMA in \nblocking mode\n.\n\n\n\n\nminc: false - only send the first byte of the \ntransmitBuf\n, \nlength\n times\n\n\nminc: true - send \nlength\n bytes from the \ntransmitBuf\n\n\n\n\nuint8_t dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length);\n\n\nSend and receive data using DMA in \nblocking mode\n.\n\n\nIf \ntransmitBuf\n is NULL, \n0xFF\n is transmitted instead.\n\n\nstm32SetMOSI(uint8_t pin);\n\n\nSet the MOSI pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetMISO(uint8_t pin);\n\n\nSet the alternative MISO pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetSCK(uint8_t pin);\n\n\nSet the alternative SCK pin used by this SPI.\n\n\nThis method must be called before begin()!\n\n\nstm32SetInstance(SPI_TypeDef *instance);\n\n\nSet the alternative SPI instance (SPI1/SPI2/...) used by this object.\n\n\nThis method must be called before begin()!\n\n\n\n\nExample: If you want to use a library that has hardcoded \nSPI\n in it, but you want to use SPI2:\n\n\n\n\n#include \nSPI.h\n\n\nvoid setup() {\n SPI.stm32SetInstance(SPI2);\n SPI.stm32SetMOSI(mosi);\n SPI.stm32SetMISO(miso);\n SPI.stm32SetSCK(sck);\n ...\n library.begin();\n}",
"title": "SPI" "title": "SPI"
}, },
{ {
@ -186,19 +186,19 @@
"title": "endTransaction();" "title": "endTransaction();"
}, },
{ {
"location": "/spi/#transfer", "location": "/spi/#uint8_t-transferuint8_t-data",
"text": "TODO write doc", "text": "Send a 8 bits on SPI, and return the received 8 bit data.",
"title": "transfer(...);" "title": "uint8_t transfer(uint8_t data);"
}, },
{ {
"location": "/spi/#transfer16", "location": "/spi/#uint16_t-transfer16uint16_t-data",
"text": "TODO write doc", "text": "Send a 16 bits on SPI, and return the received 16 bit data.",
"title": "transfer16(...);" "title": "uint16_t transfer16(uint16_t data);"
}, },
{ {
"location": "/spi/#transfer_1", "location": "/spi/#transferuint8_t-buf-size_t-count",
"text": "TODO write doc", "text": "Send the data in the buffer. The received data is stored in the same buffer.",
"title": "transfer(...);" "title": "transfer(uint8_t *buf, size_t count);"
}, },
{ {
"location": "/spi/#usinginterrupt", "location": "/spi/#usinginterrupt",
@ -206,9 +206,14 @@
"title": "usingInterrupt();" "title": "usingInterrupt();"
}, },
{ {
"location": "/spi/#transfer_2", "location": "/spi/#uint8_t-dmasenduint8_t-transmitbuf-uint16_t-length-bool-minc-true",
"text": "TODO write doc", "text": "Send data using DMA in blocking mode . minc: false - only send the first byte of the transmitBuf , length times minc: true - send length bytes from the transmitBuf",
"title": "transfer(...);" "title": "uint8_t dmaSend(uint8_t *transmitBuf, uint16_t length, bool minc = true);"
},
{
"location": "/spi/#uint8_t-dmatransferuint8_t-transmitbuf-uint8_t-receivebuf-uint16_t-length",
"text": "Send and receive data using DMA in blocking mode . If transmitBuf is NULL, 0xFF is transmitted instead.",
"title": "uint8_t dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length);"
}, },
{ {
"location": "/spi/#stm32setmosiuint8_t-pin", "location": "/spi/#stm32setmosiuint8_t-pin",
@ -310,6 +315,151 @@
"text": "Set the alternative I2C instance (I2C1/I2C2/...) used by this object. This method must be called before begin()! Example: If you want to use a library that has hardcoded I2C in it, but you want to use I2C2: #include Wire.h \n\nvoid setup() {\n Wire.stm32SetInstance(I2C2);\n Wire.stm32SetSDA(sda);\n Wire.stm32SetSCL(scl);\n ...\n library.begin();\n}", "text": "Set the alternative I2C instance (I2C1/I2C2/...) used by this object. This method must be called before begin()! Example: If you want to use a library that has hardcoded I2C in it, but you want to use I2C2: #include Wire.h \n\nvoid setup() {\n Wire.stm32SetInstance(I2C2);\n Wire.stm32SetSDA(sda);\n Wire.stm32SetSCL(scl);\n ...\n library.begin();\n}",
"title": "stm32SetInstance(I2C_TypeDef *instance);" "title": "stm32SetInstance(I2C_TypeDef *instance);"
}, },
{
"location": "/i2s/",
"text": "I2S\n\n\nNot to be confused with \nI2C\n, is a protocol for connecting to audio devices.\n\n\nThis library is in beta, and the API / implementation is subject to change!\n\n\nTo use this library, include it in your code:\n\n\n#include \nI2S.h\n\n\nI2SClass i2s(...);\n\n\n\n\n\nI2SClass(SPI_TypeDef *instance);\n\n\nConstruct I2S that will be connected to the specified I2S instance on chip.\n\n\nThe board default pins will be used for sd/ws/ck. mck will not be used.\n\n\nI2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);\n\n\nConstruct I2S that will be connected to the specified I2S instance on chip.\n\n\nThe specified pins will be used for sd/ws/ck. mck will not be used.\n\n\nI2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck, uint8_t mck);\n\n\nConstruct I2S that will be connected to the specified I2S instance on chip.\n\n\nThe specified pins will be used for sd/ws/ck/mck.\n\n\nuint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);\n\n\nConfigure the pins, and the parameters for the connection.\n\n\n\n\nmode: one of I2S_PHILIPS_MODE,I2S_RIGHT_JUSTIFIED_MODE, I2S_LEFT_JUSTIFIED_MODE\n\n\nsampleRate: between 8000 and 96000\n\n\nbitsPerSample: 16, 24 or 32\n\n\n\n\nwrite(uint16_t data);\n\n\nSend 16 bit data. \nCurrently in blocking mode\n\n\nwrite32(uint32_t data);\n\n\nSend 32 bit data. \nCurrently in blocking mode\n\n\nwrite(uint16_t *data, uint16_t size);\n\n\nSend 16 bit data. \nCurrently in blocking mode\n\n\nwrite(uint32_t *data, uint16_t size);\n\n\nSend 32 bit data. \nCurrently in blocking mode\n\n\nstm32SetSD(uint8_t pin);\n\n\nSet the alternative SD pin used by this I2S.\n\n\nThis method must be called before begin()!\n\n\nstm32SetWD(uint8_t pin);\n\n\nSet the alternative WD pin used by this I2S.\n\n\nThis method must be called before begin()!\n\n\nstm32SetCK(uint8_t pin);\n\n\nSet the alternative CK pin used by this I2S.\n\n\nThis method must be called before begin()!\n\n\nstm32SetMCK(uint8_t pin);\n\n\nSet the alternative MCK pin used by this I2S.\n\n\nThis method must be called before begin()!",
"title": "I2S"
},
{
"location": "/i2s/#i2s",
"text": "Not to be confused with I2C , is a protocol for connecting to audio devices.",
"title": "I2S"
},
{
"location": "/i2s/#this-library-is-in-beta-and-the-api-implementation-is-subject-to-change",
"text": "To use this library, include it in your code: #include I2S.h \n\nI2SClass i2s(...);",
"title": "This library is in beta, and the API / implementation is subject to change!"
},
{
"location": "/i2s/#i2sclassspi_typedef-instance",
"text": "Construct I2S that will be connected to the specified I2S instance on chip. The board default pins will be used for sd/ws/ck. mck will not be used.",
"title": "I2SClass(SPI_TypeDef *instance);"
},
{
"location": "/i2s/#i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck",
"text": "Construct I2S that will be connected to the specified I2S instance on chip. The specified pins will be used for sd/ws/ck. mck will not be used.",
"title": "I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);"
},
{
"location": "/i2s/#i2sclassspi_typedef-instance-uint8_t-sd-uint8_t-ws-uint8_t-ck-uint8_t-mck",
"text": "Construct I2S that will be connected to the specified I2S instance on chip. The specified pins will be used for sd/ws/ck/mck.",
"title": "I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck, uint8_t mck);"
},
{
"location": "/i2s/#uint8_t-i2sclassbegini2s_mode_t-mode-uint32_t-samplerate-uint8_t-bitspersample",
"text": "Configure the pins, and the parameters for the connection. mode: one of I2S_PHILIPS_MODE,I2S_RIGHT_JUSTIFIED_MODE, I2S_LEFT_JUSTIFIED_MODE sampleRate: between 8000 and 96000 bitsPerSample: 16, 24 or 32",
"title": "uint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);"
},
{
"location": "/i2s/#writeuint16_t-data",
"text": "Send 16 bit data. Currently in blocking mode",
"title": "write(uint16_t data);"
},
{
"location": "/i2s/#write32uint32_t-data",
"text": "Send 32 bit data. Currently in blocking mode",
"title": "write32(uint32_t data);"
},
{
"location": "/i2s/#writeuint16_t-data-uint16_t-size",
"text": "Send 16 bit data. Currently in blocking mode",
"title": "write(uint16_t *data, uint16_t size);"
},
{
"location": "/i2s/#writeuint32_t-data-uint16_t-size",
"text": "Send 32 bit data. Currently in blocking mode",
"title": "write(uint32_t *data, uint16_t size);"
},
{
"location": "/i2s/#stm32setsduint8_t-pin",
"text": "Set the alternative SD pin used by this I2S. This method must be called before begin()!",
"title": "stm32SetSD(uint8_t pin);"
},
{
"location": "/i2s/#stm32setwduint8_t-pin",
"text": "Set the alternative WD pin used by this I2S. This method must be called before begin()!",
"title": "stm32SetWD(uint8_t pin);"
},
{
"location": "/i2s/#stm32setckuint8_t-pin",
"text": "Set the alternative CK pin used by this I2S. This method must be called before begin()!",
"title": "stm32SetCK(uint8_t pin);"
},
{
"location": "/i2s/#stm32setmckuint8_t-pin",
"text": "Set the alternative MCK pin used by this I2S. This method must be called before begin()!",
"title": "stm32SetMCK(uint8_t pin);"
},
{
"location": "/sdio/",
"text": "SDIO / SDMMC\n\n\nTo use the hardware SDIO, include it in your code:\n\n\n#include \nSDIO.h\n\n\nSDIOClass sdio;\n\n\n\n\nbegin();\n\n\nConnects to the SDIO card, using 4-bit mode.\n\n\nReturns true on success, false on failure.\nOn failure, use \ngetError()\n.\n\n\nuint8_t end();\n\n\nDisconnects from the SDIO card.\n\n\nuint32_t getBlockSize();\n\n\nReturns the block size.\n\n\nuint8_t readBlocks(uint32_t block, uint8_t* dst, size_t blocks);\n\n\nRead the given number of blocks into dst buffer in blocking mode.\n\n\nuint8_t writeBlocks(uint32_t block, const uint8_t* src, size_t blocks);\n\n\nWrites the given number of blocks from the buffer in blocking mode.\n\n\nuint8_t eraseBlocks(uint32_t startBlock, uint32_t endBlock);\n\n\nErases the blocks from start block to end block.\n\n\nHAL_SD_ErrorTypedef getError();\n\n\nReturns the last error type.\n\n\nuint64_t getCapacity();\n\n\nReturns the SD Card capacity.\n\n\nuint8_t getType();\n\n\nReturns the type of the SD Card \n\n\nuint16_t getRCA();\n\n\nReturns the RCA register.\n\n\nHAL_SD_CIDTypedef getCID();\n\n\nReturns the CID register.\n\n\nHAL_SD_CSDTypedef getCSD();\n\n\nReturns the CSD register.",
"title": "SDIO"
},
{
"location": "/sdio/#sdio-sdmmc",
"text": "To use the hardware SDIO, include it in your code: #include SDIO.h \n\nSDIOClass sdio;",
"title": "SDIO / SDMMC"
},
{
"location": "/sdio/#begin",
"text": "Connects to the SDIO card, using 4-bit mode. Returns true on success, false on failure.\nOn failure, use getError() .",
"title": "begin();"
},
{
"location": "/sdio/#uint8_t-end",
"text": "Disconnects from the SDIO card.",
"title": "uint8_t end();"
},
{
"location": "/sdio/#uint32_t-getblocksize",
"text": "Returns the block size.",
"title": "uint32_t getBlockSize();"
},
{
"location": "/sdio/#uint8_t-readblocksuint32_t-block-uint8_t-dst-size_t-blocks",
"text": "Read the given number of blocks into dst buffer in blocking mode.",
"title": "uint8_t readBlocks(uint32_t block, uint8_t* dst, size_t blocks);"
},
{
"location": "/sdio/#uint8_t-writeblocksuint32_t-block-const-uint8_t-src-size_t-blocks",
"text": "Writes the given number of blocks from the buffer in blocking mode.",
"title": "uint8_t writeBlocks(uint32_t block, const uint8_t* src, size_t blocks);"
},
{
"location": "/sdio/#uint8_t-eraseblocksuint32_t-startblock-uint32_t-endblock",
"text": "Erases the blocks from start block to end block.",
"title": "uint8_t eraseBlocks(uint32_t startBlock, uint32_t endBlock);"
},
{
"location": "/sdio/#hal_sd_errortypedef-geterror",
"text": "Returns the last error type.",
"title": "HAL_SD_ErrorTypedef getError();"
},
{
"location": "/sdio/#uint64_t-getcapacity",
"text": "Returns the SD Card capacity.",
"title": "uint64_t getCapacity();"
},
{
"location": "/sdio/#uint8_t-gettype",
"text": "Returns the type of the SD Card",
"title": "uint8_t getType();"
},
{
"location": "/sdio/#uint16_t-getrca",
"text": "Returns the RCA register.",
"title": "uint16_t getRCA();"
},
{
"location": "/sdio/#hal_sd_cidtypedef-getcid",
"text": "Returns the CID register.",
"title": "HAL_SD_CIDTypedef getCID();"
},
{
"location": "/sdio/#hal_sd_csdtypedef-getcsd",
"text": "Returns the CSD register.",
"title": "HAL_SD_CSDTypedef getCSD();"
},
{ {
"location": "/uart/", "location": "/uart/",
"text": "Serial UART\n\n\nThere are two implementations of Serial communication: UART and USB. \n\n\nThis page describes the UART based.\n\n\nPlease check the \nMenu option\n to see which one is selected.\n\n\nSerialUART1\nis bound to UART1, \nSerialUART2\n to UART2 etc...\n\n\nPlease refer to the \nofficial documentation\n for\nthe description of Serial functions.\n\n\nSerialUARTx.stm32SetRX(uint8_t pin)\n\n\nSet the RX signal to the specified pin. Please check the chip documentation for which pin can be used for RX.\nThis must be called before begin()!\n\n\nSerialUARTx.stm32SetTx(uint8_t pin)\n\n\nSet the TX signal to the specified pin. Please check the chip documentation for which pin can be used for TX.\nThis must be called before begin()!\n\n\n\n\nExample: The following code will echo the received bytes on UART2\n\n\n\n\nvoid setup() {\n SerialUART2.stm32SetRX(Pcd);\n SerialUART2.stm32SetTX(Pab);\n SerualUART2.begin(115200);\n}\nvoid loop() {\n int data = SerialUART2.read();\n if (data != -1) {\n SerialUART2.write(data);\n }\n}", "text": "Serial UART\n\n\nThere are two implementations of Serial communication: UART and USB. \n\n\nThis page describes the UART based.\n\n\nPlease check the \nMenu option\n to see which one is selected.\n\n\nSerialUART1\nis bound to UART1, \nSerialUART2\n to UART2 etc...\n\n\nPlease refer to the \nofficial documentation\n for\nthe description of Serial functions.\n\n\nSerialUARTx.stm32SetRX(uint8_t pin)\n\n\nSet the RX signal to the specified pin. Please check the chip documentation for which pin can be used for RX.\nThis must be called before begin()!\n\n\nSerialUARTx.stm32SetTx(uint8_t pin)\n\n\nSet the TX signal to the specified pin. Please check the chip documentation for which pin can be used for TX.\nThis must be called before begin()!\n\n\n\n\nExample: The following code will echo the received bytes on UART2\n\n\n\n\nvoid setup() {\n SerialUART2.stm32SetRX(Pcd);\n SerialUART2.stm32SetTX(Pab);\n SerualUART2.begin(115200);\n}\nvoid loop() {\n int data = SerialUART2.read();\n if (data != -1) {\n SerialUART2.write(data);\n }\n}",

295
docs/sdio/index.html Normal file
View File

@ -0,0 +1,295 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>SDIO - STM32GENERIC</title>
<link href="../css/bootstrap-custom.min.css" rel="stylesheet">
<link href="../css/font-awesome-4.0.3.css" rel="stylesheet">
<link rel="stylesheet" href="../css/highlight.css">
<link href="../css/base.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../js/jquery-1.10.2.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>
<script src="../js/highlight.pack.js"></script>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">STM32GENERIC</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="..">Installation</a>
</li>
<li >
<a href="../upload/">Uploading</a>
</li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../menu_options/">Menu options</a>
</li>
<li >
<a href="../arduino_api/">Arduino API</a>
</li>
<li >
<a href="../spi/">SPI</a>
</li>
<li >
<a href="../i2c/">I2C</a>
</li>
<li >
<a href="../i2s/">I2S</a>
</li>
<li class="active">
<a href="./">SDIO</a>
</li>
<li >
<a href="../uart/">Serial UART</a>
</li>
<li >
<a href="../usb_cdc/">Serial USB</a>
</li>
<li >
<a href="../stm32_hal/">STM32 HAL</a>
</li>
</ul>
</li>
<li >
<a href="../libraries/">Libraries</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">STM32 Boards <b class="caret"></b></a>
<ul class="dropdown-menu">
<li >
<a href="../boards/">Boards list</a>
</li>
<li >
<a href="../add_board/">Adding a board</a>
</li>
<li >
<a href="../test/">Testing a board</a>
</li>
</ul>
</li>
<li >
<a href="../about/">About</a>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
<i class="fa fa-search"></i> Search
</a>
</li>
<li >
<a rel="next" href="../i2s/">
<i class="fa fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="prev" href="../uart/">
Next <i class="fa fa-arrow-right"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="main active"><a href="#sdio-sdmmc">SDIO / SDMMC</a></li>
<li><a href="#begin">begin();</a></li>
<li><a href="#uint8_t-end">uint8_t end();</a></li>
<li><a href="#uint32_t-getblocksize">uint32_t getBlockSize();</a></li>
<li><a href="#uint8_t-readblocksuint32_t-block-uint8_t-dst-size_t-blocks">uint8_t readBlocks(uint32_t block, uint8_t* dst, size_t blocks);</a></li>
<li><a href="#uint8_t-writeblocksuint32_t-block-const-uint8_t-src-size_t-blocks">uint8_t writeBlocks(uint32_t block, const uint8_t* src, size_t blocks);</a></li>
<li><a href="#uint8_t-eraseblocksuint32_t-startblock-uint32_t-endblock">uint8_t eraseBlocks(uint32_t startBlock, uint32_t endBlock);</a></li>
<li><a href="#hal_sd_errortypedef-geterror">HAL_SD_ErrorTypedef getError();</a></li>
<li><a href="#uint64_t-getcapacity">uint64_t getCapacity();</a></li>
<li><a href="#uint8_t-gettype">uint8_t getType();</a></li>
<li><a href="#uint16_t-getrca">uint16_t getRCA();</a></li>
<li><a href="#hal_sd_cidtypedef-getcid">HAL_SD_CIDTypedef getCID();</a></li>
<li><a href="#hal_sd_csdtypedef-getcsd">HAL_SD_CSDTypedef getCSD();</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<h2 id="sdio-sdmmc">SDIO / SDMMC</h2>
<p>To use the hardware SDIO, include it in your code:</p>
<pre><code class="c++">#include &quot;SDIO.h&quot;
SDIOClass sdio;
</code></pre>
<h4 id="begin"><strong><code>begin();</code></strong></h4>
<p>Connects to the SDIO card, using 4-bit mode.</p>
<p>Returns true on success, false on failure.
On failure, use <code>getError()</code>.</p>
<h4 id="uint8_t-end"><strong><code>uint8_t end();</code></strong></h4>
<p>Disconnects from the SDIO card.</p>
<h4 id="uint32_t-getblocksize"><strong><code>uint32_t getBlockSize();</code></strong></h4>
<p>Returns the block size.</p>
<h4 id="uint8_t-readblocksuint32_t-block-uint8_t-dst-size_t-blocks"><strong><code>uint8_t readBlocks(uint32_t block, uint8_t* dst, size_t blocks);</code></strong></h4>
<p>Read the given number of blocks into dst buffer in blocking mode.</p>
<h4 id="uint8_t-writeblocksuint32_t-block-const-uint8_t-src-size_t-blocks"><strong><code>uint8_t writeBlocks(uint32_t block, const uint8_t* src, size_t blocks);</code></strong></h4>
<p>Writes the given number of blocks from the buffer in blocking mode.</p>
<h4 id="uint8_t-eraseblocksuint32_t-startblock-uint32_t-endblock"><strong><code>uint8_t eraseBlocks(uint32_t startBlock, uint32_t endBlock);</code></strong></h4>
<p>Erases the blocks from start block to end block.</p>
<h4 id="hal_sd_errortypedef-geterror"><strong><code>HAL_SD_ErrorTypedef getError();</code></strong></h4>
<p>Returns the last error type.</p>
<h4 id="uint64_t-getcapacity"><strong><code>uint64_t getCapacity();</code></strong></h4>
<p>Returns the SD Card capacity.</p>
<h4 id="uint8_t-gettype"><strong><code>uint8_t getType();</code></strong></h4>
<p>Returns the type of the SD Card </p>
<h4 id="uint16_t-getrca"><strong><code>uint16_t getRCA();</code></strong></h4>
<p>Returns the RCA register.</p>
<h4 id="hal_sd_cidtypedef-getcid"><strong><code>HAL_SD_CIDTypedef getCID();</code></strong></h4>
<p>Returns the CID register.</p>
<h4 id="hal_sd_csdtypedef-getcsd"><strong><code>HAL_SD_CSDTypedef getCSD();</code></strong></h4>
<p>Returns the CSD register.</p></div>
</div>
<footer class="col-md-12">
<hr>
<center>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</center>
</footer>
<script>var base_url = '..';</script>
<script data-main="../mkdocs/js/search.js" src="../mkdocs/js/require.js"></script>
<script src="../js/base.js"></script>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="exampleModalLabel">Search</h4>
</div>
<div class="modal-body">
<p>
From here you can search these documents. Enter
your search terms below.
</p>
<form role="form">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query">
</div>
</form>
<div id="mkdocs-search-results"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -4,7 +4,7 @@
<url> <url>
<loc>/</loc> <loc>/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -12,7 +12,7 @@
<url> <url>
<loc>/upload/</loc> <loc>/upload/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -21,43 +21,55 @@
<url> <url>
<loc>/menu_options/</loc> <loc>/menu_options/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/arduino_api/</loc> <loc>/arduino_api/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/spi/</loc> <loc>/spi/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/i2c/</loc> <loc>/i2c/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/i2s/</loc>
<lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/sdio/</loc>
<lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/uart/</loc> <loc>/uart/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/usb_cdc/</loc> <loc>/usb_cdc/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/stm32_hal/</loc> <loc>/stm32_hal/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -66,7 +78,7 @@
<url> <url>
<loc>/libraries/</loc> <loc>/libraries/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -75,19 +87,19 @@
<url> <url>
<loc>/boards/</loc> <loc>/boards/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/add_board/</loc> <loc>/add_board/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
<url> <url>
<loc>/test/</loc> <loc>/test/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>
@ -96,7 +108,7 @@
<url> <url>
<loc>/about/</loc> <loc>/about/</loc>
<lastmod>2017-05-02</lastmod> <lastmod>2017-05-06</lastmod>
<changefreq>daily</changefreq> <changefreq>daily</changefreq>
</url> </url>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>
@ -193,15 +205,17 @@
<li><a href="#endtransaction">endTransaction();</a></li> <li><a href="#endtransaction">endTransaction();</a></li>
<li><a href="#transfer">transfer(...);</a></li> <li><a href="#uint8_t-transferuint8_t-data">uint8_t transfer(uint8_t data);</a></li>
<li><a href="#transfer16">transfer16(...);</a></li> <li><a href="#uint16_t-transfer16uint16_t-data">uint16_t transfer16(uint16_t data);</a></li>
<li><a href="#transfer_1">transfer(...);</a></li> <li><a href="#transferuint8_t-buf-size_t-count">transfer(uint8_t *buf, size_t count);</a></li>
<li><a href="#usinginterrupt">usingInterrupt();</a></li> <li><a href="#usinginterrupt">usingInterrupt();</a></li>
<li><a href="#transfer_2">transfer(...);</a></li> <li><a href="#uint8_t-dmasenduint8_t-transmitbuf-uint16_t-length-bool-minc-true">uint8_t dmaSend(uint8_t *transmitBuf, uint16_t length, bool minc = true);</a></li>
<li><a href="#uint8_t-dmatransferuint8_t-transmitbuf-uint8_t-receivebuf-uint16_t-length">uint8_t dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length);</a></li>
<li><a href="#stm32setmosiuint8_t-pin">stm32SetMOSI(uint8_t pin);</a></li> <li><a href="#stm32setmosiuint8_t-pin">stm32SetMOSI(uint8_t pin);</a></li>
@ -276,16 +290,23 @@ void setup() {
<p>TODO disable interrupt in pin if <code>usingInterrupt</code> was used</p> <p>TODO disable interrupt in pin if <code>usingInterrupt</code> was used</p>
<h4 id="endtransaction"><strong><code>endTransaction();</code></strong></h4> <h4 id="endtransaction"><strong><code>endTransaction();</code></strong></h4>
<p>TODO enable interrupt in pin if <code>usingInterrupt</code> was used</p> <p>TODO enable interrupt in pin if <code>usingInterrupt</code> was used</p>
<h4 id="transfer"><strong><code>transfer(...);</code></strong></h4> <h4 id="uint8_t-transferuint8_t-data"><strong><code>uint8_t transfer(uint8_t data);</code></strong></h4>
<p>TODO write doc</p> <p>Send a 8 bits on SPI, and return the received 8 bit data.</p>
<h4 id="transfer16"><strong><code>transfer16(...);</code></strong></h4> <h4 id="uint16_t-transfer16uint16_t-data"><strong><code>uint16_t transfer16(uint16_t data);</code></strong></h4>
<p>TODO write doc</p> <p>Send a 16 bits on SPI, and return the received 16 bit data.</p>
<h4 id="transfer_1"><strong><code>transfer(...);</code></strong></h4> <h4 id="transferuint8_t-buf-size_t-count"><strong><code>transfer(uint8_t *buf, size_t count);</code></strong></h4>
<p>TODO write doc</p> <p>Send the data in the buffer. The received data is stored in the same buffer.</p>
<h4 id="usinginterrupt"><strong><code>usingInterrupt();</code></strong></h4> <h4 id="usinginterrupt"><strong><code>usingInterrupt();</code></strong></h4>
<p>TODO not yet implemented</p> <p>TODO not yet implemented</p>
<h4 id="transfer_2"><strong><code>transfer(...);</code></strong></h4> <h4 id="uint8_t-dmasenduint8_t-transmitbuf-uint16_t-length-bool-minc-true"><strong><code>uint8_t dmaSend(uint8_t *transmitBuf, uint16_t length, bool minc = true);</code></strong></h4>
<p>TODO write doc</p> <p>Send data using DMA in <strong>blocking mode</strong>.</p>
<ul>
<li>minc: false - only send the first byte of the <code>transmitBuf</code>, <code>length</code> times</li>
<li>minc: true - send <code>length</code> bytes from the <code>transmitBuf</code></li>
</ul>
<h4 id="uint8_t-dmatransferuint8_t-transmitbuf-uint8_t-receivebuf-uint16_t-length"><strong><code>uint8_t dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length);</code></strong></h4>
<p>Send and receive data using DMA in <strong>blocking mode</strong>.</p>
<p>If <code>transmitBuf</code> is NULL, <code>0xFF</code> is transmitted instead.</p>
<h4 id="stm32setmosiuint8_t-pin"><strong><code>stm32SetMOSI(uint8_t pin);</code></strong></h4> <h4 id="stm32setmosiuint8_t-pin"><strong><code>stm32SetMOSI(uint8_t pin);</code></strong></h4>
<p>Set the MOSI pin used by this SPI.</p> <p>Set the MOSI pin used by this SPI.</p>
<p><strong>This method must be called before begin()!</strong></p> <p><strong>This method must be called before begin()!</strong></p>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li class="active"> <li class="active">
<a href="./">Serial UART</a> <a href="./">Serial UART</a>
</li> </li>
@ -159,7 +171,7 @@
</a> </a>
</li> </li>
<li > <li >
<a rel="next" href="../i2c/"> <a rel="next" href="../sdio/">
<i class="fa fa-arrow-left"></i> Previous <i class="fa fa-arrow-left"></i> Previous
</a> </a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -89,6 +89,18 @@
<li >
<a href="../i2s/">I2S</a>
</li>
<li >
<a href="../sdio/">SDIO</a>
</li>
<li > <li >
<a href="../uart/">Serial UART</a> <a href="../uart/">Serial UART</a>
</li> </li>

View File

@ -8,6 +8,8 @@ pages:
- Arduino API: arduino_api.md - Arduino API: arduino_api.md
- SPI: spi.md - SPI: spi.md
- I2C: i2c.md - I2C: i2c.md
- I2S: i2s.md
- SDIO: sdio.md
- Serial UART: uart.md - Serial UART: uart.md
- Serial USB: usb_cdc.md - Serial USB: usb_cdc.md
- STM32 HAL: stm32_hal.md - STM32 HAL: stm32_hal.md

View File

@ -113,14 +113,18 @@ void loop() {
} }
``` ```
#### **`attachInterrupt(...);`** #### **`void attachInterrupt(uint8_t, callback, int mode);`**
TODO not yet implemented Setup callback on the specified pin. Mode can be:
* CHANGE: When pin changes from LOW to HIGH, or HIGH to LOW, the callback will be called.
* RISING: When pin changes from LOW to HIGH the callback will be called.
* FALLING: When pin changes from HIGH to LOW, the callback will be called.
Same pins from different ports cannot be used. For exaple PA3 and PB3 cannot be used as interrupt simultaneously.
### Predefined pin constants ### Predefined pin constants
The following constants are defined in the variant.h file for each variant: The following constants are defined in the variant.h file for each variant:
TODO not all implemented
Constant | Meaning Constant | Meaning
------------------|----------- ------------------|-----------

View File

@ -0,0 +1,86 @@
## I2S
Not to be confused with [I2C](i2c.md), is a protocol for connecting to audio devices.
## **This library is in beta, and the API / implementation is subject to change!**
To use this library, include it in your code:
```c++
#include "I2S.h"
I2SClass i2s(...);
```
#### **`I2SClass(SPI_TypeDef *instance);`**
Construct I2S that will be connected to the specified I2S instance on chip.
The board default pins will be used for sd/ws/ck. mck will not be used.
#### **`I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);`**
Construct I2S that will be connected to the specified I2S instance on chip.
The specified pins will be used for sd/ws/ck. mck will not be used.
#### **`I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck, uint8_t mck);`**
Construct I2S that will be connected to the specified I2S instance on chip.
The specified pins will be used for sd/ws/ck/mck.
#### **`uint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);`**
Configure the pins, and the parameters for the connection.
* mode: one of I2S_PHILIPS_MODE,I2S_RIGHT_JUSTIFIED_MODE, I2S_LEFT_JUSTIFIED_MODE
* sampleRate: between 8000 and 96000
* bitsPerSample: 16, 24 or 32
#### **`write(uint16_t data);`**
Send 16 bit data. **Currently in blocking mode**
#### **`write32(uint32_t data);`**
Send 32 bit data. **Currently in blocking mode**
#### **`write(uint16_t *data, uint16_t size);`**
Send 16 bit data. **Currently in blocking mode**
#### **`write(uint32_t *data, uint16_t size);`**
Send 32 bit data. **Currently in blocking mode**
#### **`stm32SetSD(uint8_t pin);`**
Set the alternative SD pin used by this I2S.
**This method must be called before begin()!**
#### **`stm32SetWD(uint8_t pin);`**
Set the alternative WD pin used by this I2S.
**This method must be called before begin()!**
#### **`stm32SetCK(uint8_t pin);`**
Set the alternative CK pin used by this I2S.
**This method must be called before begin()!**
#### **`stm32SetMCK(uint8_t pin);`**
Set the alternative MCK pin used by this I2S.
**This method must be called before begin()!**

View File

@ -0,0 +1,59 @@
## SDIO / SDMMC
To use the hardware SDIO, include it in your code:
```c++
#include "SDIO.h"
SDIOClass sdio;
```
#### **`begin();`**
Connects to the SDIO card, using 4-bit mode.
Returns true on success, false on failure.
On failure, use `getError()`.
#### **`uint8_t end();`**
Disconnects from the SDIO card.
#### **`uint32_t getBlockSize();`**
Returns the block size.
#### **`uint8_t readBlocks(uint32_t block, uint8_t* dst, size_t blocks);`**
Read the given number of blocks into dst buffer in blocking mode.
#### **`uint8_t writeBlocks(uint32_t block, const uint8_t* src, size_t blocks);`**
Writes the given number of blocks from the buffer in blocking mode.
#### **`uint8_t eraseBlocks(uint32_t startBlock, uint32_t endBlock);`**
Erases the blocks from start block to end block.
#### **`HAL_SD_ErrorTypedef getError();`**
Returns the last error type.
#### **`uint64_t getCapacity();`**
Returns the SD Card capacity.
#### **`uint8_t getType();`**
Returns the type of the SD Card
#### **`uint16_t getRCA();`**
Returns the RCA register.
#### **`HAL_SD_CIDTypedef getCID();`**
Returns the CID register.
#### **`HAL_SD_CSDTypedef getCSD();`**
Returns the CSD register.

View File

@ -62,25 +62,34 @@ TODO disable interrupt in pin if `usingInterrupt` was used
TODO enable interrupt in pin if `usingInterrupt` was used TODO enable interrupt in pin if `usingInterrupt` was used
#### **`transfer(...);`** #### **`uint8_t transfer(uint8_t data);`**
TODO write doc Send a 8 bits on SPI, and return the received 8 bit data.
#### **`transfer16(...);`** #### **`uint16_t transfer16(uint16_t data);`**
TODO write doc Send a 16 bits on SPI, and return the received 16 bit data.
#### **`transfer(...);`** #### **`transfer(uint8_t *buf, size_t count);`**
TODO write doc Send the data in the buffer. The received data is stored in the same buffer.
#### **`usingInterrupt();`** #### **`usingInterrupt();`**
TODO not yet implemented TODO not yet implemented
#### **`transfer(...);`** #### **`uint8_t dmaSend(uint8_t *transmitBuf, uint16_t length, bool minc = true);`**
TODO write doc Send data using DMA in **blocking mode**.
* minc: false - only send the first byte of the `transmitBuf`, `length` times
* minc: true - send `length` bytes from the `transmitBuf`
#### **`uint8_t dmaTransfer(uint8_t *transmitBuf, uint8_t *receiveBuf, uint16_t length);`**
Send and receive data using DMA in **blocking mode**.
If `transmitBuf` is NULL, `0xFF` is transmitted instead.
#### **`stm32SetMOSI(uint8_t pin);`** #### **`stm32SetMOSI(uint8_t pin);`**