[Internal] Add Docs for Peripheral. (#2053)
authorxerrni <e.borowski@samsung.com>
Tue, 6 Oct 2020 23:24:39 +0000 (01:24 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Oct 2020 23:24:39 +0000 (08:24 +0900)
Co-authored-by: WonYoung Choi <wy80.choi@samsung.com>
23 files changed:
internals/docs/guides/media/peri_api_cert_author.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_cert_author_details.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_cert_manager.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_cert_new.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_cert_platform_privilege.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_cert_profile.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_devices.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_duty_cycle.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_duty_cycle_voltage.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_gpio.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_i2c_diagram.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_raspberry4.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_spi_diagram.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_spi_mode.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_uart_data.png [new file with mode: 0644]
internals/docs/guides/media/peri_api_uart_diagram.png [new file with mode: 0644]
internals/docs/guides/peripheral-gpio.md [new file with mode: 0644]
internals/docs/guides/peripheral-i2c.md [new file with mode: 0644]
internals/docs/guides/peripheral-pwm.md [new file with mode: 0644]
internals/docs/guides/peripheral-spi.md [new file with mode: 0644]
internals/docs/guides/peripheral-uart.md [new file with mode: 0644]
internals/docs/guides/peripheral.md [new file with mode: 0644]
internals/docs/guides/toc.md

diff --git a/internals/docs/guides/media/peri_api_cert_author.png b/internals/docs/guides/media/peri_api_cert_author.png
new file mode 100644 (file)
index 0000000..79d27d8
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_author.png differ
diff --git a/internals/docs/guides/media/peri_api_cert_author_details.png b/internals/docs/guides/media/peri_api_cert_author_details.png
new file mode 100644 (file)
index 0000000..397944f
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_author_details.png differ
diff --git a/internals/docs/guides/media/peri_api_cert_manager.png b/internals/docs/guides/media/peri_api_cert_manager.png
new file mode 100644 (file)
index 0000000..23f38d3
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_manager.png differ
diff --git a/internals/docs/guides/media/peri_api_cert_new.png b/internals/docs/guides/media/peri_api_cert_new.png
new file mode 100644 (file)
index 0000000..32f4428
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_new.png differ
diff --git a/internals/docs/guides/media/peri_api_cert_platform_privilege.png b/internals/docs/guides/media/peri_api_cert_platform_privilege.png
new file mode 100644 (file)
index 0000000..656fbb2
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_platform_privilege.png differ
diff --git a/internals/docs/guides/media/peri_api_cert_profile.png b/internals/docs/guides/media/peri_api_cert_profile.png
new file mode 100644 (file)
index 0000000..b6e9503
Binary files /dev/null and b/internals/docs/guides/media/peri_api_cert_profile.png differ
diff --git a/internals/docs/guides/media/peri_api_devices.png b/internals/docs/guides/media/peri_api_devices.png
new file mode 100644 (file)
index 0000000..979ea53
Binary files /dev/null and b/internals/docs/guides/media/peri_api_devices.png differ
diff --git a/internals/docs/guides/media/peri_api_duty_cycle.png b/internals/docs/guides/media/peri_api_duty_cycle.png
new file mode 100644 (file)
index 0000000..d2cf47f
Binary files /dev/null and b/internals/docs/guides/media/peri_api_duty_cycle.png differ
diff --git a/internals/docs/guides/media/peri_api_duty_cycle_voltage.png b/internals/docs/guides/media/peri_api_duty_cycle_voltage.png
new file mode 100644 (file)
index 0000000..64157ec
Binary files /dev/null and b/internals/docs/guides/media/peri_api_duty_cycle_voltage.png differ
diff --git a/internals/docs/guides/media/peri_api_gpio.png b/internals/docs/guides/media/peri_api_gpio.png
new file mode 100644 (file)
index 0000000..df2cddd
Binary files /dev/null and b/internals/docs/guides/media/peri_api_gpio.png differ
diff --git a/internals/docs/guides/media/peri_api_i2c_diagram.png b/internals/docs/guides/media/peri_api_i2c_diagram.png
new file mode 100644 (file)
index 0000000..954dc56
Binary files /dev/null and b/internals/docs/guides/media/peri_api_i2c_diagram.png differ
diff --git a/internals/docs/guides/media/peri_api_raspberry4.png b/internals/docs/guides/media/peri_api_raspberry4.png
new file mode 100644 (file)
index 0000000..c0b2fbc
Binary files /dev/null and b/internals/docs/guides/media/peri_api_raspberry4.png differ
diff --git a/internals/docs/guides/media/peri_api_spi_diagram.png b/internals/docs/guides/media/peri_api_spi_diagram.png
new file mode 100644 (file)
index 0000000..521fd02
Binary files /dev/null and b/internals/docs/guides/media/peri_api_spi_diagram.png differ
diff --git a/internals/docs/guides/media/peri_api_spi_mode.png b/internals/docs/guides/media/peri_api_spi_mode.png
new file mode 100644 (file)
index 0000000..bbf932d
Binary files /dev/null and b/internals/docs/guides/media/peri_api_spi_mode.png differ
diff --git a/internals/docs/guides/media/peri_api_uart_data.png b/internals/docs/guides/media/peri_api_uart_data.png
new file mode 100644 (file)
index 0000000..603def6
Binary files /dev/null and b/internals/docs/guides/media/peri_api_uart_data.png differ
diff --git a/internals/docs/guides/media/peri_api_uart_diagram.png b/internals/docs/guides/media/peri_api_uart_diagram.png
new file mode 100644 (file)
index 0000000..7e62a7f
Binary files /dev/null and b/internals/docs/guides/media/peri_api_uart_diagram.png differ
diff --git a/internals/docs/guides/peripheral-gpio.md b/internals/docs/guides/peripheral-gpio.md
new file mode 100644 (file)
index 0000000..763560e
--- /dev/null
@@ -0,0 +1,122 @@
+# GPIO
+
+[GPIO](https://en.wikipedia.org/wiki/General-purpose_input/output) (General-Purpose Input/Output) is a programmable interface for reading the state of binary input peripherals, such as a switch, and controlling the state of binary output peripherals, such as a LED.
+
+GPIO sets a direction for the data transfer. It can also detect an interrupt signaled by a level transition: either a falling edge (high to low) or a rising edge (low to high). To detect the interrupt signal you want, set the appropriate edge mode.
+
+GPIO offers the following edge modes:
+
+-   Rising mode detects data changes from low to high.
+-   Falling mode detects data changes from high to low.
+
+**Figure: GPIO edge modes**
+
+![GPIO edge modes](media/peri_api_gpio.png)
+
+## Opening and Closing a Handle
+
+To open and close a handle:
+
+1.  To open a GPIO handle, create `GpioPin` object:
+
+    ```csharp
+    int pin = 26; /* Raspberry Pi 3 and Raspberry Pi 4 : GPIO26 */
+    GpioPin gpio = new GpioPin(pin, GpioPinDriveMode.Input);
+    ```
+
+    The `pin` parameter required for this function must be set according to the following tables.
+
+    **Table: Raspberry Pi 3 and Raspberry Pi 4**
+
+      Pin name  |Pin (parameter 1)  |Pin name  |Pin (parameter 1)
+      ----------|-------------------|----------|-------------------
+      GPIO4     |4                  |GPIO5     |5
+      GPIO6     |6                  |GPIO12    |12
+      GPIO13    |13                 |GPIO16    |16
+      GPIO17    |17                 |GPIO18    |18
+      GPIO19    |19                 |GPIO20    |20
+      GPIO21    |21                 |GPIO22    |22
+      GPIO23    |23                 |GPIO24    |24
+      GPIO25    |25                 |GPIO26    |26
+      GPIO27    |27                 |-         |-
+
+    > **Note**
+    >
+    >  For more information on the pin names and locations, see [Supported Protocols](peripheral.md#protocol).
+
+2.  To close a GPIO handle that is no longer used, use the `gpio.Close()` method:
+
+    ```csharp
+    gpio.Close();
+    ```
+
+## Setting the Data Direction
+
+Gpio object constructor expect the data transfer direction parameter. It can be set to:
+
+-   `GpioPinDriveMode.Input`: Input mode to receive data from a binary output peripheral.
+-   `GpioPinDriveMode.OutputInitiallyLow`: Output mode to send data to a binary output peripheral. This value initializes the output peripheral state as low.
+-   `GpioPinDriveMode.OutputInitiallyHigh`: Output mode to send data to a binary output peripheral. This value initializes the output peripheral state as high.
+
+> **Note**
+>
+> To set the data direction to `GpioPinDriveMode.OutputInitiallyHigh` or `GpioPinDriveMode.OutputInitiallyLow`, the edge mode must be set to `GpioChangePolarity.None`.
+
+
+## Setting the Edge Mode
+
+To set the edge mode, use the `gpio.Polarity` property with 1 of the following edge mode types:
+
+-   `GpioChangePolarity.None`: No edge mode.
+-   `GpioChangePolarity.Rising`: Interrupted at a rising edge (low to high).
+-   `GpioChangePolarity.Falling`: Interrupted at a falling edge (high to low).
+-   `GpioChangePolarity.Both`: Interrupted at both rising and falling edges.
+
+```csharp
+GpioPin.Polarity(GpioChangePolarity);
+```
+
+> **Note**
+>
+> To set the edge mode to `GpioChangePolarity.Rising`, `GpioChangePolarity.Falling`, or `GpioChangePolarity.Both`, the data direction must be set to the `GpioPinDriveMode.Input`.
+
+
+## Setting the Interrupted Callback
+
+The interrupted event handler is called when the GPIO state changes, based on the selected edge mode.
+
+To implement the interrupted callback:
+
+1.  Subscribe to the interrupted event handler.
+
+    ```csharp
+    GpioPin gpio;
+    gpio.ValueChanged += myEventHandler;
+    ```
+2.  When no longer needed, unsubscribe the interrupt event handler:
+
+    ```csharp
+    gpio.ValueChanged -= myEventHandler;
+    ```
+
+## Reading and Writing Binary Data
+
+To read and write binary data:
+
+-   To read binary data from a peripheral, use the `GpioPin.Read()` method:
+
+    ```csharp
+    GpioPinValue value;
+    value = gpio.Read();
+    ```
+
+-   To write binary data to a peripheral, use the `GpioPin.Write()` method:
+
+    ```csharp
+    GpioPinValue value = GpioPinValue.Low;
+    gpio.Write(value);
+    ```
+
+> **Note**
+>
+> To write binary data, the data direction must be set to `GpioPinDriveMode.OutputInitiallyHigh` or `GpioPinDriveMode.OutputInitiallyLow`.
diff --git a/internals/docs/guides/peripheral-i2c.md b/internals/docs/guides/peripheral-i2c.md
new file mode 100644 (file)
index 0000000..81b55b5
--- /dev/null
@@ -0,0 +1,104 @@
+# I<sup>2</sup>C
+
+[I<sup>2</sup>C](https://en.wikipedia.org/wiki/I%C2%B2C) (Inter-Integrated Circuit) is a programmable interface that allows you to communicate with I<sup>2</sup>C peripherals.
+
+I<sup>2</sup>C is a synchronous serial interface that uses a clock signal to synchronize data transfers between master and slave device:
+
+-   Master device generates the clock and initiates communication with slaves.
+-   Slave device receives the clock and responds when addressed by the master.
+
+**Figure: I<sup>2</sup>C interface diagram**
+
+![I2C interface diagram](media/peri_api_i2c_diagram.png)
+
+To allow the I<sup>2</sup>C master to connect to 128 I<sup>2</sup>C slave devices, an I<sup>2</sup>C slave device provides a 7-bit address. Since most slave addresses are determined by the manufacturer, refer to the specification to find the slave device address.
+
+Using the I<sup>2</sup>C bus, the master controls signal lines called SCL (Shared CLock) and SDA (Shared DAta) to read or write data to or from the device. SCL is a clock line for communication synchronization, and SDA is a data line. The master outputs the clock for synchronization with the SCL, and the slave outputs or receives data through the SDA according to the clock output to the SCL.
+
+If the SDA line is used alone, only half duplex communication is possible because data is sent only to 1 line.
+
+## Opening and Closing a Handle
+
+To open and close a handle:
+
+1.  To open an I<sup>2</sup>C handle, create the `I2cDevice` object:
+
+    ```csharp
+    int bus = 1;
+    int address = ...;   /* See the specification */
+    I2cDevice i2c = new I2cDevice(bus, address);
+    ```
+
+    The `bus` parameter required for this function must be set according to the following table.
+
+    **Table: Raspberry Pi 3 and Raspberry Pi 4**
+
+    Pin name  |           |Bus number (parameter 1)
+    ----------|-----------|----------
+    I2C1\_SDA | I2C1\_SCL | 1
+
+    > **Note**
+    >
+    > For more information on the pin names and locations, see [Supported Protocols](peripheral.md#protocol).
+
+    The `address` parameter must be set based on the peripheral specification.
+
+2.  To close an I<sup>2</sup>C handle that is no longer used, use the `I2cDevice.Close()` method:
+
+    ```csharp
+    i2c.Close();
+    ```
+
+## Reading and Writing Data
+
+To read and write data:
+
+-   To write bytes to a slave device, use the `I2cDevice.Write()` method:
+
+    ```csharp
+    byte[] data = {0x06, 0x01};
+    i2c.Write(data);
+    ```
+
+-   To read bytes from a slave device, use the `I2cDevice.Read()` method:
+
+    ```csharp
+    byte[] data = new byte[2];
+    i2c.Read(data);
+    ```
+
+## Reading and Writing Register Data
+
+To read and write register data:
+
+-   To write single byte data to a slave device register, use the `I2cDevice.WriteRegisterByte()` method:
+
+    ```csharp
+    byte data = 0x06;
+    byte register_address = ...;  /* See the specification */
+    i2c.WriteRegisterByte(register_address, data);
+    ```
+
+-   To read single byte data from a slave device register, use the `I2cDevice.ReadRegisterByte()` method:
+
+    ```csharp
+    byte data;
+    byte register_address = ...;  /* See the specification */
+    data = i2c.ReadRegisterByte(register_address);
+    ```
+
+-   To write word data to a slave device register, use the `I2cDevice.WriteRegisterWord()` method:
+
+    ```csharp
+    ushort data = 0xffff;
+    byte register_address = ...;  /* See the specification */
+    i2c.WriteRegisterWord(register_address, data);
+    ```
+
+-   To read word data from a slave device register, use the `I2cDevice.ReadRegisterByte()` method:
+
+    ```csharp
+    ushort data;
+    byte register_address = ...;  /* See the specification */
+    data = i2c.ReadRegisterByte(register_address);
+    ```
diff --git a/internals/docs/guides/peripheral-pwm.md b/internals/docs/guides/peripheral-pwm.md
new file mode 100644 (file)
index 0000000..7a6215a
--- /dev/null
@@ -0,0 +1,86 @@
+# PWM
+
+[PWM](https://en.wikipedia.org/wiki/Pulse-width_modulation) (Pulse-Width Modulation) is a programmable interface that allows you to, for example, control motor speed or change light brightness.
+
+Peripherals that support PWM are controlled by the current strength. To modulate the current, the voltage needs to be modulated. The voltage is proportional to the intensity of the current.
+
+To modulate the voltage, you must set the duty cycle and polarity:
+
+-   The period is a constant interval at which the pulse repeats.
+-   The duty cycle is the constant time within 1 period in which a signal is active.
+-   A "polarity high" signal starts high for the duration of the duty cycle and goes low for the remainder of the period. Conversely, a "polarity low" signal starts low for the duration of the duty cycle and goes high for the remainder of the period.
+-   The pulse repeats if repetition has been enabled.
+
+**Figure: Duty cycle**
+
+![Duty cycle](media/peri_api_duty_cycle.png)
+
+For example, if the period is 10,000,000 nanoseconds and the polarity high duty cycle is 7,000,000 nanoseconds, the average voltage is at 70%.
+
+**Figure: Average voltage per duty cycle**
+
+![Average voltage per duty cycle](media/peri_api_duty_cycle_voltage.png)
+
+## Opening and Closing a Handle
+
+To open and close a handle:
+
+1.  To open a PWM handle, create the `PwmPin()` object:
+
+    ```csharp
+    int chip = 0;
+    int pin = 2;
+    PwmPin pwm = new PwmPin(chip, pin);
+    ```
+
+    > **Note**
+    >
+    > For more information on the pin names and locations, see [Supported Protocols](peripheral.md#protocol).
+
+2.  To close a PWM handle that is no longer used, use the `PwmPin.Close()` method:
+
+    ```csharp
+    pwm.Close();
+    ```
+
+## Setting the Period
+
+To set the period, use the `PwmPin.Period` property.
+
+The following example sets the period to 20 milliseconds. The unit is nanoseconds.
+
+```csharp
+uint period = 20000000;
+pwm.Period = period;
+```
+
+## Setting the Duty Cycle
+
+To set the duty cycle, use the `PwmPin.DutyCycle` property.
+
+The following example sets the duty cycle to 2 milliseconds. The unit is nanoseconds.
+
+```csharp
+uint duty_cycle = 2000000;
+pwm.DutyCycle = duty_cycle;
+```
+
+## Setting the Polarity
+
+To set the polarity, use the `PwmPin.Polarity()` method with 1 of the following `PwmPulsePolarity` types:
+
+-   `PwmPulsePolarity.ActiveHigh`: Polarity is high.
+-   `PwmPulsePolarity.ActiveLow`: Polarity is low.
+
+```csharp
+pwm.PwmPulsePolarity = PwmPulsePolarity.ActiveHigh;
+```
+
+## Enabling Repetition
+
+To enable repetition, use the `PwmPin.Enable()` method:
+
+```csharp
+bool enable = true;
+pwm.Enable = enable;
+```
diff --git a/internals/docs/guides/peripheral-spi.md b/internals/docs/guides/peripheral-spi.md
new file mode 100644 (file)
index 0000000..ea9d8ba
--- /dev/null
@@ -0,0 +1,153 @@
+# SPI
+
+[SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus) (Serial Peripheral Interface) is a programmable interface for transferring data quickly to peripherals that require high performance.
+
+The SPI protocol is a serial communication method that controls the clock signal as master and other peripherals connected to SPI as slaves. This protocol is used by peripherals, such as heart-beat pulse sensors and graphic displays, that require fast data transfer.
+
+**Figure: SPI interface diagram**
+
+![SPI interface diagram](media/peri_api_spi_diagram.png)
+
+The SPI is a communication method between 1 master and multiple slave devices. In the above figure:
+
+-   CLK (SCLK or SCK) is a simple synchronization signal and a communication clock.
+-   The data flows from the master to the slave in the MOSI (Master Out Slave In) line, and from the slave to the master in the MISO (Master In Slave Out) line. Full duplex data communication is possible with 2 lines (MOSI and MISO).
+-   CS (Chip Select) is a signal for selecting a slave device.
+
+SPI supports half duplex read/write and full duplex transfer.
+
+To use SPI, you must set the following:
+
+-   SPI mode
+
+    **Figure: SPI modes**
+
+    ![SPI modes](media/peri_api_spi_mode.png)
+
+    Each of the 4 available SPI modes defines a specific combination of clock polarity (CPOL) and clock phase (CPHA).
+
+    **Table: SPI modes**
+
+    | SPI mode   | Polarity (CPOL) | Phase (CPHA) | Description                                                  |
+    | ---------- | --------------- | ------------ | ------------------------------------------------------------ |
+    | SPI MODE 0 | 0               | 0            | CLK (Clock) is first low and data is sampled on the rising edge of each clock pulse. |
+    | SPI MODE 1 | 0               | 1            | CLK is first low and data is sampled on the falling edge of each clock pulse. |
+    | SPI MODE 2 | 1               | 0            | CLK is first high and data is sampled on the falling edge of each clock pulse. |
+    | SPI MODE 3 | 1               | 1            | CLK is first high and data is sampled on the rising edge of each clock pulse. |
+
+-   Bit order
+
+    The bit order refers to the sequential order in which bytes are arranged into larger numerical values. MSB indicates that the most significant bit is transmitted first. LSB indicates that the least significant bit is transmitted first.
+
+-   Bit per word
+
+    The bit per word refers to the number of bits to be transmitted at a time when data is exchanged with a connected slave. Normally, it is set to 8 bits per word.
+
+-   Frequency
+
+    The frequency refers to the clock signal in Hz. Since the frequencies are different for each slave device, the applicable value must be checked from the peripheral's specification.
+
+## Opening and Closing a Handle
+
+To open and close a handle:
+
+1.  To open a SPI handle, create the `SpiDevice()` object:
+
+    ```csharp
+    int bus = 2;
+    int chip_select = 0;
+    SpiDevice spi = new SpiDevice(bus, chip_select);
+    ```
+
+    The `bus` and `chip_select` parameters required for this function must be set according to the following tables.
+
+    **Table: Raspberry Pi 3 and Raspberry Pi 4**
+
+    | Pin name  | | | | Bus (parameter 1) | Chip Select (parameter 2) |
+    | --------- | --------- | -------- | -------- | ---- | ---- |
+    | SPI0_MOSI | SPI0_MISO | SPI0_CLK | SPI0_CS0 | 0    | 0    |
+    | SPI0_MOSI | SPI0_MISO | SPI0_CLK | SPI0_CS1 | 0    | 1    |
+
+    > **Note**
+    >
+    > For more information on the pin names and locations, see [Supported Protocols](peripheral.md#protocol).
+
+2.  To close a SPI handle that is no longer used, use the `SpiDevice.Close()` method:
+
+    ```csharp
+    spi.Close();
+    ```
+
+## Setting the SPI Mode
+
+To set the SPI mode, use the `SpiDevice.Mode` property with 1 of the following `SpiMode` types:
+
+-   `SpiMode.Mode0`: CLK is active high and sampled at the rising edge.
+-   `SpiMode.Mode1`: CLK is active high and sampled at the falling edge.
+-   `SpiMode.Mode2`: CLK is active low and sampled at the rising edge.
+-   `SpiMode.Mode3`: CLK is active low and sampled at the falling edge.
+
+```csharp
+spi.Mode = SpiMode.Mode0;
+```
+
+## Setting the Bit Order
+
+To set the bit order, use the `SpiDevice.BitOrder` property with 1 of the following `BitOrder` types:
+
+-   `BitOrder.MSB`: Use the most significant bit first.
+-   `BitOrder.LSB`: Use the least significant bit first.
+
+```csharp
+spi.BitOrder = BitOrder.MSB;
+```
+
+> **Note**
+>
+> The Raspberry Pi 3 and Raspberry Pi 4 boards do not support the LSB bit order.
+
+## Setting the Bits per Word
+
+To set the bits per word, use the `SpiDevice.BitsPerWord` property:
+
+```csharp
+byte bits_per_word = 8;
+spi.BitsPerWord = bits_per_word;
+```
+
+## Setting the Frequency
+
+To set the frequency, use the `SpiDevice.ClockFrequency` property.
+
+The frequency unit is Hz.
+
+```csharp
+uint frequency = 1024;
+spi.ClockFrequency  = frequency;
+```
+
+## Reading, Writing, and Transferring Data
+
+To read, write, and transfer data:
+
+-   To read data from a slave device, use the `SpiDevice.Read()` method:
+
+    ```csharp
+    byte[] data = new byte[1];
+    spi.Read(data);
+    ```
+
+-   To write data to a slave device, use the `SpiDevice.Write()` method:
+
+    ```csharp
+    byte[] data = {0x80};
+    spi.Write(data);
+    ```
+
+-   To exchange bytes data with a slave device, use the `SpiDevice.TransferSequential()` method:
+
+    ```csharp
+    byte[] tx_data = {0x80, 0x01};
+    byte[] rx_data = new byte[2];
+    spi.TransferSequential(tx_data, rx_data);
+    ```
diff --git a/internals/docs/guides/peripheral-uart.md b/internals/docs/guides/peripheral-uart.md
new file mode 100644 (file)
index 0000000..4477dd5
--- /dev/null
@@ -0,0 +1,153 @@
+# UART
+
+[UART](https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter) (Universal Asynchronous Receiver-Transmitter) is a programmable interface that allows you to communicate 1:1 with a UART peripheral.
+
+**Figure: UART interface diagram**
+
+![UART interface diagram](media/peri_api_uart_diagram.png)
+
+UART is an interface for exchanging data with peripherals. It is an asynchronous method that transmits data without a clock line, and consists of only 2 data lines: transmit (Tx) and receive (Rx). UART performs 1:1 communication.
+
+**Figure: UART data frame**
+
+![UART data frame](media/peri_api_uart_data.png)
+
+The UART data frame consists of start (1 bit), data (5\~8 bit), parity (1 bit) and stop (1 bit):
+
+-   Start bit
+
+    Indicates the start of the communication before sending data and holds it for a bit time length.
+
+-   Data
+
+    Transmits 5 to 8 bits of data.
+
+-   Parity bit
+
+    Generates and transmits a parity value for error verification, and determines a receiving side error. The following options are available: `None`, `Even`, and `Odd` parity. Selecting `None` removes this bit.
+
+-   Stop bit
+
+    Indicates the termination of the communication and holds 1 or 2 bits.
+
+-   Baud rate
+
+    Asynchronous transmission/receiving speeds must be matched to the peripheral. For this purpose, the number of signals transmitted per second can be synchronized with a peripheral. It is called the Baud.
+
+If a device supports a 5-wire UART port, hardware flow control can be used to increase the reliability of the data transmission. Software flow control can also be used to increase reliability.
+
+## Opening and Closing a Handle
+
+To open and close a handle:
+
+1.  To open a UART handle, create the `SerialPort()` object:
+
+    ```csharp
+    int port = 0;
+    SerialPort uart = new SerialPort(port);
+    ```
+
+    The `port` parameter required for this function must be set according to the following tables.
+
+    **Table: Raspberry Pi 3 and Raspberry Pi 4**
+
+    | Pin name | | Port (parameter 1) |
+    | -------- | ---------| ---- |
+    | UART0_RX | UART0_TX | 0    |
+    | UART1_RX | UART1_TX | 1    |
+
+
+    > **Note**
+    >
+    > For more information on the pin names and locations, see [Supported Protocols](peripheral.md#protocol).
+
+2.  To close a UART handle that is no longer used, use the `SerialPort.Close()` method:
+
+    ```csharp
+    uart.Close();
+    ```
+
+## Setting the Baud Rate
+
+To set the baud rate, use the `SerialPort.BaudRate` property with a `BaudRate` value:
+
+-   `BaudRate.Rate0` \~ `BaudRate.Rate230400`
+
+```csharp
+uart.BaudRate = BaudRate.Rate9600;
+```
+
+## Setting the Byte Size
+
+To set the byte size, use the `SerialPort.DataBits` property with 1 of the following `DataBits` types:
+
+-   `DataBits.Size5Bit`: Byte size is 5 bits.
+-   `DataBits.Size6Bit`: Byte size is 6 bits.
+-   `DataBits.Size7Bit`: Byte size is 7 bits.
+-   `DataBits.Size8Bit`: Byte size is 8 bits.
+
+```csharp
+uart.DataBits = DataBits.Size7Bit;
+```
+
+## Setting the Parity Bit
+
+To set the parity bit, use the `SerialPort.Parity` property with 1 of the following `Parity` types:
+
+-   `Parity.None`: No parity bit.
+-   `Parity.Even`: Parity bit is even.
+-   `Parity.Odd`: Parity bit is odd.
+
+```csharp
+uart.Parity = Parity.Even;
+```
+
+## Setting the Stop Bits
+
+To set the stop bits, use the `SerialPort.StopBits` property with 1 of the following `StopBits` types:
+
+-   `StopBits.One`: 1 bit is used for stop bits.
+-   `StopBits.Two`: 2 bit is used for stop bits.
+
+```csharp
+uart.StopBits = StopBits.Two;
+```
+
+## Setting the Flow Control
+
+To set the software flow control, use the `SerialPort.SoftwareFlowControl` property with 1 of the following `SoftwareFlowControl` types:
+
+-   `SoftwareFlowControl.None`: No software flow control.
+-   `SoftwareFlowControl.XonXoff`: Software flow control uses XONXOFF.
+
+```csharp
+uart.SoftwareFlowControl(SoftwareFlowControl.XonXoff);
+```
+
+To set the hardware flow control, use the `SerialPort.HardwareFlowControl` property with 1 of the following `HardwareFlowControl` types:
+-   `HardwareFlowControl.None`: No hardware flow control.
+-   `HardwareFlowControl.AutoRtsCts`: Hardware flow control uses RTSCTS.
+
+```csharp
+uart.HardwareFlowControl(HardwareFlowControl.AutoRtsCts);
+```
+
+## Reading and Writing Data
+
+To read and write data:
+
+-   To write data to a slave device, use the `SerialPort.Write()` method:
+
+    ```csharp
+    byte[] data = {0x06, 0x01};
+    int offset = 0;
+    SerialPort.Write(data, offset, data.Length);
+    ```
+
+-   To read data from a slave device, use the `SerialPort.Read()` method:
+
+    ```csharp
+    byte[] data = new byte[2];
+    int offset = 0;
+    SerialPort.Read(data, offset, data.Length);
+    ```
diff --git a/internals/docs/guides/peripheral.md b/internals/docs/guides/peripheral.md
new file mode 100644 (file)
index 0000000..cf3af19
--- /dev/null
@@ -0,0 +1,50 @@
+# Tizen Peripheral I/O Native API
+
+Tizen IoT provides the Peripheral I/O APIs for IoT devices to control peripherals, such as sensors and actuators, using industry-standard protocols and interfaces:
+
+-   [GPIO](peripheral-gpio.md) (General-Purpose Input/Output)
+-   [PWM](peripheral-pwm.md) (Pulse-Width Modulation)
+-   [SPI](peripheral-spi.md) (Serial Peripheral Interface)
+-   [I<sup>2</sup>C](peripheral-i2c.md) (Inter-Integrated Circuit)
+-   [UART](peripheral-uart.md) (Universal Asynchronous Receiver-Transmitter)
+
+Since each peripheral supports different interfaces and protocols, you must check from the peripheral's specifications whether a specific protocol is supported. Peripheral I/O APIs are categorized based on the protocol.
+
+**Figure: Peripherals connected to an IoT device**
+
+![Peripherals connected to an IoT device](media/peri_api_devices.png)
+
+<a name="protocol"></a>
+## Supported Protocols
+
+The following table lists the supported protocols for the Tizen IoT hardware targets.
+
+**Table: Protocols supported by the Tizen IoT hardware targets**
+
+  | Protocol  |Raspberry Pi 3 and Raspberry Pi 4 |
+  |-----------|----------------------------------|
+  | GPIO      |Yes |
+  | PWM       |No |
+  | SPI       |Yes |
+  | I<sup>2</sup>C |Yes |
+  | UART      |Yes |
+
+The following figures illustrate the pinout information for the Tizen IoT hardware targets.
+
+**Figure: Raspberry Pi 3 and Raspberry Pi 4 pinout**
+
+![Raspberry Pi 4 pinout](media/peri_api_raspberry4.png)
+
+## Prerequisites
+
+1.  To use the Peripheral I/O API, the application has to request permission by adding the following platform privilege to the `tizen-manifest.xml` file:
+
+    ```xml
+    <privileges>
+       <privilege>http://tizen.org/privilege/peripheralio</privilege>
+    </privileges>
+    ```
+
+    To obtain authorization to use platform-level privileges, the application must be signed with a **platform-level distributor** certificate. Please follow [this guide](https://docs.tizen.org/application/vstools/tools/certificate-manager/) on how to create a certificate profile for signing the application. In third section of creating certificate "Distributor Certificate" please select "Select a distributor certificate for an another app store" and provide **platform-level distributor** certificate obtained from Samsung.
+
+2.  To use the classes and data types of the Peripheral I/O API please use `Tizen.Peripheral` namespace.
index 9d282a5..20e5ca1 100644 (file)
@@ -1 +1,2 @@
 # [Tizen.Inspections](inspections.md)
+# [Tizen.Peripheral](peripheral.md)