mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
Update refman to describe changes to ADC.
This commit is contained in:
parent
6a920f3dee
commit
ef653f7731
@ -1,10 +1,14 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html><head>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
|
||||
<title>Product</title><link rel="stylesheet" type="text/css" href="../style.css"></head>
|
||||
<body>
|
||||
<title>
|
||||
Product
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h3>
|
||||
eLua Modules Reference Manual
|
||||
</h3>
|
||||
@ -13,7 +17,7 @@
|
||||
</h2>
|
||||
<p>
|
||||
A Generic eLua Module is a module that can be used by a Lua program running on any of the <a href="status.html#platforms">supported eLua platforms</a>.<br>
|
||||
Write your code once and it is already automatically ported to the main platforms of the embedded world.<br>
|
||||
Write your code once and it is already automatically ported to the main platforms of theembedded world.<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
@ -228,12 +232,8 @@
|
||||
Some notes on PIO:
|
||||
</p>
|
||||
<ul>
|
||||
<li>pio:
|
||||
only some platform have internal pullups for the pio pins, while Cortex
|
||||
is the only platform that also provides pulldowns for its pios.
|
||||
However, in this case you're safe, as eLua will signal an error if you
|
||||
try to execute a pullup operatin on a platform that does not support
|
||||
it. </li>
|
||||
<li>pio: only some platform have internal pullups for the pio pins, while Cortex is the only platform that also provides pulldowns for its pios. However, in this case you're safe, as eLua will signal an error if you try to execute a pullup operatin on a platform that does not support it.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<br>
|
||||
@ -275,10 +275,8 @@ it. </li>
|
||||
returns their values.
|
||||
</p>
|
||||
<p>
|
||||
<a name="gpio_getportname" id="gpio_getportname"></a>
|
||||
[pio.getportname] Port = pio.port( code ): return the physical port
|
||||
number associated with the given code. For example, "pio.port(
|
||||
pio.P0_20 )" will return 0. </p>
|
||||
<a name="gpio_getportname" id="gpio_getportname"></a> [pio.getportname] Port = pio.port( code ): return the physical port number associated with the given code. For example, "pio.port( pio.P0_20 )" will return 0.
|
||||
</p>
|
||||
<p>
|
||||
<a name="gpio_getpinnumber" id="gpio_getpinnumber"></a> [pio.getpinnumber] Pin = pio.pin( code ): return the physical pin number associated with the
|
||||
</p>
|
||||
@ -299,21 +297,20 @@ pio.P0_20 )" will return 0. </p>
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
[pio.configport(pio.DIR, pio.DIR_INPUT, [Port1], [Port2], ...)]
|
||||
pio.port_input( Port1, Port2, ... ): set the specified port(s) as
|
||||
input(s). </p>
|
||||
<p> [pio.configport(pio.DIR, pio.DIR_OUTPUT, [Port1],
|
||||
[Port2], ...)] pio.port_output( Port1, Port2, ... ): set the specified
|
||||
port(s) as output(s). </p>
|
||||
<p> [pio.configpin(pio.PULL, pio.PULL_UP, [Pin1], [Pin2],
|
||||
...)] pio.pullup( Pin1, Pin2, ... ): enable internal pullups on the
|
||||
specified pins.Note that some CPUs might not provide this feature. </p>
|
||||
<p> [pio.configpin(pio.PULL, pio.PULL_DOWN, [Pin1], [Pin2],
|
||||
...)] pio.pulldown( Pin1, Pin2, ... ): enable internal pulldowns on the
|
||||
specified pins. Note that some CPUs might not provide this feature. </p>
|
||||
<p> [pio.configpin(pio.PULL, pio.PULL_NO, [Pin1], [Pin2],
|
||||
...)] pio.nopull( Pin1, Pin2, ... ): disable the pullups/pulldowns on
|
||||
the specifiedpins. Note that some CPUs might not provide this feature. </p>
|
||||
[pio.configport(pio.DIR, pio.DIR_INPUT, [Port1], [Port2], ...)] pio.port_input( Port1, Port2, ... ): set the specified port(s) as input(s).
|
||||
</p>
|
||||
<p>
|
||||
[pio.configport(pio.DIR, pio.DIR_OUTPUT, [Port1], [Port2], ...)] pio.port_output( Port1, Port2, ... ): set the specified port(s) as output(s).
|
||||
</p>
|
||||
<p>
|
||||
[pio.configpin(pio.PULL, pio.PULL_UP, [Pin1], [Pin2], ...)] pio.pullup( Pin1, Pin2, ... ): enable internal pullups on the specified pins.Note that some CPUs might not provide this feature.
|
||||
</p>
|
||||
<p>
|
||||
[pio.configpin(pio.PULL, pio.PULL_DOWN, [Pin1], [Pin2], ...)] pio.pulldown( Pin1, Pin2, ... ): enable internal pulldowns on the specified pins. Note that some CPUs might not provide this feature.
|
||||
</p>
|
||||
<p>
|
||||
[pio.configpin(pio.PULL, pio.PULL_NO, [Pin1], [Pin2], ...)] pio.nopull( Pin1, Pin2, ... ): disable the pullups/pulldowns on the specifiedpins. Note that some CPUs might not provide this feature.
|
||||
</p>
|
||||
<p>
|
||||
<br>
|
||||
</p>
|
||||
@ -333,12 +330,8 @@ the specifiedpins. Note that some CPUs might not provide this feature. </p>
|
||||
It allows Lua to use the PWM blocks on the target CPU.
|
||||
</p>
|
||||
<p>
|
||||
<strike><a name="pwm_setup" id="pwm_setup"></a>[pwm.setup]</strike>(pwm.setup(
|
||||
id, frequency, Active Cycle ) Data = pwm.setup( id, frequency, duty ):
|
||||
sets the PWM block 'id' to generate the specified frequency with the
|
||||
specified duty cycle (duty is an integer number from 0 to 100,
|
||||
specifying the duty cycle in percents). It returns the actual frequency
|
||||
set on the PWM block. </p>
|
||||
<strike><a name="pwm_setup" id="pwm_setup"></a>[pwm.setup]</strike>(pwm.setup( id, frequency, Active Cycle ) Data = pwm.setup( id, frequency, duty ): sets the PWM block 'id' to generate the specified frequency with the specified duty cycle (duty is an integer number from 0 to 100, specifying the duty cycle in percents). It returns the actual frequency set on the PWM block.
|
||||
</p>
|
||||
<p>
|
||||
Here there is a bigger change on the proposal.
|
||||
</p>
|
||||
@ -391,17 +384,11 @@ set on the PWM block. </p>
|
||||
<a name="spi_send" id="spi_send"></a>spi.send( id, Data1, Data2, ... ): sends all the data to the specified SPI<br>
|
||||
interface.<br>
|
||||
<br>
|
||||
<a name="spi_sendrecv" id="spi_sendrecv"></a>[spi.sendrecv(id,
|
||||
Out1, Out2, ...)] In1, In2, ... = spi.send_recv( id, Out1, Out2, ... ):
|
||||
sends all the "out" bytes to the specified SPI interface and returts
|
||||
the data read after each sent byte.<br>
|
||||
<br> Returning several
|
||||
values in this blocking way would not complicate some queued send
|
||||
implementations ? (ok, this could be another function :)<br>
|
||||
<a name="spi_sendrecv" id="spi_sendrecv"></a>[spi.sendrecv(id, Out1, Out2, ...)] In1, In2, ... = spi.send_recv( id, Out1, Out2, ... ): sends all the "out" bytes to the specified SPI interface and returts the data read after each sent byte.<br>
|
||||
<br>
|
||||
Sending multiple data/chars in a single call and not in a table
|
||||
argument does not allow the data to be built in run time (without some
|
||||
string massage, of course :)<br>
|
||||
Returning several values in this blocking way would not complicate some queued send implementations ? (ok, this could be another function :)<br>
|
||||
<br>
|
||||
Sending multiple data/chars in a single call and not in a table argument does not allow the data to be built in run time (without some string massage, of course :)<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
@ -501,29 +488,12 @@ string massage, of course :)<br>
|
||||
Some notes on timers:
|
||||
</p>
|
||||
<ul>
|
||||
<li>timers:
|
||||
from all the platforms on which eLua runs, only the Luminary Cortex
|
||||
CPUs has rock solid 32-bit timers. You can do pretty much everything
|
||||
you need with them. All the other platforms have 16-bit timers, which
|
||||
imposes some limits on the range of delays you can achieve with them.
|
||||
Make sure to use tmr.mindelay(id) and tmr.maxdelay(id) to check the
|
||||
actual resolution of your timers, and adapt your code accordingly. To
|
||||
'compensate' for this, it's not possible to change the base timer
|
||||
frequency on the Cortex CPUs, but it is possible on most other
|
||||
platforms :) So be sure to also check the result of tmr.setclock(id) </li>
|
||||
<li>also, when using timers, remember that if you're
|
||||
using XMODEM and/or the "term" module, TMR0 is used by both of them.
|
||||
So, if you change the TMR0 base clock in your code, be sure to restore
|
||||
the original setting before returning to the shell. You can change this
|
||||
static timer assignment by modifying src/main.c. It might also be
|
||||
possible to change it dynamically in the future, although I see little
|
||||
use for this. </li>
|
||||
<li>PWM: the Cortex CPUs have 6 PWM channels, but
|
||||
channels 0/1, 2/3 and 4/5 respectively share the same base clock
|
||||
setting. So, when you're changing the base clock for channel 1, you're
|
||||
also changing the base clock for channel 0; if channel 0 was already
|
||||
running, you won't like what will happen next. This time no eLua
|
||||
function can save you, you simply need you know your CPU architecture. </li>
|
||||
<li>timers: from all the platforms on which eLua runs, only the Luminary Cortex CPUs has rock solid 32-bit timers. You can do pretty much everything you need with them. All the other platforms have 16-bit timers, which imposes some limits on the range of delays you can achieve with them. Make sure to use tmr.mindelay(id) and tmr.maxdelay(id) to check the actual resolution of your timers, and adapt your code accordingly. To 'compensate' for this, it's not possible to change the base timer frequency on the Cortex CPUs, but it is possible on most other platforms :) So be sure to also check the result of tmr.setclock(id)
|
||||
</li>
|
||||
<li>also, when using timers, remember that if you're using XMODEM and/or the "term" module, TMR0 is used by both of them. So, if you change the TMR0 base clock in your code, be sure to restore the original setting before returning to the shell. You can change this static timer assignment by modifying src/main.c. It might also be possible to change it dynamically in the future, although I see little use for this.
|
||||
</li>
|
||||
<li>PWM: the Cortex CPUs have 6 PWM channels, but channels 0/1, 2/3 and 4/5 respectively share the same base clock setting. So, when you're changing the base clock for channel 1, you're also changing the base clock for channel 0; if channel 0 was already running, you won't like what will happen next. This time no eLua function can save you, you simply need you know your CPU architecture.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<a name="tmr_delay" id="tmr_delay"></a>tmr.delay( id, delay ): uses timer 'id' to wait for 'delay' us.
|
||||
@ -611,9 +581,7 @@ function can save you, you simply need you know your CPU architecture. </li>
|
||||
</h2>
|
||||
<p>
|
||||
A Platform Dependent eLua Module is a module that runs only on one or on a few <a href="status.html#platforms">supported eLua platforms</a>.<br>
|
||||
These modules make use of specifical devices and features offered by
|
||||
some kits and allow eLua aplications to make the best use of the
|
||||
external hardware on your platforms.<br>
|
||||
These modules make use of specifical devices and features offered by some kits and allow eLua aplications to make the best use of the external hardware on your platforms.<br>
|
||||
</p>
|
||||
<h3>
|
||||
<a name="adcmodule" id="adcmodule"></a>adc - Analog to Digital Conversion Module
|
||||
@ -623,15 +591,38 @@ external hardware on your platforms.<br>
|
||||
<br>
|
||||
The ADC module handles the Analog to Digital Conversion Peripherals.<br>
|
||||
<br>
|
||||
<a name="adc_sample" id="adc_sample"></a><strong>adc.sample(channel_id, count)</strong><br>Request that <em>count</em> samples be converted from <em>channel_id</em>. <em>count</em> must be greater than zero and a power of 2</p><p><a name="adc_flush" id="adc_getsamples"></a><strong>adc.flush(channel_id)</strong><br>Empty sample and smoothing buffers.</p><p><a name="adc_getsample" id="adc_getsamples"></a><strong>adc.getsample(channel_id)</strong><br>
|
||||
Request a single sample from the buffer.</p><p><em></em><a name="adc_getsamples" id="adc_getsamples"></a><strong>adc.getsamples(channel_id, [count])</strong><br>Request <em>count</em> samples from the buffer, in a table. If <em>count</em> is either zero or omitted, all available samples are returned.</p><p><a name="adc_maxval" id="adc_maxval"></a><strong>adc.maxval(channel_id)</strong><br>Returns the largest integer one can expect fromr this channel on a given platform (based on bit depth).</p><p><a name="adc_setclock" id="adc_maxval"></a><strong>adc.setclock(channel_id, frequency, [timer_id])</strong><br>Sets the frequency and clock source for sample collection. If <span style="font-style: italic;">frequency</span> is zero (timer_id not needed), samples on <span style="font-style: italic;">channel_id</span> are collected as fast as possible. If <span style="font-style: italic;">frequency</span> is non-zero,<span style="font-style: italic;"> timer_id</span> is configured to trigger sampling on <span style="font-style: italic;">channel_id</span> at <span style="font-style: italic;">frequency.</span></p><p><a name="adc_samplesready" id="adc_samplesready"></a><strong>adc.samplesready(channel_id)</strong><br>Returns the number of samples waiting in the buffer.</p><p><a name="adc_setfreerunning" id="adc_samplesready"></a><strong>adc.setfreerunning(channel_id, mode)</strong><br><span style="font-style: italic;"><span style="font-style: italic;">mode</span></span> 0 disables freerunning mode (default), <span style="font-style: italic;"><span style="font-style: italic;">mode</span></span>
|
||||
1 enables freerunning mode. If enabled and samples are requested,
|
||||
sampling will continue after the buffer fills, replacing the oldest
|
||||
sample each time a new sample is taken.</p><p><a name="adc_setmode" id="adc_setmode"></a><strong>adc.setblocking(channel_id, mode)<br></strong> <em style="font-style: italic;">mode</em> 1 sets blocking mode (default). adc.getsample(s) will wait for requested samples to be captured before returning.<em> mode</em> 0 sets non-blocking mode<br>
|
||||
<br>
|
||||
<a name="adc_setsmoothing" id="adc_setsmoothing"></a><strong>adc.setsmoothing(channel_id, length)<br></strong> Set the <span style="font-style: italic;">length</span> of the smoothing filter on <span style="font-style: italic;">channel_id</span>. When greater than 1, and samples are requested, smoothing filter will fill to <span style="font-style: italic;">length</span> with samples, and then put the requested number of samples into the adc buffer.<br>
|
||||
<span style="font-style: italic;">length</span> must be a power of 2 (maximum = 64)</p><p><a name="adc_getsmoothing" id="adc_getsmoothing"></a><strong>adc.getsmoothing(channel_id)<br></strong> Get the current smoothing length in use.<br>
|
||||
<a name="adc_sample" id="adc_sample"></a><strong>adc.sample(channel_id | {channel_id1, channel_id2, ...}, count)</strong><br>
|
||||
Request that <em>count</em> samples be converted from <em>channel_id</em>. <em>count</em> must be greater than zero and a power of 2
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_flush" id="adc_flush"></a><strong>adc.flush(channel_id)</strong><br>
|
||||
Empty sample and smoothing buffers.
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_getsample" id="adc_getsamples"></a><strong>adc.getsample(channel_id)</strong><br>
|
||||
Request a single sample from the buffer.
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_getsamples" id="adc_getsamples"></a><strong>adc.getsamples(channel_id, [count])</strong><br>
|
||||
Request <em>count</em> samples from the buffer, in a table. If <em>count</em> is either zero or omitted, all available samples are returned.
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_maxval" id="adc_maxval"></a><strong>adc.maxval(channel_id)</strong><br>
|
||||
Returns the largest integer one can expect fromr this channel on a given platform (based on bit depth).
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_setclock" id="adc_setclock"></a><strong>adc.setclock(channel_id, frequency, [timer_id])</strong><br>
|
||||
Sets the frequency and clock source for sample collection. If <em>frequency</em> is zero (timer_id not needed), samples on <em>channel_id</em> are collected as fast as possible. If <em>frequency</em> is non-zero, <em>timer_id</em> is configured to trigger sampling on <em>channel_id</em> at <em>frequency.</em>
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_samplesready" id="adc_samplesready"></a><strong>adc.isdone(channel_id)</strong><br>
|
||||
Returns 1 if samples are still being collected on <em>channel_id</em>, 0 if channel is inactive.
|
||||
</p>
|
||||
<p>
|
||||
<a name="adc_setmode" id="adc_setmode"></a><strong>adc.setblocking(channel_id, mode)<br></strong> <em>mode</em> 1 sets blocking mode (default). adc.getsample(s) will wait for requested samples to be captured before returning. <em>mode</em> 0 sets non-blocking mode<br>
|
||||
<br>
|
||||
<a name="adc_setsmoothing" id="adc_setsmoothing"></a><strong>adc.setsmoothing(channel_id, length)<br></strong> Set the <em>length</em> of the smoothing filter on <em>channel_id</em>. When greater than 1, and samples are requested, smoothing filter will fill to <em>length</em> with samples, and then put the requested number of samples into the adc buffer.<br>
|
||||
<em>length</em> must be a power of 2 (maximum = 64)
|
||||
</p>
|
||||
<h3>
|
||||
<a name="dispmodule" id="dispmodule"></a>disp
|
||||
@ -639,7 +630,12 @@ sample each time a new sample is taken.</p><p><a name="adc_setmode" id="adc_setm
|
||||
<p>
|
||||
<strong>Currently runs on:</strong> LM3Sxxxx<br>
|
||||
<br>
|
||||
The disp module handles the RIT OLED display usage on Luminary Micro Cortex-M3 boards</p><p><span style="color: red; font-weight: bold;">## Following functions may change to merge init/on/enable and off/disable</span></p><p>
|
||||
The disp module handles the RIT OLED display usage on Luminary Micro Cortex-M3 boards
|
||||
</p>
|
||||
<p>
|
||||
<strong>## Following functions may change to merge init/on/enable and off/disable</strong>
|
||||
</p>
|
||||
<p>
|
||||
<a name="disp_init" id="disp_init"></a> <strong>disp.init( freq )</strong>
|
||||
</p>
|
||||
<p>
|
||||
@ -661,7 +657,10 @@ sample each time a new sample is taken.</p><p><a name="adc_setmode" id="adc_setm
|
||||
This function initializes the SSI interface to the OLED display.
|
||||
</p>
|
||||
<p>
|
||||
<a name="disp_disable" id="disp_disable"></a> <strong>disp.disable()</strong></p><p>Disable the SSI component of the OLED display driver and frees the SPI channel for other uses.</p><p>
|
||||
<a name="disp_disable" id="disp_disable"></a> <strong>disp.disable()</strong>
|
||||
</p>
|
||||
<p>
|
||||
Disable the SSI component of the OLED display driver and frees the SPI channel for other uses.
|
||||
</p>
|
||||
<p>
|
||||
<a name="disp_on" id="disp_on"></a><strong>disp.on()</strong>
|
||||
@ -676,14 +675,18 @@ sample each time a new sample is taken.</p><p><a name="adc_setmode" id="adc_setm
|
||||
</p>
|
||||
<p>
|
||||
Turns off the OLED display<br>
|
||||
This function will turn off the OLED display. This will stop the
|
||||
scanning of the panel and turn off the on-chip DC-DC converter,
|
||||
preventing damage to the panel due to burn-in (it has similar
|
||||
characters to a CRT in this respect).<br>
|
||||
This function will turn off the OLED display. This will stop the scanning of the panel and turn off the on-chip DC-DC converter, preventing damage to the panel due to burn-in (it has similar characters to a CRT in this respect).<br>
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
<a name="disp_clear" id="disp_clear"></a> <strong>disp.clear()</strong></p><p>Clears the OLED display.<br>This function will clear the display RAM. All pixels in the display will be turned off.</p><p><br>
|
||||
<a name="disp_clear" id="disp_clear"></a> <strong>disp.clear()</strong>
|
||||
</p>
|
||||
<p>
|
||||
Clears the OLED display.<br>
|
||||
This function will clear the display RAM. All pixels in the display will be turned off.
|
||||
</p>
|
||||
<p>
|
||||
<br>
|
||||
</p>
|
||||
<p>
|
||||
<a name="disp_print" id="disp_print"></a><strong>disp.print( str, x, y, gray )</strong><br>
|
||||
@ -696,15 +699,8 @@ characters to a CRT in this respect).<br>
|
||||
y is the vertical position to display the string, specified in rows from the top edge of the display.<br>
|
||||
gray is the 4-bit gray scale (intensity) value to be used for displayed text.<br>
|
||||
<br>
|
||||
This function will draw a string on the display. Only the ASCII
|
||||
characters between 32 (space) and 126 (tilde) are supported; other
|
||||
characters will result in random data being draw on the display (based
|
||||
on whatever appears before/after the font in memory). The font is
|
||||
mono-spaced, so characters such as ``i'' and ``l'' have more white
|
||||
space around them than characters such as ``m'' or ``w''.<br>
|
||||
If the drawing of the string reaches the right edge of the display, no
|
||||
more characters will be drawn. Therefore, special care is not required
|
||||
to avoid supplying a string that is ``too long'' to display.<br>
|
||||
This function will draw a string on the display. Only the ASCII characters between 32 (space) and 126 (tilde) are supported; other characters will result in random data being draw on the display (based on whatever appears before/after the font in memory). The font is mono-spaced, so characters such as ``i'' and ``l'' have more white space around them than characters such as ``m'' or ``w''.<br>
|
||||
If the drawing of the string reaches the right edge of the display, no more characters will be drawn. Therefore, special care is not required to avoid supplying a string that is ``too long'' to display.<br>
|
||||
<br>
|
||||
Because the OLED display packs 2 pixels of data in a single byte, the<br>
|
||||
parameter x must be an even column number (for example, 0, 2, 4, and<br>
|
||||
@ -724,20 +720,14 @@ to avoid supplying a string that is ``too long'' to display.<br>
|
||||
width is the width of the image, specified in columns.<br>
|
||||
height is the height of the image, specified in rows.<br>
|
||||
<br>
|
||||
This function will display a bitmap graphic on the display. Because of
|
||||
the format of the display RAM, the starting column x and the number of
|
||||
columns y must be an integer multiple of two.<br>
|
||||
The image data is organized with the first row of image data appearing
|
||||
left to right, followed immediately by the second row of image data.
|
||||
Each byte contains the data for two columns in the current row, with
|
||||
the leftmost column being contained in bits 7:4 and the rightmost
|
||||
column being contained in bits 3:0.<br>
|
||||
For example, an image six columns wide and seven scan lines tall would
|
||||
be arranged as follows (showing how the twenty one bytes of the image
|
||||
would appear on the display):<br>
|
||||
This function will display a bitmap graphic on the display. Because of the format of the display RAM, the starting column x and the number of columns y must be an integer multiple of two.<br>
|
||||
The image data is organized with the first row of image data appearing left to right, followed immediately by the second row of image data. Each byte contains the data for two columns in the current row, with the leftmost column being contained in bits 7:4 and the rightmost column being contained in bits 3:0.<br>
|
||||
For example, an image six columns wide and seven scan lines tall would be arranged as follows (showing how the twenty one bytes of the image would appear on the display):<br>
|
||||
<br>
|
||||
Because the OLED display packs 2 pixels of data in a single byte, the
|
||||
parameter x must be an even column number (for example, 0, 2, 4, and so
|
||||
on). </p>
|
||||
<pre>+-------------------+-------------------+-------------------+<br>| Byte 0 | Byte 1 | Byte 2 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 3 | Byte 4 | Byte 5 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 6 | Byte 7 | Byte 8 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 9 | Byte 10 | Byte 11 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 12 | Byte 13 | Byte 14 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 15 | Byte 16 | Byte 17 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 18 | Byte 19 | Byte 20 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br></pre>
|
||||
</body></html>
|
||||
Because the OLED display packs 2 pixels of data in a single byte, the parameter x must be an even column number (for example, 0, 2, 4, and so on).
|
||||
</p>
|
||||
<pre>
|
||||
+-------------------+-------------------+-------------------+<br>| Byte 0 | Byte 1 | Byte 2 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 3 | Byte 4 | Byte 5 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 6 | Byte 7 | Byte 8 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 9 | Byte 10 | Byte 11 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 12 | Byte 13 | Byte 14 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 15 | Byte 16 | Byte 17 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>| Byte 18 | Byte 19 | Byte 20 |<br>+---------+---------+---------+---------+---------+---------+<br>| 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |<br>+---------+---------+---------+---------+---------+---------+<br>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user