Skip to content

Arduino lint #1743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/arduino-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check Arduino

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Arduino Lint
uses: arduino/arduino-lint-action@v1
192 changes: 128 additions & 64 deletions boards.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/* ----------------------------------------------------------------------
Copyright (C) 2010-2012 ARM Limited. All rights reserved.

$Date: 12. March 2014
$Revision: V1.4.3

Project: CMSIS DSP Library
Title: arm_sin_cos_example_f32.c

Description: Example code demonstrating sin and cos calculation of input signal.

Target Processor: Cortex-M4/Cortex-M3

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- 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.
- Neither the name of ARM LIMITED 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 AND CONTRIBUTORS
"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 OWNER OR CONTRIBUTORS 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.
-------------------------------------------------------------------- */

/**
@ingroup groupExamples
*/

/**
@defgroup SinCosExample SineCosine Example

\par Description:
\par
Demonstrates the Pythagorean trignometric identity with the use of Cosine, Sine, Vector
Multiplication, and Vector Addition functions.

\par Algorithm:
\par
Mathematically, the Pythagorean trignometric identity is defined by the following equation:
<pre>sin(x) * sin(x) + cos(x) * cos(x) = 1</pre>
where \c x is the angle in radians.

\par Block Diagram:
\par
\image html sinCos.gif

\par Variables Description:
\par
\li \c testInput_f32 array of input angle in radians
\li \c testOutput stores sum of the squares of sine and cosine values of input angle

\par CMSIS DSP Software Library Functions Used:
\par
- arm_cos_f32()
- arm_sin_f32()
- arm_mult_f32()
- arm_add_f32()

<b> Refer </b>
\link arm_sin_cos_example_f32.c \endlink

*/


/** \example arm_sin_cos_example_f32.c
*/

#include "CMSIS_DSP.h"

/* ----------------------------------------------------------------------
Defines each of the tests performed
------------------------------------------------------------------- */
#define MAX_BLOCKSIZE 32
#define DELTA (0.0001f)


/* ----------------------------------------------------------------------
Test input data for Floating point sin_cos example for 32-blockSize
Generated by the MATLAB randn() function
------------------------------------------------------------------- */

const float32_t testInput_f32[MAX_BLOCKSIZE] =
{
-1.244916875853235400, -4.793533929171324800, 0.360705030233248850, 0.827929644170887320, -3.299532218312426900, 3.427441903227623800, 3.422401784294607700, -0.108308165334010680,
0.941943896490312180, 0.502609575000365850, -0.537345278736373500, 2.088817392965764500, -1.693168684143455700, 6.283185307179590700, -0.392545884746175080, 0.327893095115825040,
3.070147440456292300, 0.170611405884662230, -0.275275082396073010, -2.395492805446796300, 0.847311163536506600, -3.845517018083148800, 2.055818378415868300, 4.672594161978930800,
-1.990923030266425800, 2.469305197656249500, 3.609002606064021000, -4.586736582331667500, -4.147080139136136300, 1.643756718868359500, -1.150866392366494800, 1.985805026477433800


};

const float32_t testRefOutput_f32 = 1.000000000;

/* ----------------------------------------------------------------------
Declare Global variables
------------------------------------------------------------------- */
uint32_t blockSize = 32;
float32_t testOutput;
float32_t cosOutput;
float32_t sinOutput;
float32_t cosSquareOutput;
float32_t sinSquareOutput;

/* ----------------------------------------------------------------------
Max magnitude FFT Bin test
------------------------------------------------------------------- */

arm_status status;

void setup() {
Serial.begin(9600);
}

void loop() {
float32_t diff;
uint32_t i;

for (i = 0; i < blockSize; i++) {
cosOutput = arm_cos_f32(testInput_f32[i]);
sinOutput = arm_sin_f32(testInput_f32[i]);

arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);

arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);

/* absolute value of difference between ref and test */
diff = fabsf(testRefOutput_f32 - testOutput);

/* Comparison of sin_cos value with reference */
status = (diff > DELTA) ? ARM_MATH_TEST_FAILURE : ARM_MATH_SUCCESS;

if ( status == ARM_MATH_TEST_FAILURE) {
break;
}
}

if (status != ARM_MATH_SUCCESS) {
Serial.println("FAILURE");
}
else {
Serial.println("SUCCESS");
}
while (1) {};
}

/** \endlink */
2 changes: 1 addition & 1 deletion libraries/CMSIS_DSP/library.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=CMSIS DSP
name=CMSIS_DSP
version=1.0.0
author=Frederic Pillon
maintainer=stm32duino
Expand Down
2 changes: 1 addition & 1 deletion libraries/IWatchdog/library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ maintainer=stm32duino
sentence=Enables support for independent watchdog (IWDG) hardware on STM32 processors.
paragraph=Independent watchdog (IWDG) is a hardware timer on the chip which would generate a reset condition if the time is not reloaded within the specified time. It is generally used in production systems to reset the system if the CPU becomes "stuck".
category=Timing
url=
url=https://github.com/stm32duino/Arduino_Core_STM32/blob/main/libraries/IWatchdog/README.md
architectures=stm32
57 changes: 57 additions & 0 deletions libraries/Keyboard/examples/KeyboardMessage/KeyboardMessage.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Keyboard Message test

For STM32 based board with USB capabilities

Sends a text string when a button is pressed.

The circuit:
- pushbutton attached from pin 4 to +3.3V
- 10 kilohm resistor attached from pin 4 to ground

created 24 Oct 2011
modified 27 Mar 2012
by Tom Igoe
modified 11 Nov 2013
by Scott Fitzgerald

This example code is in the public domain.

https://www.arduino.cc/en/Tutorial/BuiltInExamples/KeyboardMessage
*/

#include "Keyboard.h"

#ifdef USER_BTN
const int buttonPin = USER_BTN; // input pin for pushbutton
#else
const int buttonPin = 4; // input pin for pushbutton
#endif

int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter

void setup() {
// make the pushButton pin an input:
pinMode(buttonPin, INPUT);
// initialize control over the keyboard:
Keyboard.begin();
}

void loop() {
// read the pushbutton:
int buttonState = digitalRead(buttonPin);
// if the button state has changed,
if ((buttonState != previousButtonState)
// and it's currently pressed:
&& (buttonState == HIGH)) {
// increment the button counter
counter++;
// type out a message
Keyboard.print("You pressed the button ");
Keyboard.print(counter);
Keyboard.println(" times.");
}
// save the current button state for comparison next time:
previousButtonState = buttonState;
}
8 changes: 4 additions & 4 deletions libraries/Keyboard/library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Keyboard
version=1.1.0
author=Arduino
maintainer=Arduino <[email protected]>
sentence=Allows an Arduino/Genuino board with USB capabilities to act as a Keyboard.
paragraph=This library plugs on the HID library. It can be used with or without other HID-based libraries (Mouse, Gamepad etc)
author=Arduino, stm32duino
maintainer=stm32duino
sentence=Allows a STM32 based board with USB capabilities to act as a Keyboard.
paragraph=This library plugs on the HID implementation provided by the core.
category=Device Control
url=http://www.arduino.cc/en/Reference/Keyboard
architectures=stm32
84 changes: 84 additions & 0 deletions libraries/Mouse/examples/ButtonMouseControl/ButtonMouseControl.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
ButtonMouseControl

For STM32 based board with USB capabilities

Controls the mouse from five pushbuttons.

Hardware:
- five pushbuttons attached to D2, D3, D4, D5, D6

The mouse movement is always relative. This sketch reads four pushbuttons,
and uses them to set the movement of the mouse.

WARNING: When you use the Mouse.move() command, the Arduino takes over your
mouse! Make sure you have control before you use the mouse commands.

created 15 Mar 2012
modified 27 Mar 2012
by Tom Igoe

This example code is in the public domain.

https://www.arduino.cc/en/Tutorial/BuiltInExamples/ButtonMouseControl
*/

#include "Mouse.h"

// set pin numbers for the five buttons:
const int upButton = 2;
const int downButton = 3;
const int leftButton = 4;
const int rightButton = 5;
const int mouseButton = 6;

int range = 5; // output range of X or Y movement; affects movement speed
int responseDelay = 10; // response delay of the mouse, in ms


void setup() {
// initialize the buttons' inputs:
pinMode(upButton, INPUT);
pinMode(downButton, INPUT);
pinMode(leftButton, INPUT);
pinMode(rightButton, INPUT);
pinMode(mouseButton, INPUT);
// initialize mouse control:
Mouse.begin();
}

void loop() {
// read the buttons:
int upState = digitalRead(upButton);
int downState = digitalRead(downButton);
int rightState = digitalRead(rightButton);
int leftState = digitalRead(leftButton);
int clickState = digitalRead(mouseButton);

// calculate the movement distance based on the button states:
int xDistance = (leftState - rightState) * range;
int yDistance = (upState - downState) * range;

// if X or Y is non-zero, move:
if ((xDistance != 0) || (yDistance != 0)) {
Mouse.move(xDistance, yDistance, 0);
}

// if the mouse button is pressed:
if (clickState == HIGH) {
// if the mouse is not pressed, press it:
if (!Mouse.isPressed(MOUSE_LEFT)) {
Mouse.press(MOUSE_LEFT);
}
}
// else the mouse button is not pressed:
else {
// if the mouse is pressed, release it:
if (Mouse.isPressed(MOUSE_LEFT)) {
Mouse.release(MOUSE_LEFT);
}
}

// a delay so the mouse doesn't move too fast:
delay(responseDelay);
}
8 changes: 4 additions & 4 deletions libraries/Mouse/library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Mouse
version=1.1.0
author=Arduino
maintainer=Arduino <[email protected]>
sentence=Allows an Arduino board with USB capabilities to act as a Mouse. For Leonardo/Micro only
paragraph=This library plugs on the HID library. Can be used with or without other HID-based libraries (Keyboard, Gamepad etc)
author=Arduino, stm32duino
maintainer=stm32duino
sentence=Allows a STM32 based board with USB capabilities to act as a Mouse.
paragraph=This library plugs on the HID implementation provided by the core.
category=Device Control
url=http://www.arduino.cc/en/Reference/Mouse
architectures=stm32
2 changes: 1 addition & 1 deletion libraries/RGB_LED_TLC59731/library.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=RGB LED TLC59731
name=RGB_LED_TLC59731
version=1.0.0
author=Frederic Pillon
maintainer=stm32duino
Expand Down
2 changes: 1 addition & 1 deletion libraries/SPI/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SPI
version=1.0
version=1.0.0
author=Arduino, Wi6Labs
maintainer=stm32duino
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus.
Expand Down
4 changes: 2 additions & 2 deletions libraries/Servo/library.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name=Servo
version=1.1.2
author=Michael Margolis, Arduino
maintainer=Arduino <[email protected]>
sentence=Allows Arduino/Genuino boards to control a variety of servo motors.
maintainer=stm32duino
sentence=Allows Arduino/Genuino and STM32 based boards to control a variety of servo motors.
paragraph=This library can control a great number of servos.<br />It makes careful use of timers: the library can control 12 servos using only 1 timer.<br />On the Arduino Due you can control up to 60 servos.<br />
category=Device Control
url=http://www.arduino.cc/en/Reference/Servo
Expand Down
Loading