init
This commit is contained in:
commit
1deea3c96c
10 changed files with 587 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
__pycache__
|
||||
_build
|
||||
*.pyc
|
||||
53
.travis.yml
Normal file
53
.travis.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Travis CI configuration for automated .mpy file generation.
|
||||
# Author: Tony DiCola
|
||||
# License: Public Domain
|
||||
# This configuration will work with Travis CI (travis-ci.org) to automacially
|
||||
# build .mpy files for CircuitPython when a new tagged release is created. This
|
||||
# file is relatively generic and can be shared across multiple repositories by
|
||||
# following these steps:
|
||||
# 1. Copy this file into a .travis.yml file in the root of the repository.
|
||||
# 2. Change the deploy > file section below to list each of the .mpy files
|
||||
# that should be generated. The config will automatically look for
|
||||
# .py files with the same name as the source for generating the .mpy files.
|
||||
# Note that the .mpy extension should be lower case!
|
||||
# 3. Commit the .travis.yml file and push it to GitHub.
|
||||
# 4. Go to travis-ci.org and find the repository (it needs to be setup to access
|
||||
# your github account, and your github account needs access to write to the
|
||||
# repo). Flip the 'ON' switch on for Travis and the repo, see the Travis
|
||||
# docs for more details: https://docs.travis-ci.com/user/getting-started/
|
||||
# 5. Get a GitHub 'personal access token' which has at least 'public_repo' or
|
||||
# 'repo' scope: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
|
||||
# Keep this token safe and secure! Anyone with the token will be able to
|
||||
# access and write to your GitHub repositories. Travis will use the token
|
||||
# to attach the .mpy files to the release.
|
||||
# 6. In the Travis CI settings for the repository that was enabled find the
|
||||
# environment variable editing page: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
|
||||
# Add an environment variable named GITHUB_TOKEN and set it to the value
|
||||
# of the GitHub personal access token above. Keep 'Display value in build
|
||||
# log' flipped off.
|
||||
# 7. That's it! Tag a release and Travis should go to work to add .mpy files
|
||||
# to the release. It takes about a 2-3 minutes for a worker to spin up,
|
||||
# build mpy-cross, and add the binaries to the release.
|
||||
language: generic
|
||||
|
||||
sudo: true
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GITHUB_TOKEN
|
||||
file:
|
||||
- "adafruit_bme280.mpy"
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
|
||||
before_install:
|
||||
- sudo apt-get -yqq update
|
||||
- sudo apt-get install -y build-essential git python python-pip
|
||||
- git clone https://github.com/adafruit/circuitpython.git
|
||||
- make -C circuitpython/mpy-cross
|
||||
- export PATH=$PATH:$PWD/circuitpython/mpy-cross/
|
||||
- sudo pip install shyaml
|
||||
|
||||
before_deploy:
|
||||
- shyaml get-values deploy.file < .travis.yml | sed 's/.mpy/.py/' | xargs -L1 mpy-cross
|
||||
74
CODE_OF_CONDUCT.md
Normal file
74
CODE_OF_CONDUCT.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at support@adafruit.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 ladyada for Adafruit Industries
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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 NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
44
README.rst
Normal file
44
README.rst
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
|
||||
Introduction
|
||||
============
|
||||
|
||||
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-BME280/badge/?version=latest
|
||||
:target: https://circuitpython.readthedocs.io/projects/BME280/en/latest/
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image :: https://img.shields.io/discord/327254708534116352.svg
|
||||
:target: https://discord.gg/nBQh6qu
|
||||
:alt: Discord
|
||||
|
||||
TODO
|
||||
|
||||
Dependencies
|
||||
=============
|
||||
This driver depends on:
|
||||
|
||||
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
|
||||
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
|
||||
|
||||
Please ensure all dependencies are available on the CircuitPython filesystem.
|
||||
This is easily achieved by downloading
|
||||
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
|
||||
|
||||
Usage Example
|
||||
=============
|
||||
|
||||
TODO
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
Contributions are welcome! Please read our `Code of Conduct
|
||||
<https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/master/CODE_OF_CONDUCT.md>`_
|
||||
before contributing to help this project stay welcoming.
|
||||
|
||||
API Reference
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
api
|
||||
239
adafruit_bme280.py
Normal file
239
adafruit_bme280.py
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2017 ladyada for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
"""
|
||||
`adafruit_bmp280`
|
||||
====================================================
|
||||
|
||||
CircuitPython driver from BME280 Temperature, Humidity and Barometic Pressure sensor
|
||||
|
||||
* Author(s): ladyada
|
||||
"""
|
||||
import time, math
|
||||
from micropython import const
|
||||
try:
|
||||
import struct
|
||||
except ImportError:
|
||||
import ustruct as struct
|
||||
|
||||
# I2C ADDRESS/BITS/SETTINGS
|
||||
# -----------------------------------------------------------------------
|
||||
_BME280_ADDRESS = const(0x77)
|
||||
_BME280_CHIPID = const(0x60)
|
||||
|
||||
_BME280_REGISTER_CHIPID = const(0xD0)
|
||||
_BME280_REGISTER_DIG_T1 = const(0x88)
|
||||
_BME280_REGISTER_DIG_H1 = const(0xA1)
|
||||
_BME280_REGISTER_DIG_H2 = const(0xE1)
|
||||
_BME280_REGISTER_DIG_H3 = const(0xE3)
|
||||
_BME280_REGISTER_DIG_H4 = const(0xE4)
|
||||
_BME280_REGISTER_DIG_H5 = const(0xE5)
|
||||
_BME280_REGISTER_DIG_H6 = const(0xE7)
|
||||
|
||||
_BME280_REGISTER_SOFTRESET = const(0xE0)
|
||||
_BME280_REGISTER_CTRL_HUM = const(0xF2)
|
||||
_BME280_REGISTER_STATUS = const(0xF3)
|
||||
_BME280_REGISTER_CTRL_MEAS = const(0xF4)
|
||||
_BME280_REGISTER_CONFIG = const(0xF5)
|
||||
_BME280_REGISTER_PRESSUREDATA = const(0xF7)
|
||||
_BME280_REGISTER_TEMPDATA = const(0xFA)
|
||||
_BME280_REGISTER_HUMIDDATA = const(0xFD)
|
||||
|
||||
_BME280_PRESSURE_MIN_HPA = const(300)
|
||||
_BME280_PRESSURE_MAX_HPA = const(1100)
|
||||
_BME280_HUMIDITY_MIN = const(0)
|
||||
_BME280_HUMIDITY_MAX = const(100)
|
||||
|
||||
class Adafruit_BME280:
|
||||
def __init__(self):
|
||||
"""Check the BME280 was found, read the coefficients and enable the sensor for continuous reads"""
|
||||
# Check device ID.
|
||||
id = self._read_byte(_BME280_REGISTER_CHIPID)
|
||||
if _BME280_CHIPID != id:
|
||||
raise RuntimeError('Failed to find BME280! Chip ID 0x%x' % id)
|
||||
self._write_register_byte(_BME280_REGISTER_SOFTRESET, 0xB6)
|
||||
time.sleep(0.5)
|
||||
self._read_coefficients()
|
||||
self.seaLevelhPa = 1013.25
|
||||
self._write_register_byte(_BME280_REGISTER_CTRL_HUM, 0x03) # turn on humidity oversample 16x
|
||||
|
||||
@property
|
||||
def temperature(self):
|
||||
"""Gets the compensated temperature in degrees celsius."""
|
||||
# perform one measurement
|
||||
self._write_register_byte(_BME280_REGISTER_CTRL_MEAS, 0xFE) # high res, forced mode
|
||||
|
||||
# Wait for conversion to complete
|
||||
while (self._read_byte(_BME280_REGISTER_STATUS) & 0x08):
|
||||
time.sleep(0.002)
|
||||
UT = self._read24(_BME280_REGISTER_TEMPDATA) / 16 # lowest 4 bits get dropped
|
||||
#print("raw temp: ", UT)
|
||||
|
||||
var1 = (UT / 16384.0 - self.dig_T1 / 1024.0) * self.dig_T2
|
||||
#print(var1)
|
||||
var2 = ((UT / 131072.0 - self.dig_T1 / 8192.0) * (
|
||||
UT / 131072.0 - self.dig_T1 / 8192.0)) * self.dig_T3
|
||||
#print(var2)
|
||||
|
||||
self.t_fine = int(var1 + var2)
|
||||
#print("t_fine: ", self.t_fine)
|
||||
|
||||
temp = (var1 + var2) / 5120.0
|
||||
return temp
|
||||
|
||||
@property
|
||||
def pressure(self):
|
||||
"""Gets the compensated pressure in hectoPascals."""
|
||||
self.temperature # force read of t_fine
|
||||
|
||||
# Algorithm from the BME280 driver https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c
|
||||
adc = self._read24(_BME280_REGISTER_PRESSUREDATA) / 16 # lowest 4 bits get dropped
|
||||
var1 = float(self.t_fine) / 2.0 - 64000.0
|
||||
var2 = var1 * var1 * self.dig_P6 / 32768.0
|
||||
var2 = var2 + var1 * self.dig_P5 * 2.0
|
||||
var2 = var2 / 4.0 + self.dig_P4 * 65536.0
|
||||
var3 = self.dig_P3 * var1 * var1 / 524288.0;
|
||||
var1 = (var3 + self.dig_P2 * var1) / 524288.0
|
||||
var1 = (1.0 + var1 / 32768.0) * self.dig_P1
|
||||
if var1 == 0:
|
||||
return 0
|
||||
if var1:
|
||||
p = 1048576.0 - adc
|
||||
p = ((p - var2 / 4096.0) * 6250.0) / var1
|
||||
var1 = self.dig_P9 * p * p / 2147483648.0
|
||||
var2 = p * self.dig_P8 / 32768.0
|
||||
p = p + (var1 + var2 + self.dig_P7) / 16.0
|
||||
|
||||
p /= 100
|
||||
if (p < _BME280_PRESSURE_MIN_HPA): return _BME280_PRESSURE_MIN_HPA
|
||||
if (p > _BME280_PRESSURE_MAX_HPA): return _BME280_PRESSURE_MAX_HPA
|
||||
return p
|
||||
else:
|
||||
return _BME280_PRESSURE_MIN_HPA
|
||||
|
||||
@property
|
||||
def humidity(self):
|
||||
self.temperature # force read of t_fine
|
||||
hum = self._read_register(_BME280_REGISTER_HUMIDDATA, 2)
|
||||
#print("Humidity data: ", hum)
|
||||
adc = float(hum[0] << 8 | hum[1])
|
||||
#print("adc:", adc)
|
||||
|
||||
# Algorithm from the BME280 driver https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c
|
||||
var1 = float(self.t_fine) - 76800.0
|
||||
#print("var1 ", var1)
|
||||
var2 = (self.dig_H4 * 64.0 + (self.dig_H5 / 16384.0) * var1)
|
||||
#print("var2 ",var2)
|
||||
var3 = adc - var2
|
||||
#print("var3 ",var3)
|
||||
var4 = self.dig_H2 / 65536.0
|
||||
#print("var4 ",var4)
|
||||
var5 = (1.0 + (self.dig_H3 / 67108864.0) * var1)
|
||||
#print("var5 ",var5)
|
||||
var6 = 1.0 + (self.dig_H6 / 67108864.0) * var1 * var5
|
||||
#print("var6 ",var6)
|
||||
var6 = var3 * var4 * (var5 * var6)
|
||||
humidity = var6 * (1.0 - self.dig_H1 * var6 / 524288.0)
|
||||
|
||||
if (humidity > _BME280_HUMIDITY_MAX): return _BME280_HUMIDITY_MAX
|
||||
if (humidity < _BME280_HUMIDITY_MIN): return _BME280_HUMIDITY_MIN
|
||||
# else...
|
||||
return humidity
|
||||
|
||||
@property
|
||||
def altitude(self):
|
||||
"""calculate the altitude based on the sea level pressure (seaLevelhPa) - which you must enter ahead of time)"""
|
||||
p = self.pressure # in Si units for hPascal
|
||||
return 44330 * (1.0 - math.pow(p / self.seaLevelhPa, 0.1903));
|
||||
|
||||
def _read_coefficients(self):
|
||||
"""Read & save the calibration coefficients"""
|
||||
coeff = self._read_register(_BME280_REGISTER_DIG_T1, 24)
|
||||
coeff = list(struct.unpack('<HhhHhhhhhhhh', bytes(coeff)))
|
||||
coeff = [float(i) for i in coeff]
|
||||
self.dig_T1, self.dig_T2, self.dig_T3 , self.dig_P1, self.dig_P2, self.dig_P3, self.dig_P4, self.dig_P5, self.dig_P6, self.dig_P7, self.dig_P8, self.dig_P9 = coeff
|
||||
|
||||
self.dig_H1 = self._read_byte(_BME280_REGISTER_DIG_H1)
|
||||
coeff = self._read_register(_BME280_REGISTER_DIG_H2, 7)
|
||||
coeff = list(struct.unpack('<hBBBBb', bytes(coeff)))
|
||||
self.dig_H2 = float(coeff[0])
|
||||
self.dig_H3 = float(coeff[1])
|
||||
self.dig_H4 = float((coeff[2] << 4) | (coeff[3] & 0xF))
|
||||
self.dig_H5 = float(((coeff[3] & 0xF0) << 4) | coeff[4])
|
||||
self.dig_H6 = float(coeff[5])
|
||||
|
||||
#print("%d %d %d" % (self.dig_T1, self.dig_T2, self.dig_T3))
|
||||
#print("%d %d %d" % (self.dig_P1, self.dig_P2, self.dig_P3))
|
||||
#print("%d %d %d" % (self.dig_P4, self.dig_P5, self.dig_P6))
|
||||
#print("%d %d %d" % (self.dig_P7, self.dig_P8, self.dig_P9))
|
||||
#print("%d %d %d" % (self.dig_H1, self.dig_H2, self.dig_H3))
|
||||
#print("%d %d %d" % (self.dig_H4, self.dig_H5, self.dig_H6))
|
||||
|
||||
def _read_byte(self, register):
|
||||
"""Read a byte register value and return it"""
|
||||
return self._read_register(register, 1)[0]
|
||||
|
||||
def _read24(self, register):
|
||||
"""Read an unsigned 24-bit value as a floating point and return it."""
|
||||
ret = 0.0
|
||||
for b in self._read_register(register, 3):
|
||||
ret *= 256.0
|
||||
ret += float(b & 0xFF)
|
||||
return ret
|
||||
|
||||
class Adafruit_BME280_I2C(Adafruit_BME280):
|
||||
def __init__(self, i2c, address=_BME280_ADDRESS):
|
||||
import adafruit_bus_device.i2c_device as i2c_device
|
||||
self._i2c = i2c_device.I2CDevice(i2c, address)
|
||||
super().__init__()
|
||||
|
||||
def _read_register(self, register, length):
|
||||
with self._i2c as i2c:
|
||||
i2c.write(bytes([register & 0xFF]))
|
||||
result = bytearray(length)
|
||||
i2c.read_into(result)
|
||||
#print("$%02X => %s" % (register, [hex(i) for i in result]))
|
||||
return result
|
||||
|
||||
def _write_register_byte(self, register, value):
|
||||
with self._i2c as i2c:
|
||||
i2c.write(bytes([register & 0xFF, value & 0xFF]))
|
||||
#print("$%02X <= 0x%02X" % (register, value))
|
||||
|
||||
class Adafruit_BME280_SPI(Adafruit_BME280):
|
||||
def __init__(self, spi, cs, baudrate=100000):
|
||||
import adafruit_bus_device.spi_device as spi_device
|
||||
self._spi = spi_device.SPIDevice(spi, cs, baudrate=baudrate)
|
||||
super().__init__()
|
||||
|
||||
def _read_register(self, register, length):
|
||||
register = (register | 0x80) & 0xFF # Read single, bit 7 high.
|
||||
with self._spi as spi:
|
||||
spi.write(bytearray([register]))
|
||||
result = bytearray(length)
|
||||
spi.readinto(result)
|
||||
#print("$%02X => %s" % (register, [hex(i) for i in result]))
|
||||
return result
|
||||
|
||||
def _write_register_byte(self, register, value):
|
||||
register &= 0x7F # Write, bit 7 low.
|
||||
with self._spi as spi:
|
||||
spi.write(bytes([register, value & 0xFF]))
|
||||
5
api.rst
Normal file
5
api.rst
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
.. If you created a package, create one automodule per module in the package.
|
||||
|
||||
.. automodule:: adafruit_bme280
|
||||
:members:
|
||||
145
conf.py
Normal file
145
conf.py
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.viewcode',
|
||||
]
|
||||
|
||||
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'README'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Adafruit BME280 Library'
|
||||
copyright = u'2017 ladyada'
|
||||
author = u'ladyada'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'1.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'1.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#
|
||||
default_role = "any"
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#
|
||||
add_function_parentheses = True
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
|
||||
except:
|
||||
html_theme = 'default'
|
||||
html_theme_path = ['.']
|
||||
else:
|
||||
html_theme_path = ['.']
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'AdafruitBME280Librarydoc'
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'AdafruitBME280Library.tex', u'Adafruit BME280 Library Documentation',
|
||||
author, 'manual'),
|
||||
]
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'adafruitBME280library', u'Adafruit BME280 Library Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'AdafruitBME280Library', u'Adafruit BME280 Library Documentation',
|
||||
author, 'AdafruitBME280Library', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# API docs fix
|
||||
autodoc_mock_imports = ['micropython']
|
||||
2
readthedocs.yml
Normal file
2
readthedocs.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
requirements_file: requirements.txt
|
||||
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
adafruit-circuitpython-bus-device
|
||||
Loading…
Reference in a new issue