<!DOCTYPE module SYSTEM "module.dtd">

<module name="infrared_adc" dir="sensors">
  <doc>
    <description>Infrared sensor using ADC</description>
    <configure name="ADC_IR1" value="ADC_1" description="ADC for IR horizontal channel 1"/>
    <configure name="ADC_IR2" value="ADC_2" description="ADC for IR horizontal channel 2"/>
    <configure name="ADC_IR_TOP" value="ADC_0" description="ADC for IR vertical channel"/>
    <configure name="ADC_IR_NB_SAMPLES" value="16" description="number of samples"/>
  </doc>
  <settings>
    <dl_settings>
      <dl_settings NAME="ir">
        <dl_setting MAX="15" MIN="-15" STEP="0.5" VAR="infrared.roll_neutral" shortname="roll_neutral" param="IR_ROLL_NEUTRAL_DEFAULT" alt_unit="deg"/>
        <dl_setting MAX="15" MIN="-15" STEP="0.5" VAR="infrared.pitch_neutral" shortname="pitch_neutral" param="IR_PITCH_NEUTRAL_DEFAULT" alt_unit="deg"/>

        <dl_setting MAX="1.5" MIN="0." STEP="0.1" VAR="infrared.lateral_correction" shortname="360_lat_corr" module="subsystems/sensors/infrared" param="IR_LATERAL_CORRECTION"/>
        <dl_setting MAX="1.5" MIN="0." STEP="0.1" VAR="infrared.longitudinal_correction" shortname="360_log_corr" param="IR_LONGITUDINAL_CORRECTION"/>
        <dl_setting MAX="1.5" MIN="0.5" STEP="0.1" VAR="infrared.vertical_correction" shortname="360_vert_corr" param="IR_VERTICAL_CORRECTION"/>

        <dl_setting MAX="1.5" MIN="0.5" STEP="0.1" VAR="infrared.correction_left" shortname="corr_left" param="IR_CORRECTION_LEFT"/>
        <dl_setting MAX="1.5" MIN="0.5" STEP="0.1" VAR="infrared.correction_right" shortname="corr_right" param="IR_CORRECTION_RIGHT"/>
        <dl_setting MAX="1.5" MIN="0.5" STEP="0.1" VAR="infrared.correction_up" shortname="corr_up" param="IR_CORRECTION_UP"/>
        <dl_setting MAX="1.5" MIN="0.5" STEP="0.1" VAR="infrared.correction_down" shortname="corr_down" param="IR_CORRECTION_DOWN"/>

      </dl_settings>
    </dl_settings>
  </settings>
  <header>
    <file name="infrared_adc.h"/>
  </header>
  <init fun="infrared_adc_init()"/>
  <periodic fun="infrared_adc_update()" freq="60."/>
  <makefile target="ap|sim">
    <define name="USE_INFRARED"/>
    <file name="infrared.c" dir="subsystems/sensors"/>
    <file name="infrared_adc.c" dir="subsystems/sensors"/>
  </makefile>
  <makefile target="ap">
    <raw>
ADC_IR_TOP ?= ADC_0
ADC_IR1 ?= ADC_1
ADC_IR2 ?= ADC_2
ADC_IR_NB_SAMPLES ?= 16

ap.CFLAGS += -DADC_CHANNEL_IR1=$(ADC_IR1) -DUSE_$(ADC_IR1)
ap.CFLAGS += -DADC_CHANNEL_IR2=$(ADC_IR2) -DUSE_$(ADC_IR2)
ap.CFLAGS += -DADC_CHANNEL_IR_TOP=$(ADC_IR_TOP) -DUSE_$(ADC_IR_TOP)

ap.CFLAGS += -DADC_CHANNEL_IR_NB_SAMPLES=$(ADC_IR_NB_SAMPLES)
    </raw>
  </makefile>
</module>


