Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
Classes | Macros
MeCompass.h File Reference

Header for MeCompass.cpp module. More...

#include <stdint.h>
#include <stdbool.h>
#include <Arduino.h>
#include "MeConfig.h"
#include "MePort.h"

Go to the source code of this file.

Classes

struct  Compass_Calibration_Parameter
 
class  MeCompass
 Driver for MeCompass module. More...
 

Macros

#define I2C_ERROR   (-1)
 
#define COMPASS_DEFAULT_ADDRESS   (0x1E)
 
#define COMPASS_RA_CONFIG_A   (0x00)
 
#define COMPASS_RA_CONFIG_B   (0x01)
 
#define COMPASS_RA_MODE   (0x02)
 
#define COMPASS_RA_DATAX_H   (0x03)
 
#define COMPASS_RA_DATAX_L   (0x04)
 
#define COMPASS_RA_DATAZ_H   (0x05)
 
#define COMPASS_RA_DATAZ_L   (0x06)
 
#define COMPASS_RA_DATAY_H   (0x07)
 
#define COMPASS_RA_DATAY_L   (0x08)
 
#define COMPASS_RA_STATUS   (0x09)
 
#define COMPASS_RA_ID_A   (0x0A)
 
#define COMPASS_RA_ID_B   (0x0B)
 
#define COMPASS_RA_ID_C   (0x0C)
 
#define COMPASS_AVERAGING_1   (0x00)
 
#define COMPASS_AVERAGING_2   (0x20)
 
#define COMPASS_AVERAGING_4   (0x40)
 
#define COMPASS_AVERAGING_8   (0x60)
 
#define COMPASS_RATE_0P75   (0x00)
 
#define COMPASS_RATE_1P5   (0x40)
 
#define COMPASS_RATE_3   (0x08)
 
#define COMPASS_RATE_7P5   (0x0C)
 
#define COMPASS_RATE_15   (0x10)
 
#define COMPASS_RATE_30   (0x14)
 
#define COMPASS_RATE_75   (0x18)
 
#define COMPASS_BIAS_NORMAL   (0x00)
 
#define COMPASS_BIAS_POSITIVE   (0x01)
 
#define COMPASS_BIAS_NEGATIVE   (0x02)
 
#define COMPASS_GAIN_1370   (0x00)
 
#define COMPASS_GAIN_1090   (0x20)
 
#define COMPASS_GAIN_820   (0x40)
 
#define COMPASS_GAIN_660   (0x60)
 
#define COMPASS_GAIN_440   (0x80)
 
#define COMPASS_GAIN_390   (0xA0)
 
#define COMPASS_GAIN_330   (0xC0)
 
#define COMPASS_GAIN_220   (0xE0)
 
#define COMPASS_MODE_CONTINUOUS   (0x00)
 
#define COMPASS_MODE_SINGLE   (0x01)
 
#define COMPASS_MODE_IDLE   (0x02)
 
#define COMPASS_PI   3.14159265F
 
#define START_ADDRESS_OF_EEPROM_BUFFER   (int16_t)(0x00)
 

Detailed Description

Header for MeCompass.cpp module.

Author
MakeBlock
Version
V1.0.1
Date
2015/09/08
Copyright
This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
conditions. The main licensing options available are GPL V2 or Commercial:
Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your
application with everyone you distribute it to, and you also want to give them
the right to share who uses it. If you wish to use this software under Open
Source Licensing, you must contribute all your source code to the open source
community in accordance with the GPL Version 2 when your application is
distributed. See http://www.gnu.org/copyleft/gpl.html
Description
This file is a drive for MeCompass module, It supports MeCompass V1.0 device provided by MakeBlock.
Method List:
  1. void MeCompass::setpin(uint8_t keyPin, uint8_t ledPin)
  2. void MeCompass::begin(void)
  3. bool MeCompass::testConnection(void)
  4. double MeCompass::getAngle(void)
  5. int16_t MeCompass::getHeadingX(void)
  6. int16_t MeCompass::getHeadingY(void)
  7. int16_t MeCompass::getHeadingZ(void)
  8. int16_t MeCompass::getHeading(int16_t *x, int16_t *y, int16_t *z)
History:
<Author>         <Time>        <Version>        <Descr>
Lawrence         2015/09/03           1.0.0       Rebuild the old lib.
Lawrence         2015/09/08           1.0.1       Added some comments and macros.

Macro Definition Documentation

#define COMPASS_AVERAGING_1   (0x00)
#define COMPASS_AVERAGING_2   (0x20)
#define COMPASS_AVERAGING_4   (0x40)
#define COMPASS_AVERAGING_8   (0x60)
#define COMPASS_BIAS_NEGATIVE   (0x02)
#define COMPASS_BIAS_NORMAL   (0x00)
#define COMPASS_BIAS_POSITIVE   (0x01)
#define COMPASS_DEFAULT_ADDRESS   (0x1E)
#define COMPASS_GAIN_1090   (0x20)
#define COMPASS_GAIN_1370   (0x00)
#define COMPASS_GAIN_220   (0xE0)
#define COMPASS_GAIN_330   (0xC0)
#define COMPASS_GAIN_390   (0xA0)
#define COMPASS_GAIN_440   (0x80)
#define COMPASS_GAIN_660   (0x60)
#define COMPASS_GAIN_820   (0x40)
#define COMPASS_MODE_CONTINUOUS   (0x00)
#define COMPASS_MODE_IDLE   (0x02)
#define COMPASS_MODE_SINGLE   (0x01)
#define COMPASS_PI   3.14159265F
#define COMPASS_RA_CONFIG_A   (0x00)
#define COMPASS_RA_CONFIG_B   (0x01)
#define COMPASS_RA_DATAX_H   (0x03)
#define COMPASS_RA_DATAX_L   (0x04)
#define COMPASS_RA_DATAY_H   (0x07)
#define COMPASS_RA_DATAY_L   (0x08)
#define COMPASS_RA_DATAZ_H   (0x05)
#define COMPASS_RA_DATAZ_L   (0x06)
#define COMPASS_RA_ID_A   (0x0A)
#define COMPASS_RA_ID_B   (0x0B)
#define COMPASS_RA_ID_C   (0x0C)
#define COMPASS_RA_MODE   (0x02)
#define COMPASS_RA_STATUS   (0x09)
#define COMPASS_RATE_0P75   (0x00)
#define COMPASS_RATE_15   (0x10)
#define COMPASS_RATE_1P5   (0x40)
#define COMPASS_RATE_3   (0x08)
#define COMPASS_RATE_30   (0x14)
#define COMPASS_RATE_75   (0x18)
#define COMPASS_RATE_7P5   (0x0C)
#define I2C_ERROR   (-1)
#define START_ADDRESS_OF_EEPROM_BUFFER   (int16_t)(0x00)