{"id":13613051,"url":"https://github.com/khoulihan/micropython-mpl115a2","last_synced_at":"2025-12-30T17:20:15.815Z","repository":{"id":17899479,"uuid":"20854028","full_name":"khoulihan/micropython-mpl115a2","owner":"khoulihan","description":"Support for the MPL115A2 barometric pressure sensor from a pyboard.","archived":false,"fork":false,"pushed_at":"2014-06-15T11:38:17.000Z","size":144,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T21:41:42.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khoulihan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-15T11:34:36.000Z","updated_at":"2022-02-02T08:16:47.000Z","dependencies_parsed_at":"2022-09-14T22:42:11.838Z","dependency_job_id":null,"html_url":"https://github.com/khoulihan/micropython-mpl115a2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoulihan%2Fmicropython-mpl115a2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoulihan%2Fmicropython-mpl115a2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoulihan%2Fmicropython-mpl115a2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khoulihan%2Fmicropython-mpl115a2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khoulihan","download_url":"https://codeload.github.com/khoulihan/micropython-mpl115a2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248735885,"owners_count":21153495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:00:38.544Z","updated_at":"2025-12-30T17:20:15.800Z","avatar_url":"https://github.com/khoulihan.png","language":null,"funding_links":[],"categories":["Libraries","精选驱动库"],"sub_categories":["Sensors","传感器"],"readme":"micropython-mpl115a2\n====================\n\nImplements support for the Freescale MPL115A2 barometric pressure sensor.\n\nCopyright (c) 2014 by Kevin Houlihan\nLicense: MIT, see LICENSE for more details.\n\n\nUsage\n=====\n\nThe main functionality of this module is contained in the Mpl115A2 class, which\nwraps an I2C object from the pyb module to control an MPL115A2 device. The RST\nand SHDN pins can also optionally be controlled via Pin objects.\n\nThe device must be instructed to convert its sensor data by calling the\ninitiate_conversion method. The readings should be ready after about 3ms.\n\n    bus = I2C(1, I2C.MASTER)\n    sensor = Mpl115A2(bus)\n    sensor.initiate_conversion()\n    pyb.delay(3)\n    print(sensor.temperature)\n    print(sensor.pressure)\n\n\nShutdown and Reset\n==================\n\nThe device can be shut down when not required to save power. This is not done\nvia I2C, but is controlled by a GPIO pin. A Pin object or name can be passed to\nthe constructor to allow this state to be managed.\n\n    sensor = Mpl115A2(bus, shutdown_pin='X9')\n    sensor.shutdown = True\n\nAnother pin can be used to \"reset\" the device. That is Freescale's term, not mine,\nand it is poorly documented, but apparently it shuts down the I2C interface.\n\n    sensor = Mpl115A2(bus, reset_pin='X10')\n    sensor.reset = True\n\nWhen the device is awoken from a shutdown or reset state, it takes up to 5ms before\nit is ready to respond to commands.\n\n    sensor.shutdown = False\n    pyb.delay(5)\n    sensor.initiate_conversion()\n\n\nTemperature and Pressure Scales/Units\n=====================================\n\nBy default, the temperature is in celsius and the pressure is in kilopascals. \nIf other scales/units are preferred, convertors can be provided to the constructor.\nFahrenheit and Kelvin convertor classes are included in this module for temperature.\nThe pressure convertors also allow an adjustment to be specified, which is intended\nfor adjusting the pressure to sea-level. As such, there is a convertor for\nAdjustedKiloPascals, HectoPascals, Atmospheres, PSI and Bars.\n\n    sensor = Mpl115A2(\n        bus, \n        temperature_convertor=Fahrenheit(),\n        pressure_convertor=HectoPascals(0.9)\n    )\n\nCustom convertors can be provided as objects with these signatures:\n\n    class TemperatureScaleUnit(object):\n\n        def convert_to(self, temperature):\n            '''\n            Convert TO the custom unit FROM celsius.\n            '''\n            ...\n            return new_temp\n\n\n    class PressureScaleUnit(object):\n\n        def convert_to(self, pressure):\n            '''\n            Convert TO the custom unit FROM kPa.\n            '''\n            ...\n            return new_pressure","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhoulihan%2Fmicropython-mpl115a2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhoulihan%2Fmicropython-mpl115a2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhoulihan%2Fmicropython-mpl115a2/lists"}