 <!DOCTYPE module SYSTEM "module.dtd">

 <module name="stereocam" dir="stereocam">
  <doc>
    <description>
      StereoCamera read and decode.
      Module to read and decode messages from the TU Delft stereo camera over uart.
      The stereo camera is designed and produced by Christophe de Wagter from the TU Delft.
      Baud rates tested include B38400, B230400, B921600.
      If entire images are being sent, it is recommended to use a STEREO_BAUD of B921600.
    </description>
    <configure name="STEREO_UART" value="UARTX" description="Sets the UART port number of the connected camera (required)"/>
    <configure name="STEREO_BAUD" value="BXXXXX" description="Sets the BAUD rate of the connected camera (required: must be same as camera)"/>
    <define name="FORWARD_IMAGE_DATA" value="TRUE|FALSE" description="If TRUE, a copy of received iamges is sent to the ground station over the datalink (default: TRUE)"/>
    <define name="STEREO_BODY_TO_STEREO_PHI" value="90" description="Rotation matrix from body to camera frame"/>
    <define name="STEREO_BODY_TO_STEREO_THETA" value="0"/>
    <define name="STEREO_BODY_TO_STEREO_PSI" value="90"/>
  </doc>
  <header>
    <file name="stereocam.h"/>
  </header>
  <init fun="stereocam_init()"/>
  <periodic fun="state2stereocam()" autorun="TRUE" freq="25"/>
  <event fun="stereocam_event()"/>
  <makefile>
  	<!-- Configure default UART port and baudrate -->
    <configure name="STEREO_UART" default="UART1" case="upper|lower"/>
    <configure name="STEREO_BAUD" default="B921600"/>
    
    <!-- Enable UART and set baudrate -->
    <define name="USE_$(STEREO_UART_UPPER)"/>
    <define name="UART_LINK" value="$(STEREO_UART_LOWER)"/>
    <define name="$(STEREO_UART_UPPER)_BAUD" value="$(STEREO_BAUD)"/>
    
    <!-- Sources and PPRZLink for transport -->
    <file name="stereocam.c"/>
    <file name="pprz_transport.c" dir="pprzlink/src"/>
  </makefile>
 </module>
