forked from parallaxinc/spin-standard-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.con.mlx90621.spin
81 lines (67 loc) · 2.75 KB
/
core.con.mlx90621.spin
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
{
--------------------------------------------
Filename: core.con.mlx90621
Author: Jesse Burt
Description: MLX90621-specific constants
Copyright (c) 2022
Started: Nov 11, 2018
Updated: Nov 12, 2022
See end of file for terms of use.
--------------------------------------------
}
CON
I2C_MAX_FREQ = 1_000_000
SLAVE_ADDR = $60 << 1
EE_MAX_FREQ = 400_000
EE_SLAVE_ADDR = $50 << 1
T_POR = 3_000 ' usec
' Register definitions
CMD_READREG = $02
CMD_WRITEREG_CFG = $03
CMD_WRITEREG_OSCTRIM= $04
CMD_STEP_MEASURE = $0801
PTAT = $40
COMP_PIXEL = $41
CONFIG = $92
CONFIG_MASK = $5EFF
ADCHIGHREF = 14
EEPROMENA = 12
I2CFMP = 11
RESET = 10
MEASURING = 9
OPMODE = 7
MEASMODE = 6
ADCRES = 4
REFRATE = 0
ADCRES_BITS = %11
REFRATE_BITS = %1111
ADCHIGHREF_MASK = (1 << ADCHIGHREF) ^ CONFIG_MASK
EEPROMENA_MASK = (1 << EEPROMENA) ^ CONFIG_MASK
I2CFMP_MASK = (1 << I2CFMP) ^ CONFIG_MASK
RESET_MASK = (1 << RESET) ^ CONFIG_MASK
MEASURING_MASK = (1 << MEASURING) ^ CONFIG_MASK
OPMODE_MASK = (1 << OPMODE) ^ CONFIG_MASK
MEASMODE_MASK = (1 << MEASMODE) ^ CONFIG_MASK
ADCRES_MASK = (ADCRES_BITS << ADCRES) ^ CONFIG_MASK
REFRATE_MASK = REFRATE_BITS ^ CONFIG_MASK
RESET_UPD = (1 << RESET)
OSC_TRIM = $93
OSC_TRIM_MASK = $007F
PUB null{}
' This is not a top-level object
DAT
{
Copyright 2022 Jesse Burt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}