# SPIIn

SPIIn node is used for receiving data that was sent from a MCU (via SPI). You can find demos
[here](https://github.com/luxonis/esp32-spi-message-demo).

This allows you for example to control eg.
[ColorCamera](https://docs.luxonis.com/software/depthai-components/nodes/color_camera.md) or
[ImageManip](https://docs.luxonis.com/software/depthai-components/nodes/image_manip.md) from the MCU or send a
[Buffer](https://docs.luxonis.com/software/depthai-components/messages/buffer.md) of data from the MCU to a
[Script](https://docs.luxonis.com/software/depthai-components/nodes/script.md) node.

[SPIOut](https://docs.luxonis.com/software/depthai-components/nodes/spi_out.md) is used for sending data from the VPU to a MCU
(via SPI).

## How to place it

#### Python

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

#### C++

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

## Inputs and Outputs

## Usage

#### 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);
```

## Examples of functionality

 * [SPI code demos with ESP32](https://github.com/luxonis/esp32-spi-message-demo)

## Reference

### 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.

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
