-
Notifications
You must be signed in to change notification settings - Fork 211
/
temp_alarm.erpc
79 lines (62 loc) · 1.86 KB
/
temp_alarm.erpc
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
/*!
* Copyright (c) 2016, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
program TempAlarm
type SensorAddress = uint8
struct SensorReadResult
{
SensorAddress address
float temp
}
struct AlarmInfo
{
float temp
bool enabled
}
struct SensorInfo
{
SensorAddress address
float readInterval //!< Seconds, default 1s.
AlarmInfo highAlarm
AlarmInfo lowAlarm
}
enum AlarmType
{
kHighAlarm,
kLowAlarm,
kBothAlarms, //!< Only used for enable/disable.
}
type SensorInfoList = list<SensorInfo>
type SavedState = binary
//! Calls from Linux to M4.
interface Temp
{
add_sensor(SensorAddress address) -> bool
remove_sensor(SensorAddress address) -> bool
set_interval(SensorAddress address, float interval) -> bool
set_alarm(SensorAddress address, AlarmType alarmType, float alarmTemp) -> bool
enable_alarm(SensorAddress address, AlarmType alarmType) -> bool
disable_alarm(SensorAddress address, AlarmType alarmType) -> bool
get_one_sensor(SensorAddress address) -> SensorInfo
//get_all_sensors_a(out SensorInfoList infos @length(count), out uint32 count, ) -> bool
get_all_sensors_b() -> SensorInfoList
save_settings() -> SavedState
load_settings(SavedState savedState) -> bool
//! Reads one sensor synchronously.
read_one_sensor(SensorAddress address) -> float
//! Sends read_results() asynchronously.
read_sensors(list<SensorAddress> addresses @length(count), uint32 count) -> bool
}
//! Asynchronous events from M4 to Linux.
interface TempAsync
{
//! Void return so we can verify the message was received.
alarm_fired(SensorAddress addr, float temp) -> void
//! Oneway since it's less important than an alarm.
oneway read_results(list<SensorReadResult> results @length(count), uint32 count)
}