summaryrefslogtreecommitdiffstats
path: root/Master/Real-Time Systems/mki/src/mki.h
blob: f2ef77b76bcc2d586da883a29e3454b60283781b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//============================================================================
// Name:
//   mki.h
//
// Summary:
//   A pretty simple class for controlling the parts
//   we can on the mercedes-combi-instrument
//
// Created on:
//   Okt 1, 2010
//
// Author:
//   Christian Steiger
//============================================================================

// includes
#include "libcanio.h"

// defines to make things easier, take a look at mkp.cpp
// to see what they are doing exactly.

// lamps on the display (mki::setLamps())
#define NONE			0x00
#define MKI_ABS			0x01
#define MKI_ESP			0x02
#define MKI_HANDBRAKE	0x04
#define MKI_ENGINE		0x08
#define MKI_WARN		0x10
#define MKI_WARN_BLINK	0x20
#define MKI_FUEL_LOW	0x40

// lcd display options (mki::setDisplay())
#define MKI_LIMIT		0x01
#define MKI_LIMIT_TEXT	0x02
#define MKI_PERMANENT	0x04
#define MKI_EXCEED		0x08
#define MKI_WINTER_TYRE	0x10
#define MKI_MPH_BLINK	0x10
#define MKI_NO_MPH		0x20

// warnings (mki::setAlert())
#define MKI_OIL_LOW			0x01
#define MKI_TIRE_PRESSURE	0x02
#define MKI_TIRE_DEFECT		0x04


// class definition
class mki
{
	public:
		// constructor and destructor
		mki();
		~mki();

		// various methods, see mki.cpp for descriptions
		int connect( const char* const interface );
		void setLamps( const unsigned int lamps);
		void setLampsOff(void);
		void setRpm( const unsigned short rpm );
		void setMph( const unsigned char mph );
		void setCWTemp( const unsigned char temp );
		void setDisplayMph( const unsigned char mph );
		void setDisplay( const unsigned int flags );
		void setAlert( const unsigned int problem );

		void sendData(void);

		void setKmh ( const unsigned char kmh );
		void setDisplayKmh ( const unsigned char kmh );

		// dont rely to heavily on this, it should be removed asap.
		CanIO* getInterface(void);

	protected:
		// class members
		CanIO m_can;
		unsigned char m_alert;

		can_frame m_can_id_200;
		can_frame m_can_id_208;
		can_frame m_can_id_210;
		can_frame m_can_id_308;
		can_frame m_can_id_312;
		can_frame m_can_id_550;
		can_frame m_can_id_608;
};