76 Commits

Author SHA1 Message Date
Neucrack
4d31122a39 Merge pull request #142 from dimitre/invalid
invalid
2024-06-15 16:16:19 +08:00
Dimitre
2bae74b0c0 invalid 2024-06-14 14:29:16 -03:00
Neucrack
1e63c0d678 Merge pull request #140 from dimitre/flip
[suggestion] : having a flip function with horizontal and vertical
2024-06-13 11:00:20 +08:00
Dimitre
377cb291e7 flip 2024-06-12 16:02:30 -03:00
Neucrack
0c9ca167b7 Merge pull request #132 from alirezainallo/bugFix/UARTClass
BugFix/serial1-3
2024-06-07 01:17:34 +08:00
Neucrack
6d2de50937 Merge pull request #139 from dimitre/patch-1
422
2024-06-07 01:16:28 +08:00
Dimitre
8aaca6ea3a 422 2024-06-06 11:24:08 -03:00
Neucrack
7fd025bcd4 Merge pull request #137 from dimitre/polarity
Poliraty -> Polarity
2024-06-05 10:43:54 +08:00
Neucrack
032eb52ac9 Merge pull request #135 from dimitre/rotaion
rotaion -> rotation keyword
2024-06-05 10:43:29 +08:00
Dimitre
f18df03229 polarity 2024-06-04 14:49:31 -03:00
Dimitre
d4a7042c82 rotaion -> rotation keyword 2024-06-03 23:43:52 -03:00
Neucrack
fb781728b9 Merge pull request #134 from dimitre/typo
sensro -> sensor
2024-06-03 15:34:06 +08:00
Dimitre
ca9c0a900a sensro -> sensor 2024-06-03 00:29:41 -03:00
alirezainallo
c2f8db6a9f Fix Rx/Tx define number 2023-08-02 16:39:04 +03:30
alirezainallo
22ab4ecfe7 bypass gpio map for serial1-3 2023-08-02 16:38:38 +03:30
Neucrack
aa6543538c fix readme index url error 2021-11-29 18:08:27 +08:00
Neucrack
b9c5f43fea Merge pull request #96 from mikljohansson/fix_memleak_warning
Fixed memory leak warning
2021-05-31 10:09:32 +08:00
Neucrack
e9532200e9 Merge pull request #99 from UT2UH/master
Missing devices added
2021-05-31 10:06:45 +08:00
Neucrack
50cb129b02 Merge pull request #110 from mikljohansson/add-binocular-camera-support
Add binocular camera support
2021-05-31 10:02:52 +08:00
Neucrack
f54b3f19ab Merge pull request #111 from mikljohansson/fixed-uart-write-return-value
Fixed some bugs in the Serial implementations
2021-05-31 10:00:08 +08:00
Neucrack
03b7995e0c Merge pull request #116 from per1234/optimal-library-name
Use optimal bundled library names
2021-05-31 09:55:22 +08:00
per1234
86acd72c3d Use optimal bundled library names
When multiple libraries contain files matching an #include directive in the program, the Arduino build system must pick
one to use for compilation. Multiple factors are used in order to make an intelligent determination of which library is
best.

In order to enhance this determination, the closeness of match between the library.properties name value and the
filename in the #include directive is being added as one of those factors. This new factor is referred to as
"Library Name Priority".

Unfortunately, this change can result in platform bundled libraries which had previously been correctly correctly chosen
no longer being given priority over their equivalent standalone libraries, which may be incompatible or not optimized
for the platform's boards.

This priority inversion only occurs when all the following conditions are true:

- There is a standalone library installed which provides a header filename collision.
- The platform bundled library is architecture optimized (e.g., architectures=esp32).
- The standalone library is architecture compatible (architectures=*).
- The standalone library has equal "Folder Name Priority".
- The standalone library has better "Library Name Priority" (e.g., name=SD vs name=SD(ESP32) for a library with primary
  header file SD.h.

The fix is to simply give the platform bundled library a perfect "Library Name Priority".

Some platform bundled libraries were given a modified name as a workaround to a bug in the Arduino IDE's Library Manager
which caused Library Manager to always show the library as updatable under specific circumstances. That bug was fixed in
Arduino IDE 1.8.6, ~3 years ago.
2021-05-30 13:11:35 -07:00
Mikael Johansson
f95f8e70c9 Disable debug output by default from GC0328 camera driver. Fixed GC0328 camera driver mirror/flip functionality 2021-03-13 11:13:26 +01:00
Mikael Johansson
4f4d43094b Fixed return value handling of UARTClass::write and Print::write 2021-03-13 11:00:50 +01:00
Mikael Johansson
a346d8cab1 Added support for binocular camera 2021-02-21 15:59:13 +01:00
Mikael Johansson
ca5e26d4e9 Fixed typo in Sipeed_GC0328::setRotation method name 2021-02-21 15:59:13 +01:00
vamoosebbf
abba977741 Merge pull request #103 from vamoosebbf/master
[libraries] add gc0328 support
2021-01-10 10:26:24 +08:00
vamoosebbf
ae99df0800 [libraries] add gc0328 support 2021-01-07 13:47:59 +08:00
UT2UH
ea172fc074 Merge branch 'NewBoards' 2020-11-11 13:31:04 +02:00
UT2UH
2fe52b570e min max macros and Wire fixes 2020-11-11 13:29:58 +02:00
UT2UH
403e61d90a Update README.md 2020-11-02 21:12:39 +02:00
UT2UH
1376ced183 New boards added 2020-11-02 21:05:00 +02:00
Mikael Johansson
505f888835 Fixed memory leak warning 2020-10-22 21:57:07 +02:00
UT2UH
a256706b7f Merge pull request #1 from sipeed/master
Merge to upsatream update
2020-10-18 11:46:26 +03:00
Neucrack
dead5bc98d Merge pull request #95 from mikljohansson/fix_twowire_compat
Fixed TwoWire implementation to be more Arduino compatible
2020-10-14 11:41:44 +08:00
Mikael Johansson
78f7bb18c5 Flush buffers on every I2C transaction, in case the user hasn't consumed all bytes
F
2020-10-11 15:24:14 +02:00
Mikael Johansson
763c23d13c Refacted TwoWire::begin() to reduce duplicated code with TwoWire::setClock() 2020-10-11 14:59:18 +02:00
Mikael Johansson
7c7ec509ac Return number of received bytes from TwoWire::requestFrom(), like Arduino documentation specifies
Nl
2020-10-11 12:12:37 +02:00
Mikael Johansson
9b077cb470 Set default I2C frequency to 400kHz, same as Arduino boards use 2020-10-10 16:48:49 +02:00
Mikael Johansson
359f7a89f2 Fixed return value bug in TwoWire::write 2020-10-10 16:48:14 +02:00
Bits
bb42e208a7 Merge pull request #66 from epozzobon/master
Fixed receiving the NUL '\x00' character on Serial
2019-11-20 21:35:18 +08:00
Enrico Pozzobon
0cfbfacc40 Fixed receiving the NUL '\x00' character on Serial 2019-11-17 03:07:46 +01:00
Bits
d4a0f06d05 Merge pull request #61 from ioxgd/master
Add IOXGD4 board
2019-10-30 09:20:57 +08:00
Max
2c08ea95bb Add IOXGD4 board 2019-10-25 11:41:07 +07:00
Bits
d42af6a0a2 Merge pull request #60 from sabas1080/master
Fix Typo Rotation in Sipeed_OV2640
2019-10-19 09:11:30 +08:00
Sabas
4fb76511f6 fix typo rotation 2019-10-18 13:52:31 -05:00
Sabas
64fe55b858 fix typo rotation 2019-10-18 13:51:50 -05:00
bigbits
85c0d7d24e release new version 2019-10-12 09:27:11 +08:00
Bits
31fa216fd0 Merge pull request #58 from vanvuongngo/patch-1
prettier drawline.ino example
2019-10-11 12:10:23 +08:00
Van Vuong Ngo
4dd21db55e prettier 2019-10-11 06:07:55 +02:00
Bits
6f7873a49c Merge pull request #57 from vanvuongngo/patch-1
outputs values as formatted strings
2019-10-10 11:40:56 +08:00
Van Vuong Ngo
4f5585a0dd outputs values as formatted strings 2019-10-10 05:31:11 +02:00
Bits
485cf192ba Merge pull request #55 from richardclli/fix-compile-error
Added quotes in library path to fix sketch compile error
2019-09-30 18:52:14 +08:00
Richard Li
2570fd3b5a Added quotes in library path to fix sketch compile error when Windows username has space. 2019-09-30 11:10:20 +08:00
Bits
3ffdbe9768 Merge pull request #41 from majenkotech/master
Fix module path for non-windows OS
2019-09-13 12:04:09 +08:00
Bits
d19982e248 Merge pull request #43 from sajattack/patch-1
Fix Issue #33
2019-09-13 12:03:47 +08:00
Bits
a8a5e39e9e Merge pull request #39 from iZhangHui/master
fix issue #38
2019-09-13 12:03:25 +08:00
Bits
4fad772219 Merge pull request #45 from lamloei/patch-2
Create pins_arduino.h
2019-08-07 11:44:56 +08:00
Bits
546dc5e894 Merge pull request #44 from lamloei/patch-1
Update boards.txt
2019-08-07 11:44:43 +08:00
lamloei
5d85ca78a3 Create pins_arduino.h
ADD LamLoei AIoT DaaN
2019-08-04 00:34:05 +07:00
lamloei
a241ae41a7 Update boards.txt
ADD LamLoei AIoT DaaN Board
2019-08-04 00:31:46 +07:00
Paul
1eb49c57da Fix Issue #33 2019-08-02 17:13:33 -04:00
Majenko Technologies
db7a98b893 Fix module path for non-windows OS
`/` is the universal path separator. `\` is specific to Windows. Other OSes don't understand `\`
2019-07-31 23:22:13 +01:00
Henry Zhang
9b2f110f0b fix bug of SD init failed 2019-07-31 11:19:25 +08:00
Henry Zhang
99ab059752 Keep Maixduino board backward compatibility 2019-07-31 11:18:28 +08:00
Bits
7d66935095 Maixduino board can use tx led to run blink #36 2019-07-30 13:12:44 +08:00
Bigbits
18164baf25 Modify version to 0.3.10 2019-07-23 09:06:01 +08:00
Bigbits
656abee8aa M platform.txt 2019-07-17 15:07:48 +08:00
Bigbits
240bb27d0b Fix sdcard bug #26 2019-07-17 10:27:36 +08:00
Bigbits
b47d512182 Update Lvgl to v6.0 2019-07-15 18:43:08 +08:00
Bigbits
ba0fd67e4e add lv_maixduino 2019-07-15 17:20:38 +08:00
Bigbits
98756e8832 rm lv_arduino 2019-07-15 17:19:06 +08:00
Bigbits
e75526f51f Add mit-mic board 2019-07-15 16:14:59 +08:00
Bigbits
363b2bade7 add microsecond into Ticker lib #23 2019-07-11 15:47:50 +08:00
Bigbits
b6da4a0466 modify sdk. 2019-07-11 15:29:11 +08:00
Bits
25d62719d4 Modify maixduino board burn_tool name. 2019-07-05 21:52:49 +08:00
49 changed files with 3704 additions and 270 deletions

3
.gitmodules vendored
View File

@@ -10,3 +10,6 @@
[submodule "libraries/lv_arduino"]
path = libraries/lv_arduino
url = https://github.com/btx000/lv_arduino.git
[submodule "libraries/lv_maixduino"]
path = libraries/lv_maixduino
url = https://github.com/littlevgl/lv_maixduino.git

View File

@@ -1,21 +1,76 @@
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: [maixduino.sipeed.com](https://maixduino.sipeed.com/)
Docs: [wiki.sipeed.com](https://wiki.sipeed.com/soft/maixduino/zh/index.html)
## Install
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)

View File

@@ -3,10 +3,243 @@ menu.burn_tool_firmware=Burn Tool Firmware
menu.burn_baudrate=Burn Baud Rate
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 ###############
m1.name=Sipeed Maix One Dock Board
m1.name=Sipeed Maix Dock M1
## Toolchain
m1.menu.toolsloc.default=Default
@@ -39,7 +272,7 @@ m1.build.variant=sipeed_maix_one_dock
m1.build.core=arduino
## 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
## 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.
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 ###############
bit.name=Sipeed Maix Bit Board
bit.name=Sipeed Maix Bit
## Toolchain
bit.menu.toolsloc.default=Default
@@ -86,7 +319,7 @@ bit.build.variant=sipeed_maix_bit
bit.build.core=arduino
## 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
## This selects the tool from "programmers.txt"
@@ -95,99 +328,234 @@ bit.upload.tool=kflash
## Limit is the 16MB Flash. Assume half is used for something else.
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 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 ###############
############# Sipeed Maix Bit with Mic Board ###############
mduino.name=Sipeed Maixduino Board
bitm.name=Sipeed Maix Bit-Mic
## Toolchain
mduino.menu.toolsloc.default=Default
mduino.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
bitm.menu.toolsloc.default=Default
bitm.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
bitm.menu.clksrc.400=400MHz CPU Clock Frequency
bitm.menu.clksrc.500=500MHz CPU Clock Frequency
bitm.menu.clksrc.600=600MHz CPU Clock Frequency
bitm.menu.clksrc.400.build.f_cpu=400000000L
bitm.menu.clksrc.500.build.f_cpu=500000000L
bitm.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
bitm.menu.burn_baudrate.1500000=1.5 Mbps
bitm.menu.burn_baudrate.1000000=1 Mbps
bitm.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
bitm.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
## Burn tool firmware
mduino.menu.burn_tool_firmware.dan=Default
mduino.menu.burn_tool_firmware.dan.build.burn_tool_firmware=goE
bitm.menu.burn_tool_firmware.bitm=Default
bitm.menu.burn_tool_firmware.bitm.build.burn_tool_firmware=bit-mic
## Point to the file for ./variants/<variant>/pins_arduino.h
mduino.build.variant=sipeed_maixduino
bitm.build.variant=sipeed_maix_bit_mic
## "The 'core' file directory for this board, in ./cores
mduino.build.core=arduino
bitm.build.core=arduino
## This sets a define for use in the compiled code.
mduino.build.board=BOARD_SIPEED_MAIX_DUINO
mduino.build.sdata.size=512
bitm.build.board=MAIX_BIT_M
bitm.build.sdata.size=512
## This selects the tool from "programmers.txt"
mduino.program.tool=kflash
mduino.upload.tool=kflash
bitm.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
bitm.upload.maximum_size=8388608
bitm.build.ldscript="{runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld"
##################################################
############# M5Stack M5StickV Stick ###############
stickv.name=M5Stack M5StickV Stick
## Toolchain
stickv.menu.toolsloc.default=Default
stickv.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
## CPU Clock
stickv.menu.clksrc.400=400MHz CPU Clock Frequency
stickv.menu.clksrc.500=500MHz CPU Clock Frequency
stickv.menu.clksrc.600=600MHz CPU Clock Frequency
stickv.menu.clksrc.400.build.f_cpu=400000000L
stickv.menu.clksrc.500.build.f_cpu=500000000L
stickv.menu.clksrc.600.build.f_cpu=600000000L
## Burn baud rate
stickv.menu.burn_baudrate.1500000=1.5 Mbps
stickv.menu.burn_baudrate.1000000=1 Mbps
stickv.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
stickv.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
## Burn tool firmware
stickv.menu.burn_tool_firmware.stick1=CH340
stickv.menu.burn_tool_firmware.stick1.build.burn_tool_firmware=bit-mic
## Point to the file for ./variants/<variant>/pins_arduino.h
stickv.build.variant=m5stack_m5stick_v
## "The 'core' file directory for this board, in ./cores
stickv.build.core=arduino
## This sets a define for use in the compiled code.
stickv.build.board=M5STICK_V
stickv.build.sdata.size=512
## This selects the tool from "programmers.txt"
stickv.program.tool=kflash
stickv.upload.tool=kflash
## Limit is the 16MB Flash. Assume half is used for something else.
stickv.upload.maximum_size=8388608
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

View File

@@ -29,6 +29,7 @@ class HardwareSerial : public Stream
virtual void begin(uint32_t) {};
virtual void end() {};
virtual int available(void) = 0;
virtual int availableForWrite(void) = 0;
virtual int peek(void) = 0;
virtual int read(void) = 0;
virtual void flush(void) = 0;

View File

@@ -45,12 +45,12 @@ size_t Print::printf(const char *format, ...)
}
}
len = vsnprintf(temp, len+1, format, arg);
write((uint8_t*)temp, len);
size_t ret = write((uint8_t*)temp, len);
va_end(arg);
if(len >= sizeof(loc_buf)){
delete[] temp;
}
return len;
return ret;
}
/* default implementation: may be overridden */
@@ -58,7 +58,12 @@ size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
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;
}

View File

@@ -72,8 +72,8 @@ UARTClass::begin(uint32_t dwBaudRate)
void
UARTClass::begin(uint32_t dwBaudRate, uint8_t _rx, uint8_t _tx)
{
fpioa_set_function((int)MD_PIN_MAP(_rx), this->_rxfunc);
fpioa_set_function((int)MD_PIN_MAP(_tx), this->_txfunc);
fpioa_set_function(_rx, this->_rxfunc);
fpioa_set_function(_tx, this->_txfunc);
uart_init(this->_uart);
uart_configure(this->_uart, dwBaudRate, UART_BITWIDTH_8BIT, UART_STOP_1, UART_PARITY_NONE);
this->_buff = new RingBuffer();
@@ -128,7 +128,7 @@ UARTClass::write(const uint8_t c)
while (uart[this->_uart]->LSR & (1u << 5))
continue;
uart[this->_uart]->THR = c;
return 0;
return 1;
}
static int
@@ -177,8 +177,11 @@ UARTHSClass::end()
size_t
UARTHSClass::write(const uint8_t uc_data)
{
uarths_putchar(uc_data);
return (1);
if (uarths_putchar(uc_data) == uc_data) {
return 1;
}
return 0;
}
static int
@@ -186,9 +189,9 @@ uarths_rec_callback(void *ctx)
{
int data;
auto &driver = *reinterpret_cast<UARTHSClass *>(ctx);
data = uarths_getc();
if(data != 0){
data = uarths_getchar();
if(data != EOF){
driver._buff->store_char((char)data);
}
return 0;
}
}

View File

@@ -65,11 +65,11 @@ enum BitOrder {
#endif // abs
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#endif // min
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#endif // max
#define abs(x) ((x)>0?(x):-(x))

115
libraries/AXP173/AXP173.cpp Normal file
View 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
View 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
View 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
View 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

View File

@@ -19,7 +19,7 @@ id KEYWORD2
snapshot KEYWORD2
getRGB565 KEYWORD2
getRGB888 KEYWORD2
setRotaion KEYWORD2
setRotation KEYWORD2
setInver KEYWORD2
width KEYWORD2
height KEYWORD2

View File

@@ -5,7 +5,7 @@
#include <stdbool.h>
typedef enum {
PIXFORMAT_INVLAID = 0,
PIXFORMAT_INVALID = 0,
PIXFORMAT_BAYER, // RAW
PIXFORMAT_RGB565, // RGB565
PIXFORMAT_YUV422, // YUV422
@@ -76,8 +76,9 @@ public:
* e.g. two RED pixel: {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}
*/
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 flip(bool horiz, bool vert);
virtual int width(){ return _width; }

View File

@@ -1,27 +1,39 @@
#include <MSA300.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;
MSA300 msa;
void setup() {
// put your setup code here, to run once:
static char outstr[formattedStringLength];
char * formatValue(float value)
{
dtostrf(value, formattedStringLength, numVarsAfterDecimal, outstr);
return outstr;
}
void setup()
{
Serial.begin(9600);
Wire.begin();
msa.begin();
}
void loop() {
// put your main code here, to run repeatedly:
void loop()
{
data = msa.getAcceleration();
Serial.print("Xa:");
Serial.print(data.x);
Serial.print("Ya:");
Serial.print(data.y);
Serial.print("Za:");
Serial.println(data.z);
Serial.printf("Xa:%s ", formatValue(data.x));
Serial.printf("Ya:%s ", formatValue(data.y));
Serial.printf("Za:%s", formatValue(data.z));
Serial.println();
delay(100);
}

View File

@@ -20,7 +20,7 @@ void setup()
pinMode(key, INPUT);
lcd.begin(15000000, COLOR_RED);
touchscreen.begin();
touchscreen.calibrate(320,240);
touchscreen.calibrate(320, 240);
}
void loop()
@@ -29,20 +29,16 @@ void loop()
touchscreen_status = touchscreen.getStatus();
touchscreen_x = touchscreen.getX();
touchscreen_y = touchscreen.getY();
if(draw){
if (draw) {
lcd.writeLine(x_last,y_last,touchscreen_x,touchscreen_y,COLOR_WHITE);
}
if(status_last!=touchscreen_status){
if (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE)
draw = true;
else
draw = false;
status_last=touchscreen_status;
if (status_last != touchscreen_status) {
draw = (touchscreen_status == TOUCH_BEGIN || touchscreen_status == TOUCH_MOVE);
status_last = touchscreen_status;
}
x_last = touchscreen_x;
y_last = touchscreen_y;
if(digitalRead(key) == LOW)
{
if (digitalRead(key) == LOW) {
lcd.fillScreen(COLOR_BLACK);
}
}

View File

@@ -1,4 +1,4 @@
name=SD(k210)
name=SD
version=1.2.4
author=Arduino, SparkFun, Neucrack
maintainer=Sipeed <support@sipeed.com>

View File

@@ -20,6 +20,9 @@
#define USE_SPI_LIB
#include <Arduino.h>
#include "Sd2Card.h"
#include "fpioa.h"
#include "gpio.h"
#include "wiring_digital.h"
//------------------------------------------------------------------------------
#ifndef SOFTWARE_SPI
#ifdef USE_SPI_LIB
@@ -251,6 +254,7 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
// set pin modes
pinMode(chipSelectPin_, OUTPUT);
digitalWrite(chipSelectPin_, HIGH);
#ifndef USE_SPI_LIB
pinMode(SPI_MISO_PIN, INPUT);
pinMode(SPI_MOSI_PIN, OUTPUT);

View 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);
}

View 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);
}

View 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)
#######################################

View 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

File diff suppressed because it is too large Load Diff

View 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

View File

@@ -1,6 +1,5 @@
#include <Sipeed_OV2640.h>
#include <Sipeed_ST7789.h>
#include <stdio.h>
SPIClass spi_(SPI0); // MUST be SPI0 for Maix series on board LCD
Sipeed_ST7789 lcd(320, 240, spi_);
@@ -10,11 +9,12 @@ Sipeed_OV2640 camera(FRAMESIZE_QVGA, PIXFORMAT_RGB565);
void setup()
{
Serial.begin(115200);
lcd.begin(15000000, COLOR_RED);
if(!camera.begin())
printf("camera init fail\n");
Serial.printf("camera init fail\n");
else
printf("camera init success\n");
Serial.printf("camera init success\n");
camera.run(true);
}
@@ -22,7 +22,7 @@ void loop()
{
uint8_t*img = camera.snapshot();
if(img == nullptr || img==0)
printf("snap fail\n");
Serial.printf("snap fail\n");
else
lcd.drawImage(0, 0, camera.width(), camera.height(), (uint16_t*)img);
}

View File

@@ -18,7 +18,7 @@ setFrameSize KEYWORD2
run KEYWORD2
id KEYWORD2
snapshot KEYWORD2
setRotaion KEYWORD2
setRotation KEYWORD2
setInvert KEYWORD2
#######################################

View File

@@ -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)
:Camera(frameSize, pixFormat),
_dataBuffer(NULL), _aiBuffer(NULL),
_resetPoliraty(ACTIVE_HIGH), _pwdnPoliraty(ACTIVE_HIGH),
_resetPolarity(ACTIVE_HIGH), _pwdnPolarity(ACTIVE_HIGH),
_slaveAddr(0x00),
_id(0)
{
@@ -611,7 +611,7 @@ _id(0)
Sipeed_OV2640::Sipeed_OV2640(uint16_t width, uint16_t height, pixformat_t pixFormat)
:Camera(width, height, pixFormat),
_dataBuffer(NULL), _aiBuffer(NULL),
_resetPoliraty(ACTIVE_HIGH), _pwdnPoliraty(ACTIVE_HIGH),
_resetPolarity(ACTIVE_HIGH), _pwdnPolarity(ACTIVE_HIGH),
_slaveAddr(0x00),
_id(0)
{
@@ -721,7 +721,7 @@ uint8_t* Sipeed_OV2640::snapshot()
return _dataBuffer;
}
void Sipeed_OV2640::setRotaion(uint8_t rotation)
void Sipeed_OV2640::setRotation(uint8_t rotation)
{
//FIXME
}
@@ -738,7 +738,7 @@ void Sipeed_OV2640::setInvert(bool invert)
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);
_freq = freq;
@@ -778,7 +778,7 @@ int Sipeed_OV2640::dvpInit(uint32_t freq)
if(0 == sensor_ov_detect()){//find ov sensor
// 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");
}
@@ -877,7 +877,7 @@ int Sipeed_OV2640::sensor_ov_detect()
if (_slaveAddr == 0) {
/* Sensor has been held in reset,
so the reset line is active low */
_resetPoliraty = ACTIVE_LOW;
_resetPolarity = ACTIVE_LOW;
/* Pull the sensor out of the reset state,systick_sleep() */
DCMI_RESET_HIGH();
@@ -886,14 +886,14 @@ int Sipeed_OV2640::sensor_ov_detect()
/* Probe again to set the slave addr */
_slaveAddr = cambus_scan();
if (_slaveAddr == 0) {
_pwdnPoliraty = ACTIVE_LOW;
_pwdnPolarity = ACTIVE_LOW;
DCMI_PWDN_HIGH();
msleep(10);
_slaveAddr = cambus_scan();
if (_slaveAddr == 0) {
_resetPoliraty = ACTIVE_HIGH;
_resetPolarity = ACTIVE_HIGH;
DCMI_RESET_LOW();
msleep(10);
@@ -947,7 +947,7 @@ int Sipeed_OV2640::sensor_ov_detect()
return 0;
}
int Sipeed_OV2640::sensro_gc_detect()
int Sipeed_OV2640::sensor_gc_detect()
{
DCMI_PWDN_HIGH();//enable gc0328 要恢复 normal 工作模式,需将 PWDN pin 接入低电平即可,同时写入初始化寄存器即可
DCMI_RESET_LOW();//reset gc3028
@@ -1488,6 +1488,38 @@ int Sipeed_OV2640::ov2640_set_vflip(int enable)
return ret;
}
int Sipeed_OV2640::ov2640_set_flip(bool horiz, bool vert)
{
uint8_t reg;
int ret = cambus_readb(_slaveAddr, BANK_SEL, &reg);
ret |= cambus_writeb(_slaveAddr, BANK_SEL, reg | BANK_SEL_SENSOR);
ret |= cambus_readb(_slaveAddr, REG04, &reg);
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)
{
if(NULL == addr)
@@ -1522,3 +1554,6 @@ int Sipeed_OV2640::sensor_snapshot( )
return 0;
}
int Sipeed_OV2640::flip( bool horiz, bool vert ) {
return ov2640_set_flip(horiz, vert);
}

View File

@@ -54,14 +54,16 @@ public:
virtual uint8_t* snapshot();
virtual uint16_t* getRGB565(){ return (uint16_t*)_dataBuffer; };
virtual uint8_t* getRGB888(){ return _aiBuffer; };
virtual void setRotaion(uint8_t rotation);
virtual void setRotation(uint8_t rotation);
virtual void setInvert(bool invert);
void flip(bool horiz, bool vert);
private:
uint8_t* _dataBuffer; // put RGB565 data
uint8_t* _aiBuffer; // put RGB888 data
uint8_t _resetPoliraty; // reset poliraty flag
uint8_t _pwdnPoliraty; // PWDN poliraty flag
uint8_t _resetPolarity; // reset polarity flag
uint8_t _pwdnPolarity; // PWDN polarity flag
uint8_t _slaveAddr; // camera address
uint8_t _id;
uint32_t _freq;
@@ -80,7 +82,7 @@ private:
int cambus_writew2(uint8_t slv_addr, uint16_t reg_addr, uint16_t reg_data);
int sensor_ov_detect();
int sensro_gc_detect();
int sensor_gc_detect();
int ov2640_reset();
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_set_hmirror(int enable);
int ov2640_set_vflip(int enable);
int ov2640_set_flip(bool horiz, bool vert);
int sensor_snapshot( );
int reverse_u32pixel(uint32_t* addr,uint32_t length);

View File

@@ -10,8 +10,10 @@ Ticker KEYWORD1
attach KEYWORD2
attach_ms KEYWORD2
attach_us KEYWORD2
once KEYWORD2
once_ms KEYWORD2
once_us KEYWORD2
detach KEYWORD2
#######################################

View File

@@ -25,6 +25,17 @@ Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callb
sysctl_enable_irq();
}
void
Ticker::_attach_us(uint32_t microseconds, bool repeat, callback_with_arg_t callback, size_t arg)
{
user_callback = callback;
_arg = arg;
timer_set_interval(timer_device_number_t(timer_id), TIMER_CHANNEL_0, microseconds * 1000);
timer_irq_register(timer_device_number_t(timer_id), TIMER_CHANNEL_0, !repeat, 4, timer_callback, this);
timer_set_enable(timer_device_number_t(timer_id), TIMER_CHANNEL_0, 1);
sysctl_enable_irq();
}
void
Ticker::detach()
{

View File

@@ -32,6 +32,11 @@ public:
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), 0);
}
void attach_us(uint32_t microseconds, callback_t callback)
{
_attach_us(microseconds, true, reinterpret_cast<callback_with_arg_t>(callback), 0);
}
template<typename TArg>
void attach(float seconds, void (*callback)(TArg), TArg arg)
{
@@ -48,6 +53,14 @@ public:
_attach_ms(milliseconds, true, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
template<typename TArg>
void attach_us(uint32_t microseconds, void (*callback)(TArg), TArg arg)
{
configASSERT(sizeof(TArg) <= sizeof(size_t));
size_t arg32 = (size_t)arg;
_attach_us(microseconds, true, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
void once(float seconds, callback_t callback)
{
_attach_ms(seconds * 1000, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
@@ -58,6 +71,11 @@ public:
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
}
void once_us(uint32_t microseconds, callback_t callback)
{
_attach_us(microseconds, false, reinterpret_cast<callback_with_arg_t>(callback), 0);
}
template<typename TArg>
void once(float seconds, void (*callback)(TArg), TArg arg)
{
@@ -74,6 +92,14 @@ public:
_attach_ms(milliseconds, false, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
template<typename TArg>
void once_us(uint32_t microseconds, void (*callback)(TArg), TArg arg)
{
configASSERT(sizeof(TArg) <= sizeof(size_t));
size_t arg32 = (size_t)(arg);
_attach_us(microseconds, false, reinterpret_cast<callback_with_arg_t>(callback), arg32);
}
void detach();
bool active();
@@ -82,6 +108,7 @@ public:
protected:
void _attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, size_t arg);
void _attach_us(uint32_t microseconds, bool repeat, callback_with_arg_t callback, size_t arg);
private:
timer_id_t timer_id;

View File

@@ -9,6 +9,9 @@ static int maix_i2c_slave_irq(void *userdata);
TwoWire::TwoWire(i2c_device_number_t i2c_device)
{
i2c_tx_buff = 0;
i2c_rx_buff = 0;
_i2c_num = i2c_device;
switch(i2c_device)
{
@@ -38,44 +41,27 @@ TwoWire::~TwoWire()
void
TwoWire::begin(uint8_t sda, uint8_t scl, uint32_t frequency)
{
i2c_clk = frequency;
fpioa_set_function(sda, sda_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_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));
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;
volatile i2c_t *i2c_adapter = i2c[_i2c_num];
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->dma_cr = 0x3;
i2c_adapter->dma_rdlr = 0;
i2c_adapter->dma_tdlr = 4;
i2c_adapter->enable = I2C_ENABLE_ENABLE;
is_master_mode = true;
delete i2c_tx_buff;
delete i2c_rx_buff;
i2c_tx_buff = new RingBuffer();
i2c_rx_buff = new RingBuffer();
setClock(frequency);
}
void
@@ -83,12 +69,11 @@ TwoWire::begin(uint16_t slave_address, uint8_t sda, uint8_t scl)
{
fpioa_set_function(sda, sda_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_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->con = I2C_CON_SPEED(1) | I2C_CON_STOP_DET_IFADDRESSED;
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->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_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));
i2c_adapter->enable = I2C_ENABLE_ENABLE;
is_master_mode = false;
delete i2c_tx_buff;
delete i2c_rx_buff;
i2c_tx_buff = new RingBuffer();
i2c_rx_buff = new RingBuffer();
}
i2c_adapter->enable = I2C_ENABLE_ENABLE;
}
void
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_lcnt = I2C_SS_SCL_LCNT_COUNT(v_period_clk_cnt);
i2c_adapter->enable = I2C_ENABLE_ENABLE;
}
uint32_t
@@ -236,6 +223,9 @@ TwoWire::readTransmission(uint16_t address, uint8_t* receive_buf, size_t receive
void
TwoWire::beginTransmission(uint16_t address)
{
// Clear buffers when new transation/packet starts
flush();
transmitting = 1;
txAddress = address;
}
@@ -263,24 +253,28 @@ TwoWire::endTransmission(bool sendStop) //结束时从rxbuff发送数据
uint8_t
TwoWire::requestFrom(uint16_t address, uint8_t size, bool sendStop) //请求数据存入rxbuff供read读
{
// Clear buffers when new transation/packet starts
flush();
int state,index = 0;
uint8_t rx_data[RING_BUFFER_SIZE];
state = readTransmission(address, rx_data, size, sendStop);
if(0 == state){
while(size)
while(index < size)
{
i2c_rx_buff->store_char(rx_data[index++]);
size--;
}
return size;
}
return i2c_rx_buff->available();
return 0;
}
size_t
TwoWire::write(uint8_t data) //写到txbuff
{
if(transmitting) {
if(transmitting && !i2c_tx_buff->isFull()) {
i2c_tx_buff->store_char(data);
return 1;
}
return 0;
}
@@ -288,7 +282,7 @@ TwoWire::write(uint8_t data) //写到txbuff
size_t
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])) {
return i;
}

View File

@@ -24,7 +24,7 @@ public:
TwoWire(i2c_device_number_t i2c_device);
~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 setClock(uint32_t frequency);

View File

@@ -1,6 +1,6 @@
{
"name": "framework-maixduino",
"description": "Arduino Wiring-based Framework (K210 Core)",
"version": "0.3.9",
"version": "0.3.11",
"url": "https://github.com/sipeed/Maixduino"
}

View File

@@ -1,9 +1,9 @@
name = Maixduino
version = 0.3.9
name=Maixduino
version=0.3.11
# arch
arch = k210
arch_for_c_cpp = K210
arch=k210
arch_for_c_cpp=K210
# Compile variables
compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/

View 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

View 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

View 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

View 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

View 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

View File

@@ -18,45 +18,58 @@ extern class UARTClass Serial3;
#endif
/* 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 */
#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 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
// #define IO_15 15
// #define IO_17 17
/* I2S MIC */
#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
// #define IO_21 21
// #define IO_22 22
// #define IO_23 23
// #define IO_24 24
// #define IO_25 25
/* SPI0 */
#define SPI0_CS1 25
#define SPI0_MISO 26
#define SPI0_SCLK 27
#define SPI0_MOSI 28
#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 */
#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)
@@ -70,8 +83,7 @@ typedef struct _pwm_fpio_set_t{
pwm_channel_number_t channel;
pwm_device_number_t device;
uint8_t inuse;
}pwm_fpio_set_t;
} pwm_fpio_set_t;
#define VARIANT_NUM_GPIOHS (32)

View File

@@ -0,0 +1,94 @@
#ifndef _VARIANT_SIPEED_MAIX_BIT_MIC
#define _VARIANT_SIPEED_MAIX_BIT_MIC
#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
/* UART */
#define RX1 6
#define TX1 7
#define IO_8 8
#define IO_9 9
#define IO_10 10
/* 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
// #define IO_15 15
// #define IO_17 17
/* I2S MIC */
#define MIC_BCK 18
#define MIC_WS 19
#define MIC_DAT3 20
// #define IO_21 21
// #define IO_22 22
// #define IO_23 23
// #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
// #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 */
#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

View 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

View File

@@ -1,5 +1,5 @@
#ifndef _VARIANT_BOARD_SIPEED_MAIX_GO
#define _VARIANT_BOARD_SIPEED_MAIX_GO
#ifndef _VARIANT_SIPEED_MAIX_GO
#define _VARIANT_SIPEED_MAIX_GO
#include <stdint.h>
@@ -18,21 +18,37 @@ extern class UARTClass Serial3;
#endif
/* 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 */
#define PIN_LED_GREEN 13
#define PIN_LED_BLUE 12
#define PIN_LED_GREEN 13
#define PIN_LED_RED 14
#define PIN_LED 13
#define LED_BUILTIN 13
#define LED_RED 14
#define LED_GREEN 13
#define LED_BLUE 12
#define LED_RED 14
#define LED_BUILTIN 13
/* KEY */
#define KEY0 15
#define PIN_KEY_DOWN 16
#define KEY1 15
#define KEY0 16
#define KEY2 17
#define PIN_KEY_DOWN 15
#define PIN_KEY_PRESS 16
#define PIN_KEY_UP 17
#define PIN_KEY_PRESS 15
/* MIC ARRAY */
/* I2S MIC MSM261S4030H0 */
#define MIC_BCK 18
#define MIC_WS 19
#define MIC_DAT3 20
@@ -40,13 +56,17 @@ extern class UARTClass Serial3;
#define MIC_DAT1 22
#define MIC_DAT0 23
#define MIC_LED_DAT 24
/* SPI0 */
#define SPI0_CS1 25
#define MIC_LED_CLK 25
/* SPI0 TF */
#define SPI0_MISO 26
#define SPI0_SCLK 27
#define SPI0_MOSI 28
#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_DA 34
#define I2S_BCK 35
@@ -56,14 +76,6 @@ extern class UARTClass Serial3;
#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)
@@ -77,8 +89,7 @@ typedef struct _pwm_fpio_set_t{
pwm_channel_number_t channel;
pwm_device_number_t device;
uint8_t inuse;
}pwm_fpio_set_t;
} pwm_fpio_set_t;
#define VARIANT_NUM_GPIOHS (32)

View File

@@ -1,5 +1,5 @@
#ifndef _VARIANT_SIPEED_M1_DOCK
#define _VARIANT_SIPEED_M1_DOCK
#ifndef _VARIANT_SIPEED_MAIX_ONE_DOCK
#define _VARIANT_SIPEED_MAIX_ONE_DOCK
#include <stdint.h>
@@ -18,17 +18,23 @@ 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_GREEN 13
#define PIN_LED_BLUE 12
#define PIN_LED_RED 14
#define PIN_LED 13
#define LED_BUILTIN 13
#define LED_RED 14
#define LED_GREEN 13
#define LED_BLUE 12
#define LED_RED 14
#define LED_BUILTIN 13
/* KEY */
#define KEY0 16
//#define KEY0 16
/* MIC ARRAY */
#define MIC_BCK 18
#define MIC_WS 19
@@ -56,14 +62,6 @@ extern class UARTClass Serial3;
#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)

View 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

View File

@@ -18,47 +18,48 @@ extern class UARTClass Serial3;
#endif
/* BOARD PIN DEFINE */
/* LEDs */
#define PIN_LED 13
#define LED_BUILTIN 13
#define RX0 0
#define TX0 1
/* 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 */
#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
//#define KEY0 16
/* ONBOARD ESP32 */
#define ESP_TX 6
#define ESP_RX 7
#define ESP_EN 8
#define ESP_READY 9
#define ESP_SPI_CS 25
/* 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 MIC_BCK 18
#define MIC_WS 19
#define MIC_DATA 20
/* I2C1 */
#define SCL 30
#define SDA 31
/* DAC PT8211 */
#define I2S_WS 33
#define I2S_DA 34
#define I2S_BCK 35
/* LCD */
#define LCD_BL 17
#define LCD_CS 36
#define LCD_RST 37
#define LCD_DC 38
#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 MOSI = SPI0_MOSI;
@@ -71,7 +72,7 @@ typedef struct _pwm_fpio_set_t{
uint8_t inuse;
}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};