/* * Copyright (c) 2015-2016 Infineon Technologies AG * * Driver for Infineon DPS310 Digital Barometric Pressure Sensor * * */ #include #include #include "dps310.h" #include "main.h" #include "lis3dh_driver.h" /*bus communication protocol stubs * Please wrap around platform specific implementation * for low level bus handling (I2C or SPI), that matches * prototypes provided by dps310_bus_connection structure * in dps310.h */ void delay_us(uint32_t nTimer); /* Should return -1 in case of failure otherwise valid contents*/ s16 test_read_byte(u8 ReadAddr) { uint8_t temp=0; IIC2_Start(); IIC2_Send_Byte(0xee); //·¢ËÍдÃüÁî IIC2_Wait_Ack(); IIC2_Send_Byte(ReadAddr); //·¢ËͶÁµØÖ· IIC2_Wait_Ack(); IIC2_Start(); IIC2_Send_Byte(0xef); //·¢ËͶÁÃüÁ½øÈë½ÓÊÕģʽ IIC2_Wait_Ack(); temp=IIC2_Read_Byte(0); IIC2_Stop(); //²úÉúÒ»¸öÍ£Ö¹Ìõ¼þ return temp; } /* Should return -1 or negative value in case of failure otherwise length of * read contents in read_buffer * and shall place read contents in read_buffer */ s16 test_read_block(u8 ReadAddr, u8 Len, u8 *read_buffer) { uint8_t t; uint32_t temp=0; for(t=0;t