FLI R
ADK
Ge tt in g S ta rt ed
The information contained herein does not contain technology as
defined by EAR,15 CFR772, is publicly available, and therefore
not subject to EAR.
11
write val 0x0
1
to reg 0x19 to device reg 0xD8
Configure heater GPIO as an OUTPUT (step can be skipped if already done this power cycle)
write val 0x0F to reg 0x18 to device reg 0xD8
Turn Heater ON
Set GPIO state register on ADK side to configure heater
on
write val 0x0
9
to reg 0x19 of device reg 0xD8
Configure heater GPIO as an OUTPUT
write val 0x0F to reg 0x18 of device reg 0xD8
4.5
Sample I2C Functions for Teensy SOC
Below are sample functions for i2cwrite and i2cread as well as a function to send an array
of bytes.
I2C Read and Write:
void
i2cwrite
(
byte
addy
,
byte
reg
,
byte
val
)
{
byte
err
;
Wire
.
beginTransmission
(
addy
);
Wire
.
write
(
reg
);
Wire
.
write
(
val
);
err
=
Wire
.
endTransmission
();
if
(
err
!=
0
)
{
I2Cerror
=
1
;
}
}
byte
i2cread
(
byte
addy
,
byte
reg
)
{
byte
err
;
byte
res
=
0
;
Wire
.
beginTransmission
(
addy
);
Wire
.
write
(
reg
);
err
=
Wire
.
endTransmission
();
if
(
err
!=
0
)
{
I2Cerror
=
1
;
}
Wire
.
requestFrom
((
int
)
addy
,
(
int
)
1
,
false
);
while
(
Wire
.
available
())
{
// slave may send less than requested
res
=
Wire
.
read
();
// receive a byte
}
return
res
;
// send the byte
}