initial

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mpu_mbed_config.h Source File

mpu_mbed_config.h

00001 
00002 
00003 #ifndef _MPU_MBED_CONFIG_H_
00004 #define _MPU_MBED_CONFIG_H_
00005 
00006 #include "wait_api.h"
00007 #include "us_ticker_api.h"
00008 
00009 //#define MPU_USE_I2C
00010 #define MPU_USE_SPI
00011 
00012 #define MPU9250
00013 //#define MPU6050
00014 
00015 #ifdef MPU_USE_I2C
00016 #include "mbed_i2c.h"
00017 #define mpu_hal_write(a, b, c, d)   mbed_i2c_write(a, b, c, d)
00018 #define mpu_hal_read(a, b, c, d)    mbed_i2c_read(a, b, c, d)
00019 
00020 #else // MPU_USE_SPI
00021 #include "mbed_spi.h"
00022 #define mpu_hal_write(a, b, c, d)   mbed_spi_write(b, c, d)
00023 #define mpu_hal_read(a, b, c, d)    mbed_spi_read(b, c, d)
00024 
00025 #endif
00026 
00027 #define __no_operation              __nop
00028 #define delay_ms                    wait_ms
00029 #define log_i(args...)              //printf(args)
00030 #define log_e(args...)              //printf(args)
00031 #define labs                        abs
00032 #define fabs(x)                     (((x)>0)?(x):-(x))
00033 #define min(x, y)                   (((x) < (y)) ? (x) : (y))
00034 
00035 static inline unsigned long get_ms(unsigned long *t)
00036 {
00037     unsigned long ms = us_ticker_read() / 1000;
00038     *t = ms;
00039     return ms;
00040 }
00041 static inline int reg_int_cb(struct int_param_s *int_param)
00042 {
00043     return 0;
00044 }
00045 
00046 #endif // _MPU_MBED_CONFIG_H_