# SPIIn

SPIIn 节点用于接收从 MCU（通过 SPI）发送的数据。 你可以在[此处](https://github.com/luxonis/esp32-spi-message-demo)找到示例。

例如，这允许你从 MCU 控制 [ColorCamera](https://docs.luxonis.com/software/depthai-components/nodes/color_camera.md) 或
[ImageManip](https://docs.luxonis.com/software/depthai-components/nodes/image_manip.md) 节点，或者将数据
[Buffer](https://docs.luxonis.com/software/depthai-components/messages/buffer.md) 从 MCU 发送到
[Script](https://docs.luxonis.com/software/depthai-components/nodes/script.md) 节点。

[SPIOut](https://docs.luxonis.com/software/depthai-components/nodes/spi_out.md) 用于将数据从 VPU 发送到 MCU（通过 SPI）。

## 如何放置

#### Python

```python
pipeline = dai.Pipeline()
spi = pipeline.create(dai.node.SPIIn)
```

#### C++

```cpp
dai::Pipeline pipeline;
auto spi = pipeline.create<dai::node::SPIIn>();
```

## 输入与输出

## 使用方式

#### Python

```python
pipeline = dai.Pipeline()
spi = pipeline.create(dai.node.SPIIn)

spi.setStreamName("control")
spi.setBusId(0)
```

#### C++

```cpp
dai::Pipeline pipeline;
auto spi = pipeline.create<dai::node::SPIIn>();

spi->setStreamName("control");
spi->setBusId(0);
```

## 功能示例

 * [与 ESP32 的 SPI 代码示例](https://github.com/luxonis/esp32-spi-message-demo)

## 参考

### depthai.node.SPIIn(depthai.Node)

Kind: Class

SPIIn node. Receives messages over SPI.

#### getBusId(self) -> int: int

Kind: Method

Get bus id

#### getMaxDataSize(self) -> int: int

Kind: Method

Get maximum messages size in bytes

#### getNumFrames(self) -> int: int

Kind: Method

Get number of frames in pool

#### getStreamName(self) -> str: str

Kind: Method

Get stream name

#### setBusId(self, id: typing.SupportsInt)

Kind: Method

Specifies SPI Bus number to use

Parameter ``id``:
SPI Bus id

#### setMaxDataSize(self, maxDataSize: typing.SupportsInt)

Kind: Method

Set maximum message size it can receive

Parameter ``maxDataSize``:
Maximum size in bytes

#### setNumFrames(self, numFrames: typing.SupportsInt)

Kind: Method

Set number of frames in pool for sending messages forward

Parameter ``numFrames``:
Maximum number of frames in pool

#### setStreamName(self, name: str)

Kind: Method

Specifies stream name over which the node will receive data

Parameter ``name``:
Stream name

#### out

Kind: Property

Outputs message of same type as send from host.

### 需要帮助？

请前往 [OAKChina 官网](https://www.oakchina.cn/) 获取技术支持或解答您的任何疑问。
