# {{ interface_name | pascal_case }} Serial Interface

{{ interface_description }}

Generated by MADSci template: `comm/serial` v{{ template_version }}

## Overview

Serial port communication interface using pySerial patterns. Provides
open/close/read/write/flush operations for RS-232 and similar serial
protocols.

## Usage

```python
from {{ interface_name }}_interface import {{ interface_name | pascal_case }}Interface

interface = {{ interface_name | pascal_case }}Interface(port="/dev/ttyUSB0", baudrate=9600)
interface.open()
interface.write(b"*IDN?\n")
response = interface.readline()
interface.close()
```

## Testing

Use the fake interface for development and testing without hardware:

```python
from {{ interface_name }}_fake_interface import {{ interface_name | pascal_case }}FakeInterface

interface = {{ interface_name | pascal_case }}FakeInterface(simulated_latency=0.0)
interface.set_response(b"OK\n")
interface.open()
response = interface.query("*IDN?")
assert response == "OK"
```

Run the test suite:

```bash
pytest test_{{ interface_name }}.py
```

## Dependencies

- `pyserial>=3.5` for the real interface

## Common Pitfalls

- Ensure the serial port is not in use by another process
- Check baud rate matches the device configuration
- On Linux, ensure user has permission to access serial ports (add to `dialout` group)
- On Windows, use `COM3` style port names instead of `/dev/ttyUSB0`
