@educabot/educablocks-boards 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@educabot/educablocks-boards",
3
- "version": "0.1.0",
4
- "description": "",
3
+ "version": "0.2.0",
4
+ "description": "educabot boards library",
5
5
  "main": "dist/index.js",
6
6
  "types": "index.ts",
7
7
  "scripts": {
@@ -6,7 +6,9 @@ import {
6
6
  BHOOT,
7
7
  ARDUINO_NANO,
8
8
  ARDUINO_MICRO,
9
- ARDUINO_LEONARDO
9
+ ARDUINO_LEONARDO,
10
+ MICROBIT,
11
+ MICROBIT2
10
12
  } from '../pins'
11
13
 
12
14
  export const boards: Board[] = [
@@ -140,7 +142,32 @@ export const boards: Board[] = [
140
142
  premium: 0,
141
143
  toolboxLayout: 'vertical',
142
144
  elementType: BOARD_ITEM_TYPE.BOARD,
143
- pins: {},
145
+ pins: MICROBIT,
146
+ },
147
+ {
148
+ id: 38,
149
+ type: 'senior',
150
+ image: 'microbit.png',
151
+ class: 'microbit',
152
+ name: 'micro:bit 2',
153
+ groupName: 'micro:bit 2',
154
+ company: 'Microsoft',
155
+ htmlValue: '',
156
+ compilerBoard: 'microbit',
157
+ agentCommandLine: '',
158
+ agentSignature: '',
159
+ use1200bpsTouch: false,
160
+ fileExtension: 'hex',
161
+ profile: 'microbitFull2',
162
+ lang: 'JavaScript',
163
+ show: 1,
164
+ showOnAula: 1,
165
+ enabled: 1,
166
+ enabledForCode: 0,
167
+ premium: 0,
168
+ toolboxLayout: 'vertical',
169
+ elementType: BOARD_ITEM_TYPE.BOARD,
170
+ pins: MICROBIT2,
144
171
  },
145
172
  {
146
173
  id: 5,
package/src/pins.ts CHANGED
@@ -3,10 +3,11 @@ export type PinSet = Array<Array<string>>
3
3
 
4
4
  export type Pin = {
5
5
  digital: PinSet
6
- analog: PinSet,
7
- pwm: PinSet
8
- i2c: PinSet,
6
+ analog?: PinSet,
7
+ pwm?: PinSet
8
+ i2c?: PinSet,
9
9
  motorPwm?: PinSet
10
+ motorDC?: PinSet
10
11
  keyboard?: PinSet
11
12
  ultrasonic?: PinSet
12
13
  digitalServo?: PinSet
@@ -71,4 +72,18 @@ export const ARDUINO_LEONARDO: Pin = {
71
72
  analog: [['A0', 'A0'], ['A1', 'A1'], ['A2', 'A2'], ['A3', 'A3'], ['A4', 'A4'], ['A5', 'A5']],
72
73
  pwm: [['~3', '3'], ['~5', '5'], ['~6', '6'], ['~9', '9'], ['~10', '10'], ['~11', '11'], ['~13', '13']],
73
74
  i2c: [['IIC', '3,2']],
75
+ }
76
+
77
+ export const MICROBIT: Pin = {
78
+ digital: [['P0', 'P0'], ['P1', 'P1'], ['P2', 'P2'], ['P3', 'P3'], ['P4', 'P4'], ['P5', 'P5'], ['P6', 'P6'], ['P7', 'P7'], ['P8', 'P8'], ['P9', 'P9'], ['P10', 'P10'], ['P11', 'P11'], ['P12', 'P12'], ['P13', 'P13'], ['P14', 'P14'], ['P15', 'P15'], ['P16', 'P16'], ['P19', 'P19'], ['P20', 'P20']],
79
+ i2c: [['IIC', 'P19,P20']],
80
+ }
81
+
82
+ export const MICROBIT2: Pin = {
83
+ digital: [['0', 'P0'], ['1', 'P2'], ['2', 'P11'], ['3', 'P10']],
84
+ analog: [['0', 'P0'], ['1', 'P2'], ['3', 'P10']],
85
+ i2c: [['IIC', 'P19,P20']],
86
+ ultrasonic: [['0', 'P2,P1']],
87
+ motorDC: [['0', 'P2,P1']],
88
+ motorPwm: [['MD', 'P15,P16'], ['MI', 'P13,P14']],
74
89
  }
package/dist/index.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBoardById = exports.getBoards = exports.getAllBoards = exports.boards = void 0;
4
- var data_1 = require("./src/boards/data");
5
- Object.defineProperty(exports, "boards", { enumerable: true, get: function () { return data_1.boards; } });
6
- var boards_1 = require("./src/boards/boards");
7
- Object.defineProperty(exports, "getAllBoards", { enumerable: true, get: function () { return boards_1.getAllBoards; } });
8
- Object.defineProperty(exports, "getBoards", { enumerable: true, get: function () { return boards_1.getBoards; } });
9
- Object.defineProperty(exports, "getBoardById", { enumerable: true, get: function () { return boards_1.getBoardById; } });
10
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAAjC,8FAAA,MAAM,OAAA;AACf,8CAA2E;AAAlE,sGAAA,YAAY,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,sGAAA,YAAY,OAAA"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBoards = exports.getBoardById = exports.getAllBoards = void 0;
4
- const getAllBoards = ({ boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
5
- prop: '',
6
- value: ''
7
- } }) => {
8
- switch (type) {
9
- case 'senior':
10
- return boards.filter(b => b.type === 'senior' &&
11
- (hidden || b.show === 1) &&
12
- (premium || !b.premium) &&
13
- (disabled || b.enabled) &&
14
- (!b[exclude.prop] || b[exclude.prop] !== exclude.value));
15
- case 'junior':
16
- return boards.filter(b => b.type === 'junior' &&
17
- (hidden || b.show === 1) &&
18
- (premium || !b.premium) &&
19
- (disabled || b.enabled) &&
20
- (!b[exclude.prop] || b[exclude.prop] !== exclude.value));
21
- case 'code':
22
- return boards.filter(b => b.type === 'senior' &&
23
- b.enabledForCode > 0 &&
24
- (hidden || b.show === 1) &&
25
- (premium || !b.premium) &&
26
- (disabled || b.enabled) &&
27
- (!b[exclude.prop] || b[exclude.prop] !== exclude.value));
28
- case 'aula':
29
- return boards.filter(b => (hidden || b.showOnAula === 1) &&
30
- (disabled || b.enabled) &&
31
- (!b[exclude.prop] || b[exclude.prop] !== exclude.value));
32
- case 'all':
33
- default:
34
- return boards.filter(b => (hidden || b.show === 1) &&
35
- (premium || !b.premium) &&
36
- (disabled || b.enabled) &&
37
- (!b[exclude.prop] || b[exclude.prop] !== exclude.value));
38
- }
39
- };
40
- exports.getAllBoards = getAllBoards;
41
- const getBoardById = (boards, id) => boards
42
- .find((board) => {
43
- const boardId = typeof id === 'string' ? parseInt(id, 10) : id;
44
- return board.id === boardId;
45
- });
46
- exports.getBoardById = getBoardById;
47
- /**
48
- * Get all filtered boards
49
- * legacy support
50
- *
51
- * @param boards all boards
52
- * @param [type='all'] type of board
53
- * @param [premium=true] include premium boards
54
- * @param [disabled=true] include disabled boards
55
- * @param [hidden=false] include hidden boards
56
- * @param [exclude={
57
- * prop: '',
58
- * value: ''
59
- * }] exclude boards by property name and value
60
- */
61
- const getBoards = (boards, type = 'all', premium = true, disabled = true, hidden = false, exclude = {
62
- prop: '',
63
- value: ''
64
- }) => (0, exports.getAllBoards)({ boards, type, premium, disabled, hidden, exclude });
65
- exports.getBoards = getBoards;
66
- //# sourceMappingURL=boards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boards.js","sourceRoot":"","sources":["../../../src/boards/boards.ts"],"names":[],"mappings":";;;AAgBO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,IAAI,GAAG,KAAK,EACZ,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,IAAI,EACf,MAAM,GAAG,KAAK,EACd,OAAO,GAAG;IACN,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;CACZ,EACU,EAAW,EAAE;IACxB,QAAQ,IAAI,EAAE;QACV,KAAK,QAAQ;YACT,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC,CAAC,IAAI,KAAK,QAAQ;gBACnB,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;gBACxB,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;gBACvB,CAAC,QAAQ,IAAI,CAAC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