mirror of
https://github.com/sipeed/Maixduino.git
synced 2026-03-23 18:36:57 +01:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d31122a39 | ||
|
|
2bae74b0c0 | ||
|
|
1e63c0d678 | ||
|
|
377cb291e7 | ||
|
|
0c9ca167b7 | ||
|
|
6d2de50937 | ||
|
|
8aaca6ea3a | ||
|
|
7fd025bcd4 | ||
|
|
032eb52ac9 | ||
|
|
f18df03229 | ||
|
|
d4a7042c82 | ||
|
|
fb781728b9 | ||
|
|
ca9c0a900a | ||
|
|
c2f8db6a9f | ||
|
|
22ab4ecfe7 | ||
|
|
aa6543538c | ||
|
|
b9c5f43fea | ||
|
|
e9532200e9 | ||
|
|
50cb129b02 | ||
|
|
f54b3f19ab | ||
|
|
03b7995e0c | ||
|
|
86acd72c3d | ||
|
|
f95f8e70c9 | ||
|
|
4f4d43094b | ||
|
|
a346d8cab1 | ||
|
|
ca5e26d4e9 | ||
|
|
abba977741 | ||
|
|
ae99df0800 | ||
|
|
ea172fc074 | ||
|
|
2fe52b570e | ||
|
|
403e61d90a | ||
|
|
1376ced183 | ||
|
|
505f888835 | ||
|
|
a256706b7f | ||
|
|
dead5bc98d | ||
|
|
78f7bb18c5 | ||
|
|
763c23d13c | ||
|
|
7c7ec509ac | ||
|
|
9b077cb470 | ||
|
|
359f7a89f2 | ||
|
|
bb42e208a7 | ||
|
|
0cfbfacc40 | ||
|
|
d4a0f06d05 | ||
|
|
2c08ea95bb | ||
|
|
d42af6a0a2 | ||
|
|
4fb76511f6 | ||
|
|
64fe55b858 | ||
|
|
85c0d7d24e | ||
|
|
31fa216fd0 | ||
|
|
4dd21db55e | ||
|
|
6f7873a49c | ||
|
|
4f5585a0dd | ||
|
|
485cf192ba | ||
|
|
2570fd3b5a | ||
|
|
3ffdbe9768 | ||
|
|
d19982e248 | ||
|
|
a8a5e39e9e | ||
|
|
4fad772219 | ||
|
|
546dc5e894 | ||
|
|
5d85ca78a3 | ||
|
|
a241ae41a7 | ||
|
|
1eb49c57da | ||
|
|
db7a98b893 | ||
|
|
9b2f110f0b | ||
|
|
99ab059752 | ||
|
|
7d66935095 |
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -10,6 +10,6 @@
|
|||||||
[submodule "libraries/lv_arduino"]
|
[submodule "libraries/lv_arduino"]
|
||||||
path = libraries/lv_arduino
|
path = libraries/lv_arduino
|
||||||
url = https://github.com/btx000/lv_arduino.git
|
url = https://github.com/btx000/lv_arduino.git
|
||||||
[submodule "libraries\\lv_maixduino"]
|
[submodule "libraries/lv_maixduino"]
|
||||||
path = libraries\\lv_maixduino
|
path = libraries/lv_maixduino
|
||||||
url = https://github.com/littlevgl/lv_maixduino.git
|
url = https://github.com/littlevgl/lv_maixduino.git
|
||||||
|
|||||||
63
README.md
63
README.md
@@ -1,21 +1,76 @@
|
|||||||
Maixduino
|
Maixduino
|
||||||
========
|
========
|
||||||
|
|
||||||
Arduino core for Maix Board (K210)
|
# Arduino Core for K210 based devices
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Supported devices
|
||||||
|
|
||||||
|
### Sipeed Maix series
|
||||||
|
- [Amigo](https://dl.sipeed.com/MAIX/HDK/Sipeed-Amigo)
|
||||||
|
- [Cube](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maix-Cube)
|
||||||
|
- [Go](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maix-GO)
|
||||||
|
- [Maixduino](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maixduino)
|
||||||
|
- [Dock](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maix-Dock)
|
||||||
|
- [BiT](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maix-Bit)
|
||||||
|
- [Nano](https://dl.sipeed.com/MAIX/HDK/Sipeed-Maix-Nano)
|
||||||
|
|
||||||
|
### M5Stack
|
||||||
|
* [M5StickV](https://m5stack.com/products/stickv)
|
||||||
|
* [M5UnitV](https://m5stack.com/collections/m5-unit/products/unitv-ai-camera)
|
||||||
|
|
||||||
|
### Various custom boards
|
||||||
|
* [LAMLOEI AOIT DAAN](https://github.com/lamloei/AIoTDaaN/tree/master/hardware/20190505-R2/AIoTDaaN_R2/pdf)
|
||||||
|
* [IOXGD4](https://github.com/ioxgd/IOXGD-hardware/tree/master/IOXGD4/pdf)
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
Docs: [maixduino.sipeed.com](https://maixduino.sipeed.com/)
|
Docs: [wiki.sipeed.com](https://wiki.sipeed.com/soft/maixduino/zh/index.html)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Refer install doc: [Install](https://maixduino.sipeed.com/en/get_started/install.html)
|
Refer install doc: [Install](https://maixduino.sipeed.com/en/get_started/install.html)
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
## Other SDK
|
### From Board Manager
|
||||||
|
|
||||||
|
1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software) (at least version v1.9.8)
|
||||||
|
2. Start the Arduino IDE
|
||||||
|
3. Go into Preferences
|
||||||
|
4. Add ```https://dl.sipeed.com/MAIX/Maixduino/package_Maixduino_k210_index.json``` as an "Additional Board Manager URL"
|
||||||
|
5. Open the Boards Manager from the Tools -> Board menu and install "Maixduino(K210)"
|
||||||
|
6. Select your K210 board from the Tools -> Board menu
|
||||||
|
|
||||||
|
### From git
|
||||||
|
|
||||||
|
1. Follow steps from Board Manager section above
|
||||||
|
2. ```cd <SKETCHBOOK>```, where ```<SKETCHBOOK>``` is your Arduino Sketch folder:
|
||||||
|
* OS X: ```~/Documents/Arduino```
|
||||||
|
* Linux: ```~/Arduino```
|
||||||
|
* Windows: ```~/Documents/Arduino```
|
||||||
|
3. Create a folder named ```hardware```, if it does not exist, and change directories to it
|
||||||
|
4. Clone this repo: ```git clone https://github.com/Sipeed/Maixduino Maixduino/k210```
|
||||||
|
5. Restart the Arduino IDE
|
||||||
|
|
||||||
|
### Firmware flashing
|
||||||
|
The firmware of the K210 devices is updated with a Python-based [kflash](https://github.com/sipeed/kflash.py) cross-platform tool.
|
||||||
|
Follow ```kflash``` github page on installation instruction.
|
||||||
|
|
||||||
|
|
||||||
|
###### Change board settings in Tools section on the top of Arduino IDE
|
||||||
|
|
||||||
|
1. Board: The same as your dev board
|
||||||
|
2. Burn Toolfirmware: leave default, for Maix Go Kit - ```open-ec```
|
||||||
|
3. Burn Baudrate: Decrease it if download fails
|
||||||
|
4. Port: Serial port, e.g. ```/dev/ttyUSB0```
|
||||||
|
5. Programmer: ```k-flash```
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
This core is based on and compatible with the [Sipeed Maixduino Core](https://github.com/sipeed/Maixduino)
|
||||||
|
|
||||||
If you want to code by scripts, refer to our [MaixPy](https://maixpy.sipeed.com)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
490
boards.txt
490
boards.txt
@@ -3,10 +3,243 @@ menu.burn_tool_firmware=Burn Tool Firmware
|
|||||||
menu.burn_baudrate=Burn Baud Rate
|
menu.burn_baudrate=Burn Baud Rate
|
||||||
menu.toolsloc=Tool Install Location
|
menu.toolsloc=Tool Install Location
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# Sipeed Maix Amigo ###############
|
||||||
|
|
||||||
|
amigo.name=Sipeed Maix Amigo
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
amigo.menu.toolsloc.default=Default
|
||||||
|
amigo.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
amigo.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
amigo.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
amigo.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
amigo.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
amigo.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
amigo.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
amigo.menu.burn_baudrate.2000000=2 Mbps
|
||||||
|
amigo.menu.burn_baudrate.4500000=4.5 Mbps (Must open-ec!)
|
||||||
|
amigo.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
amigo.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
amigo.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
||||||
|
amigo.menu.burn_baudrate.4500000.build.burn_baudrate=4500000
|
||||||
|
amigo.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
amigo.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
amigo.menu.burn_tool_firmware.amigo=open-ec
|
||||||
|
amigo.menu.burn_tool_firmware.amigo.build.burn_tool_firmware=goE
|
||||||
|
|
||||||
|
## Core settings
|
||||||
|
amigo.build.variant=sipeed_maix_amigo
|
||||||
|
amigo.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
amigo.build.board=MAIX_AMIGO
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
amigo.program.tool=kflash
|
||||||
|
amigo.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
amigo.upload.maximum_size=8388608
|
||||||
|
amigo.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# Sipeed Maix Cube ###############
|
||||||
|
|
||||||
|
cube.name=Sipeed Maix Cube
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
cube.menu.toolsloc.default=Default
|
||||||
|
cube.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
cube.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
cube.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
cube.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
cube.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
cube.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
cube.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
cube.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
cube.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
cube.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
cube.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
cube.menu.burn_tool_firmware.cube=open-ec
|
||||||
|
cube.menu.burn_tool_firmware.cube.build.burn_tool_firmware=goE
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
cube.build.variant=sipeed_maix_cube
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
cube.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
cube.build.board=MAIX_CUBE
|
||||||
|
cube.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
cube.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
cube.upload.maximum_size=8388608
|
||||||
|
cube.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
############### Sipeed Maix Go Board ###############
|
||||||
|
|
||||||
|
go.name=Sipeed Maix Go
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
go.menu.toolsloc.default=Default
|
||||||
|
go.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
go.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
go.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
go.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
go.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
go.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
go.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
go.menu.burn_baudrate.2000000=2 Mbps
|
||||||
|
go.menu.burn_baudrate.4500000=4.5 Mbps (Must open-ec!)
|
||||||
|
go.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
go.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
go.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
||||||
|
go.menu.burn_baudrate.4500000.build.burn_baudrate=4500000
|
||||||
|
go.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
go.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
go.menu.burn_tool_firmware.goE=open-ec
|
||||||
|
go.menu.burn_tool_firmware.goD=CMSIS-DAP
|
||||||
|
go.menu.burn_tool_firmware.goE.build.burn_tool_firmware=goE
|
||||||
|
go.menu.burn_tool_firmware.goD.build.burn_tool_firmware=goD
|
||||||
|
|
||||||
|
## Core settings
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
go.build.variant=sipeed_maix_go
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
go.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
go.build.board=MAIX_GO
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
go.program.tool=kflash
|
||||||
|
go.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
go.upload.maximum_size=8388608
|
||||||
|
go.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# Sipeed Maixduino Board ###############
|
||||||
|
|
||||||
|
mduino.name=Sipeed Maixduino
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
mduino.menu.toolsloc.default=Default
|
||||||
|
mduino.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
mduino.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
mduino.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
mduino.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
mduino.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
mduino.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
mduino.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
mduino.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
mduino.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
mduino.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
mduino.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
mduino.menu.burn_tool_firmware.mduino=Default
|
||||||
|
mduino.menu.burn_tool_firmware.mduino.build.burn_tool_firmware=maixduino
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
mduino.build.variant=sipeed_maixduino
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
mduino.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
mduino.build.board=MAIX_DUINO
|
||||||
|
mduino.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
mduino.program.tool=kflash
|
||||||
|
mduino.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
mduino.upload.maximum_size=8388608
|
||||||
|
mduino.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# Sipeed M1W Dock Board ###############
|
||||||
|
|
||||||
|
m1w.name=Sipeed Maix Dock M1W
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
m1w.menu.toolsloc.default=Default
|
||||||
|
m1w.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
m1w.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
m1w.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
m1w.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
m1w.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
m1w.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
m1w.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
m1w.menu.burn_baudrate.2000000=2 Mbps
|
||||||
|
m1w.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
m1w.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
m1w.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
||||||
|
m1w.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
m1w.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
m1w.menu.burn_tool_firmware.dan=Default
|
||||||
|
m1w.menu.burn_tool_firmware.dan.build.burn_tool_firmware=dan
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
m1w.build.variant=sipeed_maix_one_w_dock
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
m1w.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
m1w.build.board=MAIX_DOCK_M1W
|
||||||
|
m1w.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
m1w.program.tool=kflash
|
||||||
|
m1w.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
m1w.upload.maximum_size=8388608
|
||||||
|
m1w.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
############# Sipeed M1 Dock Board ###############
|
############# Sipeed M1 Dock Board ###############
|
||||||
|
|
||||||
m1.name=Sipeed Maix One Dock Board
|
m1.name=Sipeed Maix Dock M1
|
||||||
|
|
||||||
## Toolchain
|
## Toolchain
|
||||||
m1.menu.toolsloc.default=Default
|
m1.menu.toolsloc.default=Default
|
||||||
@@ -39,7 +272,7 @@ m1.build.variant=sipeed_maix_one_dock
|
|||||||
m1.build.core=arduino
|
m1.build.core=arduino
|
||||||
|
|
||||||
## This sets a define for use in the compiled code.
|
## This sets a define for use in the compiled code.
|
||||||
m1.build.board=BOARD_SIPEED_MAIX_ONE_DOCK
|
m1.build.board=MAIX_DOCK_M1
|
||||||
m1.build.sdata.size=512
|
m1.build.sdata.size=512
|
||||||
|
|
||||||
## This selects the tool from "programmers.txt"
|
## This selects the tool from "programmers.txt"
|
||||||
@@ -48,12 +281,12 @@ m1.upload.tool=kflash
|
|||||||
|
|
||||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
m1.upload.maximum_size=8388608
|
m1.upload.maximum_size=8388608
|
||||||
m1.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
m1.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
############# Sipeed Maix Bit Board ###############
|
############# Sipeed Maix Bit Board ###############
|
||||||
|
|
||||||
bit.name=Sipeed Maix Bit Board
|
bit.name=Sipeed Maix Bit
|
||||||
|
|
||||||
## Toolchain
|
## Toolchain
|
||||||
bit.menu.toolsloc.default=Default
|
bit.menu.toolsloc.default=Default
|
||||||
@@ -86,7 +319,7 @@ bit.build.variant=sipeed_maix_bit
|
|||||||
bit.build.core=arduino
|
bit.build.core=arduino
|
||||||
|
|
||||||
## This sets a define for use in the compiled code.
|
## This sets a define for use in the compiled code.
|
||||||
bit.build.board=BOARD_SIPEED_MAIX_BIT
|
bit.build.board=MAIX_BIT
|
||||||
bit.build.sdata.size=512
|
bit.build.sdata.size=512
|
||||||
|
|
||||||
## This selects the tool from "programmers.txt"
|
## This selects the tool from "programmers.txt"
|
||||||
@@ -95,13 +328,13 @@ bit.upload.tool=kflash
|
|||||||
|
|
||||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
bit.upload.maximum_size=8388608
|
bit.upload.maximum_size=8388608
|
||||||
bit.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
bit.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
############# Sipeed Maix Bit with Mic Board ###############
|
############# Sipeed Maix Bit with Mic Board ###############
|
||||||
|
|
||||||
bitm.name=Sipeed Maix Bit-Mic Board
|
bitm.name=Sipeed Maix Bit-Mic
|
||||||
|
|
||||||
## Toolchain
|
## Toolchain
|
||||||
bitm.menu.toolsloc.default=Default
|
bitm.menu.toolsloc.default=Default
|
||||||
@@ -132,7 +365,7 @@ bitm.build.variant=sipeed_maix_bit_mic
|
|||||||
bitm.build.core=arduino
|
bitm.build.core=arduino
|
||||||
|
|
||||||
## This sets a define for use in the compiled code.
|
## This sets a define for use in the compiled code.
|
||||||
bitm.build.board=BOARD_SIPEED_MAIX_BIT
|
bitm.build.board=MAIX_BIT_M
|
||||||
bitm.build.sdata.size=512
|
bitm.build.sdata.size=512
|
||||||
|
|
||||||
## This selects the tool from "programmers.txt"
|
## This selects the tool from "programmers.txt"
|
||||||
@@ -140,100 +373,189 @@ bitm.upload.tool=kflash
|
|||||||
|
|
||||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
bitm.upload.maximum_size=8388608
|
bitm.upload.maximum_size=8388608
|
||||||
bitm.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
bitm.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
|
||||||
############### Sipeed Maix Go Board ###############
|
|
||||||
|
|
||||||
go.name=Sipeed Maix Go Board
|
|
||||||
|
|
||||||
|
|
||||||
## Toolchain
|
|
||||||
go.menu.toolsloc.default=Default
|
|
||||||
go.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
|
||||||
|
|
||||||
## CPU Clock
|
|
||||||
go.menu.clksrc.400=400MHz CPU Clock Frequency
|
|
||||||
go.menu.clksrc.500=500MHz CPU Clock Frequency
|
|
||||||
go.menu.clksrc.600=600MHz CPU Clock Frequency
|
|
||||||
go.menu.clksrc.400.build.f_cpu=400000000L
|
|
||||||
go.menu.clksrc.500.build.f_cpu=500000000L
|
|
||||||
go.menu.clksrc.600.build.f_cpu=600000000L
|
|
||||||
|
|
||||||
## Burn baud rate
|
|
||||||
go.menu.burn_baudrate.2000000=2 Mbps
|
|
||||||
go.menu.burn_baudrate.4500000=4.5 Mbps (Must open-ec!)
|
|
||||||
go.menu.burn_baudrate.1500000=1.5 Mbps
|
|
||||||
go.menu.burn_baudrate.1000000=1 Mbps
|
|
||||||
go.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
|
||||||
go.menu.burn_baudrate.4500000.build.burn_baudrate=4500000
|
|
||||||
go.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
|
||||||
go.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
|
||||||
|
|
||||||
## Burn tool firmware
|
|
||||||
go.menu.burn_tool_firmware.goE=open-ec
|
|
||||||
go.menu.burn_tool_firmware.goD=CMSIS-DAP
|
|
||||||
go.menu.burn_tool_firmware.goE.build.burn_tool_firmware=goE
|
|
||||||
go.menu.burn_tool_firmware.goD.build.burn_tool_firmware=goD
|
|
||||||
|
|
||||||
## Core settings
|
|
||||||
go.build.variant=sipeed_maix_go
|
|
||||||
go.build.core=arduino
|
|
||||||
|
|
||||||
## This sets a define for use in the compiled code.
|
|
||||||
go.build.board=BOARD_SIPEED_MAIX_GO
|
|
||||||
|
|
||||||
## This selects the tool from "programmers.txt"
|
|
||||||
go.program.tool=kflash
|
|
||||||
go.upload.tool=kflash
|
|
||||||
|
|
||||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
|
||||||
go.upload.maximum_size=8388608
|
|
||||||
go.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
############# Sipeed Maixduino Board ###############
|
############# M5Stack M5StickV Stick ###############
|
||||||
|
|
||||||
mduino.name=Sipeed Maixduino Board
|
stickv.name=M5Stack M5StickV Stick
|
||||||
|
|
||||||
## Toolchain
|
## Toolchain
|
||||||
mduino.menu.toolsloc.default=Default
|
stickv.menu.toolsloc.default=Default
|
||||||
mduino.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
stickv.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
## CPU Clock
|
## CPU Clock
|
||||||
mduino.menu.clksrc.400=400MHz CPU Clock Frequency
|
stickv.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
mduino.menu.clksrc.500=500MHz CPU Clock Frequency
|
stickv.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
mduino.menu.clksrc.600=600MHz CPU Clock Frequency
|
stickv.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
mduino.menu.clksrc.400.build.f_cpu=400000000L
|
stickv.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
mduino.menu.clksrc.500.build.f_cpu=500000000L
|
stickv.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
mduino.menu.clksrc.600.build.f_cpu=600000000L
|
stickv.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
## Burn baud rate
|
## Burn baud rate
|
||||||
mduino.menu.burn_baudrate.1500000=1.5 Mbps
|
stickv.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
mduino.menu.burn_baudrate.1000000=1 Mbps
|
stickv.menu.burn_baudrate.1000000=1 Mbps
|
||||||
mduino.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
stickv.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
mduino.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
stickv.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
## Burn tool firmware
|
## Burn tool firmware
|
||||||
mduino.menu.burn_tool_firmware.mduino=Default
|
stickv.menu.burn_tool_firmware.stick1=CH340
|
||||||
mduino.menu.burn_tool_firmware.mduino.build.burn_tool_firmware=maixduino
|
stickv.menu.burn_tool_firmware.stick1.build.burn_tool_firmware=bit-mic
|
||||||
|
|
||||||
|
|
||||||
## Point to the file for ./variants/<variant>/pins_arduino.h
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
mduino.build.variant=sipeed_maixduino
|
stickv.build.variant=m5stack_m5stick_v
|
||||||
|
|
||||||
## "The 'core' file directory for this board, in ./cores
|
## "The 'core' file directory for this board, in ./cores
|
||||||
mduino.build.core=arduino
|
stickv.build.core=arduino
|
||||||
|
|
||||||
## This sets a define for use in the compiled code.
|
## This sets a define for use in the compiled code.
|
||||||
mduino.build.board=BOARD_SIPEED_MAIX_DUINO
|
stickv.build.board=M5STICK_V
|
||||||
mduino.build.sdata.size=512
|
stickv.build.sdata.size=512
|
||||||
|
|
||||||
## This selects the tool from "programmers.txt"
|
## This selects the tool from "programmers.txt"
|
||||||
mduino.program.tool=kflash
|
stickv.program.tool=kflash
|
||||||
mduino.upload.tool=kflash
|
stickv.upload.tool=kflash
|
||||||
|
|
||||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
mduino.upload.maximum_size=8388608
|
stickv.upload.maximum_size=8388608
|
||||||
mduino.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
stickv.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# M5Stack M5UnitV Camera ###############
|
||||||
|
|
||||||
|
unitv.name=M5Stack M5UnitV Camera
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
unitv.menu.toolsloc.default=Default
|
||||||
|
unitv.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
unitv.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
unitv.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
unitv.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
unitv.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
unitv.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
unitv.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
unitv.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
unitv.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
unitv.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
unitv.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
unitv.menu.burn_tool_firmware.unit1=CH340
|
||||||
|
unitv.menu.burn_tool_firmware.unit1.build.burn_tool_firmware=bit-mic
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
unitv.build.variant=m5stack_m5unit_v
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
unitv.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
unitv.build.board=M5UNIT_V
|
||||||
|
unitv.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
unitv.program.tool=kflash
|
||||||
|
unitv.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
unitv.upload.maximum_size=8388608
|
||||||
|
unitv.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# LamLoei AIoT DaaN Board ###############
|
||||||
|
|
||||||
|
aiotdaan.name=LamLoei AIoT DaaN
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
aiotdaan.menu.toolsloc.default=Default
|
||||||
|
aiotdaan.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
aiotdaan.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
aiotdaan.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
aiotdaan.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
aiotdaan.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
aiotdaan.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
aiotdaan.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
aiotdaan.menu.burn_baudrate.2000000=2 Mbps
|
||||||
|
aiotdaan.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
aiotdaan.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
aiotdaan.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
||||||
|
aiotdaan.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
aiotdaan.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
aiotdaan.menu.burn_tool_firmware.dan=Default
|
||||||
|
aiotdaan.menu.burn_tool_firmware.dan.build.burn_tool_firmware=dan
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
aiotdaan.build.variant=lamloei_aiot_daan
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
aiotdaan.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
aiotdaan.build.board=MAIX_DOCK_M1
|
||||||
|
aiotdaan.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
aiotdaan.program.tool=kflash
|
||||||
|
aiotdaan.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
aiotdaan.upload.maximum_size=8388608
|
||||||
|
aiotdaan.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
############# IOXGD4 ###############
|
||||||
|
|
||||||
|
ioxgd4.name=IOXGD4
|
||||||
|
|
||||||
|
## Toolchain
|
||||||
|
ioxgd4.menu.toolsloc.default=Default
|
||||||
|
ioxgd4.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||||
|
|
||||||
|
## CPU Clock
|
||||||
|
ioxgd4.menu.clksrc.400=400MHz CPU Clock Frequency
|
||||||
|
ioxgd4.menu.clksrc.500=500MHz CPU Clock Frequency
|
||||||
|
ioxgd4.menu.clksrc.600=600MHz CPU Clock Frequency
|
||||||
|
ioxgd4.menu.clksrc.400.build.f_cpu=400000000L
|
||||||
|
ioxgd4.menu.clksrc.500.build.f_cpu=500000000L
|
||||||
|
ioxgd4.menu.clksrc.600.build.f_cpu=600000000L
|
||||||
|
|
||||||
|
## Burn baud rate
|
||||||
|
ioxgd4.menu.burn_baudrate.2000000=2 Mbps
|
||||||
|
ioxgd4.menu.burn_baudrate.1500000=1.5 Mbps
|
||||||
|
ioxgd4.menu.burn_baudrate.1000000=1 Mbps
|
||||||
|
ioxgd4.menu.burn_baudrate.2000000.build.burn_baudrate=2000000
|
||||||
|
ioxgd4.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
|
||||||
|
ioxgd4.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
|
||||||
|
|
||||||
|
## Burn tool firmware
|
||||||
|
ioxgd4.menu.burn_tool_firmware.dan=Default
|
||||||
|
ioxgd4.menu.burn_tool_firmware.dan.build.burn_tool_firmware=dan
|
||||||
|
|
||||||
|
## Point to the file for ./variants/<variant>/pins_arduino.h
|
||||||
|
ioxgd4.build.variant=ioxgd4
|
||||||
|
|
||||||
|
## "The 'core' file directory for this board, in ./cores
|
||||||
|
ioxgd4.build.core=arduino
|
||||||
|
|
||||||
|
## This sets a define for use in the compiled code.
|
||||||
|
ioxgd4.build.board=MAIX_DOCK_M1
|
||||||
|
ioxgd4.build.sdata.size=512
|
||||||
|
|
||||||
|
## This selects the tool from "programmers.txt"
|
||||||
|
ioxgd4.program.tool=kflash
|
||||||
|
ioxgd4.upload.tool=kflash
|
||||||
|
|
||||||
|
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||||
|
ioxgd4.upload.maximum_size=8388608
|
||||||
|
ioxgd4.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class HardwareSerial : public Stream
|
|||||||
virtual void begin(uint32_t) {};
|
virtual void begin(uint32_t) {};
|
||||||
virtual void end() {};
|
virtual void end() {};
|
||||||
virtual int available(void) = 0;
|
virtual int available(void) = 0;
|
||||||
|
virtual int availableForWrite(void) = 0;
|
||||||
virtual int peek(void) = 0;
|
virtual int peek(void) = 0;
|
||||||
virtual int read(void) = 0;
|
virtual int read(void) = 0;
|
||||||
virtual void flush(void) = 0;
|
virtual void flush(void) = 0;
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ size_t Print::printf(const char *format, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = vsnprintf(temp, len+1, format, arg);
|
len = vsnprintf(temp, len+1, format, arg);
|
||||||
write((uint8_t*)temp, len);
|
size_t ret = write((uint8_t*)temp, len);
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
if(len >= sizeof(loc_buf)){
|
if(len >= sizeof(loc_buf)){
|
||||||
delete[] temp;
|
delete[] temp;
|
||||||
}
|
}
|
||||||
return len;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* default implementation: may be overridden */
|
/* default implementation: may be overridden */
|
||||||
@@ -58,7 +58,12 @@ size_t Print::write(const uint8_t *buffer, size_t size)
|
|||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
n += write(*buffer++);
|
size_t ret = write(*buffer++);
|
||||||
|
if (ret == 0) {
|
||||||
|
// Write of last byte didn't complete, abort additional processing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
n += ret;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ UARTClass::begin(uint32_t dwBaudRate)
|
|||||||
void
|
void
|
||||||
UARTClass::begin(uint32_t dwBaudRate, uint8_t _rx, uint8_t _tx)
|
UARTClass::begin(uint32_t dwBaudRate, uint8_t _rx, uint8_t _tx)
|
||||||
{
|
{
|
||||||
fpioa_set_function((int)MD_PIN_MAP(_rx), this->_rxfunc);
|
fpioa_set_function(_rx, this->_rxfunc);
|
||||||
fpioa_set_function((int)MD_PIN_MAP(_tx), this->_txfunc);
|
fpioa_set_function(_tx, this->_txfunc);
|
||||||
uart_init(this->_uart);
|
uart_init(this->_uart);
|
||||||
uart_configure(this->_uart, dwBaudRate, UART_BITWIDTH_8BIT, UART_STOP_1, UART_PARITY_NONE);
|
uart_configure(this->_uart, dwBaudRate, UART_BITWIDTH_8BIT, UART_STOP_1, UART_PARITY_NONE);
|
||||||
this->_buff = new RingBuffer();
|
this->_buff = new RingBuffer();
|
||||||
@@ -128,7 +128,7 @@ UARTClass::write(const uint8_t c)
|
|||||||
while (uart[this->_uart]->LSR & (1u << 5))
|
while (uart[this->_uart]->LSR & (1u << 5))
|
||||||
continue;
|
continue;
|
||||||
uart[this->_uart]->THR = c;
|
uart[this->_uart]->THR = c;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -177,8 +177,11 @@ UARTHSClass::end()
|
|||||||
size_t
|
size_t
|
||||||
UARTHSClass::write(const uint8_t uc_data)
|
UARTHSClass::write(const uint8_t uc_data)
|
||||||
{
|
{
|
||||||
uarths_putchar(uc_data);
|
if (uarths_putchar(uc_data) == uc_data) {
|
||||||
return (1);
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -186,8 +189,8 @@ uarths_rec_callback(void *ctx)
|
|||||||
{
|
{
|
||||||
int data;
|
int data;
|
||||||
auto &driver = *reinterpret_cast<UARTHSClass *>(ctx);
|
auto &driver = *reinterpret_cast<UARTHSClass *>(ctx);
|
||||||
data = uarths_getc();
|
data = uarths_getchar();
|
||||||
if(data != 0){
|
if(data != EOF){
|
||||||
driver._buff->store_char((char)data);
|
driver._buff->store_char((char)data);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ enum BitOrder {
|
|||||||
#endif // abs
|
#endif // abs
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) (((a)<(b))?(a):(b))
|
||||||
#endif // min
|
#endif // min
|
||||||
|
|
||||||
#ifndef max
|
#ifndef max
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
#define max(a,b) (((a)>(b))?(a):(b))
|
||||||
#endif // max
|
#endif // max
|
||||||
|
|
||||||
#define abs(x) ((x)>0?(x):-(x))
|
#define abs(x) ((x)>0?(x):-(x))
|
||||||
|
|||||||
115
libraries/AXP173/AXP173.cpp
Normal file
115
libraries/AXP173/AXP173.cpp
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
#include "AXP173.h"
|
||||||
|
|
||||||
|
AXP173::AXP173()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP173::begin(bool isInited)
|
||||||
|
{
|
||||||
|
if(!isInited){
|
||||||
|
Wire.begin((uint8_t) SDA, (uint8_t) SCL, 400000);
|
||||||
|
}
|
||||||
|
#if defined (ARDUINO_MAIX_AMIGO)
|
||||||
|
Write1Byte(0x27, 0x20); //LDO4 - 0.8V (default 0x48 1.8V)
|
||||||
|
Write1Byte(0x28, 0x0C); //LDO2/3 - LDO2 1.8V / LDO3 3.0V
|
||||||
|
#else //ARDUINO_MAIX_CUBE
|
||||||
|
Write1Byte(0x46, 0xFF); //Clear interupts
|
||||||
|
Write1Byte(0x33, 0xC1); //Set Bat Charging Voltage to 4V2, Current to 190mA
|
||||||
|
Write1Byte(0x10, (Read8bit(0x10) & 0xFC)); //EXTEN & DC-DC2 control
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP173::Write1Byte( uint8_t Addr , uint8_t Data )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.write(Data);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t AXP173::Read8bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 1);
|
||||||
|
return Wire.read();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP173::Read12Bit( uint8_t Addr)
|
||||||
|
{
|
||||||
|
uint16_t Data = 0;
|
||||||
|
uint8_t buf[2];
|
||||||
|
ReadBuff(Addr,2,buf);
|
||||||
|
Data = ((buf[0] << 4) + buf[1]);
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP173::Read13Bit( uint8_t Addr)
|
||||||
|
{
|
||||||
|
uint16_t Data = 0;
|
||||||
|
uint8_t buf[2];
|
||||||
|
ReadBuff(Addr,2,buf);
|
||||||
|
Data = ((buf[0] << 5) + buf[1]);
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP173::Read16bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint16_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 2);
|
||||||
|
for( int i = 0 ; i < 2 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP173::Read24bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint32_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 3);
|
||||||
|
for( int i = 0 ; i < 3 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP173::Read32bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint32_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 4);
|
||||||
|
for( int i = 0 ; i < 4 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP173::ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, (int)Size);
|
||||||
|
for (int i = 0; i < Size; i++)
|
||||||
|
{
|
||||||
|
*( Buff + i ) = Wire.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
53
libraries/AXP173/AXP173.h
Normal file
53
libraries/AXP173/AXP173.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#ifndef __AXP173_H__
|
||||||
|
#define __AXP173_H__
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#define SLEEP_MSEC(us) (((uint64_t)us) * 1000L)
|
||||||
|
#define SLEEP_SEC(us) (((uint64_t)us) * 1000000L)
|
||||||
|
#define SLEEP_MIN(us) (((uint64_t)us) * 60L * 1000000L)
|
||||||
|
#define SLEEP_HR(us) (((uint64_t)us) * 60L * 60L * 1000000L)
|
||||||
|
|
||||||
|
#define AXP_ADDR 0X34
|
||||||
|
|
||||||
|
#define CURRENT_100MA (0b0000)
|
||||||
|
#define CURRENT_190MA (0b0001)
|
||||||
|
#define CURRENT_280MA (0b0010)
|
||||||
|
#define CURRENT_360MA (0b0011)
|
||||||
|
#define CURRENT_450MA (0b0100)
|
||||||
|
#define CURRENT_550MA (0b0101)
|
||||||
|
#define CURRENT_630MA (0b0110)
|
||||||
|
#define CURRENT_700MA (0b0111)
|
||||||
|
|
||||||
|
class AXP173 {
|
||||||
|
public:
|
||||||
|
|
||||||
|
AXP173();
|
||||||
|
/**
|
||||||
|
* DCDC1: 3V3 Main rail. When not set the stick shuts down
|
||||||
|
* DCDC2: 0V9 K210 VCore
|
||||||
|
* DCDC3: 1V8 Use unknown
|
||||||
|
* LDO1: Don't set GPIO1 as LDO
|
||||||
|
* LDO2: 2V8 Display backlight
|
||||||
|
* LDO3: 1V5 Display Control
|
||||||
|
* GPIO0: LDO1 LCD_BL
|
||||||
|
* EXTEN:
|
||||||
|
*/
|
||||||
|
void begin(bool isInited = false);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Write1Byte( uint8_t Addr , uint8_t Data );
|
||||||
|
uint8_t Read8bit( uint8_t Addr );
|
||||||
|
uint16_t Read12Bit( uint8_t Addr);
|
||||||
|
uint16_t Read13Bit( uint8_t Addr);
|
||||||
|
uint16_t Read16bit( uint8_t Addr );
|
||||||
|
uint32_t Read24bit( uint8_t Addr );
|
||||||
|
uint32_t Read32bit( uint8_t Addr );
|
||||||
|
void ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
428
libraries/AXP192/AXP192.cpp
Normal file
428
libraries/AXP192/AXP192.cpp
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
#include "AXP192.h"
|
||||||
|
|
||||||
|
AXP192::AXP192()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::begin(bool isInited)
|
||||||
|
{
|
||||||
|
if(!isInited){
|
||||||
|
Wire.begin((uint8_t) SDA, (uint8_t) SCL, 400000);
|
||||||
|
}
|
||||||
|
|
||||||
|
Write1Byte(0x46, 0xFF); //Clear interupts
|
||||||
|
Write1Byte(0x23, 0x08); //Set DC-DC2 (VCore) to 0V9
|
||||||
|
Write1Byte(0x33, 0xC0); //Set Bat Charging Voltage to 4V2, Current to 100mA
|
||||||
|
Write1Byte(0x36, 0x0C); //Set 128ms power on, 4s power off
|
||||||
|
Write1Byte(0x91, 0xF0); //Set GPIO0 (TFT_BL) (from 0x70 (min)) to 3V3 (max)
|
||||||
|
Write1Byte(0x90, 0x02); //Set GPIO0 to LDO mode
|
||||||
|
Write1Byte(0x28, 0xF0); //VDD2.8V net: LDO2 3.3V, VDD 1.5V net: LDO3 1.8V
|
||||||
|
Write1Byte(0x27, 0x2C); //VDD1.8V net: DC-DC3 1.8V
|
||||||
|
Write1Byte(0x12, 0xFF); //Enble all LDO/DC_DC and EXTEN
|
||||||
|
Write1Byte(0x23, 0x08); //VDD 0.9v net: DC-DC2 0.9V
|
||||||
|
Write1Byte(0x32, 0x46); //Enable bat detection
|
||||||
|
Write1Byte(0x39, 0xFC); //Disable Temp Protection (Sensor doesn't exist!)
|
||||||
|
Write1Byte(0x31, (Read8bit(0x31) & 0xf8) | (1 << 2)); // Set Power off voltage 3V0
|
||||||
|
|
||||||
|
fpioa_set_function(INTL_INT, (fpioa_function_t)(FUNC_GPIOHS0 + 26));
|
||||||
|
gpiohs_set_drive_mode(26, GPIO_DM_OUTPUT);
|
||||||
|
gpiohs_set_pin(26, GPIO_PV_HIGH); //Disable VBUS As Input, BAT->5V Boost->VBUS->Charing Cycle
|
||||||
|
|
||||||
|
msleep(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::Write1Byte( uint8_t Addr , uint8_t Data )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.write(Data);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t AXP192::Read8bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 1);
|
||||||
|
return Wire.read();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP192::Read12Bit( uint8_t Addr)
|
||||||
|
{
|
||||||
|
uint16_t Data = 0;
|
||||||
|
uint8_t buf[2];
|
||||||
|
ReadBuff(Addr,2,buf);
|
||||||
|
Data = ((buf[0] << 4) + buf[1]);
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP192::Read13Bit( uint8_t Addr)
|
||||||
|
{
|
||||||
|
uint16_t Data = 0;
|
||||||
|
uint8_t buf[2];
|
||||||
|
ReadBuff(Addr,2,buf);
|
||||||
|
Data = ((buf[0] << 5) + buf[1]);
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t AXP192::Read16bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint16_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 2);
|
||||||
|
for( int i = 0 ; i < 2 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP192::Read24bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint32_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 3);
|
||||||
|
for( int i = 0 ; i < 3 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP192::Read32bit( uint8_t Addr )
|
||||||
|
{
|
||||||
|
uint32_t ReData = 0;
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 4);
|
||||||
|
for( int i = 0 ; i < 4 ; i++ )
|
||||||
|
{
|
||||||
|
ReData <<= 8;
|
||||||
|
ReData |= Wire.read();
|
||||||
|
}
|
||||||
|
return ReData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff )
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(Addr);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, (int)Size);
|
||||||
|
for (int i = 0; i < Size; i++)
|
||||||
|
{
|
||||||
|
*( Buff + i ) = Wire.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::ScreenBreath(uint8_t brightness)
|
||||||
|
{
|
||||||
|
if (brightness > 12)
|
||||||
|
{
|
||||||
|
brightness = 12;
|
||||||
|
}
|
||||||
|
uint8_t buf = Read8bit( 0x28 );
|
||||||
|
Write1Byte( 0x28 , ((buf & 0x0f) | (brightness << 4)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return True = Battery Exist
|
||||||
|
bool AXP192::GetBatState()
|
||||||
|
{
|
||||||
|
if( Read8bit(0x01) | 0x20 )
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Input Power Status
|
||||||
|
uint8_t AXP192::GetInputPowerStatus()
|
||||||
|
{
|
||||||
|
return Read8bit(0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Battery Charging Status
|
||||||
|
uint8_t AXP192::GetBatteryChargingStatus()
|
||||||
|
{
|
||||||
|
return Read8bit(0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------coulombcounter_from_here---------
|
||||||
|
//enable: void EnableCoulombcounter(void);
|
||||||
|
//disable: void DisableCOulombcounter(void);
|
||||||
|
//stop: void StopCoulombcounter(void);
|
||||||
|
//clear: void ClearCoulombcounter(void);
|
||||||
|
//get charge data: uint32_t GetCoulombchargeData(void);
|
||||||
|
//get discharge data: uint32_t GetCoulombdischargeData(void);
|
||||||
|
//get coulomb val affter calculation: float GetCoulombData(void);
|
||||||
|
//------------------------------------------
|
||||||
|
void AXP192::EnableCoulombcounter(void)
|
||||||
|
{
|
||||||
|
Write1Byte( 0xB8 , 0x80 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::DisableCoulombcounter(void)
|
||||||
|
{
|
||||||
|
Write1Byte( 0xB8 , 0x00 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::StopCoulombcounter(void)
|
||||||
|
{
|
||||||
|
Write1Byte( 0xB8 , 0xC0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::ClearCoulombcounter(void)
|
||||||
|
{
|
||||||
|
Write1Byte( 0xB8, Read8bit(0xB8) | 0x20); // Only set the Clear Flag
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP192::GetCoulombchargeData(void)
|
||||||
|
{
|
||||||
|
return Read32bit(0xB0);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t AXP192::GetCoulombdischargeData(void)
|
||||||
|
{
|
||||||
|
return Read32bit(0xB4);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetCoulombData(void)
|
||||||
|
{
|
||||||
|
uint32_t coin = GetCoulombchargeData();
|
||||||
|
uint32_t coout = GetCoulombdischargeData();
|
||||||
|
uint32_t valueDifferent = 0;
|
||||||
|
bool bIsNegative = false;
|
||||||
|
|
||||||
|
if (coin > coout)
|
||||||
|
{ // Expected, in always more then out
|
||||||
|
valueDifferent = coin - coout;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // Warning: Out is more than In, the battery is not started at 0%
|
||||||
|
// just Flip the output sign later
|
||||||
|
bIsNegative = true;
|
||||||
|
valueDifferent = coout - coin;
|
||||||
|
}
|
||||||
|
//c = 65536 * current_LSB * (coin - coout) / 3600 / ADC rate
|
||||||
|
//Adc rate can be read from 84H, change this variable if you change the ADC reate
|
||||||
|
float ccc = (65536 * 0.5 * valueDifferent) / 3600.0 / 200.0; // Note the ADC has defaulted to be 200 Hz
|
||||||
|
|
||||||
|
if( bIsNegative )
|
||||||
|
ccc = 0.0 - ccc; // Flip it back to negative
|
||||||
|
return ccc;
|
||||||
|
}
|
||||||
|
//----------coulomb_end_at_here----------
|
||||||
|
|
||||||
|
uint8_t AXP192::GetWarningLeve(void)
|
||||||
|
{
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(0x47);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 1);
|
||||||
|
uint8_t buf = Wire.read();
|
||||||
|
return (buf & 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::SetSleep(void)
|
||||||
|
{
|
||||||
|
Write1Byte(0x31 , Read8bit(0x31) | ( 1 << 3)); // Turn on short press to wake up
|
||||||
|
Write1Byte(0x90 , Read8bit(0x90) | 0x07); // GPIO1 floating
|
||||||
|
Write1Byte(0x82, 0x00); // Disable ADCs
|
||||||
|
Write1Byte(0x12, Read8bit(0x12) & 0xA1); // Disable all outputs but DCDC1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return 0 = not press, 0x01 = long press(1.5s), 0x02 = short press
|
||||||
|
uint8_t AXP192::GetBtnPress()
|
||||||
|
{
|
||||||
|
uint8_t state = Read8bit(0x46); // IRQ 3 status.
|
||||||
|
if(state)
|
||||||
|
{
|
||||||
|
Write1Byte( 0x46 , 0x03 ); // Write 1 back to clear IRQ
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Low Volt Level 1, when APS Volt Output < 3.4496 V
|
||||||
|
// Low Volt Level 2, when APS Volt Output < 3.3992 V, then this flag is SET (0x01)
|
||||||
|
// Flag will reset once battery volt is charged above Low Volt Level 1
|
||||||
|
// Note: now AXP192 have the Shutdown Voltage of 3.0V (B100) Def in REG 31H
|
||||||
|
uint8_t AXP192::GetWarningLevel(void)
|
||||||
|
{
|
||||||
|
return Read8bit(0x47) & 0x01;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatVoltage()
|
||||||
|
{
|
||||||
|
float ADCLSB = 1.1 / 1000.0;
|
||||||
|
uint16_t ReData = Read12Bit( 0x78 );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatCurrent()
|
||||||
|
{
|
||||||
|
float ADCLSB = 0.5;
|
||||||
|
uint16_t CurrentIn = Read13Bit( 0x7A );
|
||||||
|
uint16_t CurrentOut = Read13Bit( 0x7C );
|
||||||
|
return ( CurrentIn - CurrentOut ) * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetVinVoltage()
|
||||||
|
{
|
||||||
|
float ADCLSB = 1.7 / 1000.0;
|
||||||
|
uint16_t ReData = Read12Bit( 0x56 );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetVinCurrent()
|
||||||
|
{
|
||||||
|
float ADCLSB = 0.625;
|
||||||
|
uint16_t ReData = Read12Bit( 0x58 );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetVBusVoltage()
|
||||||
|
{
|
||||||
|
float ADCLSB = 1.7 / 1000.0;
|
||||||
|
uint16_t ReData = Read12Bit( 0x5A );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetVBusCurrent()
|
||||||
|
{
|
||||||
|
float ADCLSB = 0.375;
|
||||||
|
uint16_t ReData = Read12Bit( 0x5C );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetTempInAXP192()
|
||||||
|
{
|
||||||
|
float ADCLSB = 0.1;
|
||||||
|
const float OFFSET_DEG_C = -144.7;
|
||||||
|
uint16_t ReData = Read12Bit( 0x5E );
|
||||||
|
return OFFSET_DEG_C + ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatPower()
|
||||||
|
{
|
||||||
|
float VoltageLSB = 1.1;
|
||||||
|
float CurrentLCS = 0.5;
|
||||||
|
uint32_t ReData = Read24bit( 0x70 );
|
||||||
|
return VoltageLSB * CurrentLCS * ReData/ 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatChargeCurrent()
|
||||||
|
{
|
||||||
|
float ADCLSB = 0.5;
|
||||||
|
uint16_t ReData = Read13Bit( 0x7A );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetAPSVoltage()
|
||||||
|
{
|
||||||
|
float ADCLSB = 1.4 / 1000.0;
|
||||||
|
uint16_t ReData = Read12Bit( 0x7E );
|
||||||
|
return ReData * ADCLSB;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatCoulombInput()
|
||||||
|
{
|
||||||
|
uint32_t ReData = Read32bit( 0xB0 );
|
||||||
|
return ReData * 65536 * 0.5 / 3600 /25.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AXP192::GetBatCoulombOut()
|
||||||
|
{
|
||||||
|
uint32_t ReData = Read32bit( 0xB4 );
|
||||||
|
return ReData * 65536 * 0.5 / 3600 /25.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can turn LCD Backlight OFF for power saving
|
||||||
|
void AXP192::SetLDO2( bool State )
|
||||||
|
{
|
||||||
|
uint8_t buf = Read8bit(0x12);
|
||||||
|
if( State == true )
|
||||||
|
{
|
||||||
|
buf = (1<<2) | buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = ~(1<<2) & buf;
|
||||||
|
}
|
||||||
|
Write1Byte( 0x12 , buf );
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::SetLDO3(bool State)
|
||||||
|
{
|
||||||
|
uint8_t buf = Read8bit(0x12);
|
||||||
|
if( State == true )
|
||||||
|
{
|
||||||
|
buf = (1<<3) | buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = ~(1<<3) & buf;
|
||||||
|
}
|
||||||
|
Write1Byte( 0x12 , buf );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not recommend to set charge current > 100mA, since Battery is only 80mAh.
|
||||||
|
// more then 1C charge-rate may shorten battery life-span.
|
||||||
|
void AXP192::SetChargeCurrent(uint8_t current)
|
||||||
|
{
|
||||||
|
uint8_t buf = Read8bit(0x33);
|
||||||
|
buf = (buf & 0xf0) | (current & 0x07);
|
||||||
|
Write1Byte(0x33, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cut all power, except for LDO1 (RTC)
|
||||||
|
void AXP192::PowerOff()
|
||||||
|
{
|
||||||
|
Write1Byte(0x32, Read8bit(0x32) | 0x80); // MSB for Power Off
|
||||||
|
}
|
||||||
|
|
||||||
|
void AXP192::SetAdcState(bool state)
|
||||||
|
{
|
||||||
|
Write1Byte(0x82, state ? 0xff : 0x00); // Enable / Disable all ADCs
|
||||||
|
}
|
||||||
|
|
||||||
|
// AXP192 have a 6 byte storage, when the power is still valid, the data will not be lost
|
||||||
|
void AXP192::Read6BytesStorage( uint8_t *bufPtr )
|
||||||
|
{
|
||||||
|
// Address from 0x06 - 0x0B
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(0x06);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom(AXP_ADDR, 6);
|
||||||
|
for( int i = 0; i < 6; ++i )
|
||||||
|
{
|
||||||
|
bufPtr[i] = Wire.read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AXP192 have a 6 byte storage, when the power is still valid, the data will not be lost
|
||||||
|
void AXP192::Write6BytesStorage( uint8_t *bufPtr )
|
||||||
|
{
|
||||||
|
// Address from 0x06 - 0x0B
|
||||||
|
Wire.beginTransmission(AXP_ADDR);
|
||||||
|
Wire.write(0x06);
|
||||||
|
Wire.write(bufPtr[0]);
|
||||||
|
Wire.write(0x07);
|
||||||
|
Wire.write(bufPtr[1]);
|
||||||
|
Wire.write(0x08);
|
||||||
|
Wire.write(bufPtr[2]);
|
||||||
|
Wire.write(0x09);
|
||||||
|
Wire.write(bufPtr[3]);
|
||||||
|
Wire.write(0x0A);
|
||||||
|
Wire.write(bufPtr[4]);
|
||||||
|
Wire.write(0x0B);
|
||||||
|
Wire.write(bufPtr[5]);
|
||||||
|
Wire.endTransmission();
|
||||||
|
}
|
||||||
94
libraries/AXP192/AXP192.h
Normal file
94
libraries/AXP192/AXP192.h
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
#ifndef __AXP192_H__
|
||||||
|
#define __AXP192_H__
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#define SLEEP_MSEC(us) (((uint64_t)us) * 1000L)
|
||||||
|
#define SLEEP_SEC(us) (((uint64_t)us) * 1000000L)
|
||||||
|
#define SLEEP_MIN(us) (((uint64_t)us) * 60L * 1000000L)
|
||||||
|
#define SLEEP_HR(us) (((uint64_t)us) * 60L * 60L * 1000000L)
|
||||||
|
|
||||||
|
#define AXP_ADDR 0X34
|
||||||
|
|
||||||
|
#define CURRENT_100MA (0b0000)
|
||||||
|
#define CURRENT_190MA (0b0001)
|
||||||
|
#define CURRENT_280MA (0b0010)
|
||||||
|
#define CURRENT_360MA (0b0011)
|
||||||
|
#define CURRENT_450MA (0b0100)
|
||||||
|
#define CURRENT_550MA (0b0101)
|
||||||
|
#define CURRENT_630MA (0b0110)
|
||||||
|
#define CURRENT_700MA (0b0111)
|
||||||
|
|
||||||
|
class AXP192 {
|
||||||
|
public:
|
||||||
|
|
||||||
|
AXP192();
|
||||||
|
/**
|
||||||
|
* DCDC1: 3V3 Main rail. When not set the stick shuts down
|
||||||
|
* DCDC2: 0V9 K210 VCore
|
||||||
|
* DCDC3: 1V8 Use unknown
|
||||||
|
* LDO1: Don't set GPIO1 as LDO
|
||||||
|
* LDO2: 2V8 Display backlight
|
||||||
|
* LDO3: 1V5 Display Control
|
||||||
|
* GPIO0: LDO1 LCD_BL
|
||||||
|
* EXTEN:
|
||||||
|
*/
|
||||||
|
void begin(bool isInited = false);
|
||||||
|
void ScreenBreath(uint8_t brightness);
|
||||||
|
bool GetBatState();
|
||||||
|
|
||||||
|
uint8_t GetInputPowerStatus();
|
||||||
|
uint8_t GetBatteryChargingStatus();
|
||||||
|
|
||||||
|
void EnableCoulombcounter(void);
|
||||||
|
void DisableCoulombcounter(void);
|
||||||
|
void StopCoulombcounter(void);
|
||||||
|
void ClearCoulombcounter(void);
|
||||||
|
uint32_t GetCoulombchargeData(void); // Raw Data for Charge
|
||||||
|
uint32_t GetCoulombdischargeData(void); // Raw Data for Discharge
|
||||||
|
float GetCoulombData(void); // total in - total out and calc
|
||||||
|
uint8_t GetBtnPress(void);
|
||||||
|
void SetSleep(void);
|
||||||
|
uint8_t GetWarningLeve(void);
|
||||||
|
|
||||||
|
public:
|
||||||
|
// void SetChargeVoltage( uint8_t );
|
||||||
|
void SetChargeCurrent( uint8_t );
|
||||||
|
float GetBatVoltage();
|
||||||
|
float GetBatCurrent();
|
||||||
|
float GetVinVoltage();
|
||||||
|
float GetVinCurrent();
|
||||||
|
float GetVBusVoltage();
|
||||||
|
float GetVBusCurrent();
|
||||||
|
float GetTempInAXP192();
|
||||||
|
float GetBatPower();
|
||||||
|
float GetBatChargeCurrent();
|
||||||
|
float GetAPSVoltage();
|
||||||
|
float GetBatCoulombInput();
|
||||||
|
float GetBatCoulombOut();
|
||||||
|
uint8_t GetWarningLevel(void);
|
||||||
|
void SetLDO2( bool State ); // Can turn LCD Backlight OFF for power saving
|
||||||
|
void SetLDO3( bool State );
|
||||||
|
void SetAdcState(bool State);
|
||||||
|
|
||||||
|
// -- Power Off
|
||||||
|
void PowerOff();
|
||||||
|
|
||||||
|
// Power Maintained Storage
|
||||||
|
void Read6BytesStorage( uint8_t *bufPtr );
|
||||||
|
void Write6BytesStorage( uint8_t *bufPtr );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Write1Byte( uint8_t Addr , uint8_t Data );
|
||||||
|
uint8_t Read8bit( uint8_t Addr );
|
||||||
|
uint16_t Read12Bit( uint8_t Addr);
|
||||||
|
uint16_t Read13Bit( uint8_t Addr);
|
||||||
|
uint16_t Read16bit( uint8_t Addr );
|
||||||
|
uint32_t Read24bit( uint8_t Addr );
|
||||||
|
uint32_t Read32bit( uint8_t Addr );
|
||||||
|
void ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -19,7 +19,7 @@ id KEYWORD2
|
|||||||
snapshot KEYWORD2
|
snapshot KEYWORD2
|
||||||
getRGB565 KEYWORD2
|
getRGB565 KEYWORD2
|
||||||
getRGB888 KEYWORD2
|
getRGB888 KEYWORD2
|
||||||
setRotaion KEYWORD2
|
setRotation KEYWORD2
|
||||||
setInver KEYWORD2
|
setInver KEYWORD2
|
||||||
width KEYWORD2
|
width KEYWORD2
|
||||||
height KEYWORD2
|
height KEYWORD2
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PIXFORMAT_INVLAID = 0,
|
PIXFORMAT_INVALID = 0,
|
||||||
PIXFORMAT_BAYER, // RAW
|
PIXFORMAT_BAYER, // RAW
|
||||||
PIXFORMAT_RGB565, // RGB565
|
PIXFORMAT_RGB565, // RGB565
|
||||||
PIXFORMAT_YUV422, // YUV422
|
PIXFORMAT_YUV422, // YUV422
|
||||||
@@ -76,8 +76,9 @@ public:
|
|||||||
* e.g. two RED pixel: {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}
|
* e.g. two RED pixel: {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}
|
||||||
*/
|
*/
|
||||||
virtual uint8_t* getRGB888(){ return nullptr; };
|
virtual uint8_t* getRGB888(){ return nullptr; };
|
||||||
virtual void setRotaion(uint8_t rotation) = 0;
|
virtual void setRotation(uint8_t rotation) = 0;
|
||||||
virtual void setInvert(bool invert) = 0;
|
virtual void setInvert(bool invert) = 0;
|
||||||
|
virtual void flip(bool horiz, bool vert);
|
||||||
|
|
||||||
|
|
||||||
virtual int width(){ return _width; }
|
virtual int width(){ return _width; }
|
||||||
|
|||||||
@@ -1,27 +1,39 @@
|
|||||||
#include <MSA300.h>
|
#include <MSA300.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
|
// This is the length of the string that will be created
|
||||||
|
// included minus and decimal point
|
||||||
|
const signed char formattedStringLength = 11;
|
||||||
|
|
||||||
|
// The number of digits after the deimal point to print
|
||||||
|
const unsigned char numVarsAfterDecimal = 6;
|
||||||
|
|
||||||
acc_t data;
|
acc_t data;
|
||||||
MSA300 msa;
|
MSA300 msa;
|
||||||
|
|
||||||
void setup() {
|
static char outstr[formattedStringLength];
|
||||||
// put your setup code here, to run once:
|
|
||||||
|
char * formatValue(float value)
|
||||||
|
{
|
||||||
|
dtostrf(value, formattedStringLength, numVarsAfterDecimal, outstr);
|
||||||
|
return outstr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
msa.begin();
|
msa.begin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
// put your main code here, to run repeatedly:
|
{
|
||||||
data = msa.getAcceleration();
|
data = msa.getAcceleration();
|
||||||
Serial.print("Xa:");
|
|
||||||
Serial.print(data.x);
|
Serial.printf("Xa:%s ", formatValue(data.x));
|
||||||
Serial.print("Ya:");
|
Serial.printf("Ya:%s ", formatValue(data.y));
|
||||||
Serial.print(data.y);
|
Serial.printf("Za:%s", formatValue(data.z));
|
||||||
Serial.print("Za:");
|
Serial.println();
|
||||||
Serial.println(data.z);
|
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ void setup()
|
|||||||
pinMode(key, INPUT);
|
pinMode(key, INPUT);
|
||||||
lcd.begin(15000000, COLOR_RED);
|
lcd.begin(15000000, COLOR_RED);
|
||||||
touchscreen.begin();
|
touchscreen.begin();
|
||||||
touchscreen.calibrate(320,240);
|
touchscreen.calibrate(320, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
@@ -29,20 +29,16 @@ void loop()
|
|||||||
touchscreen_status = touchscreen.getStatus();
|
touchscreen_status = touchscreen.getStatus();
|
||||||
touchscreen_x = touchscreen.getX();
|
touchscreen_x = touchscreen.getX();
|
||||||
touchscreen_y = touchscreen.getY();
|
touchscreen_y = touchscreen.getY();
|
||||||
if(draw){
|
if (draw) {
|
||||||
lcd.writeLine(x_last,y_last,touchscreen_x,touchscreen_y,COLOR_WHITE);
|
lcd.writeLine(x_last,y_last,touchscreen_x,touchscreen_y,COLOR_WHITE);
|
||||||
}
|
}
|
||||||
if(status_last!=touchscreen_status){
|
if (status_last != touchscreen_status) {
|
||||||
if (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE)
|
draw = (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE);
|
||||||
draw = true;
|
status_last = touchscreen_status;
|
||||||
else
|
|
||||||
draw = false;
|
|
||||||
status_last=touchscreen_status;
|
|
||||||
}
|
}
|
||||||
x_last = touchscreen_x;
|
x_last = touchscreen_x;
|
||||||
y_last = touchscreen_y;
|
y_last = touchscreen_y;
|
||||||
if(digitalRead(key) == LOW)
|
if (digitalRead(key) == LOW) {
|
||||||
{
|
|
||||||
lcd.fillScreen(COLOR_BLACK);
|
lcd.fillScreen(COLOR_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name=SD(k210)
|
name=SD
|
||||||
version=1.2.4
|
version=1.2.4
|
||||||
author=Arduino, SparkFun, Neucrack
|
author=Arduino, SparkFun, Neucrack
|
||||||
maintainer=Sipeed <support@sipeed.com>
|
maintainer=Sipeed <support@sipeed.com>
|
||||||
|
|||||||
@@ -252,18 +252,9 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
|
|||||||
uint32_t arg;
|
uint32_t arg;
|
||||||
|
|
||||||
// set pin modes
|
// set pin modes
|
||||||
//#ifdef BOARD_SIPEED_MAIXDUINO
|
pinMode(chipSelectPin_, OUTPUT);
|
||||||
int gpionum = get_gpio(chipSelectPin_);
|
digitalWrite(chipSelectPin_, HIGH);
|
||||||
if(gpionum >= 0){
|
|
||||||
fpioa_function_t function = fpioa_function_t(FUNC_GPIOHS0 + gpionum);
|
|
||||||
fpioa_set_function(chipSelectPin_, function);
|
|
||||||
gpiohs_set_drive_mode((uint8_t)gpionum, GPIO_DM_OUTPUT);
|
|
||||||
gpiohs_set_pin((uint8_t)gpionum, GPIO_PV_HIGH);
|
|
||||||
}
|
|
||||||
//#else
|
|
||||||
// pinMode(chipSelectPin_, OUTPUT);
|
|
||||||
// digitalWrite(chipSelectPin_, HIGH);
|
|
||||||
//#endif
|
|
||||||
#ifndef USE_SPI_LIB
|
#ifndef USE_SPI_LIB
|
||||||
pinMode(SPI_MISO_PIN, INPUT);
|
pinMode(SPI_MISO_PIN, INPUT);
|
||||||
pinMode(SPI_MOSI_PIN, OUTPUT);
|
pinMode(SPI_MOSI_PIN, OUTPUT);
|
||||||
|
|||||||
26
libraries/Sipeed_GC0328/examples/sipeed_gc0328.ino
Normal file
26
libraries/Sipeed_GC0328/examples/sipeed_gc0328.ino
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include <Sipeed_GC0328.h>
|
||||||
|
#include <Sipeed_ST7789.h>
|
||||||
|
|
||||||
|
SPIClass spi_(SPI0); // MUST be SPI0 for Maix series on board LCD
|
||||||
|
Sipeed_ST7789 lcd(320, 240, spi_);
|
||||||
|
Sipeed_GC0328 camera(FRAMESIZE_QVGA, PIXFORMAT_RGB565, &Wire);
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
lcd.begin(15000000, COLOR_RED);
|
||||||
|
if(!camera.begin())
|
||||||
|
Serial.printf("camera init fail\n");
|
||||||
|
else
|
||||||
|
Serial.printf("camera init success\n");
|
||||||
|
camera.run(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
uint8_t*img = camera.snapshot();
|
||||||
|
if(img == nullptr || img==0)
|
||||||
|
Serial.printf("snap fail\r\n");
|
||||||
|
else
|
||||||
|
lcd.drawImage(0, 0, camera.width(), camera.height(), (uint16_t*)img);
|
||||||
|
}
|
||||||
35
libraries/Sipeed_GC0328/examples/sipeed_gc0328_binocular.ino
Normal file
35
libraries/Sipeed_GC0328/examples/sipeed_gc0328_binocular.ino
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#include <Sipeed_GC0328.h>
|
||||||
|
#include <Sipeed_ST7789.h>
|
||||||
|
|
||||||
|
SPIClass spi_(SPI0); // MUST be SPI0 for Maix series on board LCD
|
||||||
|
Sipeed_ST7789 lcd(320, 240, spi_);
|
||||||
|
Sipeed_GC0328 camera(FRAMESIZE_QVGA, PIXFORMAT_RGB565, &Wire);
|
||||||
|
|
||||||
|
// Use left camera if true, right camera when true
|
||||||
|
bool leftCamera = true;
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
lcd.begin(15000000, COLOR_RED);
|
||||||
|
|
||||||
|
// Start camera in binocular mode
|
||||||
|
if(!camera.begin(true))
|
||||||
|
Serial.printf("camera init fail\n");
|
||||||
|
else
|
||||||
|
Serial.printf("camera init success\n");
|
||||||
|
camera.run(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// Switch left/right cameras
|
||||||
|
camera.shutdown(leftCamera);
|
||||||
|
leftCamera = !leftCamera;
|
||||||
|
|
||||||
|
uint8_t*img = camera.snapshot();
|
||||||
|
if(img == nullptr || img==0)
|
||||||
|
Serial.printf("snap fail\r\n");
|
||||||
|
else
|
||||||
|
lcd.drawImage(0, 0, camera.width(), camera.height(), (uint16_t*)img);
|
||||||
|
}
|
||||||
29
libraries/Sipeed_GC0328/keywords.txt
Normal file
29
libraries/Sipeed_GC0328/keywords.txt
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#######################################
|
||||||
|
# Syntax Coloring Map
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Datatypes (KEYWORD1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Methods and Functions (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
begin KEYWORD2
|
||||||
|
end KEYWORD2
|
||||||
|
reset KEYWORD2
|
||||||
|
setPixFormat KEYWORD2
|
||||||
|
setFrameSize KEYWORD2
|
||||||
|
run KEYWORD2
|
||||||
|
id KEYWORD2
|
||||||
|
snapshot KEYWORD2
|
||||||
|
setRotation KEYWORD2
|
||||||
|
setInvert KEYWORD2
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Constants (LITERAL1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
9
libraries/Sipeed_GC0328/library.properties
Normal file
9
libraries/Sipeed_GC0328/library.properties
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name=Sipeed_GC0328
|
||||||
|
version=1.0
|
||||||
|
author=vamoosebbf
|
||||||
|
maintainer=vamoosebbf<vamoosebbf@Sipeed.com>
|
||||||
|
sentence=Camera Sipeed_GC0328 driver
|
||||||
|
paragraph=Camera Sipeed_GC0328 driver
|
||||||
|
category=Sensors
|
||||||
|
url=
|
||||||
|
architectures=k210
|
||||||
1263
libraries/Sipeed_GC0328/src/Sipeed_GC0328.cpp
Normal file
1263
libraries/Sipeed_GC0328/src/Sipeed_GC0328.cpp
Normal file
File diff suppressed because it is too large
Load Diff
107
libraries/Sipeed_GC0328/src/Sipeed_GC0328.h
Normal file
107
libraries/Sipeed_GC0328/src/Sipeed_GC0328.h
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#ifndef __SIPEED_GC0328_H
|
||||||
|
#define __SIPEED_GC0328_H
|
||||||
|
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "Wire.h"
|
||||||
|
|
||||||
|
#define GC0328_ID (0x9d)
|
||||||
|
#define GC0328_ADDR (0x21)
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GAINCEILING_2X,
|
||||||
|
GAINCEILING_4X,
|
||||||
|
GAINCEILING_8X,
|
||||||
|
GAINCEILING_16X,
|
||||||
|
GAINCEILING_32X,
|
||||||
|
GAINCEILING_64X,
|
||||||
|
GAINCEILING_128X,
|
||||||
|
} gainceiling_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FRAMERATE_2FPS =0x9F,
|
||||||
|
FRAMERATE_8FPS =0x87,
|
||||||
|
FRAMERATE_15FPS=0x83,
|
||||||
|
FRAMERATE_30FPS=0x81,
|
||||||
|
FRAMERATE_60FPS=0x80,
|
||||||
|
} framerate_t;
|
||||||
|
|
||||||
|
|
||||||
|
class Sipeed_GC0328 : public Camera{
|
||||||
|
|
||||||
|
public:
|
||||||
|
Sipeed_GC0328(framesize_t frameSize = FRAMESIZE_QVGA, pixformat_t pixFormat = PIXFORMAT_RGB565, TwoWire *i2c = &Wire);
|
||||||
|
Sipeed_GC0328(uint16_t width, uint16_t height, pixformat_t pixFormat = PIXFORMAT_RGB565, TwoWire *i2c = &Wire);
|
||||||
|
~Sipeed_GC0328();
|
||||||
|
|
||||||
|
virtual bool begin();
|
||||||
|
bool begin(bool binocular);
|
||||||
|
virtual void end();
|
||||||
|
bool reset(bool binocular = false);
|
||||||
|
void debug(bool enable);
|
||||||
|
bool setPixFormat(pixformat_t pixFormat);
|
||||||
|
bool setFrameSize(framesize_t frameSize);
|
||||||
|
virtual bool run(bool run);
|
||||||
|
virtual int id();
|
||||||
|
/**
|
||||||
|
* @return pixels
|
||||||
|
* If pixels format is RGB565: return RGB565 pixels with every uint16_t one pixel, e.g. RED: 0xF800
|
||||||
|
*/
|
||||||
|
virtual uint8_t* snapshot();
|
||||||
|
virtual uint16_t* getRGB565(){ return (uint16_t*)_dataBuffer; };
|
||||||
|
virtual uint8_t* getRGB888(){ return _aiBuffer; };
|
||||||
|
virtual void setRotation(uint8_t rotation);
|
||||||
|
virtual void setInvert(bool invert);
|
||||||
|
virtual void shutdown(bool enable);
|
||||||
|
void setFlip(bool flip);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t* _dataBuffer; // put RGB565 data
|
||||||
|
uint8_t* _aiBuffer; // put RGB888 data
|
||||||
|
uint8_t _resetPolarity; // reset polarity flag
|
||||||
|
uint8_t _pwdnPolarity; // PWDN polarity flag
|
||||||
|
uint8_t _slaveAddr; // camera address
|
||||||
|
uint8_t _id;
|
||||||
|
uint32_t _freq;
|
||||||
|
TwoWire *_i2c; // replace sccb
|
||||||
|
bool _vflip;
|
||||||
|
bool _hmirror;
|
||||||
|
bool _debug;
|
||||||
|
|
||||||
|
int dvpInit(uint32_t freq = 14000000);
|
||||||
|
int dvpInitIrq();
|
||||||
|
|
||||||
|
int cambus_scan();
|
||||||
|
int cambus_read_id(uint8_t addr,uint16_t *manuf_id, uint16_t *device_id);
|
||||||
|
int cambus_scan_gc0328(void);
|
||||||
|
int cambus_readb(uint8_t slv_addr, uint8_t reg_addr, uint8_t *reg_data);
|
||||||
|
int cambus_writeb(uint8_t slv_addr, uint8_t reg_addr, uint8_t reg_data);
|
||||||
|
|
||||||
|
int sensor_gc_detect();
|
||||||
|
|
||||||
|
int gc0328_reset();
|
||||||
|
int gc0328_read_reg(uint8_t reg_addr);
|
||||||
|
int gc0328_write_reg(uint8_t reg_addr, uint8_t reg_data);
|
||||||
|
|
||||||
|
int gc0328_set_pixformat(pixformat_t pixformat);
|
||||||
|
int gc0328_set_framesize(framesize_t framesize);
|
||||||
|
int gc0328_set_framerate(framerate_t framerate);
|
||||||
|
int gc0328_set_contrast(int level);
|
||||||
|
int gc0328_set_brightness(int level);
|
||||||
|
int gc0328_set_saturation(int level);
|
||||||
|
int gc0328_set_gainceiling( gainceiling_t gainceiling);
|
||||||
|
int gc0328_set_quality(int qs);
|
||||||
|
int gc0328_set_colorbar(int enable);
|
||||||
|
int gc0328_set_auto_gain(int enable, float gain_db, float gain_db_ceiling);
|
||||||
|
int gc0328_get_gain_db(float *gain_db);
|
||||||
|
int gc0328_set_auto_exposure(int enable, int exposure_us);
|
||||||
|
int gc0328_get_exposure_us(int *exposure_us);
|
||||||
|
int gc0328_set_auto_whitebal(int enable, float r_gain_db, float g_gain_db, float b_gain_db);
|
||||||
|
int gc0328_get_rgb_gain_db(float *r_gain_db, float *g_gain_db, float *b_gain_db);
|
||||||
|
int gc0328_set_hmirror(int enable);
|
||||||
|
int gc0328_set_vflip(int enable);
|
||||||
|
int sensor_snapshot( );
|
||||||
|
int reverse_u32pixel(uint32_t* addr,uint32_t length);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,7 +18,7 @@ setFrameSize KEYWORD2
|
|||||||
run KEYWORD2
|
run KEYWORD2
|
||||||
id KEYWORD2
|
id KEYWORD2
|
||||||
snapshot KEYWORD2
|
snapshot KEYWORD2
|
||||||
setRotaion KEYWORD2
|
setRotation KEYWORD2
|
||||||
setInvert KEYWORD2
|
setInvert KEYWORD2
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
|||||||
@@ -599,7 +599,7 @@ static const uint8_t saturation_regs[NUM_SATURATION_LEVELS + 1][5] = {
|
|||||||
Sipeed_OV2640::Sipeed_OV2640( framesize_t frameSize, pixformat_t pixFormat)
|
Sipeed_OV2640::Sipeed_OV2640( framesize_t frameSize, pixformat_t pixFormat)
|
||||||
:Camera(frameSize, pixFormat),
|
:Camera(frameSize, pixFormat),
|
||||||
_dataBuffer(NULL), _aiBuffer(NULL),
|
_dataBuffer(NULL), _aiBuffer(NULL),
|
||||||
_resetPoliraty(ACTIVE_HIGH), _pwdnPoliraty(ACTIVE_HIGH),
|
_resetPolarity(ACTIVE_HIGH), _pwdnPolarity(ACTIVE_HIGH),
|
||||||
_slaveAddr(0x00),
|
_slaveAddr(0x00),
|
||||||
_id(0)
|
_id(0)
|
||||||
{
|
{
|
||||||
@@ -611,7 +611,7 @@ _id(0)
|
|||||||
Sipeed_OV2640::Sipeed_OV2640(uint16_t width, uint16_t height, pixformat_t pixFormat)
|
Sipeed_OV2640::Sipeed_OV2640(uint16_t width, uint16_t height, pixformat_t pixFormat)
|
||||||
:Camera(width, height, pixFormat),
|
:Camera(width, height, pixFormat),
|
||||||
_dataBuffer(NULL), _aiBuffer(NULL),
|
_dataBuffer(NULL), _aiBuffer(NULL),
|
||||||
_resetPoliraty(ACTIVE_HIGH), _pwdnPoliraty(ACTIVE_HIGH),
|
_resetPolarity(ACTIVE_HIGH), _pwdnPolarity(ACTIVE_HIGH),
|
||||||
_slaveAddr(0x00),
|
_slaveAddr(0x00),
|
||||||
_id(0)
|
_id(0)
|
||||||
{
|
{
|
||||||
@@ -721,7 +721,7 @@ uint8_t* Sipeed_OV2640::snapshot()
|
|||||||
return _dataBuffer;
|
return _dataBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sipeed_OV2640::setRotaion(uint8_t rotation)
|
void Sipeed_OV2640::setRotation(uint8_t rotation)
|
||||||
{
|
{
|
||||||
//FIXME
|
//FIXME
|
||||||
}
|
}
|
||||||
@@ -738,7 +738,7 @@ void Sipeed_OV2640::setInvert(bool invert)
|
|||||||
|
|
||||||
int Sipeed_OV2640::dvpInit(uint32_t freq)
|
int Sipeed_OV2640::dvpInit(uint32_t freq)
|
||||||
{
|
{
|
||||||
// just support RGB565 and YUV442 on k210
|
// just support RGB565 and YUV422 on k210
|
||||||
configASSERT(_pixFormat==PIXFORMAT_RGB565 || _pixFormat==PIXFORMAT_YUV422);
|
configASSERT(_pixFormat==PIXFORMAT_RGB565 || _pixFormat==PIXFORMAT_YUV422);
|
||||||
_freq = freq;
|
_freq = freq;
|
||||||
|
|
||||||
@@ -778,7 +778,7 @@ int Sipeed_OV2640::dvpInit(uint32_t freq)
|
|||||||
if(0 == sensor_ov_detect()){//find ov sensor
|
if(0 == sensor_ov_detect()){//find ov sensor
|
||||||
// printf("find ov sensor\n");
|
// printf("find ov sensor\n");
|
||||||
}
|
}
|
||||||
else if(0 == sensro_gc_detect()){//find gc0328 sensor
|
else if(0 == sensor_gc_detect()){//find gc0328 sensor
|
||||||
// printf("find gc3028\n");
|
// printf("find gc3028\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ int Sipeed_OV2640::sensor_ov_detect()
|
|||||||
if (_slaveAddr == 0) {
|
if (_slaveAddr == 0) {
|
||||||
/* Sensor has been held in reset,
|
/* Sensor has been held in reset,
|
||||||
so the reset line is active low */
|
so the reset line is active low */
|
||||||
_resetPoliraty = ACTIVE_LOW;
|
_resetPolarity = ACTIVE_LOW;
|
||||||
|
|
||||||
/* Pull the sensor out of the reset state,systick_sleep() */
|
/* Pull the sensor out of the reset state,systick_sleep() */
|
||||||
DCMI_RESET_HIGH();
|
DCMI_RESET_HIGH();
|
||||||
@@ -886,14 +886,14 @@ int Sipeed_OV2640::sensor_ov_detect()
|
|||||||
/* Probe again to set the slave addr */
|
/* Probe again to set the slave addr */
|
||||||
_slaveAddr = cambus_scan();
|
_slaveAddr = cambus_scan();
|
||||||
if (_slaveAddr == 0) {
|
if (_slaveAddr == 0) {
|
||||||
_pwdnPoliraty = ACTIVE_LOW;
|
_pwdnPolarity = ACTIVE_LOW;
|
||||||
|
|
||||||
DCMI_PWDN_HIGH();
|
DCMI_PWDN_HIGH();
|
||||||
msleep(10);
|
msleep(10);
|
||||||
|
|
||||||
_slaveAddr = cambus_scan();
|
_slaveAddr = cambus_scan();
|
||||||
if (_slaveAddr == 0) {
|
if (_slaveAddr == 0) {
|
||||||
_resetPoliraty = ACTIVE_HIGH;
|
_resetPolarity = ACTIVE_HIGH;
|
||||||
|
|
||||||
DCMI_RESET_LOW();
|
DCMI_RESET_LOW();
|
||||||
msleep(10);
|
msleep(10);
|
||||||
@@ -947,7 +947,7 @@ int Sipeed_OV2640::sensor_ov_detect()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sipeed_OV2640::sensro_gc_detect()
|
int Sipeed_OV2640::sensor_gc_detect()
|
||||||
{
|
{
|
||||||
DCMI_PWDN_HIGH();//enable gc0328 要恢复 normal 工作模式,需将 PWDN pin 接入低电平即可,同时写入初始化寄存器即可
|
DCMI_PWDN_HIGH();//enable gc0328 要恢复 normal 工作模式,需将 PWDN pin 接入低电平即可,同时写入初始化寄存器即可
|
||||||
DCMI_RESET_LOW();//reset gc3028
|
DCMI_RESET_LOW();//reset gc3028
|
||||||
@@ -1488,6 +1488,38 @@ int Sipeed_OV2640::ov2640_set_vflip(int enable)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Sipeed_OV2640::ov2640_set_flip(bool horiz, bool vert)
|
||||||
|
{
|
||||||
|
uint8_t reg;
|
||||||
|
int ret = cambus_readb(_slaveAddr, BANK_SEL, ®);
|
||||||
|
ret |= cambus_writeb(_slaveAddr, BANK_SEL, reg | BANK_SEL_SENSOR);
|
||||||
|
ret |= cambus_readb(_slaveAddr, REG04, ®);
|
||||||
|
|
||||||
|
if (horiz) {
|
||||||
|
reg |= REG04_HFLIP_IMG;
|
||||||
|
reg |= REG04_HREF_EN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reg &= ~REG04_HFLIP_IMG;
|
||||||
|
reg &= ~REG04_HREF_EN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vert) {
|
||||||
|
reg |= REG04_VFLIP_IMG;
|
||||||
|
reg |= REG04_VREF_EN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reg &= ~REG04_VFLIP_IMG;
|
||||||
|
reg &= ~REG04_VREF_EN;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret |= cambus_writeb(_slaveAddr, REG04, reg);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Sipeed_OV2640::reverse_u32pixel(uint32_t* addr,uint32_t length)
|
int Sipeed_OV2640::reverse_u32pixel(uint32_t* addr,uint32_t length)
|
||||||
{
|
{
|
||||||
if(NULL == addr)
|
if(NULL == addr)
|
||||||
@@ -1522,3 +1554,6 @@ int Sipeed_OV2640::sensor_snapshot( )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Sipeed_OV2640::flip( bool horiz, bool vert ) {
|
||||||
|
return ov2640_set_flip(horiz, vert);
|
||||||
|
}
|
||||||
@@ -54,14 +54,16 @@ public:
|
|||||||
virtual uint8_t* snapshot();
|
virtual uint8_t* snapshot();
|
||||||
virtual uint16_t* getRGB565(){ return (uint16_t*)_dataBuffer; };
|
virtual uint16_t* getRGB565(){ return (uint16_t*)_dataBuffer; };
|
||||||
virtual uint8_t* getRGB888(){ return _aiBuffer; };
|
virtual uint8_t* getRGB888(){ return _aiBuffer; };
|
||||||
virtual void setRotaion(uint8_t rotation);
|
virtual void setRotation(uint8_t rotation);
|
||||||
virtual void setInvert(bool invert);
|
virtual void setInvert(bool invert);
|
||||||
|
void flip(bool horiz, bool vert);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t* _dataBuffer; // put RGB565 data
|
uint8_t* _dataBuffer; // put RGB565 data
|
||||||
uint8_t* _aiBuffer; // put RGB888 data
|
uint8_t* _aiBuffer; // put RGB888 data
|
||||||
uint8_t _resetPoliraty; // reset poliraty flag
|
uint8_t _resetPolarity; // reset polarity flag
|
||||||
uint8_t _pwdnPoliraty; // PWDN poliraty flag
|
uint8_t _pwdnPolarity; // PWDN polarity flag
|
||||||
uint8_t _slaveAddr; // camera address
|
uint8_t _slaveAddr; // camera address
|
||||||
uint8_t _id;
|
uint8_t _id;
|
||||||
uint32_t _freq;
|
uint32_t _freq;
|
||||||
@@ -80,7 +82,7 @@ private:
|
|||||||
int cambus_writew2(uint8_t slv_addr, uint16_t reg_addr, uint16_t reg_data);
|
int cambus_writew2(uint8_t slv_addr, uint16_t reg_addr, uint16_t reg_data);
|
||||||
|
|
||||||
int sensor_ov_detect();
|
int sensor_ov_detect();
|
||||||
int sensro_gc_detect();
|
int sensor_gc_detect();
|
||||||
|
|
||||||
int ov2640_reset();
|
int ov2640_reset();
|
||||||
int ov2640_read_reg(uint8_t reg_addr);
|
int ov2640_read_reg(uint8_t reg_addr);
|
||||||
@@ -103,6 +105,8 @@ private:
|
|||||||
int ov2640_get_rgb_gain_db(float *r_gain_db, float *g_gain_db, float *b_gain_db);
|
int ov2640_get_rgb_gain_db(float *r_gain_db, float *g_gain_db, float *b_gain_db);
|
||||||
int ov2640_set_hmirror(int enable);
|
int ov2640_set_hmirror(int enable);
|
||||||
int ov2640_set_vflip(int enable);
|
int ov2640_set_vflip(int enable);
|
||||||
|
int ov2640_set_flip(bool horiz, bool vert);
|
||||||
|
|
||||||
int sensor_snapshot( );
|
int sensor_snapshot( );
|
||||||
int reverse_u32pixel(uint32_t* addr,uint32_t length);
|
int reverse_u32pixel(uint32_t* addr,uint32_t length);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ static int maix_i2c_slave_irq(void *userdata);
|
|||||||
|
|
||||||
TwoWire::TwoWire(i2c_device_number_t i2c_device)
|
TwoWire::TwoWire(i2c_device_number_t i2c_device)
|
||||||
{
|
{
|
||||||
|
i2c_tx_buff = 0;
|
||||||
|
i2c_rx_buff = 0;
|
||||||
|
|
||||||
_i2c_num = i2c_device;
|
_i2c_num = i2c_device;
|
||||||
switch(i2c_device)
|
switch(i2c_device)
|
||||||
{
|
{
|
||||||
@@ -38,44 +41,27 @@ TwoWire::~TwoWire()
|
|||||||
void
|
void
|
||||||
TwoWire::begin(uint8_t sda, uint8_t scl, uint32_t frequency)
|
TwoWire::begin(uint8_t sda, uint8_t scl, uint32_t frequency)
|
||||||
{
|
{
|
||||||
i2c_clk = frequency;
|
|
||||||
fpioa_set_function(sda, sda_func);
|
fpioa_set_function(sda, sda_func);
|
||||||
fpioa_set_function(scl, scl_func);
|
fpioa_set_function(scl, scl_func);
|
||||||
volatile i2c_t *i2c_adapter = i2c[_i2c_num];
|
|
||||||
uint8_t speed_mode = I2C_CON_SPEED_STANDARD;
|
|
||||||
//i2c_clk_init
|
|
||||||
sysctl_clock_enable((sysctl_clock_t)(SYSCTL_CLOCK_I2C0 + _i2c_num));
|
sysctl_clock_enable((sysctl_clock_t)(SYSCTL_CLOCK_I2C0 + _i2c_num));
|
||||||
sysctl_clock_set_threshold((sysctl_threshold_t)(SYSCTL_THRESHOLD_I2C0 + _i2c_num), 3);
|
sysctl_clock_set_threshold((sysctl_threshold_t)(SYSCTL_THRESHOLD_I2C0 + _i2c_num), 3);
|
||||||
|
|
||||||
uint32_t v_i2c_freq = sysctl_clock_get_freq((sysctl_clock_t)(SYSCTL_CLOCK_I2C0 + _i2c_num));
|
volatile i2c_t *i2c_adapter = i2c[_i2c_num];
|
||||||
uint16_t v_period_clk_cnt = floor( (v_i2c_freq*1.0 / i2c_clk / 2) + 0.5 );
|
|
||||||
|
|
||||||
|
|
||||||
if(v_period_clk_cnt <= 6)
|
|
||||||
v_period_clk_cnt = 6;
|
|
||||||
if(v_period_clk_cnt >= 65525)//65535-10
|
|
||||||
v_period_clk_cnt = 65525;
|
|
||||||
if((i2c_clk>100000) && (i2c_clk<=1000000))
|
|
||||||
speed_mode = I2C_CON_SPEED_FAST;
|
|
||||||
else
|
|
||||||
speed_mode = I2C_CON_SPEED_HIGH;
|
|
||||||
i2c_adapter->enable = 0;
|
i2c_adapter->enable = 0;
|
||||||
i2c_adapter->con = I2C_CON_MASTER_MODE | I2C_CON_SLAVE_DISABLE | I2C_CON_RESTART_EN |
|
|
||||||
(address_width == 10 ? I2C_CON_10BITADDR_SLAVE : 0) | I2C_CON_SPEED(speed_mode);
|
|
||||||
i2c_adapter->ss_scl_hcnt = I2C_SS_SCL_HCNT_COUNT(v_period_clk_cnt);
|
|
||||||
i2c_adapter->ss_scl_lcnt = I2C_SS_SCL_LCNT_COUNT(v_period_clk_cnt);
|
|
||||||
|
|
||||||
i2c_adapter->intr_mask = 0;
|
i2c_adapter->intr_mask = 0;
|
||||||
i2c_adapter->dma_cr = 0x3;
|
i2c_adapter->dma_cr = 0x3;
|
||||||
i2c_adapter->dma_rdlr = 0;
|
i2c_adapter->dma_rdlr = 0;
|
||||||
i2c_adapter->dma_tdlr = 4;
|
i2c_adapter->dma_tdlr = 4;
|
||||||
i2c_adapter->enable = I2C_ENABLE_ENABLE;
|
|
||||||
is_master_mode = true;
|
is_master_mode = true;
|
||||||
|
|
||||||
|
delete i2c_tx_buff;
|
||||||
|
delete i2c_rx_buff;
|
||||||
i2c_tx_buff = new RingBuffer();
|
i2c_tx_buff = new RingBuffer();
|
||||||
i2c_rx_buff = new RingBuffer();
|
i2c_rx_buff = new RingBuffer();
|
||||||
|
|
||||||
|
setClock(frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -84,11 +70,10 @@ TwoWire::begin(uint16_t slave_address, uint8_t sda, uint8_t scl)
|
|||||||
fpioa_set_function(sda, sda_func);
|
fpioa_set_function(sda, sda_func);
|
||||||
fpioa_set_function(scl, scl_func);
|
fpioa_set_function(scl, scl_func);
|
||||||
|
|
||||||
volatile i2c_t *i2c_adapter = i2c[_i2c_num];
|
|
||||||
|
|
||||||
sysctl_clock_enable((sysctl_clock_t)(SYSCTL_CLOCK_I2C0 + _i2c_num));
|
sysctl_clock_enable((sysctl_clock_t)(SYSCTL_CLOCK_I2C0 + _i2c_num));
|
||||||
sysctl_clock_set_threshold((sysctl_threshold_t)(SYSCTL_THRESHOLD_I2C0 + _i2c_num), 3);
|
sysctl_clock_set_threshold((sysctl_threshold_t)(SYSCTL_THRESHOLD_I2C0 + _i2c_num), 3);
|
||||||
|
|
||||||
|
volatile i2c_t *i2c_adapter = i2c[_i2c_num];
|
||||||
i2c_adapter->enable = 0;
|
i2c_adapter->enable = 0;
|
||||||
i2c_adapter->con = I2C_CON_SPEED(1) | I2C_CON_STOP_DET_IFADDRESSED;
|
i2c_adapter->con = I2C_CON_SPEED(1) | I2C_CON_STOP_DET_IFADDRESSED;
|
||||||
i2c_adapter->ss_scl_hcnt = I2C_SS_SCL_HCNT_COUNT(37);
|
i2c_adapter->ss_scl_hcnt = I2C_SS_SCL_HCNT_COUNT(37);
|
||||||
@@ -98,17 +83,20 @@ TwoWire::begin(uint16_t slave_address, uint8_t sda, uint8_t scl)
|
|||||||
i2c_adapter->tx_tl = I2C_TX_TL_VALUE(0);
|
i2c_adapter->tx_tl = I2C_TX_TL_VALUE(0);
|
||||||
i2c_adapter->intr_mask = I2C_INTR_MASK_RX_FULL | I2C_INTR_MASK_START_DET | I2C_INTR_MASK_STOP_DET | I2C_INTR_MASK_RD_REQ;
|
i2c_adapter->intr_mask = I2C_INTR_MASK_RX_FULL | I2C_INTR_MASK_START_DET | I2C_INTR_MASK_STOP_DET | I2C_INTR_MASK_RD_REQ;
|
||||||
|
|
||||||
|
is_master_mode = false;
|
||||||
|
|
||||||
plic_set_priority((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num), 1);
|
plic_set_priority((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num), 1);
|
||||||
plic_irq_register((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num), maix_i2c_slave_irq, this);
|
plic_irq_register((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num), maix_i2c_slave_irq, this);
|
||||||
plic_irq_enable((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num));
|
plic_irq_enable((plic_irq_t)(IRQN_I2C0_INTERRUPT + _i2c_num));
|
||||||
|
|
||||||
i2c_adapter->enable = I2C_ENABLE_ENABLE;
|
delete i2c_tx_buff;
|
||||||
is_master_mode = false;
|
delete i2c_rx_buff;
|
||||||
|
|
||||||
i2c_tx_buff = new RingBuffer();
|
i2c_tx_buff = new RingBuffer();
|
||||||
i2c_rx_buff = new RingBuffer();
|
i2c_rx_buff = new RingBuffer();
|
||||||
|
|
||||||
|
i2c_adapter->enable = I2C_ENABLE_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TwoWire::setTimeOut(uint16_t timeOutMillis)
|
TwoWire::setTimeOut(uint16_t timeOutMillis)
|
||||||
{
|
{
|
||||||
@@ -145,7 +133,6 @@ TwoWire::setClock(uint32_t frequency)
|
|||||||
i2c_adapter->ss_scl_hcnt = I2C_SS_SCL_HCNT_COUNT(v_period_clk_cnt);
|
i2c_adapter->ss_scl_hcnt = I2C_SS_SCL_HCNT_COUNT(v_period_clk_cnt);
|
||||||
i2c_adapter->ss_scl_lcnt = I2C_SS_SCL_LCNT_COUNT(v_period_clk_cnt);
|
i2c_adapter->ss_scl_lcnt = I2C_SS_SCL_LCNT_COUNT(v_period_clk_cnt);
|
||||||
i2c_adapter->enable = I2C_ENABLE_ENABLE;
|
i2c_adapter->enable = I2C_ENABLE_ENABLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
@@ -236,6 +223,9 @@ TwoWire::readTransmission(uint16_t address, uint8_t* receive_buf, size_t receive
|
|||||||
void
|
void
|
||||||
TwoWire::beginTransmission(uint16_t address)
|
TwoWire::beginTransmission(uint16_t address)
|
||||||
{
|
{
|
||||||
|
// Clear buffers when new transation/packet starts
|
||||||
|
flush();
|
||||||
|
|
||||||
transmitting = 1;
|
transmitting = 1;
|
||||||
txAddress = address;
|
txAddress = address;
|
||||||
}
|
}
|
||||||
@@ -263,24 +253,28 @@ TwoWire::endTransmission(bool sendStop) //结束时从rxbuff发送数据?
|
|||||||
uint8_t
|
uint8_t
|
||||||
TwoWire::requestFrom(uint16_t address, uint8_t size, bool sendStop) //请求数据,存入rxbuff,供read读
|
TwoWire::requestFrom(uint16_t address, uint8_t size, bool sendStop) //请求数据,存入rxbuff,供read读
|
||||||
{
|
{
|
||||||
|
// Clear buffers when new transation/packet starts
|
||||||
|
flush();
|
||||||
|
|
||||||
int state,index = 0;
|
int state,index = 0;
|
||||||
uint8_t rx_data[RING_BUFFER_SIZE];
|
uint8_t rx_data[RING_BUFFER_SIZE];
|
||||||
state = readTransmission(address, rx_data, size, sendStop);
|
state = readTransmission(address, rx_data, size, sendStop);
|
||||||
if(0 == state){
|
if(0 == state){
|
||||||
while(size)
|
while(index < size)
|
||||||
{
|
{
|
||||||
i2c_rx_buff->store_char(rx_data[index++]);
|
i2c_rx_buff->store_char(rx_data[index++]);
|
||||||
size--;
|
|
||||||
}
|
}
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
return i2c_rx_buff->available();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
TwoWire::write(uint8_t data) //写到txbuff
|
TwoWire::write(uint8_t data) //写到txbuff
|
||||||
{
|
{
|
||||||
if(transmitting) {
|
if(transmitting && !i2c_tx_buff->isFull()) {
|
||||||
i2c_tx_buff->store_char(data);
|
i2c_tx_buff->store_char(data);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -288,7 +282,7 @@ TwoWire::write(uint8_t data) //写到txbuff
|
|||||||
size_t
|
size_t
|
||||||
TwoWire::write(const uint8_t *data, int quantity)
|
TwoWire::write(const uint8_t *data, int quantity)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < quantity; ++i) {
|
for(size_t i = 0; i < quantity; i++) {
|
||||||
if(!write(data[i])) {
|
if(!write(data[i])) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
TwoWire(i2c_device_number_t i2c_device);
|
TwoWire(i2c_device_number_t i2c_device);
|
||||||
~TwoWire();
|
~TwoWire();
|
||||||
void begin(uint8_t sda = SDA, uint8_t scl = SCL, uint32_t frequency = 500000);
|
void begin(uint8_t sda = SDA, uint8_t scl = SCL, uint32_t frequency = 400000);
|
||||||
void begin(uint16_t slave_address, uint8_t sda = SDA, uint8_t scl = SCL);
|
void begin(uint16_t slave_address, uint8_t sda = SDA, uint8_t scl = SCL);
|
||||||
|
|
||||||
void setClock(uint32_t frequency);
|
void setClock(uint32_t frequency);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "framework-maixduino",
|
"name": "framework-maixduino",
|
||||||
"description": "Arduino Wiring-based Framework (K210 Core)",
|
"description": "Arduino Wiring-based Framework (K210 Core)",
|
||||||
"version": "0.3.10",
|
"version": "0.3.11",
|
||||||
"url": "https://github.com/sipeed/Maixduino"
|
"url": "https://github.com/sipeed/Maixduino"
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
name=Maixduino
|
name=Maixduino
|
||||||
version=0.3.10
|
version=0.3.11
|
||||||
|
|
||||||
# arch
|
# arch
|
||||||
arch=k210
|
arch=k210
|
||||||
|
|||||||
91
variants/ioxgd4/pins_arduino.h
Normal file
91
variants/ioxgd4/pins_arduino.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#ifndef _VARIANT_IOXGD4
|
||||||
|
#define _VARIANT_IOXGD4
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_GREEN 13
|
||||||
|
#define PIN_LED_BLUE 12
|
||||||
|
#define PIN_LED_RED 14
|
||||||
|
#define PIN_LED 13
|
||||||
|
#define LED_BUILTIN 13
|
||||||
|
#define LED_GREEN 13
|
||||||
|
#define LED_BLUE 12
|
||||||
|
#define LED_RED 14
|
||||||
|
/* KEY */
|
||||||
|
#define KEY0 16
|
||||||
|
/* MIC ARRAY */
|
||||||
|
#define MIC_BCK 18
|
||||||
|
#define MIC_WS 19
|
||||||
|
#define MIC_DAT3 20
|
||||||
|
#define MIC_DAT2 21
|
||||||
|
#define MIC_DAT1 22
|
||||||
|
#define MIC_DAT0 23
|
||||||
|
#define MIC_LED_DAT 24
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_CS1 25
|
||||||
|
#define SPI0_MISO 26
|
||||||
|
#define SPI0_SCLK 27
|
||||||
|
#define SPI0_MOSI 28
|
||||||
|
#define SPI0_CS0 29
|
||||||
|
/* I2S */
|
||||||
|
#define MIC0_WS 30
|
||||||
|
#define MIC0_DATA 31
|
||||||
|
#define MIC0_BCK 32
|
||||||
|
#define I2S_WS 33
|
||||||
|
#define I2S_DA 34
|
||||||
|
#define I2S_BCK 35
|
||||||
|
/* LCD */
|
||||||
|
#define LCD_CS 36
|
||||||
|
#define LCD_RST 37
|
||||||
|
#define LCD_DC 38
|
||||||
|
#define LCD_WR 39
|
||||||
|
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
|
||||||
|
#define RX1 7
|
||||||
|
#define TX1 6
|
||||||
|
|
||||||
|
#define SDA 33
|
||||||
|
#define SCL 32
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
}pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
91
variants/lamloei_aiot_daan/pins_arduino.h
Normal file
91
variants/lamloei_aiot_daan/pins_arduino.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#ifndef _VARIANT_LAMLOEI_AIOT_DAAN
|
||||||
|
#define _VARIANT_LAMLOEI_AIOT_DAAN
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_GREEN 13
|
||||||
|
#define PIN_LED_BLUE 12
|
||||||
|
#define PIN_LED_RED 14
|
||||||
|
#define PIN_LED 13
|
||||||
|
#define LED_BUILTIN 13
|
||||||
|
#define LED_GREEN 13
|
||||||
|
#define LED_BLUE 12
|
||||||
|
#define LED_RED 14
|
||||||
|
/* KEY */
|
||||||
|
#define KEY0 16
|
||||||
|
/* MIC ARRAY */
|
||||||
|
#define MIC_BCK 18
|
||||||
|
#define MIC_WS 19
|
||||||
|
#define MIC_DAT3 20
|
||||||
|
#define MIC_DAT2 21
|
||||||
|
#define MIC_DAT1 22
|
||||||
|
#define MIC_DAT0 23
|
||||||
|
#define MIC_LED_DAT 24
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_CS1 25
|
||||||
|
#define SPI0_MISO 26
|
||||||
|
#define SPI0_SCLK 27
|
||||||
|
#define SPI0_MOSI 28
|
||||||
|
#define SPI0_CS0 29
|
||||||
|
/* I2S */
|
||||||
|
#define MIC0_WS 30
|
||||||
|
#define MIC0_DATA 31
|
||||||
|
#define MIC0_BCK 32
|
||||||
|
#define I2S_WS 33
|
||||||
|
#define I2S_DA 34
|
||||||
|
#define I2S_BCK 35
|
||||||
|
/* LCD */
|
||||||
|
#define LCD_CS 36
|
||||||
|
#define LCD_RST 37
|
||||||
|
#define LCD_DC 38
|
||||||
|
#define LCD_WR 39
|
||||||
|
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
|
||||||
|
#define SDA 31
|
||||||
|
#define SCL 30
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
}pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
93
variants/m5stack_m5stick_v/pins_arduino.h
Normal file
93
variants/m5stack_m5stick_v/pins_arduino.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
#ifndef _VARIANT_M5STACK_M5STICK_V
|
||||||
|
#define _VARIANT_M5STACK_M5STICK_V
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UART */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_RED 6
|
||||||
|
#define PIN_LED_WHITE 7
|
||||||
|
#define PIN_LED_BLUE 8
|
||||||
|
#define PIN_LED_GREEN 9
|
||||||
|
#define PIN_LED 9
|
||||||
|
#define LED_RED 6
|
||||||
|
#define LED_WHITE 7
|
||||||
|
#define LED_BLUE 8
|
||||||
|
#define LED_GREEN 9
|
||||||
|
#define LED_BUILTIN 9
|
||||||
|
/* MIC ARRAY */
|
||||||
|
#define MIC_WS 10
|
||||||
|
#define MIC_DAT3 12
|
||||||
|
#define MIC_BCK 13
|
||||||
|
/* SPK MAX98357 */
|
||||||
|
#define I2S_SD 11
|
||||||
|
#define I2S_LRCLK 14
|
||||||
|
#define I2S_BCLK 15
|
||||||
|
#define I2S_DIN 17
|
||||||
|
/* LCD ST7789 135x240 */
|
||||||
|
#define LCD_SDA 18
|
||||||
|
#define LCD_SCL 19
|
||||||
|
#define LCD_DC 20
|
||||||
|
#define LCD_RST 21
|
||||||
|
#define LCD_CS 22
|
||||||
|
/* AXP192 INT PIN */
|
||||||
|
#define INTL_INT 23
|
||||||
|
/* INTL I2C - AXP192, MPU6886 */
|
||||||
|
#define SCL 28
|
||||||
|
#define SDA 29
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_SCLK 30
|
||||||
|
#define SPI0_MISO 31
|
||||||
|
#define SPI0_CS0 32
|
||||||
|
#define SPI0_MOSI 33
|
||||||
|
/* GROVE */
|
||||||
|
#define RX1 34
|
||||||
|
#define TX1 35
|
||||||
|
#define EXTL_SCL 34
|
||||||
|
#define EXTL_SDA 35
|
||||||
|
/* BUTTONS */
|
||||||
|
#define BTN_A 36
|
||||||
|
#define BTN_B 37
|
||||||
|
#define KEY0 36
|
||||||
|
#define KEY1 37
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
78
variants/m5stack_m5unit_v/pins_arduino.h
Normal file
78
variants/m5stack_m5unit_v/pins_arduino.h
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
#ifndef _VARIANT_M5STACK_M5UNIT_V
|
||||||
|
#define _VARIANT_M5STACK_M5UNIT_V
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UART */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* WS2812 LEDs */
|
||||||
|
#define PIN_LED_RGB 8
|
||||||
|
|
||||||
|
/* MIC ARRAY */
|
||||||
|
#define MIC_WS 10
|
||||||
|
#define MIC_DAT3 12
|
||||||
|
#define MIC_BCK 13
|
||||||
|
/* SPK MAX98357 */
|
||||||
|
#define SPK_LRCLK 14
|
||||||
|
#define SPK_BCLK 15
|
||||||
|
#define SPK_DIN 17
|
||||||
|
#define SPK_SD 25
|
||||||
|
/* BUTTONS */
|
||||||
|
#define BTN_A 18
|
||||||
|
#define BTN_B 19
|
||||||
|
#define KEY0 18
|
||||||
|
#define KEY1 19
|
||||||
|
/* AXP192 INT PIN */
|
||||||
|
#define AXP_INT 23
|
||||||
|
/* INTL I2C */
|
||||||
|
#define SCL 28
|
||||||
|
#define SDA 29
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_SCLK 30
|
||||||
|
#define SPI0_MISO 31
|
||||||
|
#define SPI0_CS0 32
|
||||||
|
#define SPI0_MOSI 33
|
||||||
|
/* EXTL I2C */
|
||||||
|
#define EXTL_SCL 34
|
||||||
|
#define EXTL_SDA 35
|
||||||
|
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
}pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
96
variants/sipeed_maix_amigo/pins_arduino.h
Normal file
96
variants/sipeed_maix_amigo/pins_arduino.h
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#ifndef _VARIANT_SIPEED_MAIX_AMIGO
|
||||||
|
#define _VARIANT_SIPEED_MAIX_AMIGO
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS CH552T */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* UART Grove */
|
||||||
|
#define RX1 9 //Grove
|
||||||
|
#define TX1 7 //Grove
|
||||||
|
/* 8P Connector */
|
||||||
|
// #define PB0 8 //8P-12
|
||||||
|
// #define PB1 12 //8P-3
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_MISO 6 //8P-11
|
||||||
|
#define SPI0_MOSI 10 //8P-2
|
||||||
|
#define SPI0_SCLK 11 //8P-1
|
||||||
|
#define SPI0_CS0 26 //TF
|
||||||
|
/* KEYs */
|
||||||
|
#define KEY2 20 //Grove
|
||||||
|
#define KEY1 23 //Grove
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_RED 14
|
||||||
|
#define PIN_LED_GREEN 15
|
||||||
|
#define PIN_LED_BLUE 17
|
||||||
|
#define PIN_LED 15
|
||||||
|
#define LED_RED 14
|
||||||
|
#define LED_GREEN 15
|
||||||
|
#define LED_BLUE 17
|
||||||
|
#define LED_BUILTIN 15
|
||||||
|
/* UART3 */
|
||||||
|
#define TX2 22 //8P-4
|
||||||
|
#define RX2 25 //8P-5
|
||||||
|
/* I2C1 - AXP173, MSA301, TOUCH */
|
||||||
|
#define SCL 24
|
||||||
|
#define SDA 27
|
||||||
|
/* USB_SBU */
|
||||||
|
#define USB_DP 28 //8P-8
|
||||||
|
#define USB_DM 29 //8P-9
|
||||||
|
/* I2S AUDIO CODEC ES8374 */
|
||||||
|
#define I2S2_MCLK 13
|
||||||
|
#define I2S2_WS 18
|
||||||
|
#define I2S2_SCLK 21
|
||||||
|
#define I2S2_DOUT 34
|
||||||
|
#define I2S2_DIN 35
|
||||||
|
/* Flash LED */
|
||||||
|
#define WLED_EN 32
|
||||||
|
/* TouchScreen */
|
||||||
|
#define CAP_TOUCH_IRQ 33
|
||||||
|
/* LCD */
|
||||||
|
#define LCD_TEN 19
|
||||||
|
#define LCD_CS 36
|
||||||
|
#define LCD_RST 37
|
||||||
|
#define LCD_DC 38
|
||||||
|
#define LCD_WR 39
|
||||||
|
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,45 +18,58 @@ extern class UARTClass Serial3;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BOARD PIN DEFINE */
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* UART */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
|
||||||
|
// #define IO_8 8
|
||||||
|
// #define IO_9 9
|
||||||
|
// #define IO_10 10
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
#define PIN_LED_GREEN 13
|
#define PIN_LED_GREEN 12
|
||||||
#define PIN_LED_BLUE 12
|
#define PIN_LED_RED 13
|
||||||
#define PIN_LED_RED 14
|
#define PIN_LED_BLUE 14
|
||||||
#define PIN_LED 13
|
#define PIN_LED 12
|
||||||
#define LED_BUILTIN 13
|
#define LED_RED 13
|
||||||
#define LED_GREEN 13
|
#define LED_GREEN 12
|
||||||
#define LED_BLUE 12
|
#define LED_BLUE 14
|
||||||
#define LED_RED 14
|
#define LED_BUILTIN 12
|
||||||
/* KEY */
|
// #define IO_15 15
|
||||||
#define KEY0 16
|
// #define IO_17 17
|
||||||
/* MIC ARRAY */
|
|
||||||
|
/* I2S MIC */
|
||||||
#define MIC_BCK 18
|
#define MIC_BCK 18
|
||||||
#define MIC_WS 19
|
#define MIC_WS 19
|
||||||
#define MIC_DAT3 20
|
#define MIC_DAT3 20
|
||||||
#define MIC_DAT2 21
|
|
||||||
#define MIC_DAT1 22
|
// #define IO_21 21
|
||||||
#define MIC_DAT0 23
|
// #define IO_22 22
|
||||||
#define MIC_LED_DAT 24
|
// #define IO_23 23
|
||||||
|
// #define IO_24 24
|
||||||
|
// #define IO_25 25
|
||||||
/* SPI0 */
|
/* SPI0 */
|
||||||
#define SPI0_CS1 25
|
|
||||||
#define SPI0_MISO 26
|
#define SPI0_MISO 26
|
||||||
#define SPI0_SCLK 27
|
#define SPI0_SCLK 27
|
||||||
#define SPI0_MOSI 28
|
#define SPI0_MOSI 28
|
||||||
#define SPI0_CS0 29
|
#define SPI0_CS0 29
|
||||||
|
|
||||||
|
// #define SCL 30
|
||||||
|
// #define SDA 31
|
||||||
|
// #define IO_30 30
|
||||||
|
// #define IO_31 31
|
||||||
|
// #define IO_32 32
|
||||||
|
// #define IO_33 33
|
||||||
|
// #define IO_34 34
|
||||||
|
// #define IO_35 35
|
||||||
/* LCD */
|
/* LCD */
|
||||||
#define LCD_CS 36
|
#define LCD_CS 36
|
||||||
#define LCD_RST 37
|
#define LCD_RST 37
|
||||||
#define LCD_DC 38
|
#define LCD_DC 38
|
||||||
#define LCD_WR 39
|
#define LCD_WR 39
|
||||||
|
|
||||||
#define RX0 4
|
|
||||||
#define TX0 5
|
|
||||||
|
|
||||||
#define RX1 6
|
|
||||||
#define TX1 7
|
|
||||||
|
|
||||||
#define SDA 31
|
|
||||||
#define SCL 30
|
|
||||||
|
|
||||||
#define MD_PIN_MAP(fpio) (fpio)
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
#define ORG_PIN_MAP(org_pin) (org_pin)
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
@@ -70,8 +83,7 @@ typedef struct _pwm_fpio_set_t{
|
|||||||
pwm_channel_number_t channel;
|
pwm_channel_number_t channel;
|
||||||
pwm_device_number_t device;
|
pwm_device_number_t device;
|
||||||
uint8_t inuse;
|
uint8_t inuse;
|
||||||
}pwm_fpio_set_t;
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define VARIANT_NUM_GPIOHS (32)
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
|||||||
@@ -18,45 +18,56 @@ extern class UARTClass Serial3;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BOARD PIN DEFINE */
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* UART */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
|
||||||
|
#define IO_8 8
|
||||||
|
#define IO_9 9
|
||||||
|
#define IO_10 10
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
#define PIN_LED_GREEN 13
|
#define PIN_LED_GREEN 12
|
||||||
#define PIN_LED_BLUE 12
|
#define PIN_LED_RED 13
|
||||||
#define PIN_LED_RED 14
|
#define PIN_LED_BLUE 14
|
||||||
#define PIN_LED 13
|
#define PIN_LED 12
|
||||||
#define LED_BUILTIN 13
|
#define LED_RED 13
|
||||||
#define LED_GREEN 13
|
#define LED_GREEN 12
|
||||||
#define LED_BLUE 12
|
#define LED_BLUE 14
|
||||||
#define LED_RED 14
|
#define LED_BUILTIN 12
|
||||||
/* KEY */
|
// #define IO_15 15
|
||||||
#define KEY0 16
|
// #define IO_17 17
|
||||||
/* MIC ARRAY */
|
/* I2S MIC */
|
||||||
#define MIC_BCK 18
|
#define MIC_BCK 18
|
||||||
#define MIC_WS 19
|
#define MIC_WS 19
|
||||||
#define MIC_DAT3 20
|
#define MIC_DAT3 20
|
||||||
#define MIC_DAT2 21
|
// #define IO_21 21
|
||||||
#define MIC_DAT1 22
|
// #define IO_22 22
|
||||||
#define MIC_DAT0 23
|
// #define IO_23 23
|
||||||
#define MIC_LED_DAT 24
|
// #define IO_24 24
|
||||||
|
// #define IO_25 25
|
||||||
/* SPI0 */
|
/* SPI0 */
|
||||||
#define SPI0_CS1 25
|
|
||||||
#define SPI0_MISO 26
|
#define SPI0_MISO 26
|
||||||
#define SPI0_SCLK 27
|
#define SPI0_SCLK 27
|
||||||
#define SPI0_MOSI 28
|
#define SPI0_MOSI 28
|
||||||
#define SPI0_CS0 29
|
#define SPI0_CS0 29
|
||||||
|
|
||||||
|
// #define SCL 30
|
||||||
|
// #define SDA 31
|
||||||
|
// #define IO_30 30
|
||||||
|
// #define IO_31 31
|
||||||
|
// #define IO_32 32
|
||||||
|
// #define IO_33 33
|
||||||
|
// #define IO_34 34
|
||||||
|
// #define IO_35 35
|
||||||
/* LCD */
|
/* LCD */
|
||||||
#define LCD_CS 36
|
#define LCD_CS 36
|
||||||
#define LCD_RST 37
|
#define LCD_RST 37
|
||||||
#define LCD_DC 38
|
#define LCD_DC 38
|
||||||
#define LCD_WR 39
|
#define LCD_WR 39
|
||||||
|
|
||||||
#define RX0 4
|
|
||||||
#define TX0 5
|
|
||||||
|
|
||||||
#define RX1 6
|
|
||||||
#define TX1 7
|
|
||||||
|
|
||||||
#define SDA 31
|
|
||||||
#define SCL 30
|
|
||||||
|
|
||||||
#define MD_PIN_MAP(fpio) (fpio)
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
#define ORG_PIN_MAP(org_pin) (org_pin)
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
@@ -70,8 +81,7 @@ typedef struct _pwm_fpio_set_t{
|
|||||||
pwm_channel_number_t channel;
|
pwm_channel_number_t channel;
|
||||||
pwm_device_number_t device;
|
pwm_device_number_t device;
|
||||||
uint8_t inuse;
|
uint8_t inuse;
|
||||||
}pwm_fpio_set_t;
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define VARIANT_NUM_GPIOHS (32)
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
|||||||
99
variants/sipeed_maix_cube/pins_arduino.h
Normal file
99
variants/sipeed_maix_cube/pins_arduino.h
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
#ifndef _VARIANT_SIPEED_MAIX_CUBE
|
||||||
|
#define _VARIANT_SIPEED_MAIX_CUBE
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS CH552T */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* SPMOD */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
// #define IO_8 8
|
||||||
|
// #define IO_9 9
|
||||||
|
/* KEYs */
|
||||||
|
#define KEY1 10
|
||||||
|
#define KEY2 11
|
||||||
|
#define PIN_KEY_DOWN 10
|
||||||
|
#define PIN_KEY_UP 11
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_GREEN 12
|
||||||
|
#define PIN_LED_RED 13
|
||||||
|
#define PIN_LED_BLUE 14
|
||||||
|
#define PIN_LED 12
|
||||||
|
#define LED_RED 13
|
||||||
|
#define LED_GREEN 12
|
||||||
|
#define LED_BLUE 14
|
||||||
|
#define LED_BUILTIN 12
|
||||||
|
/* SPMOD */
|
||||||
|
// #define IO_15 15
|
||||||
|
// #define IO_20 20
|
||||||
|
// #define IO_21 21
|
||||||
|
/* I2S AUDIO CODEC ES8374 */
|
||||||
|
#define I2S_DIN 18
|
||||||
|
#define I2S_MCLK 19
|
||||||
|
#define I2S_LRCK 33
|
||||||
|
#define I2S_DOUT 34
|
||||||
|
#define I2S_SCLK 35
|
||||||
|
/* USB_SBU */
|
||||||
|
// #define IO_22 22
|
||||||
|
// #define IO_23 23
|
||||||
|
/* GROVE */
|
||||||
|
// #define IO_24 24
|
||||||
|
// #define IO_25 25
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_MISO 26
|
||||||
|
#define SPI0_SCLK 27
|
||||||
|
#define SPI0_MOSI 28
|
||||||
|
#define SPI0_CS0 29
|
||||||
|
/* I2C1 - AXP173, MSA301*/
|
||||||
|
#define SCL 30
|
||||||
|
#define SDA 31
|
||||||
|
/* Flash LED */
|
||||||
|
#define WLED_EN 32
|
||||||
|
/* LCD */
|
||||||
|
#define LCD_BL 17
|
||||||
|
#define LCD_CS 36
|
||||||
|
#define LCD_RST 37
|
||||||
|
#define LCD_DC 38
|
||||||
|
#define LCD_WR 39
|
||||||
|
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef _VARIANT_BOARD_SIPEED_MAIX_GO
|
#ifndef _VARIANT_SIPEED_MAIX_GO
|
||||||
#define _VARIANT_BOARD_SIPEED_MAIX_GO
|
#define _VARIANT_SIPEED_MAIX_GO
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -18,21 +18,37 @@ extern class UARTClass Serial3;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BOARD PIN DEFINE */
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* WIFI UART1 */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
#define ESP_TX 6
|
||||||
|
#define ESP_RX 7
|
||||||
|
#define ESP_EN 8
|
||||||
|
/* BPSK */
|
||||||
|
#define BPSK_P 9
|
||||||
|
#define BPSK_N 10
|
||||||
|
// #define IO_11 11
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
#define PIN_LED_GREEN 13
|
|
||||||
#define PIN_LED_BLUE 12
|
#define PIN_LED_BLUE 12
|
||||||
|
#define PIN_LED_GREEN 13
|
||||||
#define PIN_LED_RED 14
|
#define PIN_LED_RED 14
|
||||||
#define PIN_LED 13
|
#define PIN_LED 13
|
||||||
#define LED_BUILTIN 13
|
#define LED_RED 14
|
||||||
#define LED_GREEN 13
|
#define LED_GREEN 13
|
||||||
#define LED_BLUE 12
|
#define LED_BLUE 12
|
||||||
#define LED_RED 14
|
#define LED_BUILTIN 13
|
||||||
/* KEY */
|
/* KEY */
|
||||||
#define KEY0 15
|
#define KEY1 15
|
||||||
#define PIN_KEY_DOWN 16
|
#define KEY0 16
|
||||||
|
#define KEY2 17
|
||||||
|
#define PIN_KEY_DOWN 15
|
||||||
|
#define PIN_KEY_PRESS 16
|
||||||
#define PIN_KEY_UP 17
|
#define PIN_KEY_UP 17
|
||||||
#define PIN_KEY_PRESS 15
|
|
||||||
/* MIC ARRAY */
|
/* MIC ARRAY */
|
||||||
|
/* I2S MIC MSM261S4030H0 */
|
||||||
#define MIC_BCK 18
|
#define MIC_BCK 18
|
||||||
#define MIC_WS 19
|
#define MIC_WS 19
|
||||||
#define MIC_DAT3 20
|
#define MIC_DAT3 20
|
||||||
@@ -40,13 +56,17 @@ extern class UARTClass Serial3;
|
|||||||
#define MIC_DAT1 22
|
#define MIC_DAT1 22
|
||||||
#define MIC_DAT0 23
|
#define MIC_DAT0 23
|
||||||
#define MIC_LED_DAT 24
|
#define MIC_LED_DAT 24
|
||||||
/* SPI0 */
|
#define MIC_LED_CLK 25
|
||||||
#define SPI0_CS1 25
|
/* SPI0 TF */
|
||||||
#define SPI0_MISO 26
|
#define SPI0_MISO 26
|
||||||
#define SPI0_SCLK 27
|
#define SPI0_SCLK 27
|
||||||
#define SPI0_MOSI 28
|
#define SPI0_MOSI 28
|
||||||
#define SPI0_CS0 29
|
#define SPI0_CS0 29
|
||||||
/* I2S */
|
/* I2C1 MSA300 */
|
||||||
|
#define SCL 30
|
||||||
|
#define SDA 31
|
||||||
|
// #define IO_32 32
|
||||||
|
/* I2S DAC PT8211 */
|
||||||
#define I2S_WS 33
|
#define I2S_WS 33
|
||||||
#define I2S_DA 34
|
#define I2S_DA 34
|
||||||
#define I2S_BCK 35
|
#define I2S_BCK 35
|
||||||
@@ -56,14 +76,6 @@ extern class UARTClass Serial3;
|
|||||||
#define LCD_DC 38
|
#define LCD_DC 38
|
||||||
#define LCD_WR 39
|
#define LCD_WR 39
|
||||||
|
|
||||||
#define RX0 4
|
|
||||||
#define TX0 5
|
|
||||||
|
|
||||||
#define RX1 6
|
|
||||||
#define TX1 7
|
|
||||||
|
|
||||||
#define SDA 31
|
|
||||||
#define SCL 30
|
|
||||||
|
|
||||||
#define MD_PIN_MAP(fpio) (fpio)
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
#define ORG_PIN_MAP(org_pin) (org_pin)
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
@@ -77,8 +89,7 @@ typedef struct _pwm_fpio_set_t{
|
|||||||
pwm_channel_number_t channel;
|
pwm_channel_number_t channel;
|
||||||
pwm_device_number_t device;
|
pwm_device_number_t device;
|
||||||
uint8_t inuse;
|
uint8_t inuse;
|
||||||
}pwm_fpio_set_t;
|
} pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define VARIANT_NUM_GPIOHS (32)
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef _VARIANT_SIPEED_M1_DOCK
|
#ifndef _VARIANT_SIPEED_MAIX_ONE_DOCK
|
||||||
#define _VARIANT_SIPEED_M1_DOCK
|
#define _VARIANT_SIPEED_MAIX_ONE_DOCK
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -18,17 +18,23 @@ extern class UARTClass Serial3;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BOARD PIN DEFINE */
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* WIFI UART1 */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
/* LEDs */
|
/* LEDs */
|
||||||
#define PIN_LED_GREEN 13
|
#define PIN_LED_GREEN 13
|
||||||
#define PIN_LED_BLUE 12
|
#define PIN_LED_BLUE 12
|
||||||
#define PIN_LED_RED 14
|
#define PIN_LED_RED 14
|
||||||
#define PIN_LED 13
|
#define PIN_LED 13
|
||||||
#define LED_BUILTIN 13
|
#define LED_RED 14
|
||||||
#define LED_GREEN 13
|
#define LED_GREEN 13
|
||||||
#define LED_BLUE 12
|
#define LED_BLUE 12
|
||||||
#define LED_RED 14
|
#define LED_BUILTIN 13
|
||||||
/* KEY */
|
/* KEY */
|
||||||
#define KEY0 16
|
//#define KEY0 16
|
||||||
/* MIC ARRAY */
|
/* MIC ARRAY */
|
||||||
#define MIC_BCK 18
|
#define MIC_BCK 18
|
||||||
#define MIC_WS 19
|
#define MIC_WS 19
|
||||||
@@ -56,14 +62,6 @@ extern class UARTClass Serial3;
|
|||||||
#define LCD_DC 38
|
#define LCD_DC 38
|
||||||
#define LCD_WR 39
|
#define LCD_WR 39
|
||||||
|
|
||||||
#define RX0 4
|
|
||||||
#define TX0 5
|
|
||||||
|
|
||||||
#define RX1 6
|
|
||||||
#define TX1 7
|
|
||||||
|
|
||||||
#define SDA 31
|
|
||||||
#define SCL 30
|
|
||||||
|
|
||||||
#define MD_PIN_MAP(fpio) (fpio)
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
#define ORG_PIN_MAP(org_pin) (org_pin)
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|||||||
90
variants/sipeed_maix_one_w_dock/pins_arduino.h
Normal file
90
variants/sipeed_maix_one_w_dock/pins_arduino.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#ifndef _VARIANT_SIPEED_MAIX_ONE_W_DOCK
|
||||||
|
#define _VARIANT_SIPEED_MAIX_ONE_W_DOCK
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define RISCV
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
#include "pwm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include "UARTClass.h"
|
||||||
|
extern class UARTHSClass Serial;
|
||||||
|
extern class UARTClass Serial1;
|
||||||
|
extern class UARTClass Serial2;
|
||||||
|
extern class UARTClass Serial3;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* BOARD PIN DEFINE */
|
||||||
|
/* UARTHS */
|
||||||
|
#define RX0 4
|
||||||
|
#define TX0 5
|
||||||
|
/* WIFI UART1 */
|
||||||
|
#define RX1 6
|
||||||
|
#define TX1 7
|
||||||
|
/* LEDs */
|
||||||
|
#define PIN_LED_RED 14
|
||||||
|
#define PIN_LED_GREEN 13
|
||||||
|
#define PIN_LED_BLUE 12
|
||||||
|
#define PIN_LED 13
|
||||||
|
#define LED_RED 14
|
||||||
|
#define LED_GREEN 13
|
||||||
|
#define LED_BLUE 12
|
||||||
|
#define LED_BUILTIN 13
|
||||||
|
/* KEY */
|
||||||
|
//#define KEY0 16
|
||||||
|
/* MIC ARRAY */
|
||||||
|
#define MIC_BCK 18
|
||||||
|
#define MIC_WS 19
|
||||||
|
#define MIC_DAT3 20
|
||||||
|
#define MIC_DAT2 21
|
||||||
|
#define MIC_DAT1 22
|
||||||
|
#define MIC_DAT0 23
|
||||||
|
#define MIC_LED_DAT 24
|
||||||
|
/* SPI0 */
|
||||||
|
#define SPI0_CS1 25
|
||||||
|
#define SPI0_MISO 26
|
||||||
|
#define SPI0_SCLK 27
|
||||||
|
#define SPI0_MOSI 28
|
||||||
|
#define SPI0_CS0 29
|
||||||
|
/* I2S */
|
||||||
|
#define MIC0_WS 30
|
||||||
|
#define MIC0_DATA 31
|
||||||
|
#define MIC0_BCK 32
|
||||||
|
|
||||||
|
#define I2S_WS 33
|
||||||
|
#define I2S_DA 34
|
||||||
|
#define I2S_BCK 35
|
||||||
|
/* LCD */
|
||||||
|
#define LCD_CS 36
|
||||||
|
#define LCD_RST 37
|
||||||
|
#define LCD_DC 38
|
||||||
|
#define LCD_WR 39
|
||||||
|
|
||||||
|
|
||||||
|
#define MD_PIN_MAP(fpio) (fpio)
|
||||||
|
#define ORG_PIN_MAP(org_pin) (org_pin)
|
||||||
|
|
||||||
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
|
static const uint8_t MISO = SPI0_MISO;
|
||||||
|
static const uint8_t SCK = SPI0_SCLK;
|
||||||
|
|
||||||
|
typedef struct _pwm_fpio_set_t{
|
||||||
|
pwm_channel_number_t channel;
|
||||||
|
pwm_device_number_t device;
|
||||||
|
uint8_t inuse;
|
||||||
|
}pwm_fpio_set_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define VARIANT_NUM_GPIOHS (32)
|
||||||
|
#define VARIANT_NUM_GPIO ( 8)
|
||||||
|
#define VARIANT_NUM_PWM (12)
|
||||||
|
#define VARIANT_NUM_I2C ( 3)
|
||||||
|
#define VARIANT_NUM_SPI ( 3)
|
||||||
|
#define VARIANT_NUM_UART ( 3)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -18,47 +18,48 @@ extern class UARTClass Serial3;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BOARD PIN DEFINE */
|
/* BOARD PIN DEFINE */
|
||||||
/* LEDs */
|
#define RX0 0
|
||||||
#define PIN_LED 13
|
#define TX0 1
|
||||||
#define LED_BUILTIN 13
|
/* LEDs (USE Builtin TX PIN led)*/
|
||||||
|
#define PIN_LED_RED 13
|
||||||
|
#define PIN_LED_GREEN 12
|
||||||
|
#define PIN_LED_BLUE 14
|
||||||
|
#define PIN_LED 12
|
||||||
|
#define LED_RED 13
|
||||||
|
#define LED_GREEN 12
|
||||||
|
#define LED_BLUE 14
|
||||||
|
#define LED_BUILTIN 12
|
||||||
/* KEY */
|
/* KEY */
|
||||||
#define KEY0 16
|
//#define KEY0 16
|
||||||
/* MIC ARRAY */
|
/* ONBOARD ESP32 */
|
||||||
#define MIC_BCK 18
|
#define ESP_TX 6
|
||||||
#define MIC_WS 19
|
#define ESP_RX 7
|
||||||
#define MIC_DAT3 20
|
#define ESP_EN 8
|
||||||
#define MIC_DAT2 21
|
#define ESP_READY 9
|
||||||
#define MIC_DAT1 22
|
#define ESP_SPI_CS 25
|
||||||
#define MIC_DAT0 23
|
|
||||||
#define MIC_LED_DAT 24
|
|
||||||
/* SPI0 */
|
/* SPI0 */
|
||||||
#define SPI0_CS1 25
|
|
||||||
#define SPI0_MISO 26
|
#define SPI0_MISO 26
|
||||||
#define SPI0_SCLK 27
|
#define SPI0_SCLK 27
|
||||||
#define SPI0_MOSI 28
|
#define SPI0_MOSI 28
|
||||||
#define SPI0_CS0 29
|
#define SPI0_CS0 29
|
||||||
/* I2S */
|
/* I2S */
|
||||||
#define MIC0_WS 30
|
#define MIC_BCK 18
|
||||||
#define MIC0_DATA 31
|
#define MIC_WS 19
|
||||||
#define MIC0_BCK 32
|
#define MIC_DATA 20
|
||||||
|
/* I2C1 */
|
||||||
|
#define SCL 30
|
||||||
|
#define SDA 31
|
||||||
|
/* DAC PT8211 */
|
||||||
#define I2S_WS 33
|
#define I2S_WS 33
|
||||||
#define I2S_DA 34
|
#define I2S_DA 34
|
||||||
#define I2S_BCK 35
|
#define I2S_BCK 35
|
||||||
/* LCD */
|
/* LCD */
|
||||||
|
#define LCD_BL 17
|
||||||
#define LCD_CS 36
|
#define LCD_CS 36
|
||||||
#define LCD_RST 37
|
#define LCD_RST 37
|
||||||
#define LCD_DC 38
|
#define LCD_DC 38
|
||||||
#define LCD_WR 39
|
#define LCD_WR 39
|
||||||
|
|
||||||
#define RX0 0
|
|
||||||
#define TX0 1
|
|
||||||
|
|
||||||
#define RX1 6
|
|
||||||
#define TX1 7
|
|
||||||
|
|
||||||
#define SDA 31
|
|
||||||
#define SCL 30
|
|
||||||
|
|
||||||
static const uint8_t SS = SPI0_CS0 ;
|
static const uint8_t SS = SPI0_CS0 ;
|
||||||
static const uint8_t MOSI = SPI0_MOSI;
|
static const uint8_t MOSI = SPI0_MOSI;
|
||||||
@@ -71,7 +72,7 @@ typedef struct _pwm_fpio_set_t{
|
|||||||
uint8_t inuse;
|
uint8_t inuse;
|
||||||
}pwm_fpio_set_t;
|
}pwm_fpio_set_t;
|
||||||
|
|
||||||
#define MD_PIN_MAP(fpio) _maixduino_pin_map[(fpio)]
|
#define MD_PIN_MAP(fpio) (((fpio) < 17) ? _maixduino_pin_map[(fpio)] : (fpio))
|
||||||
|
|
||||||
static const uint8_t _maixduino_pin_map[17] = {4, 5, 21, 22, 23, 24, 32, 15, 14, 13, 12, 11, 10, 3, 31, 30, 16};
|
static const uint8_t _maixduino_pin_map[17] = {4, 5, 21, 22, 23, 24, 32, 15, 14, 13, 12, 11, 10, 3, 31, 30, 16};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user