PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
liblis3dh
writeByte.c
1
/*
2
* @file writeByte.c
3
*
4
* @author Michael Mulholland
5
*
6
* @version 1.0.0
7
*
8
* @copyright
9
* Copyright (C) Parallax, Inc. 2020. All Rights MIT Licensed.
10
*
11
* @brief Writes a byte to a register in the Parallax LIS3DH 3-Axis Accelerometer Module with ADC.
12
*
13
*/
14
15
16
#include "
simpletools.h
"
17
#include "
lis3dh.h
"
18
19
20
21
void
lis3dh_writeByte
(
lis3dh_t
*device,
unsigned
char
address,
unsigned
char
value)
22
{
23
24
low
(device->cs_pin);
25
26
shift_out
(device->sdi_pin, device->sck_pin,
MSBFIRST
, 8, address);
27
shift_out
(device->sdi_pin, device->sck_pin,
MSBFIRST
, 8, value);
28
29
high
(device->cs_pin);
30
31
}
32
33
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
lis3dh_writeByte
void lis3dh_writeByte(lis3dh_t *device, unsigned char address, unsigned char value)
write a byte value to an LIS3DH register
Definition:
writeByte.c:21
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,...
lis3dh.h
Simplifies reading Parallax LIS3DH 3-Axis Accelerometer Module with ADC.
MSBFIRST
#define MSBFIRST
For use with shift_out. Stands for most significant bit first.
Definition:
simpletools.h:417
lis3dh_st
Definition:
lis3dh.h:122
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