<!DOCTYPE module SYSTEM "module.dtd">

<module name="telemetry_w5100" dir="datalink" task="datalink">
  <doc>
    <description>
      Telemetry using PPRZ protocol over W5100 Wifi module

      W5100 is connected with a SPI link to the autopilot
    </description>
    <configure name="W5100_SPI_DEV" value="SPI1" description="SPI port used for communication"/>
    <configure name="W5100_SLAVE_IDX" value="1" description="SPI slave number"/>
    <configure name="W5100_IP" value="192,168,25,47" description="IP address"/>
    <configure name="W5100_SUBNET" value="255,255,255,0" description="network mask"/>
    <configure name="W5100_MULTICAST_IP" value="224,1,1,11" description="multicast IP address"/>
    <configure name="W5100_MULTICAST_PORT" value="1234" description="multicast IP port"/>
    <define name="W5100_DRDY_GPIO" value="GPIOX" description="GPIO port used for data ready pin"/>
    <define name="W5100_DRDY_GPIO_PIN" value="GPIOY" description="GPIO pin number used for data ready pin"/>
  </doc>
  <autoload name="telemetry" type="sim"/>
  <header>
    <file name="w5100.h" dir="subsystems/datalink"/>
  </header>
  <init fun="w5100_init()"/>
  <event fun="w5100_event()"/>
  <makefile target="!fbw|sim">
    <configure name="W5100_SPI_DEV" default="SPI1" case="upper|lower"/>
    <configure name="W5100_SLAVE_IDX" default="1"/>
    <configure name="W5100_IP" default="192,168,25,47"/>
    <configure name="W5100_SUBNET" default="255,255,255,0"/>
    <configure name="W5100_MULTICAST_IP" default="224,1,1,11"/>
    <configure name="W5100_MULTICAST_PORT" default="1234"/>
    <define name="USE_$(W5100_SPI_DEV_UPPER)"/>
    <define name="USE_SPI_SLAVE$(W5100_SLAVE_IDX)"/>
    <define name="W5100_IP" value="$(W5100_IP)"/>
    <define name="W5100_SUBNET" value="$(W5100_SUBNET)"/>
    <define name="W5100_MULTICAST_IP" value="$(W5100_MULTICAST_IP)"/>
    <define name="W5100_MULTICAST_PORT" value="$(W5100_MULTICAST_PORT)"/>
    <define name="DOWNLINK"/>
    <define name="PERIODIC_TELEMETRY"/>
    <define name="DOWNLINK_DEVICE" value="chip0"/>
    <define name="DOWNLINK_TRANSPORT" value="pprz_w5100_tp"/>
    <define name="DATALINK" value="W5100"/>
    <file name="downlink.c" dir="subsystems/datalink"/>
    <file name="datalink.c" dir="subsystems/datalink"/>
    <file name="telemetry.c" dir="subsystems/datalink"/>
    <file name="pprz_transport.c" dir="pprzlink/src"/>
    <file name="w5100.c" dir="subsystems/datalink"/>
  </makefile>
  <makefile target="ap|nps" firmware="fixedwing">
    <file name="fixedwing_datalink.c" dir="$(SRC_FIRMWARE)"/>
    <file name="ap_downlink.c" dir="$(SRC_FIRMWARE)"/>
  </makefile>
  <makefile target="ap|fbw|nps" firmware="fixedwing">
    <file name="fbw_downlink.c" dir="$(SRC_FIRMWARE)"/>
  </makefile>
  <makefile target="ap|nps" firmware="rotorcraft">
    <file name="rotorcraft_datalink.c" dir="$(SRC_FIRMWARE)"/>
    <file name="rotorcraft_telemetry.c" dir="$(SRC_FIRMWARE)"/>
  </makefile>
</module>

