Skip to content

Instantly share code, notes, and snippets.

@narioinc
Forked from janjongboom/jerryscript.patch
Created January 12, 2018 14:14
Show Gist options
  • Save narioinc/85e08327f32952ed992431f8d4860353 to your computer and use it in GitHub Desktop.
Save narioinc/85e08327f32952ed992431f8d4860353 to your computer and use it in GitHub Desktop.
RTL8195AM w/ Mbed.js
diff --git a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
index 7edae943..bb361542 100644
--- a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
+++ b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-drivers/source/DigitalOut-js.cpp
@@ -92,31 +92,6 @@ DECLARE_CLASS_FUNCTION(DigitalOut, read) {
return jerry_create_number(result);
}
-/**
- * DigitalOut#is_connected (native JavaScript method)
- *
- * @returns 0 if the DigitalOut is set to NC, or 1 if it is connected to an
- * actual pin
- */
-DECLARE_CLASS_FUNCTION(DigitalOut, is_connected) {
- CHECK_ARGUMENT_COUNT(DigitalOut, is_connected, (args_count == 0));
-
- // Extract native DigitalOut pointer
- void* void_ptr;
- const jerry_object_native_info_t* type_ptr;
- bool has_ptr = jerry_get_object_native_pointer(this_obj, &void_ptr, &type_ptr);
-
- if (!has_ptr || type_ptr != &native_obj_type_info) {
- return jerry_create_error(JERRY_ERROR_TYPE,
- (const jerry_char_t *) "Failed to get native DigitalOut pointer");
- }
-
- DigitalOut* native_ptr = static_cast<DigitalOut*>(void_ptr);
-
- int result = native_ptr->is_connected();
- return jerry_create_number(result);
-}
-
/**
* DigitalOut (native JavaScript constructor)
*
@@ -152,7 +127,6 @@ DECLARE_CLASS_CONSTRUCTOR(DigitalOut) {
// attach methods
ATTACH_CLASS_FUNCTION(js_object, DigitalOut, write);
ATTACH_CLASS_FUNCTION(js_object, DigitalOut, read);
- ATTACH_CLASS_FUNCTION(js_object, DigitalOut, is_connected);
return js_object;
}
diff --git a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/PinNames.h b/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/PinNames.h
index 525b7cd0e..6558f01a0 100644
--- a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/PinNames.h
+++ b/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/PinNames.h
@@ -52,124 +52,124 @@ typedef enum {
typedef enum {
- PA_0 = (PORT_A<<4|0),
- PA_1 = (PORT_A<<4|1),
- PA_2 = (PORT_A<<4|2),
- PA_3 = (PORT_A<<4|3),
- PA_4 = (PORT_A<<4|4),
- PA_5 = (PORT_A<<4|5),
- PA_6 = (PORT_A<<4|6),
- PA_7 = (PORT_A<<4|7),
-
- PB_0 = (PORT_B<<4|0),
- PB_1 = (PORT_B<<4|1),
- PB_2 = (PORT_B<<4|2),
- PB_3 = (PORT_B<<4|3),
- PB_4 = (PORT_B<<4|4),
- PB_5 = (PORT_B<<4|5),
- PB_6 = (PORT_B<<4|6),
- PB_7 = (PORT_B<<4|7),
-
- PC_0 = (PORT_C<<4|0),
- PC_1 = (PORT_C<<4|1),
- PC_2 = (PORT_C<<4|2),
- PC_3 = (PORT_C<<4|3),
- PC_4 = (PORT_C<<4|4),
- PC_5 = (PORT_C<<4|5),
- PC_6 = (PORT_C<<4|6),
- PC_7 = (PORT_C<<4|7),
- PC_8 = (PORT_C<<4|8),
- PC_9 = (PORT_C<<4|9),
-
- PD_0 = (PORT_D<<4|0),
- PD_1 = (PORT_D<<4|1),
- PD_2 = (PORT_D<<4|2),
- PD_3 = (PORT_D<<4|3),
- PD_4 = (PORT_D<<4|4),
- PD_5 = (PORT_D<<4|5),
- PD_6 = (PORT_D<<4|6),
- PD_7 = (PORT_D<<4|7),
- PD_8 = (PORT_D<<4|8),
- PD_9 = (PORT_D<<4|9),
-
- PE_0 = (PORT_E<<4|0),
- PE_1 = (PORT_E<<4|1),
- PE_2 = (PORT_E<<4|2),
- PE_3 = (PORT_E<<4|3),
- PE_4 = (PORT_E<<4|4),
- PE_5 = (PORT_E<<4|5),
- PE_6 = (PORT_E<<4|6),
- PE_7 = (PORT_E<<4|7),
- PE_8 = (PORT_E<<4|8),
- PE_9 = (PORT_E<<4|9),
- PE_A = (PORT_E<<4|10),
-
- PF_0 = (PORT_F<<4|0),
- PF_1 = (PORT_F<<4|1),
- PF_2 = (PORT_F<<4|2),
- PF_3 = (PORT_F<<4|3),
- PF_4 = (PORT_F<<4|4),
- PF_5 = (PORT_F<<4|5),
+ PA_0 = (0<<4|0),
+ PA_1 = (0<<4|1),
+ PA_2 = (0<<4|2),
+ PA_3 = (0<<4|3),
+ PA_4 = (0<<4|4),
+ PA_5 = (0<<4|5),
+ PA_6 = (0<<4|6),
+ PA_7 = (0<<4|7),
+
+ PB_0 = (1<<4|0),
+ PB_1 = (1<<4|1),
+ PB_2 = (1<<4|2),
+ PB_3 = (1<<4|3),
+ PB_4 = (1<<4|4),
+ PB_5 = (1<<4|5),
+ PB_6 = (1<<4|6),
+ PB_7 = (1<<4|7),
+
+ PC_0 = (2<<4|0),
+ PC_1 = (2<<4|1),
+ PC_2 = (2<<4|2),
+ PC_3 = (2<<4|3),
+ PC_4 = (2<<4|4),
+ PC_5 = (2<<4|5),
+ PC_6 = (2<<4|6),
+ PC_7 = (2<<4|7),
+ PC_8 = (2<<4|8),
+ PC_9 = (2<<4|9),
+
+ PD_0 = (3<<4|0),
+ PD_1 = (3<<4|1),
+ PD_2 = (3<<4|2),
+ PD_3 = (3<<4|3),
+ PD_4 = (3<<4|4),
+ PD_5 = (3<<4|5),
+ PD_6 = (3<<4|6),
+ PD_7 = (3<<4|7),
+ PD_8 = (3<<4|8),
+ PD_9 = (3<<4|9),
+
+ PE_0 = (4<<4|0),
+ PE_1 = (4<<4|1),
+ PE_2 = (4<<4|2),
+ PE_3 = (4<<4|3),
+ PE_4 = (4<<4|4),
+ PE_5 = (4<<4|5),
+ PE_6 = (4<<4|6),
+ PE_7 = (4<<4|7),
+ PE_8 = (4<<4|8),
+ PE_9 = (4<<4|9),
+ PE_A = (4<<4|10),
+
+ PF_0 = (5<<4|0),
+ PF_1 = (5<<4|1),
+ PF_2 = (5<<4|2),
+ PF_3 = (5<<4|3),
+ PF_4 = (5<<4|4),
+ PF_5 = (5<<4|5),
/* unavailable pins */
-// PF_6 = (PORT_F<<4|6),
-// PF_7 = (PORT_F<<4|7),
-
- PG_0 = (PORT_G<<4|0),
- PG_1 = (PORT_G<<4|1),
- PG_2 = (PORT_G<<4|2),
- PG_3 = (PORT_G<<4|3),
- PG_4 = (PORT_G<<4|4),
- PG_5 = (PORT_G<<4|5),
- PG_6 = (PORT_G<<4|6),
- PG_7 = (PORT_G<<4|7),
-
- PH_0 = (PORT_H<<4|0),
- PH_1 = (PORT_H<<4|1),
- PH_2 = (PORT_H<<4|2),
- PH_3 = (PORT_H<<4|3),
- PH_4 = (PORT_H<<4|4),
- PH_5 = (PORT_H<<4|5),
- PH_6 = (PORT_H<<4|6),
- PH_7 = (PORT_H<<4|7),
-
- PI_0 = (PORT_I<<4|0),
- PI_1 = (PORT_I<<4|1),
- PI_2 = (PORT_I<<4|2),
- PI_3 = (PORT_I<<4|3),
- PI_4 = (PORT_I<<4|4),
- PI_5 = (PORT_I<<4|5),
- PI_6 = (PORT_I<<4|6),
- PI_7 = (PORT_I<<4|7),
-
- PJ_0 = (PORT_J<<4|0),
- PJ_1 = (PORT_J<<4|1),
- PJ_2 = (PORT_J<<4|2),
- PJ_3 = (PORT_J<<4|3),
- PJ_4 = (PORT_J<<4|4),
- PJ_5 = (PORT_J<<4|5),
- PJ_6 = (PORT_J<<4|6),
+// PF_6 = (5<<4|6),
+// PF_7 = (5<<4|7),
+
+ PG_0 = (6<<4|0),
+ PG_1 = (6<<4|1),
+ PG_2 = (6<<4|2),
+ PG_3 = (6<<4|3),
+ PG_4 = (6<<4|4),
+ PG_5 = (6<<4|5),
+ PG_6 = (6<<4|6),
+ PG_7 = (6<<4|7),
+
+ PH_0 = (7<<4|0),
+ PH_1 = (7<<4|1),
+ PH_2 = (7<<4|2),
+ PH_3 = (7<<4|3),
+ PH_4 = (7<<4|4),
+ PH_5 = (7<<4|5),
+ PH_6 = (7<<4|6),
+ PH_7 = (7<<4|7),
+
+ PI_0 = (8<<4|0),
+ PI_1 = (8<<4|1),
+ PI_2 = (8<<4|2),
+ PI_3 = (8<<4|3),
+ PI_4 = (8<<4|4),
+ PI_5 = (8<<4|5),
+ PI_6 = (8<<4|6),
+ PI_7 = (8<<4|7),
+
+ PJ_0 = (9<<4|0),
+ PJ_1 = (9<<4|1),
+ PJ_2 = (9<<4|2),
+ PJ_3 = (9<<4|3),
+ PJ_4 = (9<<4|4),
+ PJ_5 = (9<<4|5),
+ PJ_6 = (9<<4|6),
/* unavailable pins */
-// PJ_7 = (PORT_J<<4|7),
-
- PK_0 = (PORT_K<<4|0),
- PK_1 = (PORT_K<<4|1),
- PK_2 = (PORT_K<<4|2),
- PK_3 = (PORT_K<<4|3),
- PK_4 = (PORT_K<<4|4),
- PK_5 = (PORT_K<<4|5),
- PK_6 = (PORT_K<<4|6),
+// PJ_7 = (9<<4|7),
+
+ PK_0 = (10<<4|0),
+ PK_1 = (10<<4|1),
+ PK_2 = (10<<4|2),
+ PK_3 = (10<<4|3),
+ PK_4 = (10<<4|4),
+ PK_5 = (10<<4|5),
+ PK_6 = (10<<4|6),
/* unavailable pins */
- // PK_7 = (PORT_K<<4|7),
+ // PK_7 = (10<<4|7),
- AD_1 = (PORT_V<<4|1),
- AD_2 = (PORT_V<<4|2),
- AD_3 = (PORT_V<<4|3),
+ AD_1 = (11<<4|1),
+ AD_2 = (11<<4|2),
+ AD_3 = (11<<4|3),
- DA_0 = (PORT_U<<4|0),
- DA_1 = (PORT_U<<4|1),
+ DA_0 = (12<<4|0),
+ DA_1 = (12<<4|1),
// Not connected
- NC = (uint32_t)0xFFFFFFFF,
+ NC = 0xFFFFFFFF,
// Generic signals namings
/* LED1~4 are defined as alias of GPIO pins, they are not the LEDs on board*/
@@ -236,3 +236,4 @@ typedef enum {
#endif
#endif
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment