opentitanlib/transport/ioexpander/
mod.rs

1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5use crate::app::TransportWrapper;
6use crate::app::config;
7use crate::io::ioexpander::IoExpander;
8
9use anyhow::Result;
10
11mod sx1503;
12
13/// Creates an instance of `IoExpander` as specified in the given configuration declaration
14/// section.  The `driver` field will decide the implementing struct.
15pub fn create(
16    conf: &config::IoExpander,
17    transport_wrapper: &TransportWrapper,
18) -> Result<IoExpander> {
19    match conf.driver {
20        config::IoExpanderDriver::Sx1503 => sx1503::create(conf, transport_wrapper),
21        // Add future drivers here
22    }
23}