├── .gitignore ├── Doxyfile ├── LICENSE.txt ├── README.md ├── code_of_conduct.md ├── docs ├── doxygen_sqlite3.db ├── html │ ├── README_8md_source.html │ ├── arrowdown.png │ ├── arrowright.png │ ├── bc_s.png │ ├── bdwn.png │ ├── closed.png │ ├── code__of__conduct_8md.html │ ├── code__of__conduct_8md_source.html │ ├── dir_000000_000001.html │ ├── dir_d28a4824dc47e487b107a5db32ef43c4.html │ ├── dir_d28a4824dc47e487b107a5db32ef43c4_dep.map │ ├── dir_d28a4824dc47e487b107a5db32ef43c4_dep.md5 │ ├── dir_d28a4824dc47e487b107a5db32ef43c4_dep.png │ ├── dir_d44c64559bbebec7f509842c48db8b23.html │ ├── dir_d44c64559bbebec7f509842c48db8b23_dep.map │ ├── dir_d44c64559bbebec7f509842c48db8b23_dep.md5 │ ├── dir_d44c64559bbebec7f509842c48db8b23_dep.png │ ├── doc.png │ ├── doxygen.css │ ├── doxygen.png │ ├── dynsections.js │ ├── examples.html │ ├── files.html │ ├── folderclosed.png │ ├── folderopen.png │ ├── globals.html │ ├── globals_enum.html │ ├── globals_eval.html │ ├── globals_func.html │ ├── graph_legend.html │ ├── graph_legend.md5 │ ├── graph_legend.png │ ├── i2c__htu21d_8c.html │ ├── i2c__htu21d_8c__incl.map │ ├── i2c__htu21d_8c__incl.md5 │ ├── i2c__htu21d_8c__incl.png │ ├── i2c__htu21d_8c_source.html │ ├── i2c_htu21d_8c-example.html │ ├── i2cdriver_8h.html │ ├── i2cdriver_8h__dep__incl.map │ ├── i2cdriver_8h__dep__incl.md5 │ ├── i2cdriver_8h__dep__incl.png │ ├── i2cdriver_8h__incl.map │ ├── i2cdriver_8h__incl.md5 │ ├── i2cdriver_8h__incl.png │ ├── i2cdriver_8h_source.html │ ├── index.html │ ├── jquery.js │ ├── md_code_of_conduct.html │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── pages.html │ ├── search │ │ ├── all_0.html │ │ ├── all_0.js │ │ ├── all_1.html │ │ ├── all_1.js │ │ ├── all_2.html │ │ ├── all_2.js │ │ ├── all_3.html │ │ ├── all_3.js │ │ ├── all_4.html │ │ ├── all_4.js │ │ ├── close.png │ │ ├── enums_0.html │ │ ├── enums_0.js │ │ ├── enumvalues_0.html │ │ ├── enumvalues_0.js │ │ ├── files_0.html │ │ ├── files_0.js │ │ ├── files_1.html │ │ ├── files_1.js │ │ ├── files_2.html │ │ ├── files_2.js │ │ ├── functions_0.html │ │ ├── functions_0.js │ │ ├── functions_1.html │ │ ├── functions_1.js │ │ ├── functions_2.html │ │ ├── functions_2.js │ │ ├── functions_3.html │ │ ├── functions_3.js │ │ ├── mag_sel.png │ │ ├── nomatches.html │ │ ├── pages_0.html │ │ ├── pages_0.js │ │ ├── pages_1.html │ │ ├── pages_1.js │ │ ├── search.css │ │ ├── search.js │ │ ├── search_l.png │ │ ├── search_m.png │ │ ├── search_r.png │ │ └── searchdata.js │ ├── spi__ad7390_8c.html │ ├── spi__ad7390_8c__incl.map │ ├── spi__ad7390_8c__incl.md5 │ ├── spi__ad7390_8c__incl.png │ ├── spi__ad7390_8c_source.html │ ├── spidriver_8h.html │ ├── spidriver_8h__dep__incl.map │ ├── spidriver_8h__dep__incl.md5 │ ├── spidriver_8h__dep__incl.png │ ├── spidriver_8h__incl.map │ ├── spidriver_8h__incl.md5 │ ├── spidriver_8h__incl.png │ ├── spidriver_8h_source.html │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css └── serbus-v1.0.2.pdf ├── examples ├── Makefile ├── bin │ └── .empty ├── i2c_htu21d.c └── spi_ad7390.c ├── include ├── i2cdriver.h └── spidriver.h ├── python ├── .gitignore ├── LICENSE.txt ├── MANIFEST.in ├── README.md ├── docs │ ├── I2C.rst │ ├── Makefile │ ├── SPI.rst │ ├── _build │ │ ├── doctrees │ │ │ ├── I2C.doctree │ │ │ ├── SPI.doctree │ │ │ ├── environment.pickle │ │ │ ├── index.doctree │ │ │ └── install.doctree │ │ └── html │ │ │ ├── .buildinfo │ │ │ ├── I2C.html │ │ │ ├── SPI.html │ │ │ ├── _sources │ │ │ ├── I2C.txt │ │ │ ├── SPI.txt │ │ │ ├── index.txt │ │ │ └── install.txt │ │ │ ├── _static │ │ │ ├── ajax-loader.gif │ │ │ ├── basic.css │ │ │ ├── comment-bright.png │ │ │ ├── comment-close.png │ │ │ ├── comment.png │ │ │ ├── css │ │ │ │ ├── badge_only.css │ │ │ │ └── theme.css │ │ │ ├── doctools.js │ │ │ ├── down-pressed.png │ │ │ ├── down.png │ │ │ ├── file.png │ │ │ ├── fonts │ │ │ │ ├── Inconsolata-Bold.ttf │ │ │ │ ├── Inconsolata-Regular.ttf │ │ │ │ ├── Lato-Bold.ttf │ │ │ │ ├── Lato-Regular.ttf │ │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ │ ├── RobotoSlab-Regular.ttf │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ ├── fontawesome-webfont.svg │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ └── fontawesome-webfont.woff │ │ │ ├── jquery-1.11.1.js │ │ │ ├── jquery.js │ │ │ ├── js │ │ │ │ ├── modernizr.min.js │ │ │ │ └── theme.js │ │ │ ├── minus.png │ │ │ ├── plus.png │ │ │ ├── pygments.css │ │ │ ├── searchtools.js │ │ │ ├── underscore-1.3.1.js │ │ │ ├── underscore.js │ │ │ ├── up-pressed.png │ │ │ ├── up.png │ │ │ └── websupport.js │ │ │ ├── genindex.html │ │ │ ├── index.html │ │ │ ├── install.html │ │ │ ├── objects.inv │ │ │ ├── search.html │ │ │ └── searchindex.js │ ├── conf.py │ ├── index.rst │ ├── install.rst │ └── make.bat ├── examples │ ├── i2c_eeprom.py │ ├── i2c_htu21d.py │ ├── i2c_read.py │ ├── i2c_write.py │ ├── spi_ad7390.py │ └── spi_read.py ├── include ├── serbus │ ├── __init__.py │ ├── pyi2cdev.c │ └── pyspidev.c ├── setup.cfg ├── setup.py └── src └── src ├── i2cdriver.c └── spidriver.c /.gitignore: -------------------------------------------------------------------------------- 1 | docs/latex 2 | examples/*.o 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Serbus 2 | 3 | Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 4 | 5 | Serbus provides basic C APIs for the I2C and SPI serial bus protocols on 6 | GNU/Linux based systems, as well as a Python package built on top of them. 7 | 8 | It's really just a wrapper for the ioctl commands provided by the standard Linux 9 | I2C and SPI drivers, so it should be pretty universal. That said, I've currently 10 | only tested it extensively on the BeagleBone Black, so use it at your own risk! 11 | (And let me know if it's working for you on another system) 12 | 13 | * Source code: https://github.com/graycatlabs/serbus/ 14 | * C API documentation: https://graycat.io/docs/serbus/ 15 | * Python API documentation: https://graycat.io/docs/serbus/python/ 16 | 17 | [![Build Status](https://ci.graycat.io/buildStatus/icon?job=serbus)](https://ci.graycat.io/job/serbus/) 18 | 19 | ## Contributing 20 | 21 | Have something to contribute? Great! This project follows the Contributor 22 | Covenant Code of Conduct, so be sure to read `code_of_conduct.md`. 23 | 24 | ## License 25 | 26 | Released under the MIT license. 27 | 28 | Permission is hereby granted, free of charge, to any person obtaining a copy 29 | of this software and associated documentation files (the "Software"), to deal 30 | in the Software without restriction, including without limitation the rights 31 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 32 | copies of the Software, and to permit persons to whom the Software is 33 | furnished to do so, subject to the following conditions: 34 | 35 | The above copyright notice and this permission notice shall be included in 36 | all copies or substantial portions of the Software. 37 | 38 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 39 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 40 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 42 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 43 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 44 | THE SOFTWARE. 45 | -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. 6 | 7 | Examples of unacceptable behavior by participants include: 8 | 9 | * The use of sexualized language or imagery 10 | * Personal attacks 11 | * Trolling or insulting/derogatory comments 12 | * Public or private harassment 13 | * Publishing other's private information, such as physical or electronic addresses, without explicit permission 14 | * Other unethical or unprofessional conduct 15 | 16 | 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. 17 | 18 | By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. 19 | 20 | This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. 21 | 22 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. 23 | 24 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/) 25 | -------------------------------------------------------------------------------- /docs/doxygen_sqlite3.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/doxygen_sqlite3.db -------------------------------------------------------------------------------- /docs/html/arrowdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/arrowdown.png -------------------------------------------------------------------------------- /docs/html/arrowright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/arrowright.png -------------------------------------------------------------------------------- /docs/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/bc_s.png -------------------------------------------------------------------------------- /docs/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/bdwn.png -------------------------------------------------------------------------------- /docs/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/closed.png -------------------------------------------------------------------------------- /docs/html/code__of__conduct_8md.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: code_of_conduct.md File Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.2 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 | 70 |
74 |
75 | 76 | 77 |
78 | 81 |
82 | 83 |
84 |
85 |
86 |
code_of_conduct.md File Reference
87 |
88 |
89 | 90 |

Go to the source code of this file.

91 |

Detailed Description

92 |

License

93 |

Released under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy
 94 | of this software and associated documentation files (the "Software"), to deal
 95 | in the Software without restriction, including without limitation the rights
 96 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 97 | copies of the Software, and to permit persons to whom the Software is
 98 | furnished to do so, subject to the following conditions:
 99 | 
100 | The above copyright notice and this permission notice shall be included in
101 | all copies or substantial portions of the Software.
102 | 
103 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
108 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
109 | THE SOFTWARE. 
110 |

Definition in file code_of_conduct.md.

111 |
112 | 113 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/html/code__of__conduct_8md_source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: code_of_conduct.md Source File 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 |
70 | 71 |
75 |
76 | 77 | 78 |
79 | 82 |
83 | 84 |
85 |
86 |
code_of_conduct.md
87 |
88 |
89 |
1 # Contributor Code of Conduct
2 
3 As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4 
5 We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6 
7 Examples of unacceptable behavior by participants include:
8 
9 * The use of sexualized language or imagery
10 * Personal attacks
11 * Trolling or insulting/derogatory comments
12 * Public or private harassment
13 * Publishing other's private information, such as physical or electronic addresses, without explicit permission
14 * Other unethical or unprofessional conduct
15 
16 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.
17 
18 By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
19 
20 This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
21 
22 Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at <alex@graycat.io>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
23 
24 This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/](http://contributor-covenant.org/version/1/3/0/)
90 | 91 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/html/dir_000000_000001.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: examples -> include Relation 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 64 |
68 |
69 | 70 | 71 |
72 | 75 |
76 | 77 | 81 |
82 |
83 |

examples → include Relation

File in examplesIncludes file in include
i2c_htu21d.ci2cdriver.h
spi_ad7390.cspidriver.h
84 | 85 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/html/dir_d28a4824dc47e487b107a5db32ef43c4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: examples Directory Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 | 70 |
74 |
75 | 76 | 77 |
78 | 81 |
82 | 83 | 87 |
88 |
89 |
90 |
examples Directory Reference
91 |
92 |
93 |
94 | Directory dependency graph for examples:
95 |
96 |
examples
97 | 98 | 99 | 100 | 101 | 102 |
103 | 104 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |

105 | Files

file  i2c_htu21d.c [code]
 Uses serbus to get RH and temperature data from an HTU21D.
 
file  spi_ad7390.c [code]
 Uses serbus to control an AD7390 DAC.
 
113 |
114 | 115 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /docs/html/dir_d28a4824dc47e487b107a5db32ef43c4_dep.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/html/dir_d28a4824dc47e487b107a5db32ef43c4_dep.md5: -------------------------------------------------------------------------------- 1 | 3b112f2a394fbcd8ace115c32cf78d20 -------------------------------------------------------------------------------- /docs/html/dir_d28a4824dc47e487b107a5db32ef43c4_dep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/dir_d28a4824dc47e487b107a5db32ef43c4_dep.png -------------------------------------------------------------------------------- /docs/html/dir_d44c64559bbebec7f509842c48db8b23.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: include Directory Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 | 70 |
74 |
75 | 76 | 77 |
78 | 81 |
82 | 83 | 87 |
88 |
89 |
90 |
include Directory Reference
91 |
92 |
93 | 94 | 96 | 97 | 98 | 99 | 100 | 101 | 102 |

95 | Files

file  i2cdriver.h [code]
 A basic driver for controlling Linux I2C interfaces.
 
file  spidriver.h [code]
 A basic driver for controlling Linux spidev interfaces.
 
103 |
104 | 105 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /docs/html/dir_d44c64559bbebec7f509842c48db8b23_dep.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/dir_d44c64559bbebec7f509842c48db8b23_dep.md5: -------------------------------------------------------------------------------- 1 | 2bcd495df4f645331d5fa1a762fad147 -------------------------------------------------------------------------------- /docs/html/dir_d44c64559bbebec7f509842c48db8b23_dep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/dir_d44c64559bbebec7f509842c48db8b23_dep.png -------------------------------------------------------------------------------- /docs/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/doc.png -------------------------------------------------------------------------------- /docs/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/doxygen.png -------------------------------------------------------------------------------- /docs/html/dynsections.js: -------------------------------------------------------------------------------- 1 | function toggleVisibility(linkObj) 2 | { 3 | var base = $(linkObj).attr('id'); 4 | var summary = $('#'+base+'-summary'); 5 | var content = $('#'+base+'-content'); 6 | var trigger = $('#'+base+'-trigger'); 7 | var src=$(trigger).attr('src'); 8 | if (content.is(':visible')===true) { 9 | content.hide(); 10 | summary.show(); 11 | $(linkObj).addClass('closed').removeClass('opened'); 12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 13 | } else { 14 | content.show(); 15 | summary.hide(); 16 | $(linkObj).removeClass('closed').addClass('opened'); 17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 18 | } 19 | return false; 20 | } 21 | 22 | function updateStripes() 23 | { 24 | $('table.directory tr'). 25 | removeClass('even').filter(':visible:even').addClass('even'); 26 | } 27 | 28 | function toggleLevel(level) 29 | { 30 | $('table.directory tr').each(function() { 31 | var l = this.id.split('_').length-1; 32 | var i = $('#img'+this.id.substring(3)); 33 | var a = $('#arr'+this.id.substring(3)); 34 | if (l 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Examples 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.3 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 64 |
65 | 66 |
70 |
71 | 72 | 73 |
74 | 77 |
78 | 79 |
80 |
81 |
Examples
82 |
83 |
84 |
Here is a list of all examples:
88 |
89 | 90 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/html/files.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: File List 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 |
70 | 71 |
75 |
76 | 77 | 78 |
79 | 82 |
83 | 84 |
85 |
86 |
File List
87 |
88 |
89 |
Here is a list of all documented files with brief descriptions:
90 |
[detail level 12]
91 | 92 | 93 | 94 | 95 | 96 | 97 |
  examples
 i2c_htu21d.cUses serbus to get RH and temperature data from an HTU21D
 spi_ad7390.cUses serbus to control an AD7390 DAC
  include
 i2cdriver.hA basic driver for controlling Linux I2C interfaces
 spidriver.hA basic driver for controlling Linux spidev interfaces
98 |
99 |
100 | 101 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/html/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/folderclosed.png -------------------------------------------------------------------------------- /docs/html/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/folderopen.png -------------------------------------------------------------------------------- /docs/html/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Globals 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 | 77 |
78 | 79 |
83 |
84 | 85 | 86 |
87 | 90 |
91 | 92 |
93 |   98 |
99 | 100 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /docs/html/globals_eval.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Globals 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 69 | 77 |
78 | 79 |
83 |
84 | 85 | 86 |
87 | 90 |
91 | 92 |
93 |   101 |
102 | 103 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/html/graph_legend.md5: -------------------------------------------------------------------------------- 1 | 387ff8eb65306fa251338d3c9bd7bfff -------------------------------------------------------------------------------- /docs/html/graph_legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/graph_legend.png -------------------------------------------------------------------------------- /docs/html/i2c__htu21d_8c__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/i2c__htu21d_8c__incl.md5: -------------------------------------------------------------------------------- 1 | 114d34a265a1e175a2861dc3967ef6ab -------------------------------------------------------------------------------- /docs/html/i2c__htu21d_8c__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/i2c__htu21d_8c__incl.png -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__dep__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__dep__incl.md5: -------------------------------------------------------------------------------- 1 | 1e8674827ed6f20ac79b58f5ca4abebe -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__dep__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/i2cdriver_8h__dep__incl.png -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__incl.md5: -------------------------------------------------------------------------------- 1 | ddfdf8561fdb28b078f6ef61b49e7d6e -------------------------------------------------------------------------------- /docs/html/i2cdriver_8h__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/i2cdriver_8h__incl.png -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Serbus 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 |
64 | 65 |
69 |
70 | 71 | 72 |
73 | 76 |
77 | 78 |
79 |
80 |
Serbus
81 |
82 |
83 |

Copyright (c) 2015 - Gray Cat Labs - https://graycat.io

84 |

Serbus provides basic C APIs for the I2C and SPI serial bus protocols on GNU/Linux based systems, as well as a Python package built on top of them.

85 |

It's really just a wrapper for the ioctl commands provided by the standard Linux I2C and SPI drivers, so it should be pretty universal. That said, I've currently only tested it extensively on the BeagleBone Black, so use it at your own risk! (And let me know if it's working for you on another system)

86 | 91 |

92 |

Contributing

93 |

Have something to contribute? Great! This project follows the Contributor Covenant Code of Conduct, so be sure to read code_of_conduct.md.

94 |

License

95 |

Released under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy
 96 | of this software and associated documentation files (the "Software"), to deal
 97 | in the Software without restriction, including without limitation the rights
 98 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 99 | copies of the Software, and to permit persons to whom the Software is
100 | furnished to do so, subject to the following conditions:
101 | 
102 | The above copyright notice and this permission notice shall be included in
103 | all copies or substantial portions of the Software.
104 | 
105 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
106 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
107 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
108 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
109 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
110 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
111 | THE SOFTWARE.
112 | 113 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/html/md_code_of_conduct.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Contributor Code of Conduct 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 | 64 |
68 |
69 | 70 | 71 |
72 | 75 |
76 | 77 |
78 |
79 |
80 |
Contributor Code of Conduct
81 |
82 |
83 |

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

84 |

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

85 |

Examples of unacceptable behavior by participants include:

86 |
    87 |
  • The use of sexualized language or imagery
  • 88 |
  • Personal attacks
  • 89 |
  • Trolling or insulting/derogatory comments
  • 90 |
  • Public or private harassment
  • 91 |
  • Publishing other's private information, such as physical or electronic addresses, without explicit permission
  • 92 |
  • Other unethical or unprofessional conduct
  • 93 |
94 |

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.

95 |

By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.

96 |

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

97 |

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at alex@.nosp@m.gray.nosp@m.cat.i.nosp@m.o. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.

98 |

This Code of Conduct is adapted from the Contributor Covenant, version 1.3.0, available at http://contributor-covenant.org/version/1/3/0/

99 |
100 | 101 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/nav_f.png -------------------------------------------------------------------------------- /docs/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/nav_g.png -------------------------------------------------------------------------------- /docs/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/nav_h.png -------------------------------------------------------------------------------- /docs/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/open.png -------------------------------------------------------------------------------- /docs/html/pages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Serbus: Related Pages 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 31 | 32 | 33 |
26 |
Serbus 27 |  v1.0.5 28 |
29 |
C and Python APIs for I2C and SPI bus control on GNU/Linux systems
30 |
34 |
35 | 36 | 37 | 40 | 63 |
64 | 65 |
69 |
70 | 71 | 72 |
73 | 76 |
77 | 78 |
79 |
80 |
Related Pages
81 |
82 |
83 |
Here is a list of all related documentation pages:
84 | 85 | 86 |
 Contributor Code of Conduct
87 |
88 |
89 | 90 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ad7390_5fsetvalue',['AD7390_setValue',['../spi__ad7390_8c.html#ac81c90f47d77aab40f41db9d14b947f9',1,'spi_ad7390.c']]], 4 | ['ad7390_5fspiconfig',['AD7390_SPIConfig',['../spi__ad7390_8c.html#a2a512b31146b2cda1657e3201402b9ad',1,'spi_ad7390.c']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['contributor_20code_20of_20conduct',['Contributor Code of Conduct',['../md_code_of_conduct.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getrh',['getRH',['../i2c__htu21d_8c.html#a8780301999f380379b2fa2491ac6ccc1',1,'i2c_htu21d.c']]], 4 | ['gettemp',['getTemp',['../i2c__htu21d_8c.html#a49fff5426126b4dcc290715fcde0ea17',1,'i2c_htu21d.c']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['i2c_5fclose',['I2C_close',['../i2cdriver_8h.html#a097ccdcc5540327f0df6118700a68364',1,'i2cdriver.h']]], 4 | ['i2c_5fdisable10bitaddressing',['I2C_disable10BitAddressing',['../i2cdriver_8h.html#a1d2c05b3127b4520cc09ee3b80709a8c',1,'i2cdriver.h']]], 5 | ['i2c_5fenable10bitaddressing',['I2C_enable10BitAddressing',['../i2cdriver_8h.html#abc7c776c69df4882cb483e30eb4404d0',1,'i2cdriver.h']]], 6 | ['i2c_5fhtu21d_2ec',['i2c_htu21d.c',['../i2c__htu21d_8c.html',1,'']]], 7 | ['i2c_5fopen',['I2C_open',['../i2cdriver_8h.html#a5df2435ff8cec2b6de06a473cf427864',1,'i2cdriver.h']]], 8 | ['i2c_5fread',['I2C_read',['../i2cdriver_8h.html#ac9c2d06e7ea0e9c01a840841743b27c5',1,'i2cdriver.h']]], 9 | ['i2c_5freadtransaction',['I2C_readTransaction',['../i2cdriver_8h.html#a4fb00c476124be12a5484290051cc465',1,'i2cdriver.h']]], 10 | ['i2c_5fsetslaveaddress',['I2C_setSlaveAddress',['../i2cdriver_8h.html#aa78b1a1354344e7010843cffe962df89',1,'i2cdriver.h']]], 11 | ['i2c_5fwrite',['I2C_write',['../i2cdriver_8h.html#a4889f4597892b63190e1d9e4dd4bb209',1,'i2cdriver.h']]], 12 | ['i2cdriver_2eh',['i2cdriver.h',['../i2cdriver_8h.html',1,'']]] 13 | ]; 14 | -------------------------------------------------------------------------------- /docs/html/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['serbus',['Serbus',['../index.html',1,'']]], 4 | ['spi_5fad7390_2ec',['spi_ad7390.c',['../spi__ad7390_8c.html',1,'']]], 5 | ['spi_5fbit_5forder',['SPI_bit_order',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4',1,'spidriver.h']]], 6 | ['spi_5fclose',['SPI_close',['../spidriver_8h.html#a7ff9166531a3a53a0204f4814af37984',1,'spidriver.h']]], 7 | ['spi_5fdisable3wire',['SPI_disable3Wire',['../spidriver_8h.html#a271b02468019ecb7746ea404772b2e6c',1,'spidriver.h']]], 8 | ['spi_5fdisablecs',['SPI_disableCS',['../spidriver_8h.html#a765c913618ea80e9ad453d8ab2120b60',1,'spidriver.h']]], 9 | ['spi_5fdisableloopback',['SPI_disableLoopback',['../spidriver_8h.html#a0208c430a384927f4a8f0eaf90fe9d41',1,'spidriver.h']]], 10 | ['spi_5fenable3wire',['SPI_enable3Wire',['../spidriver_8h.html#af319540760d84fa649545616be122399',1,'spidriver.h']]], 11 | ['spi_5fenablecs',['SPI_enableCS',['../spidriver_8h.html#ab8bffff4f109622f5425c353fd8b5851',1,'spidriver.h']]], 12 | ['spi_5fenableloopback',['SPI_enableLoopback',['../spidriver_8h.html#ad8f59619ae9d1f2d97b0e0969bb612e1',1,'spidriver.h']]], 13 | ['spi_5fgetbitsperword',['SPI_getBitsPerWord',['../spidriver_8h.html#ac60f1a39c48d5c3ae9bbed420cce8551',1,'spidriver.h']]], 14 | ['spi_5fgetclockmode',['SPI_getClockMode',['../spidriver_8h.html#acf0c4b6dd9a5f1bf164d336858ef9d63',1,'spidriver.h']]], 15 | ['spi_5fgetmaxfrequency',['SPI_getMaxFrequency',['../spidriver_8h.html#a33876b63ecaab993dbdca380bdaa2dab',1,'spidriver.h']]], 16 | ['spi_5fgetmode',['SPI_getMode',['../spidriver_8h.html#a67d1d21089f0347199f627298cb18f69',1,'spidriver.h']]], 17 | ['spi_5flsbfirst',['SPI_LSBFIRST',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4a183d076e845f5ea5d99465cd6aff505f',1,'spidriver.h']]], 18 | ['spi_5fmsbfirst',['SPI_MSBFIRST',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4a3fa35f661bf7fbb96c05ff70827553be',1,'spidriver.h']]], 19 | ['spi_5fopen',['SPI_open',['../spidriver_8h.html#af608773d4a769343f1967258b273971b',1,'spidriver.h']]], 20 | ['spi_5fread',['SPI_read',['../spidriver_8h.html#aecb40c484f3e3aeec9e496e26b75cd7f',1,'spidriver.h']]], 21 | ['spi_5fsetbitorder',['SPI_setBitOrder',['../spidriver_8h.html#ab2adb8ed5190c8c0cc112fceea89098d',1,'spidriver.h']]], 22 | ['spi_5fsetbitsperword',['SPI_setBitsPerWord',['../spidriver_8h.html#ad65e7362ab689c4de7d31f9ab19777fe',1,'spidriver.h']]], 23 | ['spi_5fsetclockmode',['SPI_setClockMode',['../spidriver_8h.html#ad02fbb762c5783f45db896b133cdf9ff',1,'spidriver.h']]], 24 | ['spi_5fsetcsactivehigh',['SPI_setCSActiveHigh',['../spidriver_8h.html#a0cb07d57c9422bacb7229e00546ad426',1,'spidriver.h']]], 25 | ['spi_5fsetcsactivelow',['SPI_setCSActiveLow',['../spidriver_8h.html#ab7d5d25b529b1c937649a8ef5bb45218',1,'spidriver.h']]], 26 | ['spi_5fsetmaxfrequency',['SPI_setMaxFrequency',['../spidriver_8h.html#af60601f12d58cb00180f16c245191dda',1,'spidriver.h']]], 27 | ['spi_5fsetmode',['SPI_setMode',['../spidriver_8h.html#a74608d149677e6ac4918457dd426ab51',1,'spidriver.h']]], 28 | ['spi_5ftransaction',['SPI_transaction',['../spidriver_8h.html#aa6d3caa61bf2ce1cda0d4c92e45f4d16',1,'spidriver.h']]], 29 | ['spi_5ftransfer',['SPI_transfer',['../spidriver_8h.html#a597d2232d2925b4e436a7c23eae4d3d3',1,'spidriver.h']]], 30 | ['spi_5fwrite',['SPI_write',['../spidriver_8h.html#a665527500ba4a01476e2a0b5cda44d41',1,'spidriver.h']]], 31 | ['spidriver_2eh',['spidriver.h',['../spidriver_8h.html',1,'']]], 32 | ['stophandler',['stopHandler',['../spi__ad7390_8c.html#aeb905a8fe359d78f6e1de27749e307d7',1,'spi_ad7390.c']]] 33 | ]; 34 | -------------------------------------------------------------------------------- /docs/html/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/search/close.png -------------------------------------------------------------------------------- /docs/html/search/enums_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/enums_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['spi_5fbit_5forder',['SPI_bit_order',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4',1,'spidriver.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/enumvalues_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/enumvalues_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['spi_5flsbfirst',['SPI_LSBFIRST',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4a183d076e845f5ea5d99465cd6aff505f',1,'spidriver.h']]], 4 | ['spi_5fmsbfirst',['SPI_MSBFIRST',['../spidriver_8h.html#a31bd35a1aecbf364e888c14b090ff3d4a3fa35f661bf7fbb96c05ff70827553be',1,'spidriver.h']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/files_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/files_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['i2c_5fhtu21d_2ec',['i2c_htu21d.c',['../i2c__htu21d_8c.html',1,'']]], 4 | ['i2cdriver_2eh',['i2cdriver.h',['../i2cdriver_8h.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/files_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/files_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['spi_5fad7390_2ec',['spi_ad7390.c',['../spi__ad7390_8c.html',1,'']]], 4 | ['spidriver_2eh',['spidriver.h',['../spidriver_8h.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/files_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/files_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['spidriver_2eh',['spidriver.h',['../spidriver_8h.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ad7390_5fsetvalue',['AD7390_setValue',['../spi__ad7390_8c.html#ac81c90f47d77aab40f41db9d14b947f9',1,'spi_ad7390.c']]], 4 | ['ad7390_5fspiconfig',['AD7390_SPIConfig',['../spi__ad7390_8c.html#a2a512b31146b2cda1657e3201402b9ad',1,'spi_ad7390.c']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['getrh',['getRH',['../i2c__htu21d_8c.html#a8780301999f380379b2fa2491ac6ccc1',1,'i2c_htu21d.c']]], 4 | ['gettemp',['getTemp',['../i2c__htu21d_8c.html#a49fff5426126b4dcc290715fcde0ea17',1,'i2c_htu21d.c']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['i2c_5fclose',['I2C_close',['../i2cdriver_8h.html#a097ccdcc5540327f0df6118700a68364',1,'i2cdriver.h']]], 4 | ['i2c_5fdisable10bitaddressing',['I2C_disable10BitAddressing',['../i2cdriver_8h.html#a1d2c05b3127b4520cc09ee3b80709a8c',1,'i2cdriver.h']]], 5 | ['i2c_5fenable10bitaddressing',['I2C_enable10BitAddressing',['../i2cdriver_8h.html#abc7c776c69df4882cb483e30eb4404d0',1,'i2cdriver.h']]], 6 | ['i2c_5fopen',['I2C_open',['../i2cdriver_8h.html#a5df2435ff8cec2b6de06a473cf427864',1,'i2cdriver.h']]], 7 | ['i2c_5fread',['I2C_read',['../i2cdriver_8h.html#ac9c2d06e7ea0e9c01a840841743b27c5',1,'i2cdriver.h']]], 8 | ['i2c_5freadtransaction',['I2C_readTransaction',['../i2cdriver_8h.html#a4fb00c476124be12a5484290051cc465',1,'i2cdriver.h']]], 9 | ['i2c_5fsetslaveaddress',['I2C_setSlaveAddress',['../i2cdriver_8h.html#aa78b1a1354344e7010843cffe962df89',1,'i2cdriver.h']]], 10 | ['i2c_5fwrite',['I2C_write',['../i2cdriver_8h.html#a4889f4597892b63190e1d9e4dd4bb209',1,'i2cdriver.h']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['spi_5fclose',['SPI_close',['../spidriver_8h.html#a7ff9166531a3a53a0204f4814af37984',1,'spidriver.h']]], 4 | ['spi_5fdisable3wire',['SPI_disable3Wire',['../spidriver_8h.html#a271b02468019ecb7746ea404772b2e6c',1,'spidriver.h']]], 5 | ['spi_5fdisablecs',['SPI_disableCS',['../spidriver_8h.html#a765c913618ea80e9ad453d8ab2120b60',1,'spidriver.h']]], 6 | ['spi_5fdisableloopback',['SPI_disableLoopback',['../spidriver_8h.html#a0208c430a384927f4a8f0eaf90fe9d41',1,'spidriver.h']]], 7 | ['spi_5fenable3wire',['SPI_enable3Wire',['../spidriver_8h.html#af319540760d84fa649545616be122399',1,'spidriver.h']]], 8 | ['spi_5fenablecs',['SPI_enableCS',['../spidriver_8h.html#ab8bffff4f109622f5425c353fd8b5851',1,'spidriver.h']]], 9 | ['spi_5fenableloopback',['SPI_enableLoopback',['../spidriver_8h.html#ad8f59619ae9d1f2d97b0e0969bb612e1',1,'spidriver.h']]], 10 | ['spi_5fgetbitsperword',['SPI_getBitsPerWord',['../spidriver_8h.html#ac60f1a39c48d5c3ae9bbed420cce8551',1,'spidriver.h']]], 11 | ['spi_5fgetclockmode',['SPI_getClockMode',['../spidriver_8h.html#acf0c4b6dd9a5f1bf164d336858ef9d63',1,'spidriver.h']]], 12 | ['spi_5fgetmaxfrequency',['SPI_getMaxFrequency',['../spidriver_8h.html#a33876b63ecaab993dbdca380bdaa2dab',1,'spidriver.h']]], 13 | ['spi_5fgetmode',['SPI_getMode',['../spidriver_8h.html#a67d1d21089f0347199f627298cb18f69',1,'spidriver.h']]], 14 | ['spi_5fopen',['SPI_open',['../spidriver_8h.html#af608773d4a769343f1967258b273971b',1,'spidriver.h']]], 15 | ['spi_5fread',['SPI_read',['../spidriver_8h.html#aecb40c484f3e3aeec9e496e26b75cd7f',1,'spidriver.h']]], 16 | ['spi_5fsetbitorder',['SPI_setBitOrder',['../spidriver_8h.html#ab2adb8ed5190c8c0cc112fceea89098d',1,'spidriver.h']]], 17 | ['spi_5fsetbitsperword',['SPI_setBitsPerWord',['../spidriver_8h.html#ad65e7362ab689c4de7d31f9ab19777fe',1,'spidriver.h']]], 18 | ['spi_5fsetclockmode',['SPI_setClockMode',['../spidriver_8h.html#ad02fbb762c5783f45db896b133cdf9ff',1,'spidriver.h']]], 19 | ['spi_5fsetcsactivehigh',['SPI_setCSActiveHigh',['../spidriver_8h.html#a0cb07d57c9422bacb7229e00546ad426',1,'spidriver.h']]], 20 | ['spi_5fsetcsactivelow',['SPI_setCSActiveLow',['../spidriver_8h.html#ab7d5d25b529b1c937649a8ef5bb45218',1,'spidriver.h']]], 21 | ['spi_5fsetmaxfrequency',['SPI_setMaxFrequency',['../spidriver_8h.html#af60601f12d58cb00180f16c245191dda',1,'spidriver.h']]], 22 | ['spi_5fsetmode',['SPI_setMode',['../spidriver_8h.html#a74608d149677e6ac4918457dd426ab51',1,'spidriver.h']]], 23 | ['spi_5ftransaction',['SPI_transaction',['../spidriver_8h.html#aa6d3caa61bf2ce1cda0d4c92e45f4d16',1,'spidriver.h']]], 24 | ['spi_5ftransfer',['SPI_transfer',['../spidriver_8h.html#a597d2232d2925b4e436a7c23eae4d3d3',1,'spidriver.h']]], 25 | ['spi_5fwrite',['SPI_write',['../spidriver_8h.html#a665527500ba4a01476e2a0b5cda44d41',1,'spidriver.h']]], 26 | ['stophandler',['stopHandler',['../spi__ad7390_8c.html#aeb905a8fe359d78f6e1de27749e307d7',1,'spi_ad7390.c']]] 27 | ]; 28 | -------------------------------------------------------------------------------- /docs/html/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/search/mag_sel.png -------------------------------------------------------------------------------- /docs/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
No Matches
10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['contributor_20code_20of_20conduct',['Contributor Code of Conduct',['../md_code_of_conduct.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/pages_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
Loading...
12 |
13 | 16 |
Searching...
17 |
No Matches
18 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/search/pages_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['serbus',['Serbus',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | #FSearchBox { 4 | float: left; 5 | } 6 | 7 | #MSearchBox { 8 | white-space : nowrap; 9 | position: absolute; 10 | float: none; 11 | display: inline; 12 | margin-top: 8px; 13 | right: 0px; 14 | width: 170px; 15 | z-index: 102; 16 | background-color: white; 17 | } 18 | 19 | #MSearchBox .left 20 | { 21 | display:block; 22 | position:absolute; 23 | left:10px; 24 | width:20px; 25 | height:19px; 26 | background:url('search_l.png') no-repeat; 27 | background-position:right; 28 | } 29 | 30 | #MSearchSelect { 31 | display:block; 32 | position:absolute; 33 | width:20px; 34 | height:19px; 35 | } 36 | 37 | .left #MSearchSelect { 38 | left:4px; 39 | } 40 | 41 | .right #MSearchSelect { 42 | right:5px; 43 | } 44 | 45 | #MSearchField { 46 | display:block; 47 | position:absolute; 48 | height:19px; 49 | background:url('search_m.png') repeat-x; 50 | border:none; 51 | width:111px; 52 | margin-left:20px; 53 | padding-left:4px; 54 | color: #909090; 55 | outline: none; 56 | font: 9pt Arial, Verdana, sans-serif; 57 | } 58 | 59 | #FSearchBox #MSearchField { 60 | margin-left:15px; 61 | } 62 | 63 | #MSearchBox .right { 64 | display:block; 65 | position:absolute; 66 | right:10px; 67 | top:0px; 68 | width:20px; 69 | height:19px; 70 | background:url('search_r.png') no-repeat; 71 | background-position:left; 72 | } 73 | 74 | #MSearchClose { 75 | display: none; 76 | position: absolute; 77 | top: 4px; 78 | background : none; 79 | border: none; 80 | margin: 0px 4px 0px 0px; 81 | padding: 0px 0px; 82 | outline: none; 83 | } 84 | 85 | .left #MSearchClose { 86 | left: 6px; 87 | } 88 | 89 | .right #MSearchClose { 90 | right: 2px; 91 | } 92 | 93 | .MSearchBoxActive #MSearchField { 94 | color: #000000; 95 | } 96 | 97 | /*---------------- Search filter selection */ 98 | 99 | #MSearchSelectWindow { 100 | display: none; 101 | position: absolute; 102 | left: 0; top: 0; 103 | border: 1px solid #90A5CE; 104 | background-color: #F9FAFC; 105 | z-index: 1; 106 | padding-top: 4px; 107 | padding-bottom: 4px; 108 | -moz-border-radius: 4px; 109 | -webkit-border-top-left-radius: 4px; 110 | -webkit-border-top-right-radius: 4px; 111 | -webkit-border-bottom-left-radius: 4px; 112 | -webkit-border-bottom-right-radius: 4px; 113 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 114 | } 115 | 116 | .SelectItem { 117 | font: 8pt Arial, Verdana, sans-serif; 118 | padding-left: 2px; 119 | padding-right: 12px; 120 | border: 0px; 121 | } 122 | 123 | span.SelectionMark { 124 | margin-right: 4px; 125 | font-family: monospace; 126 | outline-style: none; 127 | text-decoration: none; 128 | } 129 | 130 | a.SelectItem { 131 | display: block; 132 | outline-style: none; 133 | color: #000000; 134 | text-decoration: none; 135 | padding-left: 6px; 136 | padding-right: 12px; 137 | } 138 | 139 | a.SelectItem:focus, 140 | a.SelectItem:active { 141 | color: #000000; 142 | outline-style: none; 143 | text-decoration: none; 144 | } 145 | 146 | a.SelectItem:hover { 147 | color: #FFFFFF; 148 | background-color: #3D578C; 149 | outline-style: none; 150 | text-decoration: none; 151 | cursor: pointer; 152 | display: block; 153 | } 154 | 155 | /*---------------- Search results window */ 156 | 157 | iframe#MSearchResults { 158 | width: 60ex; 159 | height: 15em; 160 | } 161 | 162 | #MSearchResultsWindow { 163 | display: none; 164 | position: absolute; 165 | left: 0; top: 0; 166 | border: 1px solid #000; 167 | background-color: #EEF1F7; 168 | } 169 | 170 | /* ----------------------------------- */ 171 | 172 | 173 | #SRIndex { 174 | clear:both; 175 | padding-bottom: 15px; 176 | } 177 | 178 | .SREntry { 179 | font-size: 10pt; 180 | padding-left: 1ex; 181 | } 182 | 183 | .SRPage .SREntry { 184 | font-size: 8pt; 185 | padding: 1px 5px; 186 | } 187 | 188 | body.SRPage { 189 | margin: 5px 2px; 190 | } 191 | 192 | .SRChildren { 193 | padding-left: 3ex; padding-bottom: .5em 194 | } 195 | 196 | .SRPage .SRChildren { 197 | display: none; 198 | } 199 | 200 | .SRSymbol { 201 | font-weight: bold; 202 | color: #425E97; 203 | font-family: Arial, Verdana, sans-serif; 204 | text-decoration: none; 205 | outline: none; 206 | } 207 | 208 | a.SRScope { 209 | display: block; 210 | color: #425E97; 211 | font-family: Arial, Verdana, sans-serif; 212 | text-decoration: none; 213 | outline: none; 214 | } 215 | 216 | a.SRSymbol:focus, a.SRSymbol:active, 217 | a.SRScope:focus, a.SRScope:active { 218 | text-decoration: underline; 219 | } 220 | 221 | span.SRScope { 222 | padding-left: 4px; 223 | } 224 | 225 | .SRPage .SRStatus { 226 | padding: 2px 5px; 227 | font-size: 8pt; 228 | font-style: italic; 229 | } 230 | 231 | .SRResult { 232 | display: none; 233 | } 234 | 235 | DIV.searchresults { 236 | margin-left: 10px; 237 | margin-right: 10px; 238 | } 239 | 240 | /*---------------- External search page results */ 241 | 242 | .searchresult { 243 | background-color: #F0F3F8; 244 | } 245 | 246 | .pages b { 247 | color: white; 248 | padding: 5px 5px 3px 5px; 249 | background-image: url("../tab_a.png"); 250 | background-repeat: repeat-x; 251 | text-shadow: 0 1px 1px #000000; 252 | } 253 | 254 | .pages { 255 | line-height: 17px; 256 | margin-left: 4px; 257 | text-decoration: none; 258 | } 259 | 260 | .hl { 261 | font-weight: bold; 262 | } 263 | 264 | #searchresults { 265 | margin-bottom: 20px; 266 | } 267 | 268 | .searchpages { 269 | margin-top: 10px; 270 | } 271 | 272 | -------------------------------------------------------------------------------- /docs/html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/search/search_l.png -------------------------------------------------------------------------------- /docs/html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/search/search_m.png -------------------------------------------------------------------------------- /docs/html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/search/search_r.png -------------------------------------------------------------------------------- /docs/html/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "acgis", 4 | 1: "is", 5 | 2: "agis", 6 | 3: "s", 7 | 4: "s", 8 | 5: "cs" 9 | }; 10 | 11 | var indexSectionNames = 12 | { 13 | 0: "all", 14 | 1: "files", 15 | 2: "functions", 16 | 3: "enums", 17 | 4: "enumvalues", 18 | 5: "pages" 19 | }; 20 | 21 | var indexSectionLabels = 22 | { 23 | 0: "All", 24 | 1: "Files", 25 | 2: "Functions", 26 | 3: "Enumerations", 27 | 4: "Enumerator", 28 | 5: "Pages" 29 | }; 30 | 31 | -------------------------------------------------------------------------------- /docs/html/spi__ad7390_8c__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/spi__ad7390_8c__incl.md5: -------------------------------------------------------------------------------- 1 | 20eb838ceefef69b8c793f983020c704 -------------------------------------------------------------------------------- /docs/html/spi__ad7390_8c__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/spi__ad7390_8c__incl.png -------------------------------------------------------------------------------- /docs/html/spidriver_8h__dep__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/spidriver_8h__dep__incl.md5: -------------------------------------------------------------------------------- 1 | 5de1fcf8b6c7a5a76a185434558c70f3 -------------------------------------------------------------------------------- /docs/html/spidriver_8h__dep__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/spidriver_8h__dep__incl.png -------------------------------------------------------------------------------- /docs/html/spidriver_8h__incl.map: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/html/spidriver_8h__incl.md5: -------------------------------------------------------------------------------- 1 | a204cadc7c692ed6e97ec53c87fc272a -------------------------------------------------------------------------------- /docs/html/spidriver_8h__incl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/spidriver_8h__incl.png -------------------------------------------------------------------------------- /docs/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/splitbar.png -------------------------------------------------------------------------------- /docs/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/sync_off.png -------------------------------------------------------------------------------- /docs/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/sync_on.png -------------------------------------------------------------------------------- /docs/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/tab_a.png -------------------------------------------------------------------------------- /docs/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/tab_b.png -------------------------------------------------------------------------------- /docs/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/tab_h.png -------------------------------------------------------------------------------- /docs/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/html/tab_s.png -------------------------------------------------------------------------------- /docs/html/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 7 | } 8 | 9 | .tabs2 { 10 | font-size: 10px; 11 | } 12 | .tabs3 { 13 | font-size: 9px; 14 | } 15 | 16 | .tablist { 17 | margin: 0; 18 | padding: 0; 19 | display: table; 20 | } 21 | 22 | .tablist li { 23 | float: left; 24 | display: table-cell; 25 | background-image: url('tab_b.png'); 26 | line-height: 36px; 27 | list-style: none; 28 | } 29 | 30 | .tablist a { 31 | display: block; 32 | padding: 0 20px; 33 | font-weight: bold; 34 | background-image:url('tab_s.png'); 35 | background-repeat:no-repeat; 36 | background-position:right; 37 | color: #283A5D; 38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 39 | text-decoration: none; 40 | outline: none; 41 | } 42 | 43 | .tabs3 .tablist a { 44 | padding: 0 10px; 45 | } 46 | 47 | .tablist a:hover { 48 | background-image: url('tab_h.png'); 49 | background-repeat:repeat-x; 50 | color: #fff; 51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 52 | text-decoration: none; 53 | } 54 | 55 | .tablist li.current a { 56 | background-image: url('tab_a.png'); 57 | background-repeat:repeat-x; 58 | color: #fff; 59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 60 | } 61 | -------------------------------------------------------------------------------- /docs/serbus-v1.0.2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/docs/serbus-v1.0.2.pdf -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for serbus example programs 2 | # 3 | # Run: 4 | # $ make 5 | # to build all the example programs. 6 | # 7 | # The examples can also be built individually, e.g.: 8 | # $ make i2c_htu21d 9 | 10 | CC = gcc 11 | CFLAGS = -Wall -g 12 | INCLUDES = -I../include/ 13 | I2C_DRIVER = ../src/i2cdriver.c 14 | SPI_DRIVER = ../src/spidriver.c 15 | BIN_DIR = bin 16 | 17 | all: i2c_htu21d spi_ad7390 18 | 19 | .c.o: 20 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 21 | 22 | i2cdriver.o: $(I2CDRIVER) 23 | $(CC) $(CFLAGS) $(INCLUDES) -c $(I2C_DRIVER) 24 | 25 | spidriver.o: $(I2CDRIVER) 26 | $(CC) $(CFLAGS) $(INCLUDES) -c $(SPI_DRIVER) 27 | 28 | i2c_htu21d: i2c_htu21d.o i2cdriver.o 29 | $(CC) -o $(BIN_DIR)/i2c_htu21d $^ 30 | 31 | spi_ad7390: spi_ad7390.o spidriver.o 32 | $(CC) -o $(BIN_DIR)/spi_ad7390 $^ 33 | 34 | clean: 35 | rm -f *.o bin/* -------------------------------------------------------------------------------- /examples/bin/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/examples/bin/.empty -------------------------------------------------------------------------------- /examples/i2c_htu21d.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file i2c_htu21d.c 3 | * @author Alex Hiam - 4 | * 5 | * @brief Uses serbus to get RH and temperature data from an HTU21D. 6 | * 7 | * Requires an I2C Kernel driver be loaded to expose a /dev/i2c-N interface 8 | * and an HTU21D be connected on the I2C bus. 9 | */ 10 | 11 | #include "i2cdriver.h" 12 | #include 13 | #include 14 | #include 15 | 16 | #define HTU21D_BUS 1 // Connected to /dev/i2c-1 17 | #define HTU21D_ADDR 0x40 // HTU21D slave address 18 | #define HTU21D_CMD_TEMP 0xe3 // Command to read temperature 19 | #define HTU21D_CMD_RH 0xe5 // Command to read relative humidity 20 | 21 | /** 22 | * @brief Reads and returns the current temperature from the HUT21D 23 | * 24 | * @param i2c_fd I2C bus file descriptor 25 | * 26 | * @return the current temperature in Celsius 27 | */ 28 | float getTemp(int i2c_fd) { 29 | uint8_t rx_buffer[3]; 30 | int raw_value; 31 | // Set the slave address: 32 | if (I2C_setSlaveAddress(i2c_fd, HTU21D_ADDR) < 0) { 33 | printf("*Could set slave address to %d\n", HTU21D_ADDR); 34 | exit(0); 35 | } 36 | // Read the 3 bytes of data: 37 | I2C_readTransaction(i2c_fd, HTU21D_CMD_TEMP, (void*) rx_buffer, 3); 38 | // The crc (cyclic redundancy check) can be used to verify the data was 39 | // received without error - ignore it here 40 | // Combine the high and low bytes: 41 | raw_value = (rx_buffer[0]<<8) | rx_buffer[1]; 42 | // Clear the two status bits (see datasheet): 43 | raw_value &= ~0b11; 44 | // Convert to Celsius and return (conversion from datasheet): 45 | return -46.85 + 175.72 * (((float)raw_value)/65536.0); 46 | } 47 | 48 | /** 49 | * @brief Reads and returns the current humidity from the HUT21D 50 | * 51 | * @param i2c_fd I2C bus file descriptor 52 | * 53 | * @return the current temperature in Celsius 54 | */ 55 | float getRH(int i2c_fd) { 56 | uint8_t rx_buffer[3]; 57 | int raw_value; 58 | if (I2C_setSlaveAddress(i2c_fd, HTU21D_ADDR) < 0) { 59 | printf("*Could set slave address to %d\n", HTU21D_ADDR); 60 | exit(0); 61 | } 62 | I2C_readTransaction(i2c_fd, HTU21D_CMD_RH, (void*) rx_buffer, 3); 63 | raw_value = (rx_buffer[0]<<8) | rx_buffer[1]; 64 | raw_value &= ~0b11; 65 | // Convert to %RH and return (conversion from datasheet): 66 | return -6.0 + 125.0 * (raw_value/65536.0); 67 | } 68 | 69 | int main() { 70 | int i2c_fd; 71 | float temp, rh; 72 | // Open the I2C device file: 73 | i2c_fd = I2C_open(HTU21D_BUS); 74 | if (i2c_fd < 0) { 75 | printf("*Could not open I2C bus %d\n", HTU21D_BUS); 76 | exit(0); 77 | } 78 | // Read and print the current temp and rh: 79 | temp = getTemp(i2c_fd); 80 | rh = getRH(i2c_fd); 81 | printf("Temp : %5.2fC\n", temp); 82 | printf("RH : %5.2f%%\n", rh); 83 | // Close the I2C file descriptor: 84 | I2C_close(i2c_fd); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /examples/spi_ad7390.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file spi_ad7390.c 3 | * @author Alex Hiam - 4 | * 5 | * @brief Uses serbus to control an AD7390 DAC. 6 | * 7 | * Requires an SPI Kernel driver be loaded to expose a /dev/spidevX.Y 8 | * interface and an AD7390 be connected on the SPI bus. 9 | */ 10 | 11 | #include "spidriver.h" 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #define AD7390_BUS 1 // Connected to /dev/spidev1.X bus 18 | #define AD7390_CS 0 // Using chip select 0 (/dev/spidev1.0) 19 | #define AD7390_FREQ 1000000 // SPI clock frequency in Hz 20 | #define AD7390_BITS 16 // SPI bits per word 21 | #define AD7390_CLOCKMODE 3 // SPI clock mode 22 | 23 | static uint8_t running; 24 | 25 | /** 26 | * @brief Sets the given SPI bus per the AD7390's required configuration 27 | * 28 | * @param spi_fd SPI bus file descriptor 29 | */ 30 | void AD7390_SPIConfig(int spi_fd) { 31 | SPI_setMaxFrequency(spi_fd, AD7390_FREQ); 32 | SPI_setBitsPerWord(spi_fd, AD7390_BITS); 33 | SPI_setClockMode(spi_fd, AD7390_CLOCKMODE); 34 | SPI_setCSActiveHigh(spi_fd); 35 | SPI_setBitOrder(spi_fd, SPI_MSBFIRST); 36 | } 37 | 38 | /** 39 | * @brief Sets the output of the AD7390 in the range 0-4095 40 | * 41 | * @param spi_fd SPI bus file descriptor 42 | * @param value DAC value in range 0-4095 43 | */ 44 | void AD7390_setValue(int spi_fd, uint16_t value) { 45 | SPI_write(spi_fd, (void*) &value, 1); 46 | } 47 | 48 | 49 | /** 50 | * @brief Called when Ctrl+C is pressed - triggers the program to stop. 51 | */ 52 | void stopHandler(int sig) { 53 | running = 0; 54 | } 55 | 56 | int main() { 57 | int spi_fd, value; 58 | // Open the SPI device file: 59 | spi_fd = SPI_open(AD7390_BUS, AD7390_CS); 60 | if (spi_fd < 0) { 61 | printf("*Could not open SPI bus %d\n", AD7390_BUS); 62 | exit(0); 63 | } 64 | // Configure the SPI bus: 65 | AD7390_SPIConfig(spi_fd); 66 | 67 | // Loop until Ctrl+C pressed: 68 | running = 1; 69 | signal(SIGINT, stopHandler); 70 | while(running) { 71 | // Ramp up from 0V to full-scale: 72 | for (value=0; value<4095; value++) { 73 | AD7390_setValue(spi_fd, value); 74 | } 75 | // Ramp down from full-scale to 0V: 76 | for (value=4096; value>0; value--) { 77 | AD7390_setValue(spi_fd, value); 78 | } 79 | } 80 | // Set DAC output to 0 and close the SPI file descriptor: 81 | AD7390_setValue(spi_fd, 0); 82 | SPI_close(spi_fd); 83 | return 0; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /include/i2cdriver.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | ******************************************************************************/ 22 | 23 | /** 24 | * @file i2cdriver.h 25 | * @author Alex Hiam - 26 | * 27 | * @brief A basic driver for controlling Linux I2C interfaces. 28 | * 29 | * Requires an I2C Kernel driver be loaded to expose /dev/i2c-N interfaces 30 | * which provide the standard Linux I2C ioctls. This driver is really just an 31 | * ioctl wrapper. 32 | * 33 | * @see 34 | * `examples/i2c_htu21d.c` @include i2c_htu21d.c 35 | */ 36 | 37 | #ifndef _I2C_DRIVER_H_ 38 | #define _I2C_DRIVER_H_ 39 | 40 | #include 41 | 42 | /** 43 | * @brief Opens the /dev/i2c-[bus] interface. 44 | * 45 | * @param bus I2C bus number 46 | * 47 | * @return Returns the file descriptor for the I2C bus. 48 | */ 49 | int I2C_open(uint8_t bus); 50 | 51 | /** 52 | * @brief Closes the given I2C interface. 53 | * 54 | * @param i2c_fd I2C bus file descriptor to close 55 | */ 56 | void I2C_close(int i2c_fd); 57 | 58 | /** 59 | * @brief Enables 10-bit addressing the given I2C interface. 60 | * 61 | * @param i2c_fd I2C file descriptor 62 | * 63 | * @return Returns 0 if successful, ioctl error code otherwise 64 | */ 65 | int I2C_enable10BitAddressing(int i2c_fd); 66 | 67 | /** 68 | * @brief Disables 10-bit addressing the given I2C interface. 69 | * 70 | * @param i2c_fd I2C file descriptor 71 | * 72 | * @return Returns 0 if successful, ioctl error code otherwise 73 | */ 74 | int I2C_disable10BitAddressing(int i2c_fd); 75 | 76 | /** 77 | * @brief Sets the I2C slave address to communicate with. 78 | * 79 | * Sets the I2C slave address that's sent with all subsequent I2C transactions 80 | * on the given I2C bus, until I2C_setSlaveAddress is called again with a new 81 | * address. 82 | * 83 | * @param i2c_fd I2C file descriptor 84 | * @param addr the 7- or 10-bit address of the slave device 85 | * 86 | * @return Returns 0 if successful, ioctl error code otherwise 87 | */ 88 | int I2C_setSlaveAddress(int i2c_fd, int addr); 89 | 90 | /** 91 | * @brief Reads a block from the given I2C interface. 92 | * 93 | * Reads \p n_bytes from the current slave address on the given I2C 94 | * interface. and puts them into the given 95 | * buffer. 96 | * 97 | * @param i2c_fd I2C file descriptor 98 | * @param rx_buffer pointer to an array, already initialized to the required 99 | * size 100 | * @param n_bytes the number of bytes to read into rx_buffer 101 | * 102 | * @return Returns 0 if successful, file access error code otherwise 103 | */ 104 | int I2C_read(int i2c_fd, void *rx_buffer, int n_bytes); 105 | 106 | /** 107 | * @brief Writes the given command then reads a block from the given I2C 108 | * interface. 109 | * 110 | * Writes the given byte, then immediately reads n_bytes bytes from the current 111 | * slave address on the given I2C interface. Useful for things like reading 112 | * register values from memory mapped devices. 113 | * 114 | * @param i2c_fd I2C file descriptor 115 | * @param byte the byte to write before reading 116 | * @param rx_buffer pointer to an array, already initialized to the required 117 | * size 118 | * @param n_bytes the number of bytes to read into rx_buffer 119 | * 120 | * @return Returns 0 if successful, file access error code otherwise 121 | */ 122 | int I2C_readTransaction(int i2c_fd, uint8_t byte, void *rx_buffer, int n_bytes); 123 | 124 | /** 125 | * @brief Writes a block to the given I2C interface. 126 | * 127 | * Writes n_bytes bytes from the given buffer to the current slave address on 128 | * the given I2C interface. 129 | * 130 | * @param i2c_fd I2C file descriptor 131 | * @param tx_buffer pointer to an array containing the words to be transmitted 132 | * @param n_bytes the number of bytes to write from tx_buffer 133 | * 134 | * @return Returns 0 if successful, file access error code otherwise 135 | */ 136 | int I2C_write(int i2c_fd, void *tx_buffer, int n_bytes); 137 | 138 | #endif // _I2C_DRIVER_H_ -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyo 2 | *.pyc 3 | build/ 4 | dist/ 5 | serbus.egg-info/ -------------------------------------------------------------------------------- /python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE.txt 2 | include README.md 3 | recursive-include serbus *.py *.c *.h 4 | recursive-include include *.h 5 | recursive-include src *.c -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | # Serbus 2 | 3 | Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 4 | 5 | Serbus provides basic C APIs for the I2C and SPI serial bus protocols on 6 | GNU/Linux based systems, as well as a Python package built on top of them. 7 | 8 | It's really just a wrapper for the ioctl commands provided by the standard Linux 9 | I2C and SPI drivers, so it should be pretty universal. That said, I've currently 10 | only tested it extensively on the BeagleBone Black, so use it at your own risk! 11 | (And let me know if it's working for you on another system) 12 | 13 | * Source code: https://github.com/graycatlabs/serbus/ 14 | * C API documentation: https://graycat.io/docs/serbus/ 15 | * Python API documentation: https://graycat.io/docs/serbus/python/ 16 | 17 | ## Contributing 18 | 19 | Have something to contribute? Great! This project follows the Contributor 20 | Covenant Code of Conduct, so be sure to read `code_of_conduct.md`. 21 | 22 | ## License 23 | 24 | Released under the MIT license. 25 | 26 | Permission is hereby granted, free of charge, to any person obtaining a copy 27 | of this software and associated documentation files (the "Software"), to deal 28 | in the Software without restriction, including without limitation the rights 29 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 30 | copies of the Software, and to permit persons to whom the Software is 31 | furnished to do so, subject to the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be included in 34 | all copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 37 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 38 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 39 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 40 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 41 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 42 | THE SOFTWARE. -------------------------------------------------------------------------------- /python/docs/I2C.rst: -------------------------------------------------------------------------------- 1 | I2C 2 | === 3 | 4 | The :class:`serbus.I2CDev` class provides an API for interfacing with standard GNU/Linux spidev devices. It is instantiated with a bus number corresponding to the I2C bus device file it will use - to communicate with devices on the I2C bus connected to `/dev/i2c-0` you could create the instance :code:`bus = serbus.I2CDev(0)`. 5 | 6 | .. note:: 7 | For more info on I2C (Inter-Integrated Circuit) see https://en.wikipedia.org/wiki/I%C2%B2C 8 | 9 | 10 | API 11 | --- 12 | 13 | .. autoclass:: serbus.I2CDev 14 | :members: 15 | 16 | Examples 17 | -------- 18 | 19 | These are a few examples of using the I2CDev object. They will only work if you have the proper hardware connected to the system running them and your I2C kernel driver loaded. Depending on the system there may be additional required setup as well, such as configuring pin multiplexers on embedded GNU/Linux systems like the `BeagleBone Black`_. 20 | 21 | Reading data 22 | ~~~~~~~~~~~~ 23 | 24 | This example shows how to read a single byte from an I2C device. It is not specific to any particular device. 25 | 26 | .. literalinclude:: ../examples/i2c_read.py 27 | :linenos: 28 | :language: python 29 | :lines: 3- 30 | 31 | EEPROM memory 32 | ~~~~~~~~~~~~~ 33 | 34 | In this example, a sequence of bytes are written to a `24LC256`_ (or equivalent) I2C EEPROM, then reading them back to verify they have been written. 35 | 36 | .. literalinclude:: ../examples/i2c_eeprom.py 37 | :linenos: 38 | :language: python 39 | :lines: 3- 40 | 41 | For this to work, the EEPROM's *WP* (write protect) pin must be pulled down to GND to allow writing. 42 | 43 | HTU21D humidity sensor 44 | ~~~~~~~~~~~~~~~~~~~~~~ 45 | 46 | This example shows how the `I2CDev` class can be used to measure relative humidity and temperature from the `HTU21D`_ I2C humidity sensor. 47 | 48 | .. literalinclude:: ../examples/i2c_htu21d.py 49 | :linenos: 50 | :language: python 51 | :lines: 3- 52 | 53 | .. Links: 54 | .. _BeagleBone Black: http://beagleboard.org/BLACK 55 | .. _24LC256: http://www.microchip.com/wwwproducts/Devices.aspx?product=24LC256 56 | .. _HTU21D: http://www.meas-spec.com/product/humidity/HTU21D.aspx -------------------------------------------------------------------------------- /python/docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " applehelp to make an Apple Help Book" 34 | @echo " devhelp to make HTML files and a Devhelp project" 35 | @echo " epub to make an epub" 36 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 37 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 38 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 39 | @echo " text to make text files" 40 | @echo " man to make manual pages" 41 | @echo " texinfo to make Texinfo files" 42 | @echo " info to make Texinfo files and run them through makeinfo" 43 | @echo " gettext to make PO message catalogs" 44 | @echo " changes to make an overview of all changed/added/deprecated items" 45 | @echo " xml to make Docutils-native XML files" 46 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 47 | @echo " linkcheck to check all external links for integrity" 48 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 49 | @echo " coverage to run coverage check of the documentation (if enabled)" 50 | 51 | clean: 52 | rm -rf $(BUILDDIR)/* 53 | 54 | html: 55 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 56 | @echo 57 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 58 | 59 | dirhtml: 60 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 61 | @echo 62 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 63 | 64 | singlehtml: 65 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 66 | @echo 67 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 68 | 69 | pickle: 70 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 71 | @echo 72 | @echo "Build finished; now you can process the pickle files." 73 | 74 | json: 75 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 76 | @echo 77 | @echo "Build finished; now you can process the JSON files." 78 | 79 | htmlhelp: 80 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 81 | @echo 82 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 83 | ".hhp project file in $(BUILDDIR)/htmlhelp." 84 | 85 | qthelp: 86 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 87 | @echo 88 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 89 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 90 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Serbus.qhcp" 91 | @echo "To view the help file:" 92 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Serbus.qhc" 93 | 94 | applehelp: 95 | $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp 96 | @echo 97 | @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." 98 | @echo "N.B. You won't be able to view it unless you put it in" \ 99 | "~/Library/Documentation/Help or install it in your application" \ 100 | "bundle." 101 | 102 | devhelp: 103 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 104 | @echo 105 | @echo "Build finished." 106 | @echo "To view the help file:" 107 | @echo "# mkdir -p $$HOME/.local/share/devhelp/Serbus" 108 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Serbus" 109 | @echo "# devhelp" 110 | 111 | epub: 112 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 113 | @echo 114 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 115 | 116 | latex: 117 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 118 | @echo 119 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 120 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 121 | "(use \`make latexpdf' here to do that automatically)." 122 | 123 | latexpdf: 124 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 125 | @echo "Running LaTeX files through pdflatex..." 126 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 127 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 128 | 129 | latexpdfja: 130 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 131 | @echo "Running LaTeX files through platex and dvipdfmx..." 132 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 133 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 134 | 135 | text: 136 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 137 | @echo 138 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 139 | 140 | man: 141 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 142 | @echo 143 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 144 | 145 | texinfo: 146 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 147 | @echo 148 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 149 | @echo "Run \`make' in that directory to run these through makeinfo" \ 150 | "(use \`make info' here to do that automatically)." 151 | 152 | info: 153 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 154 | @echo "Running Texinfo files through makeinfo..." 155 | make -C $(BUILDDIR)/texinfo info 156 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 157 | 158 | gettext: 159 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 160 | @echo 161 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 162 | 163 | changes: 164 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 165 | @echo 166 | @echo "The overview file is in $(BUILDDIR)/changes." 167 | 168 | linkcheck: 169 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 170 | @echo 171 | @echo "Link check complete; look for any errors in the above output " \ 172 | "or in $(BUILDDIR)/linkcheck/output.txt." 173 | 174 | doctest: 175 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 176 | @echo "Testing of doctests in the sources finished, look at the " \ 177 | "results in $(BUILDDIR)/doctest/output.txt." 178 | 179 | coverage: 180 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 181 | @echo "Testing of coverage in the sources finished, look at the " \ 182 | "results in $(BUILDDIR)/coverage/python.txt." 183 | 184 | xml: 185 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 186 | @echo 187 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 188 | 189 | pseudoxml: 190 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 191 | @echo 192 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." 193 | -------------------------------------------------------------------------------- /python/docs/SPI.rst: -------------------------------------------------------------------------------- 1 | SPI 2 | === 3 | 4 | The :class:`serbus.SPIDev` class provides an API for interfacing with standard GNU/Linux spidev devices. It is instantiated with a bus number corresponding to the `spidev` device file it will use - to communicate with devices on the SPI bus connected to `/dev/spidev0.X` you could create the instance :code:`bus = serbus.SPIDev(0)`. The read/write methods then take a chip select as their first argument, so to read a byte from a device on chip select 1 of spidev0 (`/dev/spidev0.1`) you would call :code:`bus.read(1, 1)`. 5 | 6 | .. note:: 7 | For more info on SPI (Serial Peripheral Interface) see https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus 8 | 9 | API 10 | --- 11 | 12 | .. autoclass:: serbus.SPIDev 13 | :members: 14 | 15 | Clock Modes 16 | ----------- 17 | 18 | The `clock_mode` parameter passed to :func:`~serbus.SPIDev.setClockMode` tells the SPI kernel driver how to drive the clock signal. The SPI spec allows four possible clock configurations, and the required mode for a particular device will be given in its datasheet (sometimes explicitly, but often just shown visually in an SPI timing diagram). The possible modes are: 19 | 20 | +--------------+------------------+--------------------------------+ 21 | | `clock_mode` | clock idle state | clock edge data is captured on | 22 | +--------------+------------------+--------------------------------+ 23 | | 0 | low | rising edge | 24 | +--------------+------------------+--------------------------------+ 25 | | 1 | low | falling edge | 26 | +--------------+------------------+--------------------------------+ 27 | | 2 | high | falling edge | 28 | +--------------+------------------+--------------------------------+ 29 | | 3 | high | rising edge | 30 | +--------------+------------------+--------------------------------+ 31 | 32 | Examples 33 | -------- 34 | 35 | These are a few examples of using the SPIDev object. They will only work if you have the proper hardware connected to the system running them and your SPI kernel driver loaded. Depending on the system there may be additional required setup as well, such as configuring pin multiplexers on embedded GNU/Linux systems like the `BeagleBone Black`_. 36 | 37 | Reading data 38 | ~~~~~~~~~~~~ 39 | 40 | This example shows how to read a single word from an SPI device. It is not specific to any particular device. 41 | 42 | .. literalinclude:: ../examples/spi_read.py 43 | :linenos: 44 | :language: python 45 | :lines: 3- 46 | 47 | AD7390 digital-to-analog converter 48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 | 50 | This example shows how to control an `AD7390`_ 12-bit SPI DAC (digital-to-analog converter). 51 | 52 | .. literalinclude:: ../examples/spi_ad7390.py 53 | :linenos: 54 | :language: python 55 | :lines: 3- 56 | 57 | The AD7390 requires an active high chip slelct signal on its LD pin, and because it uses 12-bit values its word size in larger than the default 8-bits of many SPI modules - both of these are easy set with the included methods. 58 | 59 | .. Links: 60 | .. _BeagleBone Black: http://beagleboard.org/BLACK 61 | .. _AD7390: http://www.analog.com/en/products/digital-to-analog-converters/da-converters/ad7390.html -------------------------------------------------------------------------------- /python/docs/_build/doctrees/I2C.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/doctrees/I2C.doctree -------------------------------------------------------------------------------- /python/docs/_build/doctrees/SPI.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/doctrees/SPI.doctree -------------------------------------------------------------------------------- /python/docs/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /python/docs/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /python/docs/_build/doctrees/install.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/doctrees/install.doctree -------------------------------------------------------------------------------- /python/docs/_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: ced11241590dd6c307b4b23dada84d62 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /python/docs/_build/html/_sources/I2C.txt: -------------------------------------------------------------------------------- 1 | I2C 2 | === 3 | 4 | The :class:`serbus.I2CDev` class provides an API for interfacing with standard GNU/Linux spidev devices. It is instantiated with a bus number corresponding to the I2C bus device file it will use - to communicate with devices on the I2C bus connected to `/dev/i2c-0` you could create the instance :code:`bus = serbus.I2CDev(0)`. 5 | 6 | .. note:: 7 | For more info on I2C (Inter-Integrated Circuit) see https://en.wikipedia.org/wiki/I%C2%B2C 8 | 9 | 10 | API 11 | --- 12 | 13 | .. autoclass:: serbus.I2CDev 14 | :members: 15 | 16 | Examples 17 | -------- 18 | 19 | These are a few examples of using the I2CDev object. They will only work if you have the proper hardware connected to the system running them and your I2C kernel driver loaded. Depending on the system there may be additional required setup as well, such as configuring pin multiplexers on embedded GNU/Linux systems like the `BeagleBone Black`_. 20 | 21 | Reading data 22 | ~~~~~~~~~~~~ 23 | 24 | This example shows how to read a single byte from an I2C device. It is not specific to any particular device. 25 | 26 | .. literalinclude:: ../examples/i2c_read.py 27 | :linenos: 28 | :language: python 29 | :lines: 3- 30 | 31 | EEPROM memory 32 | ~~~~~~~~~~~~~ 33 | 34 | In this example, a sequence of bytes are written to a `24LC256`_ (or equivalent) I2C EEPROM, then reading them back to verify they have been written. 35 | 36 | .. literalinclude:: ../examples/i2c_eeprom.py 37 | :linenos: 38 | :language: python 39 | :lines: 3- 40 | 41 | For this to work, the EEPROM's *WP* (write protect) pin must be pulled down to GND to allow writing. 42 | 43 | HTU21D humidity sensor 44 | ~~~~~~~~~~~~~~~~~~~~~~ 45 | 46 | This example shows how the `I2CDev` class can be used to measure relative humidity and temperature from the `HTU21D`_ I2C humidity sensor. 47 | 48 | .. literalinclude:: ../examples/i2c_htu21d.py 49 | :linenos: 50 | :language: python 51 | :lines: 3- 52 | 53 | .. Links: 54 | .. _BeagleBone Black: http://beagleboard.org/BLACK 55 | .. _24LC256: http://www.microchip.com/wwwproducts/Devices.aspx?product=24LC256 56 | .. _HTU21D: http://www.meas-spec.com/product/humidity/HTU21D.aspx -------------------------------------------------------------------------------- /python/docs/_build/html/_sources/SPI.txt: -------------------------------------------------------------------------------- 1 | SPI 2 | === 3 | 4 | The :class:`serbus.SPIDev` class provides an API for interfacing with standard GNU/Linux spidev devices. It is instantiated with a bus number corresponding to the `spidev` device file it will use - to communicate with devices on the SPI bus connected to `/dev/spidev0.X` you could create the instance :code:`bus = serbus.SPIDev(0)`. The read/write methods then take a chip select as their first argument, so to read a byte from a device on chip select 1 of spidev0 (`/dev/spidev0.1`) you would call :code:`bus.read(1, 1)`. 5 | 6 | .. note:: 7 | For more info on SPI (Serial Peripheral Interface) see https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus 8 | 9 | API 10 | --- 11 | 12 | .. autoclass:: serbus.SPIDev 13 | :members: 14 | 15 | Clock Modes 16 | ----------- 17 | 18 | The `clock_mode` parameter passed to :func:`~serbus.SPIDev.setClockMode` tells the SPI kernel driver how to drive the clock signal. The SPI spec allows four possible clock configurations, and the required mode for a particular device will be given in its datasheet (sometimes explicitly, but often just shown visually in an SPI timing diagram). The possible modes are: 19 | 20 | +--------------+------------------+--------------------------------+ 21 | | `clock_mode` | clock idle state | clock edge data is captured on | 22 | +--------------+------------------+--------------------------------+ 23 | | 0 | low | rising edge | 24 | +--------------+------------------+--------------------------------+ 25 | | 1 | low | falling edge | 26 | +--------------+------------------+--------------------------------+ 27 | | 2 | high | falling edge | 28 | +--------------+------------------+--------------------------------+ 29 | | 3 | high | rising edge | 30 | +--------------+------------------+--------------------------------+ 31 | 32 | Examples 33 | -------- 34 | 35 | These are a few examples of using the SPIDev object. They will only work if you have the proper hardware connected to the system running them and your SPI kernel driver loaded. Depending on the system there may be additional required setup as well, such as configuring pin multiplexers on embedded GNU/Linux systems like the `BeagleBone Black`_. 36 | 37 | Reading data 38 | ~~~~~~~~~~~~ 39 | 40 | This example shows how to read a single word from an SPI device. It is not specific to any particular device. 41 | 42 | .. literalinclude:: ../examples/spi_read.py 43 | :linenos: 44 | :language: python 45 | :lines: 3- 46 | 47 | AD7390 digital-to-analog converter 48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 | 50 | This example shows how to control an `AD7390`_ 12-bit SPI DAC (digital-to-analog converter). 51 | 52 | .. literalinclude:: ../examples/spi_ad7390.py 53 | :linenos: 54 | :language: python 55 | :lines: 3- 56 | 57 | The AD7390 requires an active high chip slelct signal on its LD pin, and because it uses 12-bit values its word size in larger than the default 8-bits of many SPI modules - both of these are easy set with the included methods. 58 | 59 | .. Links: 60 | .. _BeagleBone Black: http://beagleboard.org/BLACK 61 | .. _AD7390: http://www.analog.com/en/products/digital-to-analog-converters/da-converters/ad7390.html -------------------------------------------------------------------------------- /python/docs/_build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. PySerbus documentation master file 2 | 3 | PySerbus 4 | ====================== 5 | 6 | The `serbus` Python package provides slim APIs for communicating with I2C and SPI devices on GNU/Linux systems. It interfaces with the `/dev/i2c-N` and `/dev/spidevX.Y` device files provided by standard Linux I2C and SPI drivers. 7 | 8 | Why? 9 | ==== 10 | 11 | The serbus library was developed as part of `PyBBIO`_, a Python library for hardware IO support on the `BeagleBone Black`_. There are already some Python packages for SPI and I2C communication, like `spidev`_ and `smbus`_, but neither have very friendly APIs, and they both have some limitations. The `serbus` library was written from scratch for PyBBIO, to provide clean and simple APIs in both `C`_ and Python. 12 | 13 | 14 | Contents 15 | ======== 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | install 21 | I2C 22 | SPI 23 | 24 | * :ref:`genindex` 25 | * :ref:`search` 26 | 27 | 28 | .. note:: 29 | `PySerbus` requires the `/dev/i2c-N` and `/dev/spidevX.Y` device files be present, and therefore relies on there being I2C and SPI drivers present and loaded. 30 | 31 | I2C and SPI device files typically require root privileges to access, and therefore any programs using the `serbus` package will need to be run with root permissions. 32 | 33 | .. warning:: 34 | Because PySerbus provides direct access to the SPI and I2C buses you could certainly cause some damage with it, e.g. putting an on-board device into a bad or unknown state - use at your own risk! 35 | 36 | 37 | .. Links: 38 | .. _PyBBIO: https://github.com/graycatlabs/PyBBIO 39 | .. _BeagleBone Black: http://beagleboard.org/BLACK 40 | .. _smbus: https://pypi.python.org/pypi/smbus-cffi 41 | .. _spidev: https://pypi.python.org/pypi/spidev 42 | .. _C: https://graycat.io/docs/serbus -------------------------------------------------------------------------------- /python/docs/_build/html/_sources/install.txt: -------------------------------------------------------------------------------- 1 | Installing PySerbus 2 | ================= 3 | 4 | Stable releases 5 | --------------- 6 | 7 | You can install the latest stable release of `serbus` using the `pip` Python package manager:: 8 | 9 | $ sudo pip install -U serbus 10 | 11 | Install from source 12 | ------------------- 13 | 14 | You can install `serbus` from source by clonign the git repository:: 15 | 16 | $ git clone https://github.com/graycatlabs/serbus.git 17 | 18 | Then building the Python package:: 19 | 20 | $ cd serbus/python/ 21 | $ python setup.py install 22 | 23 | -------------------------------------------------------------------------------- /python/docs/_build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /python/docs/_build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/comment-close.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/comment.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}img{width:100%;height:auto}} 2 | /*# sourceMappingURL=badge_only.css.map */ 3 | -------------------------------------------------------------------------------- /python/docs/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/down.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/file.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/Inconsolata-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/Inconsolata-Bold.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /python/docs/_build/html/_static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /python/docs/_build/html/_static/js/theme.js: -------------------------------------------------------------------------------- 1 | require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o"); 77 | 78 | // Add expand links to all parents of nested ul 79 | $('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () { 80 | var link = $(this); 81 | expand = $(''); 82 | expand.on('click', function (ev) { 83 | self.toggleCurrent(link); 84 | ev.stopPropagation(); 85 | return false; 86 | }); 87 | link.prepend(expand); 88 | }); 89 | }; 90 | 91 | nav.reset = function () { 92 | // Get anchor from URL and open up nested nav 93 | var anchor = encodeURI(window.location.hash); 94 | if (anchor) { 95 | try { 96 | var link = $('.wy-menu-vertical') 97 | .find('[href="' + anchor + '"]'); 98 | $('.wy-menu-vertical li.toctree-l1 li.current') 99 | .removeClass('current'); 100 | link.closest('li.toctree-l2').addClass('current'); 101 | link.closest('li.toctree-l3').addClass('current'); 102 | link.closest('li.toctree-l4').addClass('current'); 103 | } 104 | catch (err) { 105 | console.log("Error expanding nav for anchor", err); 106 | } 107 | } 108 | }; 109 | 110 | nav.onScroll = function () { 111 | this.winScroll = false; 112 | var newWinPosition = this.win.scrollTop(), 113 | winBottom = newWinPosition + this.winHeight, 114 | navPosition = this.navBar.scrollTop(), 115 | newNavPosition = navPosition + (newWinPosition - this.winPosition); 116 | if (newWinPosition < 0 || winBottom > this.docHeight) { 117 | return; 118 | } 119 | this.navBar.scrollTop(newNavPosition); 120 | this.winPosition = newWinPosition; 121 | }; 122 | 123 | nav.onResize = function () { 124 | this.winResize = false; 125 | this.winHeight = this.win.height(); 126 | this.docHeight = $(document).height(); 127 | }; 128 | 129 | nav.hashChange = function () { 130 | this.linkScroll = true; 131 | this.win.one('hashchange', function () { 132 | this.linkScroll = false; 133 | }); 134 | }; 135 | 136 | nav.toggleCurrent = function (elem) { 137 | var parent_li = elem.closest('li'); 138 | parent_li.siblings('li.current').removeClass('current'); 139 | parent_li.siblings().find('li.current').removeClass('current'); 140 | parent_li.find('> ul li.current').removeClass('current'); 141 | parent_li.toggleClass('current'); 142 | } 143 | 144 | return nav; 145 | }; 146 | 147 | module.exports.ThemeNav = ThemeNav(); 148 | 149 | if (typeof(window) != 'undefined') { 150 | window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav }; 151 | } 152 | 153 | },{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]); 154 | -------------------------------------------------------------------------------- /python/docs/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/minus.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/plus.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 11 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 16 | .highlight .go { color: #333333 } /* Generic.Output */ 17 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 21 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #902000 } /* Keyword.Type */ 27 | .highlight .m { color: #208050 } /* Literal.Number */ 28 | .highlight .s { color: #4070a0 } /* Literal.String */ 29 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 30 | .highlight .nb { color: #007020 } /* Name.Builtin */ 31 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #60add5 } /* Name.Constant */ 33 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 34 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #007020 } /* Name.Exception */ 36 | .highlight .nf { color: #06287e } /* Name.Function */ 37 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 38 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 41 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 44 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 45 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 46 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 47 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 48 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 49 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 50 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 51 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 52 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 53 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 54 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 55 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 56 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 57 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 58 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 59 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 60 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 61 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 62 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 63 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /python/docs/_build/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/up-pressed.png -------------------------------------------------------------------------------- /python/docs/_build/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/_static/up.png -------------------------------------------------------------------------------- /python/docs/_build/html/install.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Installing PySerbus — PySerbus 1.0.5 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | 99 | 100 |
101 | 102 | 103 | 107 | 108 | 109 | 110 |
111 |
112 | 113 | 114 | 115 | 116 | 117 | 118 |
119 |
    120 |
  • Docs »
  • 121 | 122 |
  • Installing PySerbus
  • 123 |
  • 124 | 125 | 126 | View page source 127 | 128 | 129 |
  • 130 |
131 |
132 |
133 |
134 |
135 | 136 |
137 |

Installing PySerbus

138 |
139 |

Stable releases

140 |

You can install the latest stable release of serbus using the pip Python package manager:

141 |
$ sudo pip install -U serbus
142 | 
143 |
144 |
145 |
146 |

Install from source

147 |

You can install serbus from source by clonign the git repository:

148 |
$ git clone https://github.com/graycatlabs/serbus.git
149 | 
150 |
151 |

Then building the Python package:

152 |
$ cd serbus/python/
153 | $ python setup.py install
154 | 
155 |
156 |
157 |
158 | 159 | 160 |
161 |
162 |
163 | 164 | 172 | 173 | 174 |
175 | 176 |
177 |

178 | © Copyright 2015, Gray Cat Labs. 179 | 180 |

181 |
182 | Built with Sphinx using a theme provided by Read the Docs. 183 | 184 |
185 | 186 |
187 |
188 | 189 |
190 | 191 |
192 | 193 | 194 | 195 | 196 | 197 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /python/docs/_build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graycatlabs/serbus/0349af70452c67f7c3ab449472c63f4eabf9c0df/python/docs/_build/html/objects.inv -------------------------------------------------------------------------------- /python/docs/_build/html/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Search — PySerbus 1.0.5 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
43 | 44 | 45 | 93 | 94 |
95 | 96 | 97 | 101 | 102 | 103 | 104 |
105 |
106 | 107 | 108 | 109 | 110 | 111 | 112 |
113 |
    114 |
  • Docs »
  • 115 | 116 |
  • 117 |
  • 118 | 119 |
  • 120 |
121 |
122 |
123 |
124 |
125 | 126 | 134 | 135 | 136 |
137 | 138 |
139 | 140 |
141 |
142 |
143 | 144 | 145 |
146 | 147 |
148 |

149 | © Copyright 2015, Gray Cat Labs. 150 | 151 |

152 |
153 | Built with Sphinx using a theme provided by Read the Docs. 154 | 155 |
156 | 157 |
158 |
159 | 160 |
161 | 162 |
163 | 164 | 165 | 166 | 167 | 168 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 196 | 197 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /python/docs/_build/html/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({envversion:46,filenames:["I2C","SPI","index","install"],objects:{"serbus.I2CDev":{close:[0,0,1,""],open:[0,0,1,""],read:[0,0,1,""],readTransaction:[0,0,1,""],write:[0,0,1,""]},"serbus.SPIDev":{close:[1,0,1,""],disableCS:[1,0,1,""],disableLoopback:[1,0,1,""],enableCS:[1,0,1,""],enableLoopback:[1,0,1,""],open:[1,0,1,""],read:[1,0,1,""],setBitsPerWord:[1,0,1,""],setCSActiveHigh:[1,0,1,""],setCSActiveLow:[1,0,1,""],setClockMode:[1,0,1,""],setLSBFirst:[1,0,1,""],setMSBFirst:[1,0,1,""],setMaxFrequency:[1,0,1,""],transaction:[1,0,1,""],transfer:[1,0,1,""],write:[1,0,1,""]},serbus:{I2CDev:[0,1,1,""],SPIDev:[1,1,1,""]}},objnames:{"0":["py","method","Python method"],"1":["py","class","Python class"]},objtypes:{"0":"py:method","1":"py:class"},terms:{"0b11":0,"0x00":0,"0x40":0,"0x50":0,"0xe3":0,"0xe5":0,"10m":0,"24lc256":0,"byte":[0,1],"class":[0,1],"default":[0,1],"import":[0,1],"int":[0,1],"return":[0,1],"true":[0,1],"try":[0,1],"while":[0,1],access:2,activ:1,addit:[0,1],address:0,allow:[0,1],alreadi:2,ani:[0,1,2],appli:1,argument:1,asynchron:0,b2c:0,back:0,bad:2,beaglebon:[0,1,2],becaus:[1,2],been:0,befor:[0,1],bit:[0,1],bits_per_word:1,black:[0,1,2],board:2,bool:[0,1],both:[1,2],build:3,buse:2,call:[0,1],can:[0,3],captur:1,caus:2,celsiu:0,certainli:2,check:0,chip:1,circuit:0,clean:2,clear:0,clock_mod:1,clone:3,clonign:3,close:[0,1],com:3,combin:0,command:0,commun:[0,1,2],complet:0,configur:[0,1],connect:[0,1],control:1,convers:0,convert:0,correspond:[0,1],could:[0,1,2],crc:0,creat:[0,1],cyclic:0,dac:1,damag:2,data_to_writ:0,datasheet:[0,1],def:0,depend:[0,1],describ:1,desir:1,dev:[0,1,2],develop:2,devic:[0,1,2],diagram:1,direct:2,disabl:1,disablec:1,disableloopback:1,doc:1,down:[0,1],drive:1,driver:[0,1,2],duplex:1,easi:1,edg:1,eeprom_addr:0,els:0,embed:[0,1],enabl:[0,1],enablec:1,enableloopback:1,enough:0,equival:0,error:0,except:[0,1],explicitli:1,fail:0,fall:1,fals:[0,1],few:[0,1],file:[0,1,2],first:1,format:[0,1],four:1,frequenc:1,friendli:2,from:[0,1,2],full:1,getrh:0,gettemp:0,git:3,github:3,give:0,given:[0,1],gnd:0,gnu:[0,1,2],graycat:1,graycatlab:3,half:1,hardwar:[0,1,2],have:[0,1,2],here:0,high:[0,1],how:[0,1],html:1,http:[0,1,3],htu21d_addr:0,htu21d_bu:0,htu21d_cmd_rh:0,htu21d_cmd_temp:0,i2cdev:0,idl:1,ignor:0,immedi:0,includ:1,index:2,info:[0,1],initi:[0,1],instal:2,instanc:[0,1],instanti:[0,1],integ:1,integr:0,inter:0,interfac:[0,1,2],invert:1,ioerror:1,just:1,kernel:[0,1],keyboardinterrupt:[0,1],larger:1,latest:3,least:1,len:0,length:1,level:1,librari:2,like:[0,1,2],limit:2,linux:[0,1,2],list:[0,1],load:[0,1,2],locat:0,loopback:1,low:[0,1],lsb:0,mai:[0,1],manag:3,mani:1,map:0,maximum:1,measur:0,method:[0,1],mode:0,mode_3wir:1,modul:1,more:[0,1],most:1,msb:0,multiplex:[0,1],must:[0,1],n_byte:0,n_rx_word:1,n_word:1,need:2,neither:2,none:1,note:1,number:[0,1],object:[0,1],often:1,onli:[0,1],open:[0,1],option:[0,1],order:1,org:[0,1],other:[0,1],own:2,packag:[2,3],page:2,paramet:[0,1],part:2,particular:[0,1],pass:1,per:1,peripher:1,permiss:2,pin:[0,1],pip:3,possibl:1,present:2,print:[0,1],privileg:2,program:2,proper:[0,1],protect:0,provid:[0,1,2],pull:0,put:2,pybbio:2,python:[1,2,3],rais:1,ramp:1,rang:[0,1],raw_valu:0,read_data:0,readtransact:0,receiv:[0,1],redund:0,regist:0,rel:0,releas:2,reli:2,remain:1,repositori:3,requir:[0,1,2],rise:1,risk:2,root:2,run:[0,1,2],same:1,scale:1,scratch:2,search:2,see:[0,1],select:[0,1],sequenc:0,serbu:[0,1,2,3],serial:1,serial_peripheral_interface_bu:1,set:1,setbitsperword:1,setclockmod:1,setcsactivehigh:1,setcsactivelow:1,setlsbfirst:1,setmaxfrequ:1,setmsbfirst:1,setup:[0,1,3],should:0,show:[0,1],shown:1,signal:1,signific:1,simpl:2,simultan:1,singl:[0,1],size:1,slave:[0,1],slave_addr:0,sleep:[0,1],slelct:1,slim:2,smbu:2,some:2,sometim:1,sourc:2,spec:1,specif:[0,1],spi_bu:1,spidev0:1,spidev1:1,spidev:[0,1,2],spidevx:2,stabl:2,standard:[0,1,2],start_lsb:0,start_msb:0,state:[1,2],statu:0,success:0,sudo:3,support:2,system:[0,1,2],take:1,tell:1,temperatur:0,than:[0,1],thei:[0,1,2],them:[0,1],therefor:2,thi:[0,1],thing:0,time:[0,1],transact:1,transfer:1,two:0,tx_byte:0,tx_word:1,typic:2,unabl:1,unchang:1,unknown:2,use_10bit_address:0,valu:[0,1],veri:2,verifi:0,visual:1,well:[0,1],were:1,when:1,whether:0,wiki:[0,1],wikipedia:[0,1],wire:1,without:0,word:[0,1],work:[0,1],would:1,write:[0,1],written:[0,1,2],you:[0,1,2,3],your:[0,1,2]},titles:["I2C","SPI","PySerbus","Installing PySerbus"],titleterms:{ad7390:1,analog:1,api:[0,1],clock:1,content:2,convert:1,data:[0,1],digit:1,eeprom:0,exampl:[0,1],from:3,htu21d:0,humid:0,i2c:0,instal:3,memori:0,mode:1,pyserbu:[2,3],read:[0,1],releas:3,sensor:0,sourc:3,spi:1,stabl:3,why:2}}) -------------------------------------------------------------------------------- /python/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. PySerbus documentation master file 2 | 3 | PySerbus 4 | ====================== 5 | 6 | The `serbus` Python package provides slim APIs for communicating with I2C and SPI devices on GNU/Linux systems. It interfaces with the `/dev/i2c-N` and `/dev/spidevX.Y` device files provided by standard Linux I2C and SPI drivers. 7 | 8 | Why? 9 | ==== 10 | 11 | The serbus library was developed as part of `PyBBIO`_, a Python library for hardware IO support on the `BeagleBone Black`_. There are already some Python packages for SPI and I2C communication, like `spidev`_ and `smbus`_, but neither have very friendly APIs, and they both have some limitations. The `serbus` library was written from scratch for PyBBIO, to provide clean and simple APIs in both `C`_ and Python. 12 | 13 | 14 | Contents 15 | ======== 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | install 21 | I2C 22 | SPI 23 | 24 | * :ref:`genindex` 25 | * :ref:`search` 26 | 27 | 28 | .. note:: 29 | `PySerbus` requires the `/dev/i2c-N` and `/dev/spidevX.Y` device files be present, and therefore relies on there being I2C and SPI drivers present and loaded. 30 | 31 | I2C and SPI device files typically require root privileges to access, and therefore any programs using the `serbus` package will need to be run with root permissions. 32 | 33 | .. warning:: 34 | Because PySerbus provides direct access to the SPI and I2C buses you could certainly cause some damage with it, e.g. putting an on-board device into a bad or unknown state - use at your own risk! 35 | 36 | 37 | .. Links: 38 | .. _PyBBIO: https://github.com/graycatlabs/PyBBIO 39 | .. _BeagleBone Black: http://beagleboard.org/BLACK 40 | .. _smbus: https://pypi.python.org/pypi/smbus-cffi 41 | .. _spidev: https://pypi.python.org/pypi/spidev 42 | .. _C: https://graycat.io/docs/serbus -------------------------------------------------------------------------------- /python/docs/install.rst: -------------------------------------------------------------------------------- 1 | Installing PySerbus 2 | ================= 3 | 4 | Stable releases 5 | --------------- 6 | 7 | You can install the latest stable release of `serbus` using the `pip` Python package manager:: 8 | 9 | $ sudo pip install -U serbus 10 | 11 | Install from source 12 | ------------------- 13 | 14 | You can install `serbus` from source by clonign the git repository:: 15 | 16 | $ git clone https://github.com/graycatlabs/serbus.git 17 | 18 | Then building the Python package:: 19 | 20 | $ cd serbus/python/ 21 | $ python setup.py install 22 | 23 | -------------------------------------------------------------------------------- /python/examples/i2c_eeprom.py: -------------------------------------------------------------------------------- 1 | # i2c_read.py 2 | # Write data to an I2C EEPROM (e.g. 24LC256) then reading it back 3 | import serbus, time 4 | 5 | eeprom_addr = 0x50 # I2C slave address of EEPROM 6 | start_msb = 0x00 # High byte of location in EEPROM to write/read 7 | start_lsb = 0x00 # Low byte of location in EEPROM to write/read 8 | 9 | data_to_write = range(10) 10 | 11 | # Create an I2CDev instance for interfacing to /dev/i2c-2: 12 | bus = serbus.I2CDev(2) 13 | bus.open() 14 | 15 | print "Writing data: {}".format(data_to_write) 16 | # Write the data to the EEPROM: 17 | bus.write(eeprom_addr, [start_msb, start_lsb] + data_to_write) 18 | # The I2C write is asynchronous - give it a bit of time to complete: 19 | time.sleep(0.01) # 10ms should be more than enough 20 | 21 | # Read the data from the EEPROM: 22 | bus.write(eeprom_addr, [start_msb, start_lsb]) 23 | read_data = bus.read(0x50, len(data_to_write)) 24 | print "Data read: {}".format(read_data) 25 | 26 | if read_data == data_to_write: 27 | print "EEPROM write successful!" 28 | else: 29 | print "EEPROM write failed, is WP enabled?" 30 | 31 | bus.close() -------------------------------------------------------------------------------- /python/examples/i2c_htu21d.py: -------------------------------------------------------------------------------- 1 | # i2c_htu21d.py 2 | # Example of reading data from the HTU21D I2C temp/humidity sensor 3 | import serbus, time 4 | 5 | htu21d_bus = 1 # Connected to /dev/i2c-1 6 | htu21d_addr = 0x40 # HTU21D slave address 7 | htu21d_cmd_temp = 0xe3 # Command to read temperature 8 | htu21d_cmd_rh = 0xe5 # Command to read relative humidity 9 | 10 | bus = serbus.I2CDev(1) 11 | bus.open() 12 | 13 | def getTemp(): 14 | # Read the 3 bytes of data: 15 | msb, lsb, crc = bus.readTransaction(htu21d_addr, htu21d_cmd_temp, 3) 16 | # The crc (cyclic redundancy check) can be used to verify the data was 17 | # received without error - ignore it here 18 | # Combine the high and low bytes: 19 | raw_value = (msb<<8) | lsb 20 | # Clear the two status bits (see datasheet): 21 | raw_value &= ~0b11 22 | # Convert to Celsius and return (conversion from datasheet): 23 | return -46.85 + 175.72 * (raw_value/65536.0) 24 | 25 | def getRH(): 26 | msb, lsb, crc = bus.readTransaction(htu21d_addr, htu21d_cmd_rh, 3) 27 | raw_value = (msb<<8) | lsb 28 | raw_value &= ~0b11 29 | # Convert to %RH and return (conversion from datasheet): 30 | return -6.0 + 125.0 * (raw_value/65536.0) 31 | 32 | try: 33 | while True: 34 | print 35 | print "Temperature: {:0.2f}C".format(getTemp()) 36 | print "Relative humidity: {:0.2f}%".format(getRH()) 37 | time.sleep(1) 38 | 39 | except KeyboardInterrupt: 40 | bus.close() -------------------------------------------------------------------------------- /python/examples/i2c_read.py: -------------------------------------------------------------------------------- 1 | # i2c_read.py 2 | # Example of reading I2C data 3 | import serbus 4 | 5 | # Create an I2CDev instance for interfacing to /dev/i2c-1: 6 | bus = serbus.I2CDev(1) 7 | bus.open() 8 | 9 | # Read a single byte from the slave device with address 0x50: 10 | data = bus.read(0x50, 1) 11 | print "byte received: {:x}".format(data[0]) 12 | 13 | bus.close() -------------------------------------------------------------------------------- /python/examples/i2c_write.py: -------------------------------------------------------------------------------- 1 | # i2c_read.py 2 | # Example of reading I2C data 3 | import serbus 4 | 5 | # Create an I2CDev instance for interfacing to /dev/i2c-1: 6 | bus = serbus.I2CDev(1) 7 | bus.open() 8 | 9 | # Write a couple bytes to the slave device with address 0x50: 10 | bus.write(0x50, [0x00, 0x01]) 11 | 12 | bus.close() -------------------------------------------------------------------------------- /python/examples/spi_ad7390.py: -------------------------------------------------------------------------------- 1 | # spi_ad7390.py 2 | # Example of controlling an AD7390 DAC 3 | import serbus, time 4 | 5 | # The SPI bus and chip select the AD7390 is connected to: 6 | spi_bus = 1 7 | cs = 0 8 | # /dev/spidev1.0 9 | 10 | bus = serbus.SPIDev(spi_bus) 11 | bus.open() 12 | 13 | # Set bus configuration, as described in the AD7390 datasheet: 14 | bus.setMaxFrequency(cs, 1000000) 15 | bus.setBitsPerWord(cs, 16) 16 | bus.setClockMode(cs, 3) 17 | bus.setCSActiveHigh(cs) 18 | bus.setMSBFirst(cs) 19 | 20 | try: 21 | while True: 22 | # Ramp up from 0V to full-scale: 23 | for i in range(0, 2**12, 100): 24 | bus.write(cs, [i]) 25 | time.sleep(0.01) 26 | 27 | # Ramp down from full-scale to 0V: 28 | for i in range(2**12-1, 0, -100): 29 | bus.write(cs, [i]) 30 | time.sleep(0.01) 31 | 32 | except KeyboardInterrupt: 33 | bus.close() -------------------------------------------------------------------------------- /python/examples/spi_read.py: -------------------------------------------------------------------------------- 1 | # spi_read.py 2 | # Example of reading SPI data 3 | import serbus 4 | 5 | # The chip select connected to the slave device: 6 | cs = 0 7 | 8 | # Create a SPIDev instance for interfacing to /dev/spidev0.x devices: 9 | bus = serbus.SPIDev(0) 10 | bus.open() 11 | 12 | # Set bus configuration: 13 | bus.setMaxFrequency(cs, 1000000) 14 | bus.setBitsPerWord(cs, 8) 15 | bus.setClockMode(cs, 0) 16 | bus.setCSActiveLow(cs) 17 | bus.setMSBFirst(cs) 18 | 19 | # Read a single 8-bit word from the device: 20 | data = bus.read(cs, 1) 21 | print "word received: {:x}".format(data[0]) 22 | 23 | bus.close() -------------------------------------------------------------------------------- /python/include: -------------------------------------------------------------------------------- 1 | ../include/ -------------------------------------------------------------------------------- /python/serbus/__init__.py: -------------------------------------------------------------------------------- 1 | # __init__.py file for serpus package 2 | 3 | from i2cdev import I2CDev 4 | from spidev import SPIDev -------------------------------------------------------------------------------- /python/setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = ../README.md -------------------------------------------------------------------------------- /python/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, Extension 2 | 3 | extensions = [ 4 | Extension("serbus.spidev", 5 | ["serbus/pyspidev.c", 6 | "src/spidriver.c"], 7 | include_dirs=["include"]), 8 | 9 | Extension("serbus.i2cdev", 10 | ["serbus/pyi2cdev.c", 11 | "src/i2cdriver.c"], 12 | include_dirs=["include"]), 13 | ] 14 | 15 | setup(name="serbus", 16 | version="1.0.5", 17 | description="A Python package for I2C and SPI serial bus communication on GNU/Linux systems.", 18 | long_description=open("README.md").read(), 19 | author="Alexander Hiam", 20 | author_email="alex@graycat.io", 21 | license="MIT License", 22 | url="https://github.com/graycatlabs/serbus", 23 | download_url="https://github.com/graycatlabs/serbus/tarball/v1.0.5", 24 | keywords=["I2C", "SPI", "serial", "Linux"], 25 | packages=["serbus"], 26 | ext_modules=extensions, 27 | classifiers=[ 28 | "License :: OSI Approved :: MIT License", 29 | "Operating System :: POSIX :: Linux", 30 | "Topic :: Software Development :: Embedded Systems", 31 | "Topic :: Software Development :: Libraries :: Python Modules", 32 | "Topic :: System :: Hardware" 33 | ]) 34 | -------------------------------------------------------------------------------- /python/src: -------------------------------------------------------------------------------- 1 | ../src/ -------------------------------------------------------------------------------- /src/i2cdriver.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2015 - Gray Cat Labs - https://graycat.io 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | ******************************************************************************/ 22 | 23 | /** 24 | * @file i2cdriver.c 25 | * @author Alex Hiam - 26 | * 27 | * @brief A basic driver for controlling Linux I2C interfaces. 28 | * 29 | * Requires an I2C Kernel driver be loaded to expose /dev/i2c-N interfaces 30 | * which provide the standard Linux I2C ioctls. This driver is really just an 31 | * ioctl wrapper. 32 | */ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include "i2cdriver.h" 42 | 43 | /// Buffer size at least large enough to fit the max length of "/dev/i2c-N" 44 | #define I2C_PATH_LEN 20 45 | 46 | int I2C_open(uint8_t bus) { 47 | char device[I2C_PATH_LEN]; 48 | sprintf(device, "/dev/i2c-%d", bus); 49 | return open(device, O_RDWR, 0); 50 | } 51 | 52 | void I2C_close(int i2c_fd) { 53 | close(i2c_fd); 54 | } 55 | 56 | int I2C_enable10BitAddressing(int i2c_fd) { 57 | int ret; 58 | ret = ioctl(i2c_fd, I2C_TENBIT, 1); 59 | if (ret < 0) return ret; 60 | return 0; 61 | } 62 | 63 | int I2C_disable10BitAddressing(int i2c_fd) { 64 | int ret; 65 | ret = ioctl(i2c_fd, I2C_TENBIT, 0); 66 | if (ret < 0) return ret; 67 | return 0; 68 | } 69 | 70 | int I2C_setSlaveAddress(int i2c_fd, int addr) { 71 | int ret; 72 | ret = ioctl(i2c_fd, I2C_SLAVE, addr); 73 | if (ret < 0) return ret; 74 | return 0; 75 | } 76 | 77 | int I2C_read(int i2c_fd, void *rx_buffer, int n_bytes) { 78 | int ret; 79 | ret = read(i2c_fd, rx_buffer, n_bytes); 80 | if (ret < 0) return ret; 81 | return 0; 82 | } 83 | 84 | int I2C_readTransaction(int i2c_fd, uint8_t command, void *rx_buffer, 85 | int n_bytes) { 86 | int ret; 87 | ret = write(i2c_fd, &command, 1); 88 | if (ret < 0) return ret; 89 | 90 | ret = read(i2c_fd, rx_buffer, n_bytes); 91 | if (ret < 0) return ret; 92 | return 0; 93 | } 94 | 95 | int I2C_write(int i2c_fd, void *tx_buffer, int n_bytes) { 96 | int ret; 97 | ret = write(i2c_fd, tx_buffer, n_bytes); 98 | if (ret < 0) return ret; 99 | return 0; 100 | } --------------------------------------------------------------------------------