pressure = 1048576. - raw_press pressure = (pressure - var2 / 4096.) * 6250. / var1 var1 = calib_data.dig_P9 * pressure * pressure / 2147483648. var2 = pressure * calib_data.dig_P8 / 32768. pressure = pressure + (var1 + var2 + calib_data.dig_P7) / 16. if pressure < 30000.: return 30000. if pressure > 110000.0: return 110000.0 return pressure # ############################################################################ # Main routine. if __name__ == "__main__": # Initialization of the Application Board 2.0 BOARD = BST.UserApplicationBoard() bst_init_brd_app20() BME280_CS_PIN = BST.ShuttleBoardPin.COINES_SHUTTLE_PIN_7 # Note: The I2C address could be changed to 0x77 by setting a HIGH signal to the SDO pin of # BME280, however this is not possible with the current implementation of the COINES layer BME280_I2C_ADDR = CONSTANTS['BME280_I2C_ADDR_PRIM'] #myif = 'spi' myif = 'i2c' print('\n +++ Interface: ' + myif + ' +++\n') BOARD.SetVDD(0) BOARD.SetVDDIO(0)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ (c) Bosch Sensortec GmbH, Reutlingen, Germany 20. Nov 2019 Install `coinespy` before running this script $ pip install coinespy """ import coinespy as BST if __name__ == "__main__": board = BST.UserApplicationBoard() # If you get an error message on startup, that coineslib could not be loaded, then # intialize the UserApplicationBoard object with the path to the library, e.g. #(WIN)board = BST.UserApplicationBoard(r'libcoines.dll') #(LINUX)board = BST.UserApplicationBoard(r'libcoines.so') board.PCInterfaceConfig(BST.PCINTERFACE.USB) if board.ERRORCODE != 0: print('Could not connect to board: %d' % (board.ERRORCODE)) else: b_info = board.GetBoardInfo() print('BoardInfo: HW/SW ID: ' + hex(b_info.HardwareId) + '/' + hex(b_info.SoftwareId)) board.ClosePCInterface()