Skip to content

Commit

Permalink
add gitbook framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jan 10, 2019
1 parent 0efb9fa commit c412eef
Show file tree
Hide file tree
Showing 75 changed files with 1,640 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .bookignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/config/
gulpfile.js
.markdownlint.json
package.json
.gitignore
.bookignore
/README.md
/zh/CONTRIBUTING.md
*.xlsx
*.orig
*.less
*.ai
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
npm-debug.log
.DS_Store
node_modules/
output/
.vscode/
_book/
*.epub
*.pdf
*.mobi
5 changes: 5 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"fenced-code-language": false,
"ol-prefix": false,
"line-length": false
}
2 changes: 2 additions & 0 deletions LANGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [English](/en)
- [中文](/zh)
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Documentation Of MaixPy
===========


|[Read me online](https://sipeed.github.io/MaixPy_DOC/en/) | [在线阅读](https://sipeed.github.io/MaixPy_DOC/zh/) |
| ------------------------ | ----------- |
| | |


Binary file added assets/BiT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Dan_Dock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Go.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/M1_Dan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_sipeed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_sipeed2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/k210-front-background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/micropython.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions book.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"title": "MaixPy DOC",
"description": "MaixPy documentation",
"author":"sipeed",
"plugins": [
"my-toolbar",
"-lunr",
"-search",
"search-title",
"anchor-navigation-ex",
"anchorjs",
"sharing",
"splitter",
"edit-link",
"ga",
"theme-default-customize@git+https://github.com/cocos-creator/theme-default.git",
"expandable-chapters-small@git+https://github.com/cocos-creator/gitbook-plugin-expandable-chapters-small.git"
],
"styles": {
"website": "./styles/website.css"
},
"pluginsConfig": {
"github": {
"url": "https://github.com/sipeed/MaixPy"
},
"my-toolbar": {
"buttons": [
{
"label": "Github",
"text":" ",
"icon": "fa fa-github",
"position": "left",
"target": "_blank",
"url": "https://github.com/sipeed/MaixPy"
}
]
},
"search": {
"maxIndexSize": 1000000000
},

"lunr": {
"maxIndexSize": 1000000000
},
"edit-link": {
"base": "https://github.com/sipeed/MaixPy_DOC/blob/master",
"label": ""
},
"sharing": {
"douban": false,
"facebook": true,
"google": true,
"hatenaBookmark": false,
"instapaper": false,
"line": false,
"linkedin": false,
"messenger": false,
"pocket": false,
"qq": false,
"qzone": false,
"stumbleupon": false,
"twitter": true,
"viber": false,
"vk": false,
"weibo": true,
"whatsapp": false,
"all": [
"weibo",
"facebook",
"google",
"twitter",
"vk"
]
},
"anchor-navigation-ex": {
"associatedWithSummary": false,
"showLevel": true,
"multipleH1": false,
"mode": "float",
"pageTop": {
"showLevelIcon": true,
"level1Icon": "fa fa-angle-double-right",
"level2Icon": "fa fa-angle-double-right",
"level3Icon": "fa fa-angle-double-right"
}
},
"ga": {
"token": "UA-119047820-2"
}
}
}
92 changes: 92 additions & 0 deletions en/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
MaixPy Documentation
======

<div>
<img src="../assets/micropython.png"> <img src="../assets/icon_sipeed2.png" height="60">
</div>


## What is MaixPy

MaixPy is a [Micropython](http://micropython.org/) port on 64Bit Dual-Core RISC-V CPU [K210](https://kendryte.com/),

> MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.
> K210 created for AIOT(AI+IOT) use, It's powerful performance and low cost are very competitive.

Micropython make program on hardware(K210) easier, so we build this and open source on [github]((https://github.com/sipeed/MaixPy))

For example if we want to find I2C device, we just need code:
```python
from machine import I2C

i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29)
devices = i2c.scan()
print(devices)
```


If we want to make a `breathing light` by PWM, we just need code:
```python
from machine import Timer,PWM
import time

tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PWM)
ch = PWM(tim, freq=500000, duty=50, pin=board_info.LED_G)
duty=0
dir = True
while True:
if dir:
duty += 10
else:
duty -= 10
if duty>100:
duty = 100
dir = False
elif duty<0:
duty = 0
dir = True
time.sleep(0.05)
ch.duty(duty)
```

## About this documentation

Everything related to Maixpy, mainly about
* How to get a hardware( board )
* How to get start with MaixPy even we are not so be expert in program for hardware.
* Learn Micropython basic knowledge
* Libriaries(API) reference

## Let's get started

To get started, we need one dev board, there's three kind of board as follow:

* Dan dock with Sipeed M1(Dan) module

![Dan dock](../assets/Dan_Dock.png)

* Sipeed Maix BiT

![BiT](../assets/BiT.png)

* Sipeed Go

![Go](../assets/Go.jpg)

To get these board, visit [Sipeed official website](https://sipeed.com/)

More hardware infomation [here](en/hardware/hardware.md)

Then we can write software, refer to [get started](en/get_started.md)

## Source code

MaixPy source code [on github](https://github.com/sipeed/MaixPy)


------------

Maintained by &copy;<a href="https://www.sipeed.com" style="color: #f14c42">Sipeed</a> Co.,Ltd.

64 changes: 64 additions & 0 deletions en/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Summary
=====

## Introduction

- [Introduction](README.md)

## Hardware

- [K210](hardware/k210.md)
- [Module](hardware/module.md)
- [Sipeed M1](hardware/m1.md)
- [Board](hardware/board.md)
- [Dan Dock](hardware/dan_dock.md)
- [BiT](hardware/bit.md)
- [Go](hardware/go.md)

## Getting Started

- [Prepare](get_started/prepare.md)
- [Get Hardware](get_started/get_hardware.md)
- [Upgrade Firmware](get_started/upgrade_firmware.md)
- [Power On](get_started/power_on.md)
- [LED Blink](get_started/led_blink.md)
- [How To Read Docs](get_started/how_to_read.md)

## Reference

- [Basic Syntax](mpy_basic_syntax/README.md)
- [Libraries](libs/README.md)
- [standard](libs/standard/README.md)
- [cmath](libs/standard/cmath.md)
- [gc](libs/standard/gc.md)
- [math](libs/standard/math.md)
- [sys](libs/standard/sys.md)
- [ubinascii](libs/standard/ubinascii.md)
- [ucollections](libs/standard/ucollections.md)
- [uerrno](libs/standard/uerrno.md)
- [uheapq](libs/standard/uheapq.md)
- [uos](libs/standard/uos.md)
- [ure](libs/standard/ure.md)
- [uselect](libs/standard/uselect.md)
- [ustruct](libs/standard/ustruct.md)
- [utime](libs/standard/utime.md)
- [uzlib](libs/standard/uzlib.md)
- [machine](libs/machine/README.md)
- [I2C](libs/machine/i2c.md)
- [PWM](libs/machine/pwm.md)
- [SPI](libs/machine/spi.md)
- [Timer](libs/machine/timer.md)
- [UART](libs/machine/uart.md)

## Others

- [Contribute](contribute/README.md)
- [doc convention](contribute/doc_convention.md)
- [code convention](contribute/code_convention.md)
- [Open Source Projects](others/open_projects.md)






47 changes: 47 additions & 0 deletions en/_layouts/website/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% extends template.self %}
{% block book_header %}
<div class="sipeed-navbar navbar-collapse" id="navbar" role="navigation">
<ul class="nav navbar-nav">
<li><a href="https://www.sipeed.com" class="btn" target="_blank"><img src="/assets/icon_sipeed2.png" height="30" /></a></li>
<li><a href="#" class="btn autohide" onclick="toggleLanguage()">中文</a></li>
{% for item in book.items %}
{% if item.links %}
<li>
<a href="#" class="btn autohide"><i ></i>{{item.name}}</a>
<ul class="hovershow">
{% for entry in item.links %}
<li><a href="{{entry.link}}" class="btn" target="_blank">{{entry.name}}</a></li>
{% endfor %}
</ul>
</li>
{% else %}
<li><a href="{{item.link}}" class="btn autohide" target="_blank"><i ></i>{{item.name}}</a></li>
{% endif %}
{% endfor %}
{% for item in book.version %}
{% if item.links %}
<li class="version-link">
<a class="btn" style="color:#444">Version: <span style="font-weight:bold">{{item.name}}</span></a>
<ul class="hovershow">
{% for entry in item.links %}
<li><a href="{{entry.link}}" class="btn">Version: <span style="font-weight:bold">{{entry.name}}</span></a></li>
{% endfor %}
</ul>
</li>
{% else %}
<li><a href="{{item.link}}" class="btn">{{item.name}}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>
<div class="book-header" role="navigation">
{% if glossary.path %}
<a href="{{ ('/' + glossary.path)|resolveFile }}" class="btn pull-left" aria-label="{{ "GLOSSARY_OPEN"|t }}"><i class="fa fa-sort-alpha-asc"></i></a>
{% endif %}
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="{{ "/"|resolveFile }}" >{{ page.title }}</a>
</h1>
</div>
{% endblock %}
54 changes: 54 additions & 0 deletions en/_layouts/website/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% extends template.self %}
{% block book_sidebar %}
<nav role="navigation" class="autoshow">
<ul class="summary">
<li><a href="https://www.sipeed.com" class="btn" target="_blank"><img src="/assets/icon_sipeed2.png" height="30" /></a></li>
<li><a href="#" class="btn" onclick="toggleLanguage()">中文</a></li>
{% for item in book.version %}
{% if item.links %}
<li class="version-link">
<a href="#" class="btn" style="color:#444"></i>Version: <span style="font-weight: bold; display: inline">{{item.name}}</span></a>
<ul class="hovershow">
{% for entry in item.links %}
<li><a href="{{entry.link}}" class="btn">Version: <span style="font-weight:bold; display: inline">{{entry.name}}</span></a></li>
{% endfor %}
</ul>
</li>
{% else %}
<li><a href="{{item.link}}" class="btn"></i>{{item.name}}</a></li>
{% endif %}
{% endfor %}
{% for item in book.items %}
{% if item.links %}
<li>
<a href="#" class="btn"><i ></i>{{item.name}}</a>
<ul>
{% for entry in item.links %}
<li><a href="{{entry.link}}" class="btn" target="_blank">{{entry.name}}</a></li>
{% endfor %}
</ul>
</li>
{% else %}
<li><a href="{{item.link}}" class="btn" target="_blank"><i></i>{{item.name}}</a></li>
{% endif %}
{% endfor %}
</ul>
</nav>
{{ super() }}
{% endblock %}
{% block javascript %}
{{ super() }}
<script type="text/javascript">
function toggleLanguage () {
var path = location.href;
// console.log(path);
if (path.indexOf('/zh') !== -1) {
path = path.replace(/\/zh[\/$\s]/i, '/en/');
} else if (path.indexOf('/en') !== -1) {
path = path.replace(/\/en[\/$\s]/i, '/zh/');
}
// console.log('after: ' + path);
location.assign(path);
}
</script>
{% endblock %}
Loading

0 comments on commit c412eef

Please sign in to comment.