Hard coded pins for nRF51822 in this version

Fork of Grove_3-Axis_Digital_Accelerometer_MMA7660FC_Library by Austin Blackstone

Committer:
michaeljkoster
Date:
Tue Nov 04 05:29:12 2014 +0000
Revision:
1:513c1fefeede
Parent:
0:cc40c3196635
Define I2C pins for nRF51822

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:cc40c3196635 1 /*
mbedAustin 0:cc40c3196635 2 * MMA7760.h
mbedAustin 0:cc40c3196635 3 * Library for accelerometer_MMA7760
mbedAustin 0:cc40c3196635 4 *
mbedAustin 0:cc40c3196635 5 * Copyright (c) 2013 seeed technology inc.
mbedAustin 0:cc40c3196635 6 * Author : FrankieChu
mbedAustin 0:cc40c3196635 7 * Create Time : Jan 2013
mbedAustin 0:cc40c3196635 8 * Change Log :
mbedAustin 0:cc40c3196635 9 *
mbedAustin 0:cc40c3196635 10 * The MIT License (MIT)
mbedAustin 0:cc40c3196635 11 *
mbedAustin 0:cc40c3196635 12 * Permission is hereby granted, free of charge, to any person obtaining a copy
mbedAustin 0:cc40c3196635 13 * of this software and associated documentation files (the "Software"), to deal
mbedAustin 0:cc40c3196635 14 * in the Software without restriction, including without limitation the rights
mbedAustin 0:cc40c3196635 15 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
mbedAustin 0:cc40c3196635 16 * copies of the Software, and to permit persons to whom the Software is
mbedAustin 0:cc40c3196635 17 * furnished to do so, subject to the following conditions:
mbedAustin 0:cc40c3196635 18 *
mbedAustin 0:cc40c3196635 19 * The above copyright notice and this permission notice shall be included in
mbedAustin 0:cc40c3196635 20 * all copies or substantial portions of the Software.
mbedAustin 0:cc40c3196635 21 *
mbedAustin 0:cc40c3196635 22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
mbedAustin 0:cc40c3196635 23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
mbedAustin 0:cc40c3196635 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
mbedAustin 0:cc40c3196635 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
mbedAustin 0:cc40c3196635 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mbedAustin 0:cc40c3196635 27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
mbedAustin 0:cc40c3196635 28 * THE SOFTWARE.
mbedAustin 0:cc40c3196635 29 */
mbedAustin 0:cc40c3196635 30 #include "mbed.h"
mbedAustin 0:cc40c3196635 31
mbedAustin 0:cc40c3196635 32 #ifndef __MMC7660_H__
mbedAustin 0:cc40c3196635 33 #define __MMC7660_H__
mbedAustin 0:cc40c3196635 34
mbedAustin 0:cc40c3196635 35 #define MMA7660_ADDR 0x4c
mbedAustin 0:cc40c3196635 36
mbedAustin 0:cc40c3196635 37 #define MMA7660_X 0x00
mbedAustin 0:cc40c3196635 38 #define MMA7660_Y 0x01
mbedAustin 0:cc40c3196635 39 #define MMA7660_Z 0x02
mbedAustin 0:cc40c3196635 40 #define MMA7660_TILT 0x03
mbedAustin 0:cc40c3196635 41 #define MMA7660_SRST 0x04
mbedAustin 0:cc40c3196635 42 #define MMA7660_SPCNT 0x05
mbedAustin 0:cc40c3196635 43 #define MMA7660_INTSU 0x06
mbedAustin 0:cc40c3196635 44 #define MMA7660_MODE 0x07
mbedAustin 0:cc40c3196635 45 #define MMA7660_STAND_BY 0x00
mbedAustin 0:cc40c3196635 46 #define MMA7660_ACTIVE 0x01
mbedAustin 0:cc40c3196635 47 #define MMA7660_SR 0x08 //sample rate register
mbedAustin 0:cc40c3196635 48 #define AUTO_SLEEP_120 0X00//120 sample per second
mbedAustin 0:cc40c3196635 49 #define AUTO_SLEEP_64 0X01
mbedAustin 0:cc40c3196635 50 #define AUTO_SLEEP_32 0X02
mbedAustin 0:cc40c3196635 51 #define AUTO_SLEEP_16 0X03
mbedAustin 0:cc40c3196635 52 #define AUTO_SLEEP_8 0X04
mbedAustin 0:cc40c3196635 53 #define AUTO_SLEEP_4 0X05
mbedAustin 0:cc40c3196635 54 #define AUTO_SLEEP_2 0X06
mbedAustin 0:cc40c3196635 55 #define AUTO_SLEEP_1 0X07
mbedAustin 0:cc40c3196635 56 #define MMA7660_PDET 0x09
mbedAustin 0:cc40c3196635 57 #define MMA7660_PD 0x0A
mbedAustin 0:cc40c3196635 58 class MMA7660
mbedAustin 0:cc40c3196635 59 {
mbedAustin 0:cc40c3196635 60 private:
mbedAustin 0:cc40c3196635 61 void write(uint8_t _register, uint8_t _data);
mbedAustin 0:cc40c3196635 62 uint8_t read(uint8_t _register);
mbedAustin 0:cc40c3196635 63 public:
mbedAustin 0:cc40c3196635 64 void init();
mbedAustin 0:cc40c3196635 65 void setMode(uint8_t mode);
mbedAustin 0:cc40c3196635 66 void setSampleRate(uint8_t rate);
mbedAustin 0:cc40c3196635 67 void getXYZ(int8_t *x,int8_t *y,int8_t *z);
mbedAustin 0:cc40c3196635 68 void getAcceleration(float *ax,float *ay,float *az);
mbedAustin 0:cc40c3196635 69 };
mbedAustin 0:cc40c3196635 70
mbedAustin 0:cc40c3196635 71 #endif //__MMC7660_H__