compass KRI 2018
Embed:
(wiki syntax)
Show/hide line numbers
CMPS_KRAI.h
00001 /** 00002 * adopted from 00003 * CMPS03 by: Aarom Berk 00004 * 00005 * Bismillahirahmanirrahim 00006 */ 00007 00008 #ifndef CMPS_KRAI_H 00009 #define CMPS_KRAI_H 00010 00011 /** 00012 * Includes 00013 */ 00014 #include "mbed.h" 00015 00016 #define CMPS_DEFAULT_I2C_ADDRESS 0xC0 00017 //set register kompas 00018 #define SOFTWARE_REVISION_REG 0x0 00019 #define COMPASS_BEARING_WORD_REG 0x2 00020 00021 //Inisiasi I2C komunikasi dari kompas 00022 class CMPS_KRAI { 00023 00024 I2C* i2c; 00025 int i2cAddress; 00026 00027 public: 00028 00029 /** 00030 * Constructor. 00031 * 00032 * @param sda mbed pin to use for I2C SDA 00033 * @param scl mbed pin to use for I2C SCL 00034 * @param address I2C address of this device. 00035 */ 00036 CMPS_KRAI(PinName sda, PinName scl, int address); 00037 00038 /** 00039 * Membaca revisi dari kompas 00040 */ 00041 char readSoftwareRevision(void); 00042 00043 /** 00044 * Membaca nilai dari kompas 00045 * Range nilai 0 - 3599 00046 */ 00047 int readBearing(void); 00048 00049 /** 00050 * Kalibrasi kompas 00051 */ 00052 void calibrate(void); 00053 00054 /** 00055 * Stop calibrate 00056 */ 00057 void stopCalibrate(void); 00058 }; 00059 00060 #endif /* CMPS_KRAI_H */
Generated on Tue Aug 9 2022 20:15:42 by 1.7.2