Skip to content

Commit 6b01ad0

Browse files
committed
[rtt] Re-enable Arduino "loop()" function
- Increase default RTT heap size from 12KB to 20KB - Add a default thread named "Arduino" (4KB stack size by default) which initialize higher level devices and runs Arduino "loop()" function - Increase default FinSH stack size from 2KB to 4KB - Rename user defined RTT setup function from "rt_application_init()" to "rt_setup()" [drv] Add SPI and SD device drivers - SPI device driver requires Arduino SPI library - Enable SD device driver (using SPI1 and ChaN's FatFs) by default for MKR Zero board (SAMD) - Add FatFs related FinSH commands - exFAT support may be enabled by macro "RT_DFS_ELM_USE_EXFAT"
1 parent dc1a35e commit 6b01ad0

File tree

11 files changed

+1716
-52
lines changed

11 files changed

+1716
-52
lines changed

examples/Blink/Blink.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void blink_thread_entry(void* parameter) {
1717
}
1818

1919
// RT-Thread function called by "RT_T.begin()"
20-
void rt_application_init(void) {
20+
void rt_setup(void) {
2121
// statically initialize user thread
2222
if (RT_EOK != rt_thread_init(
2323
&blink_thread, // [in/out] thread descriptor
@@ -40,7 +40,7 @@ void setup() {
4040
RT_T.begin();
4141
}
4242

43-
// this function is not called
43+
// this function will be called by "Arduino" thread
4444
void loop() {
45-
// no code should be here
45+
// may put some code here that will be run repeatedly
4646
}

examples/FinSH/FinSH.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// ADD_SHELL_VAR(id, LED ID, led_id, finsh_type_uint)
88
// ADD_SHELL_VAR(state, LED state, led_state, finsh_type_uchar)
99

10-
// After upload, send the following command through "Serial Monitor" to see the result.
10+
// After upload, send the following command through "Serial Monitor" and check the result.
1111
// led(0, 1)
1212
// led(0, 0)
1313
// led(id, state)
@@ -40,7 +40,7 @@ void setup() {
4040
RT_T.begin();
4141
}
4242

43-
// this function is not called
43+
// this function will be called by "Arduino" thread
4444
void loop() {
45-
// no code should be here
45+
// may put some code here that will be run repeatedly
4646
}

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name=RT-Thread
2-
version=0.2.2
3-
author=Bernard Xiong <[email protected]>
2+
version=0.3.0
3+
author=Bernard Xiong <[email protected]>, onelife <[email protected]>
44
maintainer=onelife <[email protected]>
55
sentence=Real Time Operating System porting for Arduino SAM and SAMD boards
66
paragraph=RT-Thread is an open source IoT operating system from China, which has strong scalability: from a tiny kernel running on a tiny core, for example ARM Cortex-M0, or Cortex-M3/4/7, to a rich feature system running on MIPS32, ARM Cortex-A8, ARM Cortex-A9 DualCore etc.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/***************************************************************************//**
2+
* @file drv_common.h
3+
* @brief Arduino RT-Thread library device driver common header
4+
* @author onelife <onelife.real[at]gmail.com>
5+
******************************************************************************/
6+
#ifndef __DRV_COMMON_H__
7+
#define __DRV_COMMON_H__
8+
9+
/* Includes ------------------------------------------------------------------*/
10+
/* Exported defines ----------------------------------------------------------*/
11+
#define RT_DEVICE_CTRL_SPI_SPEED (0xF1)
12+
13+
/* Exported types ------------------------------------------------------------*/
14+
/* Exported constants --------------------------------------------------------*/
15+
/* Exported functions ------------------------------------------------------- */
16+
17+
#endif /* __DRV_COMMON_H__ */

0 commit comments

Comments
 (0)