PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
liblsm9ds1
imu_SPIwrite.c
1
17
#include "
simpletools.h
"
18
#include "lsm9ds1.h"
19
20
21
int
__pinSDIO, __pinSCL;
22
23
void
imu_SPIwriteByte(
unsigned
char
csPin,
unsigned
char
subAddress,
unsigned
char
data)
24
{
25
low
(csPin);
26
shift_out
(__pinSDIO, __pinSCL,
MSBFIRST
, 8, subAddress & 0x3F);
27
shift_out
(__pinSDIO, __pinSCL,
MSBFIRST
, 8, data);
28
high
(csPin);
29
}
30
31
32
/*
33
* Based on the Arduino Library for the LSM9SD1 by Jim Lindblom of Sparkfun Electronics
34
*/
35
shift_out
void shift_out(int pinDat, int pinClk, int mode, int bits, int value)
Send data to a synchronous serial device.
Definition:
shiftOut.c:19
low
void low(int pin)
Set an I/O pin to output-low.
Definition:
low.c:19
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
MSBFIRST
#define MSBFIRST
For use with shift_out. Stands for most significant bit first.
Definition:
simpletools.h:417
high
void high(int pin)
Set an I/O pin to output-high.
Definition:
high.c:19
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17