mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
18 lines
1.7 KiB
HTML
18 lines
1.7 KiB
HTML
$$HEADER$$
|
|
<h3>The platform interface</h3>
|
|
<p>The platform interface is the part of <b>eLua</b> that makes it easily portable between different hardware platforms by grouping the common elements
|
|
of all platforms supported by <b>eLua</b> in a common interface. For more details about the platform interface and the overall structure of
|
|
<b>eLua</b> in general, check <a href="arch_overview.html">this link</a>.</p>
|
|
<p>The platform interface is defined in the <i>inc/platform.h</i> header file from the <b>eLua</b> source distribution. It is a collection of various
|
|
components (UART, SPI, timers ...), each of them is detailed in the next subsections. Each such component has an <b>id</b> which is a number that
|
|
identifies that component in <b>eLua</b>. Generally, numbers are assigned to components in their "natural" order; for example, PORTA will have the id
|
|
0, PORTB will have 1 and so on. Similarly, the second SPI interface (SPI1) of the MCU will probably have an id equal to 1. However, this is not a strict
|
|
rule. The implementation of the platform interface might choose to expose only some of the peripherals (components) of the MCU, thus this rule might be
|
|
broken. For example, if a board has 3 UARTs, but for some reason the second UART (UART1) is dedicated and can't be touched by <b>eLua</b>, then UART0 will have the id 0 and UART2 will
|
|
have the id 1, so UART1 won't ever be accessible to the code. </p>
|
|
<p>With some exceptions (most notably the low-level support functions), the different modules supported by the platform interface are
|
|
mirrored more or less accurately in separate Lua modules that can be used directly from <b>eLua</b>. Check the reference manual for a
|
|
complete description of these modules.</p>
|
|
$$FOOTER$$
|
|
|