Subversion Repositories libIgnTiming

Rev

Rev 6 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. // This file deals with looking up ignition timing
  2.  
  3. #pragma once
  4. #include "stdint.h"
  5.  
  6. static const int TIMING_SCALE = 10;
  7. // number of RPM lookup values
  8. static unsigned const MAX_RPM_POINTS = 8;
  9. // number of vacuum lookup points
  10. static unsigned const MAX_VACUUM_POINTS = 8;
  11.  
  12. #if defined __cplusplus
  13. extern "C"
  14. {
  15. #endif
  16.  
  17.     /// @brief Get timing adjustment value
  18.     /// @return Timing adjustment value
  19.     uint8_t getTimingAdjust();
  20.  
  21.     /// @brief Set the timing adjustment value
  22.     /// @param adjust Timing value
  23.     void setTimingAdjust(int8_t adjust);
  24.  
  25.     /// @brief Get timing map RPM column heading
  26.     /// @param i column number
  27.     /// @return Value at that position
  28.     int16_t getRpmMap(unsigned int i);
  29.  
  30.     /// @brief Set the timing map RPM column heading
  31.     /// @param i column number
  32.     /// @param value Value to place at that position
  33.     void setRpmMap(unsigned int i, uint16_t value);
  34.  
  35.     /// @brief Set vacuum mapping column heading (row actually)
  36.     /// @param i row number
  37.     /// @param value Value to place at that position
  38.     void setVacuumMap(unsigned int i, uint16_t value);
  39.  
  40.     /// @brief Get vacuum mapping column heading (row actually)
  41.     /// @param i row number
  42.     uint16_t getVacuumMap(unsigned int i);
  43.  
  44.     /// @brief Set the timing value
  45.     /// @param vacuumIndex
  46.     /// @param rpmIndex
  47.     /// @param value
  48.     void setTiming(unsigned int vacuumIndex,  unsigned int rpmIndex, uint8_t value);
  49.  
  50.     /// @brief Get the timing value
  51.     /// @param vacuumIndex
  52.     /// @param rpmIndex
  53.     /// @return value
  54.     uint8_t getTiming(unsigned int vacuumIndex, unsigned int rpmIndex);
  55.  
  56.     /// @brief Lookup ignition timing
  57.     /// @param rpm Engine Speed in RPM
  58.     /// @param vacuumMb Ported vacuum in millibars of vacuum : between about 0 and 700 usually
  59.     /// @return Vacuum advance in degrees * TIMING_SCALE;
  60.     int mapTiming(int rpm, int vacuumMb);
  61. #if defined __cplusplus
  62. }
  63. #endif
  64.