//SUBLIME 3 TEXTFOLDING ctrl + shift + [  FOLDS and ctrl + shift + ] UNFLODS

#ifndef inv_ERmini_h
#define inv_ERmini_h

#include "stdbool.h"
#include "stdint.h"
#include "nrf_delay.h"          //nrf_delay_ms(50);
#include "SEGGER_RTT.h"
#include "app_error.h"
#include "string.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "boards.h"
#include "timestamping.h"
#include "nrf_drv_gpiote.h"
#include "GPIO.h"
#include "inv_mpu.h"
#include "nrf_drv_clock.h"
#include "nrf_twi_mngr.h"

#define MPUaddress (0xD0U>>1)
#define WOM_THR	0x1F
#define WHOamI	0x75

#define plusOne       + 1
#define plusTwo       + 2

#define i2c_write	mpu_i2c_write
#define i2c_read	mpu_i2c_read
#define delay_ms	nrf_delay_ms
#define get_tick_count  ms_get
#define get_ms      ms_get

#define MPL_LOGI    NRF_LOG_INFO
#define MPL_LOGE    NRF_LOG_ERROR

#define log_i       NRF_LOG_INFO
#define log_e		NRF_LOG_ERROR

#define min(a,b) ((a<b)?a:b)

#define __no_operation __NOP

void ERmini_init(void);
void twi_handler(nrf_drv_twi_evt_t const * , void * );
int mpu_i2c_write(uint8_t, uint8_t , uint8_t , uint8_t * );
int mpu_i2c_read(uint8_t , uint8_t , uint8_t , uint8_t *  );
void no_func1(unsigned long *);
void ms_get(unsigned long *);
uint16_t USART_ReceiveData(uint16_t);

#endif