-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkline.c
65 lines (39 loc) · 1.42 KB
/
kline.c
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
#include <pic16f877a.h> /* Pic definitions */
#include <stdbool.h> /* Bools, true of false */
#include <stdint.h> /* For uint8_t definition */
#include <stdlib.h>
#include <xc.h> /* XC8 General Include File */
#include "ISO.h"
#include "kline_send.h"
#include "kline_wait_functions.h"
#include "kline_struct.h"
static uint8_t checksum_kline(const uint8_t [], const uint8_t);
static void fast_initialisation(Kline *);
/* Pull the K-line low for 70msec */
/* Return the K-line to the high state for 120msec */
/* Send ?Wakeup? message: FE 04 FF FF. No response is expected */
/* Wait 200msec */
/* Send ?Initialise? message: 72 05 00 F0 99 */
/* The ECU should respond with: 02 04 00 FA */
void init_kline(void)
{
Kline *ksp = ks;
/* begin talk */
fast_initialisation(ksp);
/* choose service we want from ecu */
}
static void fast_initialisation(Kline *klinep)
{
send_kline_wake_up();
/*
* The first message of a fast initialisation always uses a header
* with target and source address and without additional length byte
*/
send_start_communication(klinep);
send_start_request(klinep);
/* 25...50 ms*, 0..1000ms** */
wait_p2(klinep);
//read_start_response(klinep);
/* 55...5000ms*, 0...5000 ms** */
//wait_p3();
}