File tree Expand file tree Collapse file tree 4 files changed +56
-18
lines changed Expand file tree Collapse file tree 4 files changed +56
-18
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: Build ectool
3
3
4
4
on :
5
5
push :
6
- branches : [ main ]
6
+ branches : [main, dev ]
7
7
pull_request :
8
8
9
9
jobs :
52
52
name : ectool-linux
53
53
path : |
54
54
_build/src/core/ectool
55
- _build/src/core/libectool.so
55
+ _build/src/core/libectool.so
Original file line number Diff line number Diff line change 2
2
#include < stdlib.h>
3
3
#include < string.h>
4
4
5
+ #include " libectool.h"
5
6
#include " battery.h"
6
7
#include " comm-host.h"
7
8
#include " comm-usb.h"
11
12
#include " ec_panicinfo.h"
12
13
#include " ec_flash.h"
13
14
#include " ec_version.h"
14
- // #include "ectool.h"
15
15
#include " i2c.h"
16
16
#include " lightbar.h"
17
17
#include " lock/gec_lock.h"
30
30
#define GEC_LOCK_TIMEOUT_SECS 30 /* 30 secs */
31
31
#define interfaces COMM_ALL
32
32
33
- int libectool_init ();
34
- void libectool_release ();
35
- int read_mapped_temperature (int id);
36
- static uint8_t read_mapped_mem8 (uint8_t offset);
37
-
38
-
39
- extern " C" {
40
- int ascii_mode = 0 ;
41
- bool is_on_ac ();
42
- void pause_fan_control ();
43
- void set_fan_speed (int speed);
44
- float get_max_temperature ();
45
- float get_max_non_battery_temperature ();
46
-
47
-
33
+ // int read_mapped_temperature(int id);
34
+ // static uint8_t read_mapped_mem8(uint8_t offset);
35
+ // int ascii_mode;
48
36
49
37
// -----------------------------------------------------------------------------
50
38
// Top-level endpoint functions
Original file line number Diff line number Diff line change
1
+ #ifndef LIBECTOOL_H
2
+ #define LIBECTOOL_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ // Library init/release
9
+ int libectool_init ();
10
+ void libectool_release ();
11
+
12
+ // API functions to expose
13
+ bool is_on_ac ();
14
+ void pause_fan_control ();
15
+ void set_fan_speed (int speed );
16
+ float get_max_temperature ();
17
+ float get_max_non_battery_temperature ();
18
+
19
+ #ifdef __cplusplus
20
+ }
21
+ #endif
22
+
23
+ #endif // LIBECTOOL_H
Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include "libectool.h"
3
+
4
+ int main () {
5
+ printf ("Testing libectool...\n" );
6
+
7
+ // Test is_on_ac
8
+ bool ac = is_on_ac ();
9
+ printf ("is_on_ac() = %d\n" , ac );
10
+
11
+ // // Test fan control functions
12
+ // printf("Pausing fan control...\n");
13
+ // pause_fan_control();
14
+
15
+ // printf("Setting fan speed to 50%%...\n");
16
+ // set_fan_speed(50);
17
+
18
+ // Test temperature functions
19
+ float max_temp = get_max_temperature ();
20
+ printf ("Max temperature = %.2f C\n" , max_temp );
21
+
22
+ float max_non_batt_temp = get_max_non_battery_temperature ();
23
+ printf ("Max non-battery temperature = %.2f C\n" , max_non_batt_temp );
24
+
25
+ printf ("Test complete.\n" );
26
+ return 0 ;
27
+ }
You can’t perform that action at this time.
0 commit comments