-
Notifications
You must be signed in to change notification settings - Fork 30
/
example.yaml
167 lines (162 loc) · 3.71 KB
/
example.yaml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Copyright (C) 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Datasheet: http://www.ti.com/lit/ds/symlink/ads1015.pdf
cyanobyte: 0.1.0
info:
contact:
name: Nick Felker
url: https://github.com/google/cyanobyte
email: [email protected]
package: com.cyanobyte
title: Example
description: Example of a package
copyright:
name: Google Inc.
date: '2019'
license:
name: Apache-2.0
version: 0.1.0
'x-foo': 'x-bar'
i2c:
addressType: 7-bit
address:
- 0x10
- 0x20
- 0x30
addressMask: 0xFF
registers:
RegisterA:
address: 0x00
length: 8
title: First example
description: An 8-bit register
RegisterB:
address: 0x01
length: 16
title: Second example
description: A 16-bit register
RegisterC:
address: 0x02
length: 32
title: Third example
description: A 32-bit register
RegisterD:
address: 0x03
length: 0
title: Fourth example
description: A dummy register that has no data
fields:
FieldA:
title: Read-only fields for RegisterA
description: This is a few bits
register: '#/registers/RegisterA'
readWrite: 'R'
bitStart: 7
bitEnd: 4
type: number
FieldB:
title: Write-only fields for RegisterA
description: This is fewer bits
register: '#/registers/RegisterA'
readWrite: 'W'
bitStart: 3
bitEnd: 2
type: enum
enum:
VAL_1:
title: Value 1
value: 0b0001
VAL_2:
title: Value 2
value: 0b0010
VAL_3:
title: Value 3
value: 0b0100
VAL_4:
title: Value 4
value: 0b1000
FieldC:
title: Read/write field for RegisterA
description: A single-bit
register: '#/registers/RegisterA'
readWrite: 'R/W'
bitStart: 1
bitEnd: 1
type: number
FieldD:
title: This field should never appear
description: A bit that is neither readable nor writeable
register: '#/registers/RegisterA'
readWrite: 'n'
bitStart: 0
bitEnd: 0
type: number
functions:
Return:
title: Return a value
description: Computes and returns
register: '#/registers/RegisterA'
computed:
Number:
variables:
summation: int16
logic:
- summation:
- sum:
- 1024
- 1024
- send: summation
return: summation
Array:
variables:
summation: int16
logic:
- summation:
- sum:
- 1024
- 1024
- send: summation
return:
- summation
- summation
Void:
variables:
summation: int16
logic:
- summation:
- sum:
- 1024
- 1024
- send: summation
_lifecycle:
title: Code to run when device class is constructed
description: Enables features on device
register: '#/registers/RegisterA'
computed:
Begin:
variables:
output: int8
logic:
- output: = 1
- send: output
return: output
End:
variables:
output: int8
logic:
- output: = 1
- send: output
return: output
extensions:
foo: bar