Skip to content

Commit 60e8deb

Browse files
authored
Merge pull request #1743 from fpistm/arduino-lint
Arduino lint
2 parents beb5f5c + cf05e1e commit 60e8deb

File tree

17 files changed

+486
-95
lines changed

17 files changed

+486
-95
lines changed

.github/workflows/arduino-lint.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Check Arduino
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Arduino Lint
19+
uses: arduino/arduino-lint-action@v1

boards.txt

+128-64
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
/* ----------------------------------------------------------------------
2+
Copyright (C) 2010-2012 ARM Limited. All rights reserved.
3+
4+
$Date: 12. March 2014
5+
$Revision: V1.4.3
6+
7+
Project: CMSIS DSP Library
8+
Title: arm_sin_cos_example_f32.c
9+
10+
Description: Example code demonstrating sin and cos calculation of input signal.
11+
12+
Target Processor: Cortex-M4/Cortex-M3
13+
14+
Redistribution and use in source and binary forms, with or without
15+
modification, are permitted provided that the following conditions
16+
are met:
17+
- Redistributions of source code must retain the above copyright
18+
notice, this list of conditions and the following disclaimer.
19+
- Redistributions in binary form must reproduce the above copyright
20+
notice, this list of conditions and the following disclaimer in
21+
the documentation and/or other materials provided with the
22+
distribution.
23+
- Neither the name of ARM LIMITED nor the names of its contributors
24+
may be used to endorse or promote products derived from this
25+
software without specific prior written permission.
26+
27+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
POSSIBILITY OF SUCH DAMAGE.
39+
-------------------------------------------------------------------- */
40+
41+
/**
42+
@ingroup groupExamples
43+
*/
44+
45+
/**
46+
@defgroup SinCosExample SineCosine Example
47+
48+
\par Description:
49+
\par
50+
Demonstrates the Pythagorean trignometric identity with the use of Cosine, Sine, Vector
51+
Multiplication, and Vector Addition functions.
52+
53+
\par Algorithm:
54+
\par
55+
Mathematically, the Pythagorean trignometric identity is defined by the following equation:
56+
<pre>sin(x) * sin(x) + cos(x) * cos(x) = 1</pre>
57+
where \c x is the angle in radians.
58+
59+
\par Block Diagram:
60+
\par
61+
\image html sinCos.gif
62+
63+
\par Variables Description:
64+
\par
65+
\li \c testInput_f32 array of input angle in radians
66+
\li \c testOutput stores sum of the squares of sine and cosine values of input angle
67+
68+
\par CMSIS DSP Software Library Functions Used:
69+
\par
70+
- arm_cos_f32()
71+
- arm_sin_f32()
72+
- arm_mult_f32()
73+
- arm_add_f32()
74+
75+
<b> Refer </b>
76+
\link arm_sin_cos_example_f32.c \endlink
77+
78+
*/
79+
80+
81+
/** \example arm_sin_cos_example_f32.c
82+
*/
83+
84+
#include "CMSIS_DSP.h"
85+
86+
/* ----------------------------------------------------------------------
87+
Defines each of the tests performed
88+
------------------------------------------------------------------- */
89+
#define MAX_BLOCKSIZE 32
90+
#define DELTA (0.0001f)
91+
92+
93+
/* ----------------------------------------------------------------------
94+
Test input data for Floating point sin_cos example for 32-blockSize
95+
Generated by the MATLAB randn() function
96+
------------------------------------------------------------------- */
97+
98+
const float32_t testInput_f32[MAX_BLOCKSIZE] =
99+
{
100+
-1.244916875853235400, -4.793533929171324800, 0.360705030233248850, 0.827929644170887320, -3.299532218312426900, 3.427441903227623800, 3.422401784294607700, -0.108308165334010680,
101+
0.941943896490312180, 0.502609575000365850, -0.537345278736373500, 2.088817392965764500, -1.693168684143455700, 6.283185307179590700, -0.392545884746175080, 0.327893095115825040,
102+
3.070147440456292300, 0.170611405884662230, -0.275275082396073010, -2.395492805446796300, 0.847311163536506600, -3.845517018083148800, 2.055818378415868300, 4.672594161978930800,
103+
-1.990923030266425800, 2.469305197656249500, 3.609002606064021000, -4.586736582331667500, -4.147080139136136300, 1.643756718868359500, -1.150866392366494800, 1.985805026477433800
104+
105+
106+
};
107+
108+
const float32_t testRefOutput_f32 = 1.000000000;
109+
110+
/* ----------------------------------------------------------------------
111+
Declare Global variables
112+
------------------------------------------------------------------- */
113+
uint32_t blockSize = 32;
114+
float32_t testOutput;
115+
float32_t cosOutput;
116+
float32_t sinOutput;
117+
float32_t cosSquareOutput;
118+
float32_t sinSquareOutput;
119+
120+
/* ----------------------------------------------------------------------
121+
Max magnitude FFT Bin test
122+
------------------------------------------------------------------- */
123+
124+
arm_status status;
125+
126+
void setup() {
127+
Serial.begin(9600);
128+
}
129+
130+
void loop() {
131+
float32_t diff;
132+
uint32_t i;
133+
134+
for (i = 0; i < blockSize; i++) {
135+
cosOutput = arm_cos_f32(testInput_f32[i]);
136+
sinOutput = arm_sin_f32(testInput_f32[i]);
137+
138+
arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1);
139+
arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1);
140+
141+
arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1);
142+
143+
/* absolute value of difference between ref and test */
144+
diff = fabsf(testRefOutput_f32 - testOutput);
145+
146+
/* Comparison of sin_cos value with reference */
147+
status = (diff > DELTA) ? ARM_MATH_TEST_FAILURE : ARM_MATH_SUCCESS;
148+
149+
if ( status == ARM_MATH_TEST_FAILURE) {
150+
break;
151+
}
152+
}
153+
154+
if (status != ARM_MATH_SUCCESS) {
155+
Serial.println("FAILURE");
156+
}
157+
else {
158+
Serial.println("SUCCESS");
159+
}
160+
while (1) {};
161+
}
162+
163+
/** \endlink */

libraries/CMSIS_DSP/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=CMSIS DSP
1+
name=CMSIS_DSP
22
version=1.0.0
33
author=Frederic Pillon
44
maintainer=stm32duino

libraries/IWatchdog/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ maintainer=stm32duino
55
sentence=Enables support for independent watchdog (IWDG) hardware on STM32 processors.
66
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".
77
category=Timing
8-
url=
8+
url=https://github.com/stm32duino/Arduino_Core_STM32/blob/main/libraries/IWatchdog/README.md
99
architectures=stm32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Keyboard Message test
3+
4+
For STM32 based board with USB capabilities
5+
6+
Sends a text string when a button is pressed.
7+
8+
The circuit:
9+
- pushbutton attached from pin 4 to +3.3V
10+
- 10 kilohm resistor attached from pin 4 to ground
11+
12+
created 24 Oct 2011
13+
modified 27 Mar 2012
14+
by Tom Igoe
15+
modified 11 Nov 2013
16+
by Scott Fitzgerald
17+
18+
This example code is in the public domain.
19+
20+
https://www.arduino.cc/en/Tutorial/BuiltInExamples/KeyboardMessage
21+
*/
22+
23+
#include "Keyboard.h"
24+
25+
#ifdef USER_BTN
26+
const int buttonPin = USER_BTN; // input pin for pushbutton
27+
#else
28+
const int buttonPin = 4; // input pin for pushbutton
29+
#endif
30+
31+
int previousButtonState = HIGH; // for checking the state of a pushButton
32+
int counter = 0; // button push counter
33+
34+
void setup() {
35+
// make the pushButton pin an input:
36+
pinMode(buttonPin, INPUT);
37+
// initialize control over the keyboard:
38+
Keyboard.begin();
39+
}
40+
41+
void loop() {
42+
// read the pushbutton:
43+
int buttonState = digitalRead(buttonPin);
44+
// if the button state has changed,
45+
if ((buttonState != previousButtonState)
46+
// and it's currently pressed:
47+
&& (buttonState == HIGH)) {
48+
// increment the button counter
49+
counter++;
50+
// type out a message
51+
Keyboard.print("You pressed the button ");
52+
Keyboard.print(counter);
53+
Keyboard.println(" times.");
54+
}
55+
// save the current button state for comparison next time:
56+
previousButtonState = buttonState;
57+
}

libraries/Keyboard/library.properties

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Keyboard
22
version=1.1.0
3-
author=Arduino
4-
maintainer=Arduino <[email protected]>
5-
sentence=Allows an Arduino/Genuino board with USB capabilities to act as a Keyboard.
6-
paragraph=This library plugs on the HID library. It can be used with or without other HID-based libraries (Mouse, Gamepad etc)
3+
author=Arduino, stm32duino
4+
maintainer=stm32duino
5+
sentence=Allows a STM32 based board with USB capabilities to act as a Keyboard.
6+
paragraph=This library plugs on the HID implementation provided by the core.
77
category=Device Control
88
url=http://www.arduino.cc/en/Reference/Keyboard
99
architectures=stm32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
ButtonMouseControl
3+
4+
For STM32 based board with USB capabilities
5+
6+
Controls the mouse from five pushbuttons.
7+
8+
Hardware:
9+
- five pushbuttons attached to D2, D3, D4, D5, D6
10+
11+
The mouse movement is always relative. This sketch reads four pushbuttons,
12+
and uses them to set the movement of the mouse.
13+
14+
WARNING: When you use the Mouse.move() command, the Arduino takes over your
15+
mouse! Make sure you have control before you use the mouse commands.
16+
17+
created 15 Mar 2012
18+
modified 27 Mar 2012
19+
by Tom Igoe
20+
21+
This example code is in the public domain.
22+
23+
https://www.arduino.cc/en/Tutorial/BuiltInExamples/ButtonMouseControl
24+
*/
25+
26+
#include "Mouse.h"
27+
28+
// set pin numbers for the five buttons:
29+
const int upButton = 2;
30+
const int downButton = 3;
31+
const int leftButton = 4;
32+
const int rightButton = 5;
33+
const int mouseButton = 6;
34+
35+
int range = 5; // output range of X or Y movement; affects movement speed
36+
int responseDelay = 10; // response delay of the mouse, in ms
37+
38+
39+
void setup() {
40+
// initialize the buttons' inputs:
41+
pinMode(upButton, INPUT);
42+
pinMode(downButton, INPUT);
43+
pinMode(leftButton, INPUT);
44+
pinMode(rightButton, INPUT);
45+
pinMode(mouseButton, INPUT);
46+
// initialize mouse control:
47+
Mouse.begin();
48+
}
49+
50+
void loop() {
51+
// read the buttons:
52+
int upState = digitalRead(upButton);
53+
int downState = digitalRead(downButton);
54+
int rightState = digitalRead(rightButton);
55+
int leftState = digitalRead(leftButton);
56+
int clickState = digitalRead(mouseButton);
57+
58+
// calculate the movement distance based on the button states:
59+
int xDistance = (leftState - rightState) * range;
60+
int yDistance = (upState - downState) * range;
61+
62+
// if X or Y is non-zero, move:
63+
if ((xDistance != 0) || (yDistance != 0)) {
64+
Mouse.move(xDistance, yDistance, 0);
65+
}
66+
67+
// if the mouse button is pressed:
68+
if (clickState == HIGH) {
69+
// if the mouse is not pressed, press it:
70+
if (!Mouse.isPressed(MOUSE_LEFT)) {
71+
Mouse.press(MOUSE_LEFT);
72+
}
73+
}
74+
// else the mouse button is not pressed:
75+
else {
76+
// if the mouse is pressed, release it:
77+
if (Mouse.isPressed(MOUSE_LEFT)) {
78+
Mouse.release(MOUSE_LEFT);
79+
}
80+
}
81+
82+
// a delay so the mouse doesn't move too fast:
83+
delay(responseDelay);
84+
}

libraries/Mouse/library.properties

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=Mouse
22
version=1.1.0
3-
author=Arduino
4-
maintainer=Arduino <[email protected]>
5-
sentence=Allows an Arduino board with USB capabilities to act as a Mouse. For Leonardo/Micro only
6-
paragraph=This library plugs on the HID library. Can be used with or without other HID-based libraries (Keyboard, Gamepad etc)
3+
author=Arduino, stm32duino
4+
maintainer=stm32duino
5+
sentence=Allows a STM32 based board with USB capabilities to act as a Mouse.
6+
paragraph=This library plugs on the HID implementation provided by the core.
77
category=Device Control
88
url=http://www.arduino.cc/en/Reference/Mouse
99
architectures=stm32

libraries/RGB_LED_TLC59731/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=RGB LED TLC59731
1+
name=RGB_LED_TLC59731
22
version=1.0.0
33
author=Frederic Pillon
44
maintainer=stm32duino

libraries/SPI/library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SPI
2-
version=1.0
2+
version=1.0.0
33
author=Arduino, Wi6Labs
44
maintainer=stm32duino
55
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus.

libraries/Servo/library.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name=Servo
22
version=1.1.2
33
author=Michael Margolis, Arduino
4-
maintainer=Arduino <[email protected]>
5-
sentence=Allows Arduino/Genuino boards to control a variety of servo motors.
4+
maintainer=stm32duino
5+
sentence=Allows Arduino/Genuino and STM32 based boards to control a variety of servo motors.
66
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 />
77
category=Device Control
88
url=http://www.arduino.cc/en/Reference/Servo

0 commit comments

Comments
 (0)