Subversion Repositories libIgnTiming

Rev

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

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