lase/
tools.rs

1// Copyright (c) 2017 Brandon Thomas <bt@brand.io>, <echelon@gmail.com>
2
3//! Various DAC-specific tools.
4
5use dac::Dac;
6use error::LaseError;
7use etherdream::network::find_first_dac;
8use etherdream::protocol;
9
10// TODO: Move these.
11
12/// Max color on Etherdream.
13pub const ETHERDREAM_COLOR_MAX : u16 = protocol::COLOR_MAX;
14/// Min color on Etherdream.
15pub const ETHERDREAM_COLOR_MIN : u16 = protocol::COLOR_MIN;
16/// Max X on Etherdream.
17pub const ETHERDREAM_X_MAX : i16 = protocol::X_MAX;
18/// Min X on Etherdream.
19pub const ETHERDREAM_X_MIN : i16 = protocol::X_MIN;
20/// Max Y on Etherdream.
21pub const ETHERDREAM_Y_MAX : i16 = protocol::Y_MAX;
22/// Min Y on Etherdream.
23pub const ETHERDREAM_Y_MIN : i16 = protocol::Y_MIN;
24
25/// Find the first Etherdream DAC on the network.
26pub fn find_first_etherdream_dac() -> Result<Dac, LaseError> {
27  let result = find_first_dac()?;
28  Ok(Dac::etherdream(result.ip_address))
29}