add .travis.yml and .gitignore; I2C.read_into -> readinto
This commit is contained in:
parent
e731810cfd
commit
47b7a5cd5f
3 changed files with 58 additions and 2 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_ads21x15.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
|
||||
|
|
@ -192,7 +192,7 @@ class ADS1x15(object):
|
|||
# Retrieve the result.
|
||||
self.buf[0] = ADS1x15_POINTER_CONVERSION
|
||||
i2c.write(self.buf, end=1, stop=False)
|
||||
i2c.read_into(self.buf, start=1)
|
||||
i2c.readinto(self.buf, start=1)
|
||||
return self._conversion_value(self.buf[2], self.buf[1])
|
||||
|
||||
def stop_adc(self):
|
||||
|
|
@ -215,5 +215,5 @@ class ADS1x15(object):
|
|||
self.buf[0] = ADS1x15_POINTER_CONVERSION
|
||||
with self.i2c_device as i2c:
|
||||
i2c.write(self.buf, end=1, stop=False)
|
||||
i2c.read_into(self.buf, start=1)
|
||||
i2c.readinto(self.buf, start=1)
|
||||
return self._conversion_value(self.buf[2], self.buf[1])
|
||||
|
|
|
|||
Loading…
Reference in a new issue