mirror of
https://github.com/sipeed/Maixduino.git
synced 2026-03-23 18:36:57 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18164baf25 | ||
|
|
656abee8aa | ||
|
|
240bb27d0b | ||
|
|
b47d512182 | ||
|
|
ba0fd67e4e | ||
|
|
98756e8832 | ||
|
|
e75526f51f | ||
|
|
363b2bade7 | ||
|
|
b6da4a0466 | ||
|
|
25d62719d4 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -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
|
||||
|
||||
52
boards.txt
52
boards.txt
@@ -98,6 +98,52 @@ bit.upload.maximum_size=8388608
|
||||
bit.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
||||
|
||||
|
||||
##################################################
|
||||
############# Sipeed Maix Bit with Mic Board ###############
|
||||
|
||||
bitm.name=Sipeed Maix Bit-Mic Board
|
||||
|
||||
## Toolchain
|
||||
bitm.menu.toolsloc.default=Default
|
||||
bitm.menu.toolsloc.default.compiler.path={runtime.tools.riscv64-unknown-elf-gcc.path}/bin/
|
||||
|
||||
## CPU Clock
|
||||
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
|
||||
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
|
||||
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
|
||||
bitm.build.variant=sipeed_maix_bit_mic
|
||||
|
||||
## "The 'core' file directory for this board, in ./cores
|
||||
bitm.build.core=arduino
|
||||
|
||||
## This sets a define for use in the compiled code.
|
||||
bitm.build.board=BOARD_SIPEED_MAIX_BIT
|
||||
bitm.build.sdata.size=512
|
||||
|
||||
## This selects the tool from "programmers.txt"
|
||||
bitm.upload.tool=kflash
|
||||
|
||||
## Limit is the 16MB Flash. Assume half is used for something else.
|
||||
bitm.upload.maximum_size=8388608
|
||||
bitm.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
||||
|
||||
|
||||
|
||||
####################################################
|
||||
############### Sipeed Maix Go Board ###############
|
||||
|
||||
@@ -171,8 +217,8 @@ 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.dan=Default
|
||||
mduino.menu.burn_tool_firmware.dan.build.burn_tool_firmware=goE
|
||||
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
|
||||
@@ -190,4 +236,4 @@ 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
|
||||
mduino.build.ldscript={runtime.platform.path}/cores/arduino/kendryte-standalone-sdk/lds/kendryte.ld
|
||||
|
||||
Submodule cores/arduino/kendryte-standalone-sdk updated: 9add324a05...1d52a1aaa0
@@ -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
|
||||
@@ -249,8 +252,18 @@ uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
|
||||
uint32_t arg;
|
||||
|
||||
// set pin modes
|
||||
pinMode(chipSelectPin_, OUTPUT);
|
||||
digitalWrite(chipSelectPin_, HIGH);
|
||||
//#ifdef BOARD_SIPEED_MAIXDUINO
|
||||
int gpionum = get_gpio(chipSelectPin_);
|
||||
if(gpionum >= 0){
|
||||
fpioa_function_t function = fpioa_function_t(FUNC_GPIOHS0 + gpionum);
|
||||
fpioa_set_function(chipSelectPin_, function);
|
||||
gpiohs_set_drive_mode((uint8_t)gpionum, GPIO_DM_OUTPUT);
|
||||
gpiohs_set_pin((uint8_t)gpionum, GPIO_PV_HIGH);
|
||||
}
|
||||
//#else
|
||||
// pinMode(chipSelectPin_, OUTPUT);
|
||||
// digitalWrite(chipSelectPin_, HIGH);
|
||||
//#endif
|
||||
#ifndef USE_SPI_LIB
|
||||
pinMode(SPI_MISO_PIN, INPUT);
|
||||
pinMode(SPI_MOSI_PIN, OUTPUT);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ Ticker KEYWORD1
|
||||
|
||||
attach KEYWORD2
|
||||
attach_ms KEYWORD2
|
||||
attach_us KEYWORD2
|
||||
once KEYWORD2
|
||||
once_ms KEYWORD2
|
||||
once_us KEYWORD2
|
||||
detach KEYWORD2
|
||||
|
||||
#######################################
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Submodule libraries/lv_arduino deleted from 3a1df1b16b
1
libraries/lv_maixduino
Submodule
1
libraries/lv_maixduino
Submodule
Submodule libraries/lv_maixduino added at 6bcae290e5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "framework-maixduino",
|
||||
"description": "Arduino Wiring-based Framework (K210 Core)",
|
||||
"version": "0.3.9",
|
||||
"version": "0.3.10",
|
||||
"url": "https://github.com/sipeed/Maixduino"
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
name = Maixduino
|
||||
version = 0.3.9
|
||||
name=Maixduino
|
||||
version=0.3.10
|
||||
|
||||
# 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/
|
||||
|
||||
84
variants/sipeed_maix_bit_mic/pins_arduino.h
Normal file
84
variants/sipeed_maix_bit_mic/pins_arduino.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#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 */
|
||||
/* 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
|
||||
/* 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
|
||||
Reference in New Issue
Block a user