HW integratation
Python CI / test (3.12) (push) Successful in 7m1s
Python CI / test (3.13) (push) Successful in 7m10s

This commit is contained in:
2025-11-11 11:57:39 +01:00
parent 5a573c901e
commit 70c0b4a1f2
19 changed files with 4082 additions and 21 deletions
+46 -21
View File
@@ -471,35 +471,60 @@ pytest --cov=dreader --cov-report=term-missing
## Hardware Integration
DReader requires a Hardware Abstraction Layer (HAL) for display and input:
DReader includes complete hardware support for e-ink displays via the **dreader-hal** library.
```python
from abc import ABC, abstractmethod
from PIL import Image
### Supported Hardware
class DisplayHAL(ABC):
"""Abstract display interface for platform integration"""
- **Display**: IT8951 e-ink controller (1872×1404)
- **Touch**: FT5316 capacitive touch panel
- **Buttons**: GPIO buttons (configurable)
- **Sensors**: BMA400 accelerometer, PCF8523 RTC, INA219 power monitor
@abstractmethod
def show_image(self, image: Image.Image):
"""Display a PIL Image on the screen"""
### Quick Setup on Raspberry Pi
@abstractmethod
def get_touch_events(self) -> Iterator[TouchEvent]:
"""Get iterator of touch events from hardware"""
```bash
# 1. Clone and install
git clone https://gitea.tourolle.paris/dtourolle/dreader-application.git
cd dreader-application
python3 -m venv venv
source venv/bin/activate
pip install -e .
./install_hardware_drivers.sh
@abstractmethod
def set_brightness(self, level: int):
"""Set display brightness (0-10)"""
# 2. Interactive hardware setup
sudo python3 setup_rpi.py
# 3. Run on hardware
python examples/run_on_hardware_config.py
```
**Example HAL Implementations:**
- **E-ink Displays**: IT8951, Remarkable device SDK
- **Desktop**: pygame, tkinter, Qt
- **Web**: Flask + HTML canvas
- **Embedded**: Device-specific framebuffer
### Hardware Configuration
See [HAL_IMPLEMENTATION_SPEC.md](HAL_IMPLEMENTATION_SPEC.md) for detailed integration guidelines.
The repository includes a pre-configured **[hardware_config.json](hardware_config.json)** for the reference hardware:
- **Buttons**: GPIO 22 (prev), GPIO 27 (next), GPIO 21 (power)
- **Display**: 1872×1404 IT8951 e-ink
- **I2C Bus**: GPIO 2/3 (touch, sensors, RTC, power)
See [HARDWARE_SETUP.md](HARDWARE_SETUP.md) for complete wiring diagrams and setup instructions.
### HAL Architecture
```python
from dreader.hal_hardware import HardwareDisplayHAL
from dreader.main import DReaderApplication, AppConfig
# Hardware HAL with GPIO buttons
hal = HardwareDisplayHAL(width=1872, height=1404, vcom=-2.0)
config = AppConfig(display_hal=hal, library_path="~/Books")
app = DReaderApplication(config)
```
**Available HAL Implementations:**
- **HardwareDisplayHAL** - Real e-ink hardware (IT8951 + dreader-hal)
- **PygameDisplayHAL** - Desktop testing with pygame window
See [HARDWARE_PINOUT.md](HARDWARE_PINOUT.md) for pin assignments and [GPIO_BUTTONS.md](GPIO_BUTTONS.md) for button configuration.
## Documentation