Advertisement
Guest User

config.h

a guest
Dec 29th, 2020
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 37.86 KB | None | 0 0
  1. /* ************************************************************************
  2.  *
  3.  *   global configuration, setup and settings
  4.  *
  5.  *   (c) 2012-2020 by Markus Reschke
  6.  *   based on code from Markus Frejek and Karl-Heinz Kübbeler
  7.  *
  8.  * ************************************************************************ */
  9.  
  10.  
  11. /* source management */
  12. #define CONFIG_H
  13.  
  14.  
  15. /*
  16.  *  For MCU specific settings (port and pin assignments) and display
  17.  *  settings please edit also:
  18.  *  - ATmega328:            config_328.h
  19.  *  - ATmega324/644/1284:   config_644.h
  20.  *  - ATmega640/1280/2560:  config_1280.h
  21.  */
  22.  
  23.  
  24.  
  25. /* ************************************************************************
  26.  *   Hardware options
  27.  * ************************************************************************ */
  28.  
  29.  
  30. /*
  31.  *  rotary encoder for user interface
  32.  *  - default pins: PD2 & PD3 (ATmega 328)
  33.  *  - could be in parallel with LCD module
  34.  *  - see ENCODER_PORT in config-<MCU>.h for port pins
  35.  *  - uncomment to enable and also set ENCODER_PULSES & ENCODER_STEPS below
  36.  *    to match your rotary encoder
  37.  */
  38.  
  39. //#define HW_ENCODER
  40.  
  41.  
  42. /*
  43.  *  Number of Gray code pulses per step or detent for the rotary encoder
  44.  *  - typical values: 2 or 4, rarely 1
  45.  *  - a rotary encoder's pulse is the complete sequence of 4 Gray code pulses
  46.  *  - adjust value to match your rotary encoder
  47.  */
  48.  
  49. #define ENCODER_PULSES   4
  50.  
  51.  
  52. /*
  53.  *  Number of detents or steps
  54.  *  - this is used by the detection of the rotary encoder's turning velocity
  55.  *  - it doesn't have to match exactly and also allows you to finetune the
  56.  *    the feedback (higher: slow down, lower: speed up)
  57.  *  - typical values: 20, 24 or 30
  58.  *  - adjust value to match your rotary encoder
  59.  */
  60.  
  61. #define ENCODER_STEPS    24
  62.  
  63.  
  64. /*
  65.  *  increase/decrease push buttons for user interface
  66.  *  - alternative for rotary encoder
  67.  *  - see KEY_PORT in config-<MCU>.h for port pins
  68.  *  - uncomment to enable
  69.  */
  70.  
  71. //#define HW_INCDEC_KEYS
  72.  
  73.  
  74. /*
  75.  *  2.5V voltage reference for Vcc check
  76.  *  - default pin: PC4 (ATmega 328)
  77.  *  - should be at least 10 times more precise than the voltage regulator
  78.  *  - see TP_REF in config-<MCU>.h for port pin
  79.  *  - uncomment to enable and also adjust UREF_25 below for your voltage
  80.  *    reference
  81.  */
  82.  
  83. #define HW_REF25
  84.  
  85.  
  86. /*
  87.  *  Typical voltage of 2.5V voltage reference (in mV)
  88.  *  - see datasheet of the voltage reference
  89.  *  - or use >= 5.5 digit DMM to measure the voltage
  90.  */
  91.  
  92. #define UREF_25           2495
  93.  
  94.  
  95. /*
  96.  *  Probe protection relay for discharging caps
  97.  *  - default pin: PC4 (ATmega 328)
  98.  *  - low signal: short circuit probe pins
  99.  *    high signal via external reference: remove short circuit
  100.  *  - see TP_REF in config_<MCU>.h for port pin
  101.  *  - uncomment to enable
  102.  */
  103.  
  104. //#define HW_DISCHARGE_RELAY
  105.  
  106.  
  107. /*
  108.  *  Zener check / voltage measurement up to 50V DC
  109.  *  - default pin: PC3 (ATmega 328)
  110.  *  - 10:1 voltage divider
  111.  *  - DC-DC boost converter controled by test push button
  112.  *  - see TP_ZENER in config_<MCU>.h for port pin
  113.  *  - uncomment to enable
  114.  */
  115.  
  116. #define HW_ZENER
  117.  
  118.  
  119. /*
  120.  *  alternative mode for Zener check: don't switch boost converter
  121.  *  - when the DC-DC boost converter runs all the time
  122.  *  - when measuring an external voltage (circuit without boost converter)
  123.  *  - uncomment to enable
  124.  */
  125.  
  126. //#define ZENER_UNSWITCHED
  127.  
  128.  
  129. /*
  130.  *  high resolution for Zener check
  131.  *  - 10mV instead of 0.1V
  132.  *  - uncomment to enable
  133.  */
  134.  
  135. #define ZENER_HIGH_RES
  136.  
  137.  
  138. /*
  139.  *  fixed signal output
  140.  *  - in case the MCU's OC1B pin is wired as dedicated signal output
  141.  *    instead of driving the Rl probe resistor for test pin #2
  142.  *  - uncomment to enable
  143.  */
  144.  
  145. //#define HW_FIXED_SIGNAL_OUTPUT
  146.  
  147.  
  148. /*
  149.  *  basic frequency counter
  150.  *  - default pin: T0 (PD4 ATmega 328)
  151.  *  - uses T0 directly as frequency input
  152.  *  - counts up to 1/4 of MCU clock rate
  153.  *  - might be in parallel with LCD module
  154.  *  - uncomment to enable
  155.  */
  156.  
  157. //#define HW_FREQ_COUNTER_BASIC
  158.  
  159.  
  160. /*
  161.  *  extended frequency counter
  162.  *  - low and high frequency crystal oscillators
  163.  *    and buffered frequency input
  164.  *  - prescalers 1:1 and 16:1 (32:1)
  165.  *  - uses T0 directly as frequency input
  166.  *  - see COUNTER_CTRL_PORT in config-<MCU>.h for port pins
  167.  *  - requires a display with more than 2 text lines
  168.  *  - uncomment to enable
  169.  *  - select the circuit's prescaler setting: either 16:1 or 32:1
  170.  */
  171.  
  172. //#define HW_FREQ_COUNTER_EXT
  173. #define FREQ_COUNTER_PRESCALER     16   /* 16:1 */
  174. //#define FREQ_COUNTER_PRESCALER     32   /* 32:1 */
  175.  
  176.  
  177. /*
  178.  *  event counter
  179.  *  - default pin: T0 (PD4 ATmega 328)
  180.  *  - uses T0 directly as event/pulse input (rising edge)
  181.  *  - no shared operation with displays possible for T0
  182.  *  - requires additional keys (e.g. rotary encoder) and a display with
  183.  *    more than 5 lines
  184.  *  - only for MCU clock of 8, 16 or 20MHz
  185.  *  - uncomment to enable
  186.  */
  187.  
  188. //#define HW_EVENT_COUNTER
  189.  
  190.  
  191. /*
  192.  *  trigger output for event counter
  193.  *  - uses probe #2 as trigger output, probes #1 and #3 are Gnd
  194.  *  - sets trigger output to high while counting
  195.  *  - uncomment to enable
  196.  */
  197.  
  198. //#define EVENT_COUNTER_TRIGGER_OUT
  199.  
  200.  
  201. /*
  202.  *  IR remote control detection/decoder (via dedicated MCU pin)
  203.  *  - requires IR receiver module, e.g. TSOP series
  204.  *  - module is connected to fixed I/O pin
  205.  *  - see IR_PORT in config-<MCU>.h for port pin
  206.  *  - uncomment to enable
  207.  *  - for additional protocols also enable SW_IR_RX_EXTRA
  208.  */
  209.  
  210. //#define HW_IR_RECEIVER
  211.  
  212.  
  213. /*
  214.  *  fixed cap for self-adjustment
  215.  *  - see TP_CAP and ADJUST_PORT in config-<MCU>.h for port pins
  216.  *  - uncomment to enable
  217.  */
  218.  
  219. //#define HW_ADJUST_CAP
  220.  
  221.  
  222. /*
  223.  *  L/C meter hardware option
  224.  *  - uses T0 directly as frequency input
  225.  *  - see LC_CTRL_PORT in config-<MCU>.h for port pins
  226.  *  - uncomment to enable
  227.  */
  228.  
  229. //#define HW_LC_METER
  230.  
  231.  
  232. /*
  233.  *  L/C meter: value of reference capacitor C_p (in 0.1 pF)
  234.  *  - should be around 1000pF
  235.  */
  236.  
  237. #define LC_METER_C_REF        10000
  238.  
  239.  
  240. /*
  241.  *  L/C meter: also display frequency of LC oscillator
  242.  *  - helps to spot the oscillator's frequency drifting
  243.  *  - requires display with more than two text lines
  244.  *  - uncomment to enable
  245.  */
  246.  
  247. //#define LC_METER_SHOW_FREQ
  248.  
  249.  
  250. /*
  251.  *  relay for parallel cap (sampling ADC)
  252.  *  - uncomment to enable (not implemented yet)
  253.  */
  254.  
  255. //#define HW_CAP_RELAY
  256.  
  257.  
  258.  
  259. /* ************************************************************************
  260.  *   software options
  261.  * ************************************************************************ */
  262.  
  263.  
  264. /*
  265.  *  PWM generator with simple user interface
  266.  *  - signal output via OC1B
  267.  *  - uncomment to enable
  268.  */
  269.  
  270. //#define SW_PWM_SIMPLE
  271.  
  272.  
  273. /*
  274.  *  PWM generator with fancy user interface
  275.  *  - signal output via OC1B
  276.  *  - requires additional keys and display with more than 2 text lines
  277.  *  - uncomment to enable
  278.  */
  279.  
  280. //#define SW_PWM_PLUS
  281.  
  282.  
  283. /*
  284.  *  Inductance measurement
  285.  *  - uncomment to enable
  286.  */
  287.  
  288. #define SW_INDUCTOR
  289.  
  290.  
  291. /*
  292.  *  ESR measurement
  293.  *  - requires MCU clock >= 8 MHz
  294.  *  - choose SW_OLD_ESR for old method starting at 180nF
  295.  *  - uncomment to enable
  296.  */
  297.  
  298. #define SW_ESR
  299. //#define SW_OLD_ESR
  300.  
  301.  
  302. /*
  303.  *  ESR Tool (in-circuit ESR measurement)
  304.  *  - requires SW_ESR or SW_OLD_ESR to be enabled
  305.  *  - uncomment to enable
  306.  */
  307.  
  308. //#define SW_ESR_TOOL
  309.  
  310.  
  311. /*
  312.  *  check for rotary encoders
  313.  *  - uncomment to enable
  314.  */
  315.  
  316. //#define SW_ENCODER
  317.  
  318.  
  319. /*
  320.  *  squarewave signal generator
  321.  *  - signal output via OC1B
  322.  *  - requires additional keys
  323.  *  - uncomment to enable
  324.  */
  325.  
  326. //#define SW_SQUAREWAVE
  327.  
  328.  
  329. /*
  330.  *  IR remote control detection/decoder (via probes)
  331.  *  - requires IR receiver module, e.g. TSOP series
  332.  *  - module will be connected to probe leads
  333.  *  - uncomment to enable
  334.  */
  335.  
  336. //#define SW_IR_RECEIVER
  337.  
  338.  
  339. /*
  340.  *  current limiting resistor for IR receiver module
  341.  *  - for 5V only modules
  342.  *  - Warning: any short circuit may destroy your MCU
  343.  *  - uncomment to disable resistor
  344.  */
  345.  
  346. //#define SW_IR_DISABLE_RESISTOR
  347.  
  348.  
  349. /*
  350.  *  additional protocols for IR remote control detection/decoder
  351.  *  - uncommon protocols which will increase flash memory usage ;)
  352.  *  - uncomment to enable
  353.  */
  354.  
  355. //#define SW_IR_RX_EXTRA
  356.  
  357.  
  358. /*
  359.  *  IR remote control sender
  360.  *  - signal output via OC1B
  361.  *  - requires additional keys and display with more than 4 text lines
  362.  *  - also requires an IR LED with a simple driver
  363.  *  - uncomment to enable
  364.  */
  365.  
  366. //#define SW_IR_TRANSMITTER
  367.  
  368.  
  369. /*
  370.  *  Alternative delay loop for IR remote control sender
  371.  *  - in case the the C compiler screws up the default delay loop
  372.  *    and causes incorrect pulse/pause timings
  373.  *  - uncomment to enable
  374.  */
  375.  
  376. //#define SW_IR_TX_ALTDELAY
  377.  
  378.  
  379. /*
  380.  *  additional protocols for IR remote control sender
  381.  *  - uncommon protocols which will increase flash memory usage ;)
  382.  *  - uncomment to enable
  383.  */
  384.  
  385. //#define SW_IR_TX_EXTRA
  386.  
  387.  
  388. /*
  389.  *  check for opto couplers
  390.  *  - uncomment to enable
  391.  */
  392.  
  393. //#define SW_OPTO_COUPLER
  394.  
  395.  
  396. /*
  397.  *  check for Unijunction Transistor
  398.  *  - uncomment to enable
  399.  */
  400.  
  401. #define SW_UJT
  402.  
  403.  
  404. /*
  405.  *  check for Schottky Transistor (Schottky-clamped BJT)
  406.  *  - uncomment to enable
  407.  */
  408.  
  409. #define SW_SCHOTTKY_BJT
  410.  
  411.  
  412. /*
  413.  *  Servo Check
  414.  *  - signal output via OC1B
  415.  *  - requires additional keys and display with more than 2 text lines
  416.  *  - uncomment to enable
  417.  */
  418.  
  419. //#define SW_SERVO
  420.  
  421.  
  422. /*
  423.  *  DS18B20 - OneWire temperature sensor
  424.  *  - uncomment to enable
  425.  *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
  426.  */
  427.  
  428. //#define SW_DS18B20
  429.  
  430.  
  431. /*
  432.  *  OneWire: read and display ROM code
  433.  *  - option for OneWire related tools
  434.  *  - requires display with more than 2 text lines
  435.  *  - uncomment to enable
  436.  */
  437.  
  438. //#define ONEWIRE_READ_ROM
  439.  
  440.  
  441. /*
  442.  *  scan OneWire bus for devices and list their ROM codes
  443.  *  - requires display with more than 2 text lines
  444.  *  - uncomment to enable
  445.  *  - also enable ONEWIRE_PROBES or ONEWIRE_IO_PIN (see section 'Busses')
  446.  */
  447.  
  448. //#define SW_ONEWIRE_SCAN
  449.  
  450.  
  451. /*
  452.  *  capacitor leakage check
  453.  *  - requires display with more than two lines
  454.  *  - uncomment to enable
  455.  */
  456.  
  457. //#define SW_CAP_LEAKAGE
  458.  
  459.  
  460. /*
  461.  *  display reverse hFE for BJTs
  462.  *  - hFE for collector and emitter reversed
  463.  *  - uncomment to enable
  464.  */
  465.  
  466. //#define SW_REVERSE_HFE
  467.  
  468.  
  469. /*
  470.  *  display I_C/I_E test current for hFE measurement
  471.  *  - I_C for common emitter circuit
  472.  *    I_E for common collector circuit
  473.  *  - uncomment to enable
  474.  */
  475.  
  476. //#define SW_HFE_CURRENT
  477.  
  478.  
  479. /*
  480.  *  R/C/L monitors
  481.  *  - monitor passive components connected to probes #1 and #3
  482.  *  - monitors for L require SW_INDUCTOR to be enabled
  483.  *  - for ESR either SW_ESR or SW_OLD_ESR needs to be enabled
  484.  *  - uncomment to enable (one or more)
  485.  */
  486.  
  487. //#define SW_MONITOR_R          /* just R */
  488. //#define SW_MONITOR_C          /* just C plus ESR */
  489. //#define SW_MONITOR_L          /* just L */
  490. //#define SW_MONITOR_RCL        /* R plus L, or C plus ESR */
  491. //#define SW_MONITOR_RL         /* R plus L */
  492.  
  493.  
  494. /*
  495.  *  DHT11, DHT22 and compatible humidity & temperature sensors
  496.  *  - uncomment to enable
  497.  */
  498.  
  499. //#define SW_DHTXX
  500.  
  501.  
  502. /*
  503.  *  display font for test purposes
  504.  *  - uncomment to enable
  505.  */
  506.  
  507. //#define SW_FONT_TEST
  508.  
  509.  
  510. /*
  511.  *  check resistor for matching E series norm value
  512.  *  - requires a display with more than 2 text lines
  513.  *  - color-code mode requires a color graphics display
  514.  *  - uncomment to enable (one or more)
  515.  */
  516.  
  517. //#define SW_R_E24_5_T          /* E24 5% tolerance, text */
  518. //#define SW_R_E24_5_CC         /* E24 5% tolerance, color-code */
  519. //#define SW_R_E24_1_T          /* E24 1% tolerance, text */
  520. //#define SW_R_E24_1_CC         /* E24 1% tolerance, color-code */
  521. //#define SW_R_E96_T            /* E96 1% tolerance, text */
  522. //#define SW_R_E96_CC           /* E96 1% tolerance, color-code */
  523.  
  524.  
  525. /*
  526.  *  check capacitor for matching E series norm value
  527.  *  - requires a display with more than 2 text lines
  528.  *  - uncomment to enable (one or more)
  529.  */
  530.  
  531. //#define SW_C_E6_T             /* E6 20% tolerance, text */
  532. //#define SW_C_E12_T            /* E12 10% tolerance, text */
  533.  
  534.  
  535. /*
  536.  *  check inductor for matching E series norm value
  537.  *  - requires a display with more than 2 text lines
  538.  *  - uncomment to enable (one or more)
  539.  */
  540.  
  541. //#define SW_L_E6_T             /* E6 20% tolerance, text */
  542. //#define SW_L_E12_T            /* E12 10% tolerance, text */
  543.  
  544.  
  545.  
  546. /* ************************************************************************
  547.  *   workarounds for some testers
  548.  * ************************************************************************ */
  549.  
  550.  
  551. /*
  552.  *  Disable hFE measurement with common collector circuit and Rl as
  553.  *  base resistor.
  554.  *  - problem:
  555.  *    hFE values are way too high.
  556.  *  - affected testers:
  557.  *    Hiland M644 (under investigation)
  558.  *  - uncomment to enable
  559.  */
  560.  
  561. //#define NO_HFE_C_RL
  562.  
  563.  
  564.  
  565. /* ************************************************************************
  566.  *   workarounds for some IDEs
  567.  * ************************************************************************ */
  568.  
  569.  
  570. /*
  571.  *  Oscillator startup cycles (after wakeup from power-safe mode):
  572.  *  - typical values
  573.  *    - internal RC:              6
  574.  *    - full swing crystal:   16384 (also 256 or 1024 based on fuse settings)
  575.  *    - low power crystal:    16384 (also 256 or 1024 based on fuse settings)
  576.  *  - Please change value if it doesn't match your tester!
  577.  */
  578.  
  579. #ifndef OSC_STARTUP
  580.   #define OSC_STARTUP    16384
  581. #endif
  582.  
  583.  
  584.  
  585. /* ************************************************************************
  586.  *   user interface
  587.  * ************************************************************************ */
  588.  
  589.  
  590. /*
  591.  *  Language of user interface. Available languages:
  592.  *  - English (default)
  593.  *  - Czech (based on ISO 8859-1)
  594.  *  - Czech 2 (with Czech characters based on ISO 8859-2)
  595.  *  - Danish
  596.  *  - German
  597.  *  - Polish (based on ISO 8859-1)
  598.  *  - Polish 2 (with Polish characters based on ISO 8859-2)
  599.  *  - Spanish
  600.  *  - Romanian
  601.  *  - Russian (with cyrillic characters based on Windows-1251)
  602.  *  - Russian 2 (with cyrillic characters based on Windows-1251)
  603.  */
  604.  
  605. //#define UI_ENGLISH
  606. //#define UI_CZECH
  607. //#define UI_CZECH_2
  608. //#define UI_DANISH
  609. //#define UI_GERMAN
  610. #define UI_ITALIAN
  611. //#define UI_POLISH
  612. //#define UI_POLISH_2
  613. //#define UI_ROMANIAN
  614. //#define UI_RUSSIAN
  615. //#define UI_RUSSIAN_2
  616. //#define UI_SPANISH
  617.  
  618.  
  619. /*
  620.  *  Use comma instead of dot to indicate a decimal fraction.
  621.  *  - uncomment to enable
  622.  */
  623.  
  624. //#define UI_COMMA
  625.  
  626.  
  627. /*
  628.  *  Display temperatures in Fahrenheit instead of Celsius.
  629.  *  - uncomment to enable
  630.  */
  631.  
  632. //#define UI_FAHRENHEIT
  633.  
  634.  
  635. /*
  636.  *  Display hexadecimal values in uppercase instead of lowercase
  637.  *  - uncomment to enable
  638.  */
  639.  
  640. //#define UI_HEX_UPPERCASE
  641.  
  642.  
  643. /*
  644.  *  Set the default operation mode to auto-hold.
  645.  *  - instead of continous mode
  646.  *  - uncomment to enable
  647.  */
  648.  
  649. //#define UI_AUTOHOLD
  650.  
  651.  
  652. /*
  653.  *  Trigger the menu also by a short circuit of all three probes.
  654.  *  - former default behaviour
  655.  *  - uncomment to enable
  656.  */
  657.  
  658. //#define UI_SHORT_CIRCUIT_MENU
  659.  
  660.  
  661. /*
  662.  *  Show key hints instead of cursor if available.
  663.  *  - currently only "Menu/Test"
  664.  *  - requires additional keys and display with a sufficient number of
  665.  *    text lines (recommended: >= 8 lines)
  666.  *  - uncomment to enable
  667.  */
  668.  
  669. #define UI_KEY_HINTS
  670.  
  671.  
  672. /*
  673.  *  Enter menu to select adjustment profile after powering on.
  674.  *  - uncomment to enable
  675.  */
  676.  
  677. //#define UI_CHOOSE_PROFILE
  678.  
  679.  
  680. /*
  681.  *  Output components found also via TTL serial interface.
  682.  *  - uncomment to enable
  683.  *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE (see section 'Busses')
  684.  */
  685.  
  686. //#define UI_SERIAL_COPY
  687.  
  688.  
  689. /*
  690.  *  Control tester via TTL serial interface.
  691.  *  - uncomment to enable
  692.  *  - also enable SERIAL_BITBANG or SERIAL_HARDWARE, plus SERIAL_RW
  693.  *    (see section 'Busses')
  694.  */
  695.  
  696. //#define UI_SERIAL_COMMANDS
  697.  
  698.  
  699. /*
  700.  *  Maximum time to wait after probing (in ms).
  701.  *  - applies to continuous mode only
  702.  *  - Time between printing the result and starting a new probing cycle.
  703.  */
  704.  
  705. #define CYCLE_DELAY      3000
  706.  
  707.  
  708. /*
  709.  *  Maximum number of probing runs without any component found in a row.
  710.  *  - applies to continuous mode only
  711.  *  - If this number is reached the tester will power off.
  712.  *  - When set to zero the tester will run only once and turn off
  713.  *    after CYCLE_DELAY.
  714.  *  - When set to 255 this feature will be disabled and the tester runs
  715.  *    until it's powered off manually.
  716.  */
  717.  
  718. #define CYCLE_MAX        5
  719.  
  720.  
  721. /*
  722.  *  Automatic power-off when no button is pressed for a while (in s).
  723.  *  - applies to auto-hold mode only
  724.  *  - uncomment to enable, also adjust timeout (in s)
  725.  */
  726.  
  727. //#define POWER_OFF_TIMEOUT     60
  728.  
  729.  
  730. /*
  731.  *  component symbols for fancy pinout
  732.  *  - for 3-pin semiconductors
  733.  *  - requires graphics display and symbol bitmap
  734.  *  - uncomment to enable
  735.  */
  736.  
  737. #define SW_SYMBOLS
  738.  
  739.  
  740. /*
  741.  *  color coding for probes
  742.  *  - requires color graphics LCD
  743.  *  - uncomment to enable
  744.  *  - edit colors.h to select correct probe colors
  745.  */
  746.  
  747. //#define SW_PROBE_COLORS
  748.  
  749.  
  750. /*
  751.  *  main menu: power off tester
  752.  *  - uncomment to enable
  753.  */
  754.  
  755. //#define SW_POWER_OFF
  756.  
  757.  
  758. /*
  759.  *  Round some values if appropriate.
  760.  *  - for
  761.  *    - DS18B20 (0.1 °C/F)
  762.  *  - uncomment to enable
  763.  */
  764.  
  765. //#define UI_ROUND_DS18B20
  766.  
  767.  
  768. /*
  769.  *  storage of firmware data (texts, tables etc)
  770.  *  - self-adjustment data is always stored in EEPROM
  771.  *  - fonts and symbols are always stored in Flash
  772.  *  - uncomment one
  773.  */
  774.  
  775. #define DATA_EEPROM           /* store data in EEPROM */
  776. //#define DATA_FLASH            /* store data in Flash */
  777.  
  778.  
  779.  
  780. /* ************************************************************************
  781.  *   power management
  782.  * ************************************************************************ */
  783.  
  784.  
  785. /*
  786.  *  type of power switch
  787.  *  - soft-latching power switch (default)
  788.  *    - as in the tester's reference circuit
  789.  *    - tester is able to power itself off
  790.  *  - manual power switch
  791.  *    - tester isn't able to power itself off
  792.  *  - enable one
  793.  */
  794.  
  795. #define POWER_SWITCH_SOFT
  796. //#define POWER_SWITCH_MANUAL
  797.  
  798.  
  799. /*
  800.  *  Battery monitoring mode:
  801.  *  - BAT_NONE     disable battery monitoring completely
  802.  *  - BAT_DIRECT   direct measurement of battary voltage (< 5V)
  803.  *  - BAT_DIVIDER  measurement via voltage divider
  804.  *  - uncomment one of the modes
  805.  */
  806.  
  807. //#define BAT_NONE
  808. //#define BAT_DIRECT
  809. #define BAT_DIVIDER
  810.  
  811.  
  812. /*
  813.  *  Unmonitored optional external power supply
  814.  *  - Some circuits supporting an additional external power supply are designed
  815.  *    in a way that prevents the battery monitoring to measure the voltage of
  816.  *    the external power supply. This would trigger the low battery shut-down.
  817.  *    The switch below will prevent the shut-down when the measured voltage is
  818.  *    below 0.9V (caused by the diode's leakage current).
  819.  *  - uncomment to enable
  820.  */
  821.  
  822. //#define BAT_EXT_UNMONITORED
  823.  
  824.  
  825. /*
  826.  *  Voltage divider for battery monitoring
  827.  *  - BAT_R1: top resistor in Ohms
  828.  *  - BAT_R2: bottom resistor in Ohms
  829.  */
  830.  
  831. #define BAT_R1           10000
  832. #define BAT_R2           3300
  833.  
  834.  
  835. /*
  836.  *  Voltage drop by reverse voltage protection diode and power management
  837.  *  transistor (in mV):
  838.  *  - or any other circuitry in the power section
  839.  *  - Get your DMM and measure the voltage drop!
  840.  *  - Schottky diode about 200mV / PNP BJT about 100mV.
  841.  */  
  842.  
  843. #define BAT_OFFSET       290
  844.  
  845.  
  846. /*
  847.  *  Battery weak voltage (in mV).
  848.  *  - Tester warns if BAT_WEAK is reached.
  849.  *  - Voltage drop BAT_OFFSET is considered in calculation.
  850.  */
  851.  
  852. #define BAT_WEAK         7400
  853.  
  854.  
  855. /*
  856.  *  Battery low voltage (in mV).
  857.  *  - Tester powers off if BAT_LOW is reached.
  858.  *  - Voltage drop BAT_OFFSET is considered in calculation.
  859.  */
  860.  
  861. #define BAT_LOW          6400
  862.  
  863.  
  864. /*
  865.  *  Enter sleep mode when idle to save power.
  866.  *  - uncomment to enable
  867.  */
  868.  
  869. #define SAVE_POWER
  870.  
  871.  
  872.  
  873. /* ************************************************************************
  874.  *   measurement settings and offsets
  875.  * ************************************************************************ */
  876.  
  877.  
  878. /*
  879.  *  ADC voltage reference based on Vcc (in mV).
  880.  */
  881.  
  882. #define UREF_VCC         5001
  883.  
  884.  
  885. /*
  886.  * Offset for the internal bandgap voltage reference (in mV): -100 up to 100
  887.  *  - To compensate any difference between real value and measured value.
  888.  *  - The ADC has a resolution of about 4.88mV for V_ref = 5V (Vcc) and
  889.  *    1.07mV for V_ref = 1.1V (bandgap).
  890.  *  - Will be added to measured voltage of bandgap reference.
  891.  */
  892.  
  893. #define UREF_OFFSET      0
  894.  
  895.  
  896. /*
  897.  *  Exact values of probe resistors.
  898.  *  - Standard value for Rl is 680 Ohms.
  899.  *  - Standard value for Rh is 470k Ohms.
  900.  */
  901.  
  902. /* Rl in Ohms */
  903. #define R_LOW            680
  904.  
  905. /* Rh in Ohms */
  906. #define R_HIGH           470000
  907.  
  908.  
  909. /*
  910.  *  Offset for systematic error of resistor measurement with Rh (470k)
  911.  *  in Ohms.
  912.  *  - if resistors >20k measure too high or low adjust the offset accordingly
  913.  *  - standard offset is 350 Ohms
  914.  */
  915.  
  916. #define RH_OFFSET        350
  917.  
  918.  
  919. /*
  920.  *  Resistance of probes (in 0.01 Ohms).
  921.  *  - default offset for PCB tracks and probe leads
  922.  *  - resistance of two probes in series
  923.  *  - assuming all probes have same/similar resistance
  924.  *  - will be updated by self-adjustment
  925.  */
  926.  
  927. #define R_ZERO           20
  928.  
  929.  
  930. /*
  931.  *  Use probe pair specific resistance offsets instead of an
  932.  *  average value for all probes.
  933.  *  - uncomment to enable
  934.  */
  935.  
  936. //#define R_MULTIOFFSET
  937.  
  938.  
  939. /*
  940.  *  Capacitance of probes (in pF).
  941.  *  - default offset for MCU, PCB tracks and probe leads
  942.  *  - Examples:
  943.  *    capacitance  length
  944.  *    -------------------------
  945.  *     3pF         about 10cm
  946.  *     9pF         about 30cm
  947.  *    15pF         about 50cm
  948.  *  - maximum value: 100
  949.  *  - will be updated by self-adjustment
  950.  */
  951.  
  952. #define C_ZERO           43
  953.  
  954.  
  955. /*
  956.  *  Use probe pair specific capacitance offsets instead of an
  957.  *  average value for all probes.
  958.  *  - uncomment to enable
  959.  */
  960.  
  961. //#define CAP_MULTIOFFSET
  962.  
  963.  
  964. /*
  965.  *  Maximum voltage at which we consider a capacitor being
  966.  *  discharged (in mV).
  967.  */
  968.  
  969. #define CAP_DISCHARGED   2
  970.  
  971.  
  972. /*
  973.  *  Correction factors for capacitors (in 0.1%)
  974.  *  - positive factor increases capacitance value
  975.  *    negative factor decreases capacitance value
  976.  *  - CAP_FACTOR_SMALL for caps < 4.7µF
  977.  *  - CAP_FACTOR_MID for caps 4.7 - 47µF
  978.  *  - CAP_FACTOR_LARGE for caps > 47µF
  979.  */
  980.  
  981. #define CAP_FACTOR_SMALL      0      /* no correction */
  982. #define CAP_FACTOR_MID        -40    /* -4.0% */
  983. #define CAP_FACTOR_LARGE      -90    /* -9.0% */
  984.  
  985.  
  986. /*
  987.  *  Number of ADC samples to perform for each mesurement.
  988.  *  - Valid values are in the range of 1 - 255.
  989.  */
  990.  
  991. #define ADC_SAMPLES      25
  992.  
  993.  
  994. /*
  995.  *  100nF AREF buffer capacitor
  996.  *  - used by some MCU boards
  997.  *  - will increase measurement time
  998.  *  - recommendation: replace with 1nF capacitor
  999.  *  - uncomment to enable
  1000.  */
  1001.  
  1002. //#define ADC_LARGE_BUFFER_CAP
  1003.  
  1004.  
  1005.  
  1006. /* ************************************************************************
  1007.  *   R & D - meant for firmware developers
  1008.  * ************************************************************************ */
  1009.  
  1010.  
  1011. /*
  1012.  *  Enable read functions for display module.
  1013.  *  - display driver and interface settings have to support this
  1014.  *  - uncomment to enable
  1015.  */
  1016.  
  1017. //#define LCD_READ
  1018.  
  1019.  
  1020. /*
  1021.  *  Read ID of display controller.
  1022.  *  - ID is shown at welcome screen (after firmware version)
  1023.  *  - requires display read functions (LCD_READ)
  1024.  *  - recommended: serial output (UI_SERIAL_COPY)
  1025.  *  - uncomment to enable
  1026.  */
  1027.  
  1028. //#define SW_DISPLAY_ID
  1029.  
  1030.  
  1031. /*
  1032.  *  Read registers of display controller and output them via TTL serial.
  1033.  *  - requires display read functions (LCD_READ) and
  1034.  *    serial output (UI_SERIAL_COPY)
  1035.  *  - uncomment to enable
  1036.  */
  1037.  
  1038. //#define SW_DISPLAY_REG
  1039.  
  1040.  
  1041.  
  1042. /* ************************************************************************
  1043.  *   MCU specific setup to support different AVRs
  1044.  * ************************************************************************ */
  1045.  
  1046.  
  1047. /* MCU clock */
  1048. #define CPU_FREQ    F_CPU
  1049.  
  1050.  
  1051. /*
  1052.  *  ATmega 328/328P
  1053.  */
  1054.  
  1055. #if defined(__AVR_ATmega328__)
  1056.   #include "config_328.h"
  1057.  
  1058.  
  1059. /*
  1060.  *  ATmega 324P/324PA/644/644P/644PA/1284/1284P
  1061.  */
  1062.  
  1063. #elif defined(__AVR_ATmega324P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284__)
  1064.   #include "config_644.h"
  1065.  
  1066.  
  1067. /*
  1068.  *  ATmega 640/1280/2560
  1069.  */
  1070.  
  1071. #elif defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  1072.   #include "config_1280.h"
  1073.  
  1074.  
  1075. /*
  1076.  *  missing or unsupported MCU
  1077.  */
  1078.  
  1079. #else
  1080.   #error <<< No or wrong MCU type selected! >>>
  1081. #endif
  1082.  
  1083.  
  1084.  
  1085. /* ************************************************************************
  1086.  *   Busses
  1087.  * ************************************************************************ */
  1088.  
  1089.  
  1090. /*
  1091.  *  I2C bus
  1092.  *  - might be required by some hardware
  1093.  *  - could be enabled already in display section (config_<MCU>.h)
  1094.  *  - for bit-bang I2C port and pins see I2C_PORT (config_<MCU>.h)
  1095.  *  - hardware I2C (TWI) uses automatically the proper MCU pins
  1096.  *  - uncomment either I2C_BITBANG or I2C_HARDWARE to enable
  1097.  *  - uncomment one of the bus speed modes
  1098.  */
  1099.  
  1100. //#define I2C_BITBANG                /* bit-bang I2C */
  1101. //#define I2C_HARDWARE               /* MCU's hardware TWI */
  1102. //#define I2C_STANDARD_MODE          /* 100kHz bus speed */
  1103. //#define I2C_FAST_MODE              /* 400kHz bus speed */
  1104. //#define I2C_RW                     /* enable I2C read support (untested) */
  1105.  
  1106.  
  1107. /*
  1108.  *  SPI bus
  1109.  *  - might be required by some hardware
  1110.  *  - could be enabled already in display section (config_<MCU>.h)
  1111.  *  - for bit-bang SPI port and pins see SPI_PORT (config_<MCU>.h)
  1112.  *  - hardware SPI uses automatically the proper MCU pins
  1113.  *  - uncomment either SPI_BITBANG or SPI_HARDWARE to enable
  1114.  */
  1115.  
  1116. //#define SPI_BITBANG                /* bit-bang SPI */
  1117. //#define SPI_HARDWARE               /* hardware SPI */
  1118. //#define SPI_RW                     /* enable SPI read support */
  1119.  
  1120.  
  1121. /*
  1122.  *  TTL serial interface
  1123.  *  - could be enabled already in display section (config_<MCU>.h)
  1124.  *  - for bit-bang serial port and pins see SERIAL_PORT (config_<MCU>.h)
  1125.  *  - hardware serial uses automatically the proper MCU pins
  1126.  *  - uncomment either SERIAL_BITBANG or SERIAL_HARDWARE to enable
  1127.  */
  1128.  
  1129. //#define SERIAL_BITBANG             /* bit-bang serial */
  1130. //#define SERIAL_HARDWARE            /* hardware serial */
  1131. //#define SERIAL_RW                  /* enable serial read support */
  1132.  
  1133.  
  1134. /*
  1135.  *  OneWire bus
  1136.  *  - for dedicated I/O pin please see ONEWIRE_PORT (config_<MCU>.h)
  1137.  *  - uncomment either ONEWIRE_PROBES or ONEWIRE_IO_PIN to enable
  1138.  */
  1139.  
  1140. //#define ONEWIRE_PROBES             /* via probes */
  1141. //#define ONEWIRE_IO_PIN             /* via dedicated I/O pin */
  1142.  
  1143.  
  1144.  
  1145. /* ************************************************************************
  1146.  *   ADC clock
  1147.  * ************************************************************************ */
  1148.  
  1149.  
  1150. /*
  1151.  *  ADC clock
  1152.  *  - The ADC clock is 125000Hz by default.
  1153.  *  - You could also set 250000Hz, but that exceeds the max. ADC clock
  1154.  *    of 200kHz for 10 bit resolution!
  1155.  *  - Special case for 20MHz MCU clock: 156250Hz
  1156.  */
  1157.  
  1158. #if CPU_FREQ == 20000000
  1159.   /* 20MHz MCU clock */
  1160.   #define ADC_FREQ    156250
  1161. #else
  1162.   /* all other MCU clocks */
  1163.   #define ADC_FREQ    125000
  1164. #endif
  1165.  
  1166.  
  1167. /*
  1168.  *  define clock divider
  1169.  *  - supports 1MHz, 2MHz, 4MHz, 8MHz, 16MHz and 20MHz MCU clocks
  1170.  *  - we got only 7 fixed prescalers from 2 up to 128
  1171.  */
  1172.  
  1173. /* 1MHz/250kHz */
  1174. #if CPU_FREQ / ADC_FREQ == 4
  1175.   #define ADC_CLOCK_DIV (1 << ADPS1)
  1176. #endif
  1177.  
  1178. /* 1MHz/125kHz 2MHz/250kHz */
  1179. #if CPU_FREQ / ADC_FREQ == 8
  1180.   #define ADC_CLOCK_DIV (1 << ADPS1) | (1 << ADPS0)
  1181. #endif
  1182.  
  1183. /* 2MHz/125kHz 4MHz/250kHz */
  1184. #if CPU_FREQ / ADC_FREQ == 16
  1185.   #define ADC_CLOCK_DIV (1 << ADPS2)
  1186. #endif
  1187.  
  1188. /* 4MHz/125kHz 8MHz/250kHz */
  1189. #if CPU_FREQ / ADC_FREQ == 32
  1190.   #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS0)
  1191. #endif
  1192.  
  1193. /* 8MHz/125kHz 16MHz/250kHz */
  1194. #if CPU_FREQ / ADC_FREQ == 64
  1195.   #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1)
  1196. #endif
  1197.  
  1198. /* 16MHz/125kHz 20MHz/156.25kHz */
  1199. #if CPU_FREQ / ADC_FREQ == 128
  1200.   #define ADC_CLOCK_DIV (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)
  1201. #endif
  1202.  
  1203.  
  1204.  
  1205. /* ************************************************************************
  1206.  *   derived values
  1207.  * ************************************************************************ */
  1208.  
  1209.  
  1210. /*
  1211.  *  number of MCU cycles per µs
  1212.  *  - min. 1 (for 1MHz)
  1213.  *  - max. 20 (for 20MHz)
  1214.  */
  1215.  
  1216. #define MCU_CYCLES_PER_US     (CPU_FREQ / 1000000)
  1217.  
  1218.  
  1219. /*
  1220.  *  number of MCU cycles per ADC cycle
  1221.  *  - min. 4
  1222.  *  - max. 128
  1223.  */
  1224.  
  1225. #define MCU_CYCLES_PER_ADC    (CPU_FREQ / ADC_FREQ)
  1226.  
  1227.  
  1228. /*
  1229.  *  time of a MCU cycle (in 0.1 ns)
  1230.  */
  1231.  
  1232. #define MCU_CYCLE_TIME        (10000 / (CPU_FREQ / 1000000))
  1233.  
  1234.  
  1235.  
  1236. /* ************************************************************************
  1237.  *   options management
  1238.  * ************************************************************************ */
  1239.  
  1240.  
  1241. /*
  1242.  *  storage of program data (EEPROM/Flash)
  1243.  */
  1244.  
  1245. #if defined (DATA_EEPROM)
  1246.   /* memory type */
  1247.   #define MEM_TYPE            EEMEM
  1248.  
  1249.   /* read functions */
  1250.   #define DATA_read_byte(addr)     eeprom_read_byte(addr)
  1251.   #define DATA_read_word(addr)     eeprom_read_word(addr)
  1252. #elif defined (DATA_FLASH)
  1253.   /* memory type */
  1254.   #define MEM_TYPE            PROGMEM
  1255.  
  1256.   /* read functions */
  1257.   #define DATA_read_byte(addr)     pgm_read_byte(addr)
  1258.   #define DATA_read_word(addr)     pgm_read_word(addr)
  1259. #endif
  1260.  
  1261.  
  1262.  
  1263. /*
  1264.  *  hardware/software options
  1265.  */
  1266.  
  1267. /* power switch: prefer soft-latching type */
  1268. #ifdef POWER_SWITCH_SOFT
  1269.   #ifdef POWER_SWITCH_MANUAL
  1270.     #undef POWER_SWITCH_MANUAL
  1271.   #endif
  1272. #endif
  1273.  
  1274.  
  1275. /* additional keys */
  1276. /* rotary encoder, increase/decrease push buttons or touch screen */
  1277. #if defined (HW_ENCODER) || defined (HW_INCDEC_KEYS) | defined (HW_TOUCH)
  1278.   #define HW_KEYS
  1279. #endif
  1280.  
  1281. /* options which require additional keys */
  1282. #ifndef HW_KEYS
  1283.  
  1284.   /* key hints */
  1285.   #ifdef UI_KEY_HINTS
  1286.     #undef UI_KEY_HINTS
  1287.   #endif
  1288.  
  1289.   /* PWM+ */
  1290.   #ifdef SW_PWM_PLUS
  1291.     #undef SW_PWM_PLUS
  1292.     #define SW_PWM_SIMPLE  
  1293.   #endif
  1294.  
  1295.   /* squarewave generator */
  1296.   #ifdef SW_SQUAREWAVE
  1297.     #undef SW_SQUAREWAVE
  1298.   #endif
  1299.  
  1300.   /* Servo Check */
  1301.   #ifdef SW_SERVO
  1302.     #undef SW_SERVO
  1303.   #endif
  1304.  
  1305.   /* IR Sender */
  1306.   #ifdef SW_IR_TRANSMITTER
  1307.     #undef SW_IR_TRANSMITTER
  1308.   #endif
  1309.  
  1310. #endif
  1311.  
  1312.  
  1313. /* options which require inductance measurement */
  1314. #ifndef SW_INDUCTOR
  1315.  
  1316.   /* L monitor */
  1317.   #ifdef SW_MONITOR_L
  1318.     #undef SW_MONITOR_L
  1319.   #endif
  1320.  
  1321.   /* RCL Monitor */
  1322.   #ifdef SW_MONITOR_RCL
  1323.     #undef SW_MONITOR_RCL
  1324.   #endif
  1325.  
  1326.   /* RL Monitor */
  1327.   #ifdef SW_MONITOR_RL
  1328.     #undef SW_MONITOR_RL
  1329.   #endif
  1330.  
  1331. #endif
  1332.  
  1333.  
  1334. /* options which require ESR measurement */
  1335. #if ! defined (SW_ESR) && ! defined (SW_OLD_ESR)
  1336.   /* ESR tool */
  1337.   #ifdef SW_ESR_TOOL
  1338.     #undef SW_ESR_TOOL
  1339.   #endif
  1340. #endif
  1341.  
  1342.  
  1343. /* options which require a MCU clock >= 8MHz */
  1344. #if CPU_FREQ < 8000000
  1345.  
  1346.   /* ESR measurement */
  1347.   #ifdef SW_ESR
  1348.     #undef SW_ESR
  1349.   #endif
  1350.  
  1351.   /* old ESR measurement */
  1352.   #ifdef SW_OLD_ESR
  1353.     #undef SW_OLD_ESR
  1354.   #endif
  1355.  
  1356. #endif
  1357.  
  1358.  
  1359. /* SPI */
  1360. #if defined (SPI_BITBANG) && defined (SPI_HARDWARE)
  1361.   #error <<< Select either bitbang or hardware SPI! >>>
  1362. #endif
  1363.  
  1364. #if defined (SPI_BITBANG) || defined (SPI_HARDWARE)
  1365.   #define HW_SPI
  1366. #endif
  1367.  
  1368. /* 9-Bit SPI requires bit-bang mode */
  1369. #ifdef SPI_9
  1370.   #ifndef SPI_BITBANG
  1371.     #error <<< 9-Bit SPI requires bit-bang mode! >>>
  1372.   #endif
  1373. #endif
  1374.  
  1375.  
  1376. /* I2C */
  1377. #if defined (I2C_BITBANG) && defined (I2C_HARDWARE)
  1378.   #error <<< Select either bitbang or hardware I2C! >>>
  1379. #endif
  1380.  
  1381. #if defined (I2C_BITBANG) || defined (I2C_HARDWARE)
  1382.   #define HW_I2C
  1383. #endif
  1384.  
  1385.  
  1386. /* TTL serial */
  1387. #if defined (SERIAL_BITBANG) && defined (SERIAL_HARDWARE)
  1388.   #error <<< Select either bitbang or hardware serial interface! >>>
  1389. #endif
  1390.  
  1391. #if defined (SERIAL_BITBANG) || defined (SERIAL_HARDWARE)
  1392.   #define HW_SERIAL
  1393. #endif
  1394.  
  1395. /* VT100 display driver disables other options for serial interface */
  1396. #ifdef LCD_VT100
  1397.   #ifdef UI_SERIAL_COPY
  1398.     #undef UI_SERIAL_COPY
  1399.   #endif
  1400.   #ifdef UI_SERIAL_COMMANDS
  1401.     #undef UI_SERIAL_COMMANDS
  1402.   #endif  
  1403. #endif
  1404.  
  1405. /* options which require TTL serial */
  1406. #ifndef HW_SERIAL
  1407.   /* VT100 display */
  1408.   #ifdef LCD_VT100
  1409.     #undef LCD_VT100
  1410.   #endif
  1411.   /* serial copy */
  1412.   #ifdef UI_SERIAL_COPY
  1413.     #undef UI_SERIAL_COPY
  1414.   #endif
  1415.   /* remote commands */
  1416.   #ifdef UI_SERIAL_COMMANDS
  1417.     #undef UI_SERIAL_COMMANDS
  1418.   #endif
  1419. #endif
  1420.  
  1421. /* options which require TTL serial RW */
  1422. #ifndef SERIAL_RW
  1423.   #ifdef UI_SERIAL_COMMANDS
  1424.     #undef UI_SERIAL_COMMANDS
  1425.   #endif
  1426. #endif
  1427.  
  1428.  
  1429. /* OneWire */
  1430. #if defined (ONEWIRE_PROBES) && defined (ONEWIRE_IO_PIN)
  1431.   #error <<< Select either probes or dedicated IO pin for Onewire! >>>
  1432. #endif
  1433.  
  1434. /* options which require OneWire */
  1435. #if ! defined (ONEWIRE_PROBES) && ! defined (ONEWIRE_IO_PIN)
  1436.  
  1437.   /* DS18B20 */
  1438.   #ifdef SW_DS18B20
  1439.     #undef SW_DS18B20
  1440.   #endif
  1441.  
  1442.   /* OneWire scan */
  1443.   #ifdef SW_ONEWIRE_SCAN
  1444.     #undef SW_ONEWIRE_SCAN
  1445.   #endif
  1446.  
  1447. #endif
  1448.  
  1449.  
  1450. /* touchscreen */
  1451. #ifdef TOUCH_PORT
  1452.   #define HW_TOUCH
  1453. #endif
  1454.  
  1455.  
  1456. /* LCD module */
  1457. #ifdef LCD_CONTRAST
  1458.   #define SW_CONTRAST
  1459. #else
  1460.   #define LCD_CONTRAST        0
  1461. #endif
  1462.  
  1463.  
  1464. /* options which require a color display */
  1465. #ifndef LCD_COLOR
  1466.  
  1467.   /* color coding for probes */
  1468.   #ifdef SW_PROBE_COLORS
  1469.     #undef SW_PROBE_COLORS
  1470.   #endif
  1471.  
  1472. #endif
  1473.  
  1474.  
  1475. /* options which require a color graphics display */
  1476. #if ! defined (LCD_COLOR) || ! defined (LCD_GRAPHIC)
  1477.  
  1478.   /* resistor color-codes */
  1479.   #ifdef SW_R_E24_5_CC
  1480.     #undef SW_R_E24_5_CC
  1481.   #endif
  1482.   #ifdef SW_R_E24_1_CC
  1483.     #undef SW_R_E24_1_CC
  1484.   #endif
  1485.   #ifdef SW_R_E96_CC
  1486.     #undef SW_R_E96_CC
  1487.   #endif
  1488.  
  1489. #endif
  1490.  
  1491.  
  1492. /* component symbols for fancy pinout */
  1493. #if defined (SYMBOLS_24X24_H)
  1494.   #define SYMBOLS_SELECTED
  1495. #endif
  1496. #if defined (SYMBOLS_24X24_HF) || defined (SYMBOLS_30X32_HF) || defined (SYMBOLS_32X32_HF)
  1497.   #define SYMBOLS_SELECTED
  1498. #endif
  1499. #if defined (SYMBOLS_24X24_VFP)
  1500.   #define SYMBOLS_SELECTED
  1501. #endif
  1502. #if defined (SYMBOLS_24X24_VP_F)
  1503.   #define SYMBOLS_SELECTED
  1504. #endif
  1505.  
  1506. /* fancy pinout requires graphic display and symbol set */
  1507. #ifdef SW_SYMBOLS
  1508.  
  1509.   /* graphic display */
  1510.   #ifndef LCD_GRAPHIC
  1511.     #undef SW_SYMBOLS
  1512.   #endif
  1513.  
  1514.   /* symbol set */
  1515.   #ifndef SYMBOLS_SELECTED
  1516.     #undef SW_SYMBOLS
  1517.   #endif
  1518.  
  1519. #endif
  1520.  
  1521.  
  1522. /* frequency counter */
  1523. #if defined (HW_FREQ_COUNTER_BASIC) || defined (HW_FREQ_COUNTER_EXT)
  1524.   #define HW_FREQ_COUNTER
  1525. #endif
  1526.  
  1527.  
  1528. /* IR detector/decoder */
  1529. #if defined (SW_IR_RECEIVER) && defined (HW_IR_RECEIVER)
  1530.   #error <<< Select either probes or dedicated IO pin for IR detector! >>>
  1531. #endif
  1532.  
  1533.  
  1534. /* rounding for DS18B20 requires DS18B20 support */
  1535. #ifdef UI_ROUND_DS18B20
  1536.   #ifndef SW_DS18B20
  1537.     #undef UI_ROUND_DS18B20
  1538.   #endif
  1539. #endif
  1540.  
  1541.  
  1542. /* read functions for display require bus with read support enabled */
  1543. #ifdef LCD_READ
  1544.   #if defined(LCD_SPI) && ! defined(SPI_RW)
  1545.     #undef LCD_READ
  1546.   #endif
  1547.   #if defined(LCD_I2C) && ! defined(I2C_RW)
  1548.     #undef LCD_READ
  1549.   #endif
  1550.   /* can't check parallel busses */
  1551. #endif
  1552.  
  1553. /* display ID requires read functions for display */
  1554. #ifdef SW_DISPLAY_ID
  1555.   #ifndef LCD_READ
  1556.     #undef SW_DISPLAY_ID
  1557.   #endif
  1558. #endif
  1559.  
  1560. /* output of display registers requires read functions for display
  1561.    and serial output */
  1562. #ifdef SW_DISPLAY_REG
  1563.   #ifndef LCD_READ
  1564.     #undef SW_DISPLAY_REG
  1565.   #endif
  1566.   #ifndef UI_SERIAL_COPY
  1567.     #undef SW_DISPLAY_REG
  1568.   #endif
  1569. #endif
  1570.  
  1571.  
  1572.  
  1573. /* ************************************************************************
  1574.  *   simplify ifdefs
  1575.  * ************************************************************************ */
  1576.  
  1577.  
  1578. /* E6 norm values */
  1579. #if defined (SW_C_E6_T) || defined (SW_L_E6_T)
  1580.   #define SW_E6
  1581. #endif
  1582.  
  1583. /* E12 norm values */
  1584. #if defined (SW_C_E12_T) || defined (SW_L_E12_T)
  1585.   #define SW_E12
  1586. #endif
  1587.  
  1588. /* E24 norm values */
  1589. #if defined (SW_R_E24_5_T) || defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_T) || defined (SW_R_E24_1_CC)
  1590.   #define SW_E24
  1591. #endif
  1592.  
  1593. /* E96 norm values */
  1594. #if defined (SW_R_E96_T) || defined (SW_R_E96_CC)
  1595.   #define SW_E96
  1596. #endif
  1597.  
  1598.  
  1599. /* Show_ENormValues(), Display_EValue() */
  1600. #if defined (SW_R_E24_5_T) || defined (SW_R_E24_1_T) || defined (SW_R_E96_T)
  1601.   #ifndef FUNC_EVALUE
  1602.     #define FUNC_EVALUE
  1603.   #endif
  1604.   #ifndef SW_R_EXX
  1605.     #define SW_R_EXX
  1606.   #endif
  1607. #endif
  1608.  
  1609. #if defined (SW_C_E6_T) || defined (SW_C_E12_T) || defined (SW_L_E6_T) || defined (SW_L_E12_T)
  1610.   #ifndef FUNC_EVALUE
  1611.     #define FUNC_EVALUE
  1612.   #endif
  1613. #endif
  1614.  
  1615.  
  1616. /* Show_ENormCodes(), Display_ColorCode() */
  1617. #if defined (SW_R_E24_5_CC) || defined (SW_R_E24_1_CC) || defined (SW_R_E96_CC)
  1618.   #ifndef FUNC_COLORCODE
  1619.     #define FUNC_COLORCODE
  1620.   #endif
  1621.   #ifndef SW_R_EXX
  1622.     #define SW_R_EXX
  1623.   #endif
  1624. #endif
  1625.  
  1626.  
  1627. /* SmoothLongKeyPress() */
  1628. #if defined (SW_PWM_PLUS) || defined (SW_SERVO) || defined (HW_EVENT_COUNTER) || defined (HW_LC_METER)
  1629.   #ifndef FUNC_SMOOTHLONGKEYPRESS
  1630.     #define FUNC_SMOOTHLONGKEYPRESS
  1631.   #endif
  1632. #endif
  1633.  
  1634.  
  1635. /* Display_FullValue() */
  1636. #if defined (SW_SQUAREWAVE) || defined (SW_PWM_PLUS) || defined (HW_FREQ_COUNTER_EXT) || defined (SW_SERVO)
  1637.   #ifndef FUNC_DISPLAY_FULLVALUE
  1638.     #define FUNC_DISPLAY_FULLVALUE
  1639.   #endif
  1640. #endif
  1641.  
  1642. #if defined (SW_DS18B20) || defined (HW_EVENT_COUNTER) || defined (SW_DHTXX)
  1643.   #ifndef FUNC_DISPLAY_FULLVALUE
  1644.     #define FUNC_DISPLAY_FULLVALUE
  1645.   #endif
  1646. #endif
  1647.  
  1648. #if defined (FUNC_EVALUE) || defined (FUNC_COLORCODE) || defined (LC_METER_SHOW_FREQ)
  1649.   #ifndef FUNC_DISPLAY_FULLVALUE
  1650.     #define FUNC_DISPLAY_FULLVALUE
  1651.   #endif
  1652. #endif
  1653.  
  1654.  
  1655. /* Display_HexByte() */
  1656. #if defined (SW_IR_RECEIVER) || defined (HW_IR_RECEIVER) || defined (ONEWIRE_READ_ROM) || defined (SW_ONEWIRE_SCAN) || defined (SW_FONT_TEST) || defined (SW_DISPLAY_REG)
  1657.   #ifndef FUNC_DISPLAY_HEXBYTE
  1658.     #define FUNC_DISPLAY_HEXBYTE
  1659.   #endif
  1660. #endif
  1661.  
  1662. /* Display_HexValue() */
  1663. #if defined (SW_IR_TRANSMITTER) || defined (SW_DISPLAY_ID)
  1664.   #ifndef FUNC_DISPLAY_HEXVALUE
  1665.     #define FUNC_DISPLAY_HEXVALUE
  1666.   #endif
  1667. #endif
  1668.  
  1669.  
  1670.  
  1671. /* ************************************************************************
  1672.  *   EOF
  1673.  * ************************************************************************ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement