# request.rs - source
Source of the Rust file `src/request.rs`.
Keywords: rust, rustlang, rust-lang

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

    //! This module contains the request data used to communicate
    //! with the B15 via USART.
    //!
    //! Using a direct USART connection to the B15 is discouraged,
    //! if you are trying to interact with the B15 consider using
    //! the `b15f::B15F` structure instead.

    // TODO: There should be a more elegant way to do this

    #[macro_export]
    /// Builds a new request buffer from the given data
    macro_rules! build_request {
    	[$($x:expr),*] => (
    		&[$($x as u8),*]
    	);
    }

    #[repr(u8)]
    pub enum Request {
    	Discard 		= 0,
    	Test 			= 1,
    	Info 			= 2,
    	IntTest			= 3,
    	SelfTest		= 4,
    	DigitalWrite0 	= 5,
    	DigitalWrite1 	= 6,
    	DigitalRead0	= 7,
    	DigitalRead1	= 8,
    	ReadDipSwitch	= 9
    }