Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 04f06bd

Browse files
committed
code cleanup
1 parent 64ab58d commit 04f06bd

File tree

8 files changed

+240
-259
lines changed

8 files changed

+240
-259
lines changed

cores/arduino/Arduino.h

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
// to add license
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2005-2013 Arduino Team. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
214
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
319

420
/*
521
* Arduino srl

cores/arduino/SPI.h

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
* published by the Free Software Foundation.
1212
*/
1313

14+
/*
15+
* Arduino srl - www.arduino.org
16+
* 2016 Jun 9: Edited Francesco Alessi (alfran) - [email protected]
17+
*/
18+
1419
#ifndef _SPI_H_INCLUDED
1520
#define _SPI_H_INCLUDED
1621

cores/arduino/WCharacter.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#ifndef Character_h
2121
#define Character_h
22-
//ciao
2322
#include <ctype.h>
2423

2524
// WCharacter.h prototypes

cores/arduino/dac.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void dac_init(const dac_dev *dev, uint32 flags) {
7979
* DAC_CH1: Select channel 1
8080
* DAC_CH2: Select channel 2
8181
* @param status Status:
82-
* 1: enable buffer
82+
* 1: enable buffer
8383
* 0: disable buffer
8484
*/
8585
void dac_enable_buffer(const dac_dev *dev, uint32 flags, int status) {
@@ -124,7 +124,6 @@ void dac_write_channel(const dac_dev *dev, uint8 channel, uint16 val) {
124124
* @brief Enable a DAC channel
125125
* @param dev DAC device
126126
* @param channel channel to enable, either 1 or 2
127-
* @sideeffect May change pin mode of PA4 or PA5
128127
*/
129128
void dac_enable_channel(const dac_dev *dev, uint8 channel) {
130129
/*

cores/arduino/delay.h

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
Copyright (c) 2014 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
119
/**
220
* @file delay.h
321
* @brief Delay implementation
@@ -41,4 +59,3 @@ static inline void delay_ns100(uint32 us) {
4159
: "r0");
4260
}
4361
#endif
44-

cores/arduino/rcc.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void InitMCO1()
223223
gpio_set_mode(GPIOA_dev, 8, GPIO_MODE_AF | GPIO_OTYPE_PP | GPIO_OSPEED_100MHZ);
224224
}
225225

226-
void SetupClock() // to be setted properly
226+
void SetupClock()
227227
{
228228

229229
RCC_ClkInitTypeDef RCC_ClkInitStruct;
@@ -302,9 +302,6 @@ void SetupClock() // to be setted properly
302302
rcc_dev_clk_speed_table[RCC_APB1] = (SystemCoreClock/4);
303303
}
304304

305-
// alfran ----- end
306-
307-
308305
void rcc_clk_init(rcc_sysclk_src sysclk_src,
309306
rcc_pllsrc pll_src,
310307
rcc_pll_multiplier pll_mul) {

variants/otto/variant.cpp

+82-174
Large diffs are not rendered by default.

variants/otto/variant.h

+116-76
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
1+
/******************************************************************************
2+
* The MIT License
3+
*
4+
* Copyright (c) 2011 LeafLabs, LLC.
5+
*
6+
* Permission is hereby granted, free of charge, to any person
7+
* obtaining a copy of this software and associated documentation
8+
* files (the "Software"), to deal in the Software without
9+
* restriction, including without limitation the rights to use, copy,
10+
* modify, merge, publish, distribute, sublicense, and/or sell copies
11+
* of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
* SOFTWARE.
25+
*****************************************************************************/
26+
27+
/**
28+
* @file aeroquad32.h
29+
* @author Marti Bolivar <[email protected]>
30+
* @brief Private include file for Maple Native in boards.h
31+
*
32+
* See maple.h for more information on these definitions.
33+
*/
34+
35+
/*
36+
* 2016 May 31 first release for:
37+
* Adruino OTTO serial ports interface definitions
38+
*
39+
* Arduino srl
40+
*
41+
* Francesco Alessi (alfran) - [email protected]
42+
*/
43+
144
#ifndef _VARIANT_ARDUINO_STM32_
245
#define _VARIANT_ARDUINO_STM32_
346

@@ -9,22 +52,19 @@
952
#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) )
1053
#define portOutputRegister(port) ( &(port->regs->ODR) )
1154
#define portInputRegister(port) ( &(port->regs->IDR) )
12-
13-
#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) )
14-
#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) )
15-
16-
#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) )
55+
#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) )
56+
#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) )
57+
#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) )
1758

1859
#include "stm32f4xx_hal.h"
1960

2061
#define Port2Pin(port, bit) ((port-'A')*16+bit)
21-
2262
#define CYCLES_PER_MICROSECOND 180
2363

2464
#undef STM32_PCLK1
2565
#undef STM32_PCLK2
26-
#define STM32_PCLK1 (CYCLES_PER_MICROSECOND*1000000/4)
27-
#define STM32_PCLK2 (CYCLES_PER_MICROSECOND*1000000/2)
66+
#define STM32_PCLK1 (CYCLES_PER_MICROSECOND*1000000/4)
67+
#define STM32_PCLK2 (CYCLES_PER_MICROSECOND*1000000/2)
2868

2969
#define SYSTICK_RELOAD_VAL (CYCLES_PER_MICROSECOND*1000-1)
3070

@@ -33,141 +73,141 @@
3373
// USART1 - NOT USED
3474
#define USART1_TX_GPIO_DEV GPIOB_dev
3575
#define USART1_TX_GPIO_PIN 6
36-
#define USART1_TX_AF 7
76+
#define USART1_TX_AF 7
3777
#define USART1_RX_GPIO_DEV GPIOB_dev
3878
#define USART1_RX_GPIO_PIN 7
39-
#define USART1_RX_AF 7
79+
#define USART1_RX_AF 7
4080

4181
// USART2 - Serial2
4282
#define USART2_TX_GPIO_DEV GPIOD_dev
4383
#define USART2_TX_GPIO_PIN 5
44-
#define USART2_TX_AF 7
84+
#define USART2_TX_AF 7
4585
#define USART2_RX_GPIO_DEV GPIOD_dev
4686
#define USART2_RX_GPIO_PIN 6
47-
#define USART2_RX_AF 7
87+
#define USART2_RX_AF 7
4888

4989
// USART3 - Serial1 / SerialWiFi
5090
#define USART3_TX_GPIO_DEV GPIOB_dev
5191
#define USART3_TX_GPIO_PIN 10
52-
#define USART3_TX_AF 7
92+
#define USART3_TX_AF 7
5393
#define USART3_RX_GPIO_DEV GPIOB_dev
5494
#define USART3_RX_GPIO_PIN 11
55-
#define USART3_RX_AF 7
95+
#define USART3_RX_AF 7
5696

57-
// UART4 - Serial0
58-
#define UART4_TX_GPIO_DEV GPIOA_dev
97+
// UART4 - Serial
98+
#define UART4_TX_GPIO_DEV GPIOA_dev
5999
#define UART4_TX_GPIO_PIN 0
60-
#define UART4_TX_AF 8
100+
#define UART4_TX_AF 8
61101
#define UART4_RX_GPIO_DEV GPIOA_dev
62102
#define UART4_RX_GPIO_PIN 1
63-
#define UART4_RX_AF 8
103+
#define UART4_RX_AF 8
64104

65105
// UART5 - NOT USED
66-
#define UART5_TX_GPIO_DEV GPIOD_dev
106+
#define UART5_TX_GPIO_DEV GPIOD_dev
67107
#define UART5_TX_GPIO_PIN 2
68-
#define UART5_TX_AF 8
108+
#define UART5_TX_AF 8
69109
#define UART5_RX_GPIO_DEV GPIOC_dev
70110
#define UART5_RX_GPIO_PIN 12
71-
#define UART5_RX_AF 8
111+
#define UART5_RX_AF 8
72112

73113
// USART6 - Serial3
74114
#define USART6_TX_GPIO_DEV GPIOG_dev
75115
#define USART6_TX_GPIO_PIN 14
76-
#define USART6_TX_AF 8
116+
#define USART6_TX_AF 8
77117
#define USART6_RX_GPIO_DEV GPIOG_dev
78118
#define USART6_RX_GPIO_PIN 9
79-
#define USART6_RX_AF 8
119+
#define USART6_RX_AF 8
80120

81121
// UART7 - NOT USED
82-
#define UART7_TX_GPIO_DEV GPIOF_dev
122+
#define UART7_TX_GPIO_DEV GPIOF_dev
83123
#define UART7_TX_GPIO_PIN 7
84-
#define UART7_TX_AF 8
124+
#define UART7_TX_AF 8
85125
#define UART7_RX_GPIO_DEV GPIOF_dev
86126
#define UART7_RX_GPIO_PIN 6
87-
#define UART7_RX_AF 8
127+
#define UART7_RX_AF 8
88128

89129
// UART8 - NOT USED
90-
#define UART8_TX_GPIO_DEV GPIOE_dev
130+
#define UART8_TX_GPIO_DEV GPIOE_dev
91131
#define UART8_TX_GPIO_PIN 0
92-
#define UART8_TX_AF 8
132+
#define UART8_TX_AF 8
93133
#define UART8_RX_GPIO_DEV GPIOE_dev
94134
#define UART8_RX_GPIO_PIN 1
95-
#define UART8_RX_AF 8
135+
#define UART8_RX_AF 8
96136

97-
#define GPIO_PINS 165
137+
#define GPIO_PINS 165
98138
#define BOARD_NR_PWM_PINS 26
99139
#define BOARD_NR_ADC_PINS 14
100140
#define BOARD_NR_USED_PINS 80
101141

102142
// Analog PIN Definition
103-
#define A0 D54
104-
#define A1 D55
105-
#define A2 D56
106-
#define A3 D57
107-
#define A4 D58
108-
#define A5 D59
109-
#define A6 D60
110-
#define A7 D61
111-
#define A8 D62
112-
#define A9 D63
113-
#define A10 D64
114-
#define A11 D65
115-
#define A12 D66
116-
#define A13 D67
143+
#define A0 D54
144+
#define A1 D55
145+
#define A2 D56
146+
#define A3 D57
147+
#define A4 D58
148+
#define A5 D59
149+
#define A6 D60
150+
#define A7 D61
151+
#define A8 D62
152+
#define A9 D63
153+
#define A10 D64
154+
#define A11 D65
155+
#define A12 D66
156+
#define A13 D67
117157

118158
// DAC PIN Definition
119-
#define DAC0 D66
120-
#define DAC1 D67
159+
#define DAC0 D66
160+
#define DAC1 D67
121161

122162
// LEDs PIN Definition
123-
#define LED_L D13
124-
#define LED_BUILTIN D13
163+
#define LED_L D13
164+
#define LED_BUILTIN D13
125165

126166
// CAN PIN
127-
#define CANRX D68
128-
#define CANTX D69
167+
#define CANRX D68
168+
#define CANTX D69
129169
// #define CANRX1 D
130170
// #define CANTX1 D
131171

132172
// SPI PIN
133-
#define MISO D72
134-
#define SCK D73
135-
#define MOSI D74
136-
#define SS D23
137-
#define MISO1 D12
138-
#define SCK1 D13
139-
#define MOSI1 D11
140-
#define SS1 D10
173+
#define MISO D72
174+
#define SCK D73
175+
#define MOSI D74
176+
#define SS D23
177+
#define MISO1 D12
178+
#define SCK1 D13
179+
#define MOSI1 D11
180+
#define SS1 D10
141181

142182
// I2C PIN
143-
#define SCL D70
144-
#define SDA D71
145-
#define SDA1 D20
146-
#define SCL1 D21
183+
#define SCL D70
184+
#define SDA D71
185+
#define SDA1 D20
186+
#define SCL1 D21
147187

148188
// SERIAL PORT PIN
149-
#define RX D0
150-
#define TX D1
151-
#define RX1 D19
152-
#define TX1 D18
153-
#define RX2 D17
154-
#define TX2 D16
155-
#define RX3 D15
156-
#define TX3 D14
189+
#define RX D0
190+
#define TX D1
191+
#define RX1 D19
192+
#define TX1 D18
193+
#define RX2 D17
194+
#define TX2 D16
195+
#define RX3 D15
196+
#define TX3 D14
157197

158198
// WIFI POWER PIN
159-
#define WIFI_PWR D75
199+
#define WIFI_PWR D75
160200

161201
// USB POWER PIN
162-
#define USB_PWR D76
202+
#define USB_PWR D76
163203

164204
// LCD CONTROL
165-
#define LCD_BL D77
205+
#define LCD_BL D77
166206

167207
// MIC SEL
168-
#define MIC_SEL D78
169-
#define CODEC 0
170-
#define MCU 1
208+
#define MIC_SEL D78
209+
#define CODEC 0
210+
#define MCU 1
171211

172212
#endif
173213
#endif

0 commit comments

Comments
 (0)