Skip to content

Commit 32a0f31

Browse files
committed
Add README
Signed-off-by: Bigbits <[email protected]>
1 parent 418dd7b commit 32a0f31

File tree

5 files changed

+51
-26
lines changed

5 files changed

+51
-26
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1-
# Kenduino-core
2-
k210 arduino core
1+
# Arduino Core for Kendryte K210
2+
----
3+
## Windows
4+
### 1.首选项添加下列地址 然后打开开发版管理器下载开发包
5+
>https://bigbits.oss-cn-qingdao.aliyuncs.com/Arduino_for_k210/package_k210_index.json
6+
### 2.安装好之后添加工具链目录到PATH环境变量
7+
>C:\Users\\**(username)**\AppData\Local\Arduino15\packages\Kenduino\tools\riscv64-unknown-elf-gcc\8.2.0\bin
8+
### 3.安装[.Net core runtime](https://download.visualstudio.microsoft.com/download/pr/3f05ee2d-5372-43d6-9562-be86632a53d4/1361281426efa7ff206289adb0411f55/dotnet-runtime-3.0.0-preview3-27503-5-win-x64.exe)
9+
### 4.开发板选择Sipeed M1 Board 编程器选 k-flash
10+
### 5.连接开发板选对应的串口号
11+
### 6.编写程序 编译 上传 完成
12+
----
13+
## Ubuntu
14+
### 1.首选项添加下列地址 然后打开开发版管理器下载开发包
15+
>https://bigbits.oss-cn-qingdao.aliyuncs.com/Arduino_for_k210/package_k210_index.json
16+
### 2.需要解决usb串口访问权限
17+
>sudo usermode -a -G dialout **(username)**
18+
### 3.安装pyserial
19+
>pip3 install pyserial
20+
### 4.开发板选择Sipeed M1 Board 编程器选 k-flash
21+
### 5.连接开发板选对应的串口号
22+
### 6.编写程序 编译 上传 完成

cores/arduino/WCharacter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <ctype.h>
2424
#include "wiring_constants.h"
25+
#include "wiring_digital.h"
2526

2627
#ifdef __cplusplus
2728
extern "C"{

cores/arduino/WInterrupts.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,34 @@
66
void attachInterrupt(uint8_t intnum, voidFuncPtr callback, uint8_t mode)
77
{
88
plic_irq_callback_t _callback = (plic_irq_callback_t)callback;
9-
switch(mode){
10-
case LOW :
11-
gpiohs_set_pin_edge(intnum, GPIO_PE_LOW);
12-
break;
13-
case HIGH :
14-
gpiohs_set_pin_edge(intnum, GPIO_PE_HIGH);
15-
break;
16-
case FALLING :
17-
gpiohs_set_pin_edge(intnum, GPIO_PE_FALLING);
18-
break;
19-
case CHANGE :
20-
gpiohs_set_pin_edge(intnum, GPIO_PE_BOTH);
21-
break;
22-
case RISING :
23-
gpiohs_set_pin_edge(intnum, GPIO_PE_RISING);
24-
break;
9+
int gpionum = getGpio(intnum);
10+
if(gpionum >= 0){
11+
switch(mode){
12+
case LOW :
13+
gpiohs_set_pin_edge((uint8_t)gpionum, GPIO_PE_LOW);
14+
break;
15+
case HIGH :
16+
gpiohs_set_pin_edge((uint8_t)gpionum, GPIO_PE_HIGH);
17+
break;
18+
case FALLING :
19+
gpiohs_set_pin_edge((uint8_t)gpionum, GPIO_PE_FALLING);
20+
break;
21+
case CHANGE :
22+
gpiohs_set_pin_edge((uint8_t)gpionum, GPIO_PE_BOTH);
23+
break;
24+
case RISING :
25+
gpiohs_set_pin_edge((uint8_t)gpionum, GPIO_PE_RISING);
26+
break;
27+
}
28+
gpiohs_irq_register((uint8_t)gpionum, 10, _callback, NULL);
29+
sysctl_enable_irq();
2530
}
26-
gpiohs_irq_register(intnum, 1, _callback, NULL);
27-
sysctl_enable_irq();
28-
2931
}
3032

3133
void detachInterrupt(uint8_t intnum)
3234
{
33-
gpiohs_irq_unregister(intnum);
34-
35-
}
35+
int gpionum = getGpio(intnum);
36+
if(gpionum >= 0){
37+
gpiohs_irq_unregister((uint8_t)gpionum);
38+
}
39+
}

cores/arduino/WInterrupts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C"{
3535
#define DEFAULT 1
3636
#define EXTERNAL 0
3737

38-
#define digitalPinToInterrupt(P)
38+
#define digitalPinToInterrupt(Pin) Pin;
3939
typedef void (*voidFuncPtr)(void);
4040
/*
4141
* \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. Use digitalPinToInterrupt(pin) to get the correct intnum.

cores/arduino/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
#define cmb() __asm__ __volatile__ ("" ::: "memory")
8-
8+
extern "C"{ void * __dso_handle = 0 ;}
99

1010
/*
1111
* \brief Main entry point of Arduino application

0 commit comments

Comments
 (0)