PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
libmma7455
init.c
1
/*
2
* @file init.c
3
*
4
* @author Andy Lindsay
5
*
6
* @version 0.50
7
*
8
* @copyright
9
* Copyright (C) Parallax, Inc. 2014. All Rights MIT Licensed.
10
*
11
* @brief Initializes the Parallax MMA7455 3-Axis Accelerometer Module.
12
*/
13
14
15
#include "
simpletools.h
"
16
#include "
mma7455.h
"
17
18
19
int
MMA7455_pinDat
,
MMA7455_pinClk
,
MMA7455_pinEn
;
20
int
MMA7455_gRangeVal;
21
22
23
void
MMA7455_init
(
int
MMA7455_pinData,
int
pinClock,
int
MMA7455_pinEnable)
24
{
25
MMA7455_pinDat
= MMA7455_pinData;
26
MMA7455_pinClk
= pinClock;
27
MMA7455_pinEn
= MMA7455_pinEnable;
28
29
high
(
MMA7455_pinEn
);
// CS high (chip inactive)
30
low
(
MMA7455_pinClk
);
// CLK line low
31
32
const
int
MCTL_CFG = 0b01100001;
33
34
MMA7455_writeByte
(
MMA7455_MCTL
, MCTL_CFG);
35
}
36
37
MMA7455_MCTL
#define MMA7455_MCTL
Definition:
mma7455.h:137
MMA7455_writeByte
void MMA7455_writeByte(unsigned char address, unsigned char value)
write a byte value to an MMA7455 register
Definition:
writeByte.c:26
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,...
MMA7455_pinEn
int MMA7455_pinEn
Definition:
getMode.c:19
MMA7455_pinDat
int MMA7455_pinDat
Definition:
getMode.c:19
MMA7455_init
void MMA7455_init(int pinData, int pinClock, int pinEnable)
Initialize the sensor.
Definition:
init.c:23
mma7455.h
Simplifies reading Parallax MMA7455 3-Axis Accelerometer Module.
high
void high(int pin)
Set an I/O pin to output-high.
Definition:
high.c:19
MMA7455_pinClk
int MMA7455_pinClk
Definition:
getMode.c:19
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17