Skip to content

Commit ddf6d77

Browse files
committed
Add WS2812B Example Guide and API
1 parent f9d6e60 commit ddf6d77

File tree

17 files changed

+726
-1
lines changed

17 files changed

+726
-1
lines changed

source/_common/ameba_d/Example_Guides/WS2812B/WS2812B - Patterns.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Example
1919

2020
In this example, we will be using the AmebaD board to control the WS2812B RGB LED, using the SPI peripheral to create the waveform necessary for the LEDs.
2121

22-
WS2812B basics allows you to control a single LED with a color or fill all the LED with the same color.
22+
WS2812B patterns controls LED (Strip / Ring / Stick / Board) with different colors with different LED patterns.
2323

2424
Procedure
2525
-----------
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

source/ameba_pro2/amb82-mini/API_Documents/SPI/Class SPISettings.rst

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ A class of SPI implementation for Ameba.
120120
+---------------------------------+------------------------------------------+
121121
| SPIClass::end | Stop SPI master mode |
122122
+---------------------------------+------------------------------------------+
123+
| SPIClass::slaveRead | Slave receive one frame use SPI |
124+
+---------------------------------+------------------------------------------+
125+
| SPIClass::slaveWrite | Slave send one frame use SPI |
126+
+---------------------------------+------------------------------------------+
127+
| SPIClass::masterWrite | Master send one frame use SPI |
128+
+---------------------------------+------------------------------------------+
129+
| SPIClass::pSpiMaster | Pointer of SPI master project |
130+
+---------------------------------+------------------------------------------+
131+
| SPIClass::pSpiSlave | Pointer of SPI slave project |
132+
+---------------------------------+------------------------------------------+
123133

124134
**SPIClass::SPIClass**
125135
----------------------
@@ -519,3 +529,166 @@ NA
519529
NA
520530

521531
.. note :: After calling end(), you need to use begin() again to enable SPI function. "SPI.h" must be included to use the class function.
532+
533+
**SPIClass::slaveRead**
534+
-----------------
535+
536+
**Description**
537+
~~~~~~~~~~~~~~~
538+
539+
This function retrieves data from receive buffer as slave. Slave receive one frame use SPI.
540+
541+
**Syntax**
542+
~~~~~~~~~~
543+
544+
.. code-block:: c++
545+
546+
int slaveRead(void);
547+
548+
**Parameters**
549+
~~~~~~~~~~~~~~
550+
551+
NA
552+
553+
**Returns**
554+
~~~~~~~~~~~
555+
556+
This function returns the data received from master.
557+
558+
**Example Code**
559+
~~~~~~~~~~~~~~~~
560+
561+
NA
562+
563+
.. note :: "SPI.h" must be included to use the class function.
564+
565+
**SPIClass::slaveWrite**
566+
-----------------
567+
568+
**Description**
569+
~~~~~~~~~~~~~~~
570+
571+
This function use slave send one frame use SPI.
572+
573+
**Syntax**
574+
~~~~~~~~~~
575+
576+
.. code-block:: c++
577+
578+
void slaveWrite(int value);
579+
void slaveWrite(spi_t *pSpiObj, int value);
580+
581+
**Parameters**
582+
~~~~~~~~~~~~~~
583+
584+
value: the data to transmit
585+
586+
pSpiObj: spi slave object define in application software
587+
588+
**Returns**
589+
~~~~~~~~~~~
590+
591+
NA
592+
593+
**Example Code**
594+
~~~~~~~~~~~~~~~~
595+
596+
NA
597+
598+
.. note :: "SPI.h" must be included to use the class function.
599+
600+
**SPIClass::masterWrite**
601+
-----------------
602+
603+
**Description**
604+
~~~~~~~~~~~~~~~
605+
606+
This function use master send one frame use SPI.
607+
608+
**Syntax**
609+
~~~~~~~~~~
610+
611+
.. code-block:: c++
612+
613+
int masterWrite(int value);
614+
615+
**Parameters**
616+
~~~~~~~~~~~~~~
617+
618+
value: the data to transmit
619+
620+
**Returns**
621+
~~~~~~~~~~~
622+
623+
This function returns the data received from slave.
624+
625+
**Example Code**
626+
~~~~~~~~~~~~~~~~
627+
628+
NA
629+
630+
.. note :: "SPI.h" must be included to use the class function.
631+
632+
**SPIClass::pSpiMaster**
633+
-----------------
634+
635+
**Description**
636+
~~~~~~~~~~~~~~~
637+
638+
It is a pointer of SPI master project.
639+
640+
**Syntax**
641+
~~~~~~~~~~
642+
643+
.. code-block:: c++
644+
645+
spi_t *pSpiMaster;
646+
647+
**Parameters**
648+
~~~~~~~~~~~~~~
649+
650+
NA
651+
652+
**Returns**
653+
~~~~~~~~~~~
654+
655+
NA
656+
657+
**Example Code**
658+
~~~~~~~~~~~~~~~~
659+
660+
NA
661+
662+
.. note :: "SPI.h" must be included to use the class function.
663+
664+
**SPIClass::pSpiMaster**
665+
-----------------
666+
667+
**Description**
668+
~~~~~~~~~~~~~~~
669+
670+
It is a pointer of SPI slave project.
671+
672+
**Syntax**
673+
~~~~~~~~~~
674+
675+
.. code-block:: c++
676+
677+
spi_t *pSpiSlave;
678+
679+
**Parameters**
680+
~~~~~~~~~~~~~~
681+
682+
NA
683+
684+
**Returns**
685+
~~~~~~~~~~~
686+
687+
NA
688+
689+
**Example Code**
690+
~~~~~~~~~~~~~~~~
691+
692+
NA
693+
694+
.. note :: "SPI.h" must be included to use the class function.

0 commit comments

Comments
 (0)