Skip to content

Commit

Permalink
add new extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengyangliu committed Jul 11, 2021
1 parent ef8a81c commit 4e63fd7
Show file tree
Hide file tree
Showing 51 changed files with 4,274 additions and 5 deletions.
4 changes: 2 additions & 2 deletions extensions/arduino/sensor/ds18b20/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ function addMsg (Blockly) {
DS18B20_CATEGORY: 'DS18B20',
DS18B20_INIT: 'init ds18b20 pin %1 quantity %2',
DS18B20_READALLTEMPERATURES: 'ds18b20 read all temperatures',
DS18B20_GETTEMPERATURE: 'ds18b20 %1 temperatures unit %2'
DS18B20_GETTEMPERATURE: 'ds18b20 %1 temperatures %2'
});
Object.assign(Blockly.ScratchMsgs.locales['zh-cn'], {
DS18B20_CATEGORY: 'DS18B20',
DS18B20_INIT: '初始化 ds18b20 引脚 %1 数量 %2',
DS18B20_READALLTEMPERATURES: 'ds18b20 读取所有温度',
DS18B20_GETTEMPERATURE: 'ds18b20 %1 温度 单位 %2'
DS18B20_GETTEMPERATURE: 'ds18b20 %1 温度 %2'
});
return Blockly;
}
Expand Down
2 changes: 1 addition & 1 deletion extensions/arduino/sensor/max30102/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const max30102 = formatMessage => ({
iconURL: `asset/max30102.png`,
description: formatMessage({
id: 'max30102.description',
default: 'Blood oxygen and heart rate detection module based on max30102.'
default: 'Blood oxygen and heart rate detection module based on MAX30102.'
}),
featured: true,
blocks: 'blocks.js',
Expand Down
4 changes: 2 additions & 2 deletions extensions/arduino/sensor/max30102/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
/* eslint-disable require-jsdoc */
function addMsg (Blockly) {
Object.assign(Blockly.ScratchMsgs.locales.en, {
MAX30102_CATEGORY: 'MAX30102 Sensor',
MAX30102_CATEGORY: 'MAX30102',
MAX30102_INIT: 'init max30102',
MAX30102_GETDATA: 'max30102 get date',
MAX30102_IRVALUE: 'max30102 IR value',
MAX30102_HEARTBEAT: 'max30102 heart beat value per minite',
MAX30102_ISTOUCHED: 'max30102 is touched?'
});
Object.assign(Blockly.ScratchMsgs.locales['zh-cn'], {
MAX30102_CATEGORY: 'MAX30102 传感器',
MAX30102_CATEGORY: 'MAX30102',
MAX30102_INIT: '初始化 max30102',
MAX30102_GETDATA: 'max30102 获取数据',
MAX30102_IRVALUE: 'max30102 IR 数值',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions extensions/arduino/sensor/max6675/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* eslint-disable func-style */
/* eslint-disable max-len */
/* eslint-disable require-jsdoc */
function addBlocks (Blockly) {
const color = '#007979';
const secondaryColour = '#005757';

const digitalPins = Blockly.getMainWorkspace().getFlyout()
.getFlyoutItems()
.find(block => block.type === 'arduino_pin_setDigitalOutput')
.getField('PIN')
.getOptions();

Blockly.Blocks.max6675_init = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.MAX6675_INIT, // init max6675 pin DO %1 CLK %2 CS %3
args0: [
{
type: 'field_dropdown',
name: 'DO',
options: digitalPins
},
{
type: 'field_dropdown',
name: 'CLK',
options: digitalPins
},

{
type: 'field_dropdown',
name: 'CS',
options: digitalPins
}
],
colour: color,
secondaryColour: secondaryColour,
extensions: ['shape_statement']
});
}
};

Blockly.Blocks.max6675_readTemperature = {
init: function () {
this.jsonInit({
message0: Blockly.Msg.MAX6675_READTEMPERATURE, // max6675 read temperature %1
args0: [
{
type: 'field_dropdown',
name: 'UNIT',
options: [
['℃', 'false'],
['℉', 'true']]
}
],
colour: color,
secondaryColour: secondaryColour,
extensions: ['output_number']
});
}
};

return Blockly;
}

exports = addBlocks;
26 changes: 26 additions & 0 deletions extensions/arduino/sensor/max6675/generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable func-style */
/* eslint-disable max-len */
/* eslint-disable require-jsdoc */
function addGenerator (Blockly) {
Blockly.Arduino.max6675_init = function (block) {
const d0 = block.getFieldValue('DO');
const clk = block.getFieldValue('CLK');
const cs = block.getFieldValue('CS');

Blockly.Arduino.includes_.max6675_init = `#include <max6675.h>`;
Blockly.Arduino.definitions_.max6675_init = `MAX6675 max6675(${clk}, ${cs}, ${d0});`;
return '';
};

Blockly.Arduino.max6675_readTemperature = function () {
const unit = this.getFieldValue('UNIT');
if (unit === 'true') {
return [`max6675.readFahrenheit()`, Blockly.Arduino.ORDER_ATOMIC];
}
return [`max6675.readCelsius()`, Blockly.Arduino.ORDER_ATOMIC];
};

return Blockly;
}

exports = addGenerator;
27 changes: 27 additions & 0 deletions extensions/arduino/sensor/max6675/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const max6675 = formatMessage => ({
name: formatMessage({
id: 'max6675.name',
default: 'MAX6675 Module'
}),
extensionId: 'max6675',
version: '1.0.0',
supportDevice: ['arduinoUno', 'arduinoNano', 'arduinoMini', 'arduinoLeonardo',
'arduinoMega2560', 'arduinoEsp32', 'arduinoEsp8266'],
author: 'ArthurZheng',
iconURL: `asset/max6675.png`,
description: formatMessage({
id: 'max6675.description',
default: 'K-type thermocouple temperature measurement module ' +
'based on MAX6675, the measurement range is 0 ~ 1024 ℃'
}),
featured: true,
blocks: 'blocks.js',
generator: 'generator.js',
toolbox: 'toolbox.js',
msg: 'msg.js',
library: 'lib',
tags: ['sensor'],
helpLink: 'https://openblockcc.gitee.io/wiki/main'
});

module.exports = max6675;
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Adafruit Community Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

## Our Standards

We are committed to providing a friendly, safe and welcoming environment for
all.

Examples of behavior that contributes to creating a positive environment
include:

* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate

The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you don’t just aim to be
"technically unimpeachable", but rather try to be your best self.

We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.

## Our Responsibilities

Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.

## Moderation

Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.

You may report in the following ways:

In any situation, you may send an email to <[email protected]>.

On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community helpers. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.

Email and direct message reports will be kept confidential.

In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.

These are the steps for upholding our community’s standards of conduct.

1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.

## Scope

This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).

For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.
22 changes: 22 additions & 0 deletions extensions/arduino/sensor/max6675/lib/MAX6675_library/keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#######################################
# Syntax Coloring Map for NewSoftSerial
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

max6675 KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

readCelsius KEYWORD2
readFahrenheit KEYWORD2
readFarenheit KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name=MAX6675 library
version=1.1.0
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=Arduino library for interfacing with MAX6675 thermocouple amplifier
paragraph=Arduino library for interfacing with MAX6675 thermocouple amplifier
category=Sensors
url=https://github.com/adafruit/MAX6675-library
architectures=*
depends=LiquidCrystal
26 changes: 26 additions & 0 deletions extensions/arduino/sensor/max6675/lib/MAX6675_library/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Software License Agreement (BSD License)

Copyright (c) 2019, Limor Fried for Adafruit Industries
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 4e63fd7

Please sign in to comment.