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

Development #13

Merged
merged 3 commits into from
Mar 3, 2017
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
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Arduino Core for STM32F4 CPU

This repository contains the source code and configuration files of the Arduino Core
for ST Microelectronics STM32F4 processor (used on the Arduino STAR OTTO).

## Installation on Arduino IDE

This core is available as a package in the Arduino IDE cores manager.
Just open the "Boards Manager" and install the package called:

"Arduino STM32F4 Boards (32-bit ARM Cortex-M4)"

## Support

There is a dedicated section of the Arduino Forum for general discussion and project assistance:

http://forum.arduino.org/index.php?board=98.0

## Bugs or Issues

If you find a bug you can submit an issue here on github:

https://github.com/arduino/Arduino-core-stm32f4/issues

Before posting a new issue, please check if the same problem has been already reported by someone else
to avoid duplicates.

## Contributions

Contributions are always welcome. The preferred way to receive code cotribution is by submitting a
Pull Request on github.

## Hourly builds

This repository is under a Continuous Integration system that every hour checks if there are updates and
builds a release for testing (the so called "Hourly builds").

The hourly builds are available through Boards Manager. If you want to install them:
1. Open the **Preferences** of the Arduino IDE.
2. Add this URL `http://downloads.arduino.cc/Hourly/STM32F4/package_stm32f4-hourly-build_index.json` in the **Additional Boards Manager URLs** field, and click OK.
3. Open the **Boards Manager** (menu Tools->Board->Board Manager...)
4. Install **Arduino STM32F4 core - Hourly build**
5. Select one of the boards under **STM32F4 Hourly build XX** in Tools->Board menu
6. Compile/Upload as usual

If you already installed an hourly build and you want to update it with the latest:
1. Open the **Boards Manager** (menu Tools->Board->Board Manager...)
2. Remove **Arduino SAMD core - Hourly build**
3. Install again **Arduino SAMD core - Hourly build**, the Board Manager will download the latest build replacing the old one.

## License and credits

This core has been developed by Arduino.org in collaboration with STM.

```
Copyright (c) 2017 Arduino.org All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
60 changes: 3 additions & 57 deletions cores/arduino/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,70 +43,16 @@
#include "adc.h"

#include "wiring_time.h"

/**
* Specifies a GPIO pin behavior.
* @see pinMode()
*/
typedef enum WiringPinMode {
OUTPUT, /**< Basic digital output: when the pin is HIGH, the
voltage is held at +3.3v (Vcc) and when it is LOW, it
is pulled down to ground. */

OUTPUT_OPENDRAIN, /**< In open drain mode, the pin indicates
"low" by accepting current flow to ground
and "high" by providing increased
impedance. An example use would be to
connect a pin to a bus line (which is pulled
up to a positive voltage by a separate
supply through a large resistor). When the
pin is high, not much current flows through
to ground and the line stays at positive
voltage; when the pin is low, the bus
"drains" to ground with a small amount of
current constantly flowing through the large
resistor from the external supply. In this
mode, no current is ever actually sourced
from the pin. */

INPUT, /**< Basic digital input. The pin voltage is sampled; when
it is closer to 3.3v (Vcc) the pin status is high, and
when it is closer to 0v (ground) it is low. If no
external circuit is pulling the pin voltage to high or
low, it will tend to randomly oscillate and be very
sensitive to noise (e.g., a breath of air across the pin
might cause the state to flip). */

INPUT_PULLUP, /**< The state of the pin in this mode is reported
the same way as with INPUT, but the pin voltage
is gently "pulled up" towards +3.3v. This means
the state will be high unless an external device
is specifically pulling the pin down to ground,
in which case the "gentle" pull-up will not
affect the state of the input. */

INPUT_PULLDOWN, /**< The state of the pin in this mode is reported
the same way as with INPUT, but the pin voltage
is gently "pulled down" towards 0v. This means
the state will be low unless an external device
is specifically pulling the pin up to 3.3v, in
which case the "gentle" pull-down will not
affect the state of the input. */

INPUT_FLOAT, /**< Synonym for INPUT. */

OUTPUT_DAC, /**< This is a special mode for when the pin will be used for
PWM output (a special case of digital output). */
} WiringPinMode;
#include "wiring_constants.h"

/**
* Configure behavior of a GPIO pin.
*
* @param pin Number of pin to configure.
* @param mode Mode corresponding to desired pin behavior.
* @see WiringPinMode
* @see PinMode
*/
void pinMode(uint8 pin, WiringPinMode mode);
void pinMode(uint8 pin, uint8 mode);

/**
* Writes a (digital) value to a pin. The pin must have its
Expand Down
23 changes: 23 additions & 0 deletions cores/arduino/wiring_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@
extern "C"{
#endif

#define INPUT 0x0
#define OUTPUT 0x1
#define INPUT_PULLUP 0x2
#define OUTPUT_OPENDRAIN 0x3
#define INPUT_PULLUP 0x4
#define INPUT_PULLDOWN 0x5
#define INPUT_FLOAT 0x6
#define OUTPUT_DAC 0x7

#define true 0x1
#define false 0x0

#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398
#define TWO_PI 6.283185307179586476925286766559
#define DEG_TO_RAD 0.017453292519943295769236907684886
#define RAD_TO_DEG 57.295779513082320876798154814105
#define EULER 2.718281828459045235360287471352

#define SERIAL 0x0
#define DISPLAY 0x1


typedef unsigned short word;

enum BitOrder {
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/wiring_digital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "Arduino.h"
#include "dac.h"

void pinMode(uint8 pin, WiringPinMode mode)
void pinMode(uint8 pin, uint8 mode)
{
gpio_pin_mode outputMode;
boolean pwm = false;
Expand Down