/*
 * ________________________________________________________________________________________________________
 * Copyright (c) 2017 InvenSense Inc. All rights reserved.
 *
 * This software, related documentation and any modifications thereto (collectively “Software”) is subject
 * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
 * and other intellectual property rights laws.
 *
 * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
 * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
 * from InvenSense is strictly prohibited.
 *
 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
 * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
 * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 * OF THE SOFTWARE.
 * ________________________________________________________________________________________________________
 */
#ifndef _SENSOR_H_
#define _SENSOR_H_

#include <stddef.h>
#include "Invn/EmbUtils/Message.h"
#include "Invn/EmbUtils/InvError.h"
#include "Invn/Devices/SensorTypes.h"
#include "Invn/Devices/Drivers/Icp101xx/Icp101xx.h"
#include "Invn/DynamicProtocol/DynProtocol.h"
#include "Invn/DynamicProtocol/DynProtocolTransportUart.h"
#include "Invn/VSensor/VSensorData.h"

#define MIN_PRESSURE_ODR_US       	25000	// 40Hz
#define MAX_PRESSURE_ODR_US       	1000000	// 1Hz
#define DEFAULT_PRESSURE_ODR_US   	25000	// 40Hz

/*
 * Sensor identifier for control function
 */
enum sensor {
	SENSOR_CUST_PRES,
	SENSOR_MAX
};

int invpres_acknowledgeReset(void);
void notify_pressure_event(uint64_t timestamp);
int invpres_sensor_setup(void);
int sensor_control(int enable);
int sensor_configure_odr(int odr_us);
void sensor_event(const inv_sensor_event_t * event, void * arg);
void convert_sensor_event_to_dyn_prot_data(const inv_sensor_event_t * event, VSensorDataAny * vsensor_data);
enum sensor idd_sensortype_conversion(int sensor);

#endif /* !_SENSOR_H_ */