mirror of
https://github.com/platformio/platformio-core.git
synced 2025-11-15 14:59:28 +01:00
Move examples to own repo https://github.com/platformio/platformio-examples
This commit is contained in:
1
examples/stm32/stm32-cmsis-blink/.gitignore
vendored
1
examples/stm32/stm32-cmsis-blink/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
.pioenvs
|
||||
@@ -1,65 +0,0 @@
|
||||
# Continuous Integration (CI) is the practice, in software
|
||||
# engineering, of merging all developer working copies with a shared mainline
|
||||
# several times a day < http://docs.platformio.org/en/latest/ci/index.html >
|
||||
#
|
||||
# Documentation:
|
||||
#
|
||||
# * Travis CI Embedded Builds with PlatformIO
|
||||
# < https://docs.travis-ci.com/user/integration/platformio/ >
|
||||
#
|
||||
# * PlatformIO integration with Travis CI
|
||||
# < http://docs.platformio.org/en/latest/ci/travis.html >
|
||||
#
|
||||
# * User Guide for `platformio ci` command
|
||||
# < http://docs.platformio.org/en/latest/userguide/cmd_ci.html >
|
||||
#
|
||||
#
|
||||
# Please choose one of the following templates (proposed below) and uncomment
|
||||
# it (remove "# " before each line) or use own configuration according to the
|
||||
# Travis CI documentation (see above).
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Template #1: General project. Test it using existing `platformio.ini`.
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
#
|
||||
# script:
|
||||
# - platformio run
|
||||
|
||||
|
||||
#
|
||||
# Template #2: The project is intended to by used as a library with examples
|
||||
#
|
||||
|
||||
# language: python
|
||||
# python:
|
||||
# - "2.7"
|
||||
#
|
||||
# sudo: false
|
||||
# cache:
|
||||
# directories:
|
||||
# - "~/.platformio"
|
||||
#
|
||||
# env:
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/file.c
|
||||
# - PLATFORMIO_CI_SRC=examples/file.ino
|
||||
# - PLATFORMIO_CI_SRC=path/to/test/directory
|
||||
#
|
||||
# install:
|
||||
# - pip install -U platformio
|
||||
#
|
||||
# script:
|
||||
# - platformio ci --lib="." --board=TYPE_1 --board=TYPE_2 --board=TYPE_N
|
||||
@@ -1,29 +0,0 @@
|
||||
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
How to build PlatformIO based project
|
||||
=====================================
|
||||
|
||||
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
||||
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
|
||||
3. Extract ZIP archive
|
||||
4. Run these commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Change directory to example
|
||||
> cd platformio-develop/examples/stm32/stm32-cmsis-blink
|
||||
|
||||
# Process example project
|
||||
> platformio run
|
||||
|
||||
# Upload firmware
|
||||
> platformio run --target upload
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
This directory is intended for the project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link to executable file.
|
||||
|
||||
The source code of each library should be placed in separate directory, like
|
||||
"lib/private_lib/[here are source files]".
|
||||
|
||||
For example, see how can be organized `Foo` and `Bar` libraries:
|
||||
|
||||
|--lib
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |- readme.txt --> THIS FILE
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
Then in `src/main.c` you should use:
|
||||
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
// rest H/C/CPP code
|
||||
|
||||
PlatformIO will find your libraries automatically, configure preprocessor's
|
||||
include paths and build them.
|
||||
|
||||
See additional options for PlatformIO Library Dependency Finder `lib_*`:
|
||||
|
||||
http://docs.platformio.org/en/latest/projectconf.html#lib-install
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#
|
||||
# Project Configuration File
|
||||
#
|
||||
# A detailed documentation with the EXAMPLES is located here:
|
||||
# http://docs.platformio.org/en/latest/projectconf.html
|
||||
#
|
||||
|
||||
# A sign `#` at the beginning of the line indicates a comment
|
||||
# Comment lines are ignored.
|
||||
|
||||
# Simple and base environment
|
||||
# [env:mybaseenv]
|
||||
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||
# framework =
|
||||
# board =
|
||||
#
|
||||
# Automatic targets - enable auto-uploading
|
||||
# targets = upload
|
||||
|
||||
[env:disco_f407vg]
|
||||
platform = ststm32
|
||||
framework = cmsis
|
||||
board = disco_f407vg
|
||||
|
||||
[env:disco_l152rb]
|
||||
platform = ststm32
|
||||
framework = cmsis
|
||||
board = disco_l152rb
|
||||
|
||||
[env:disco_f303vc]
|
||||
platform = ststm32
|
||||
framework = cmsis
|
||||
board = disco_f303vc
|
||||
@@ -1,45 +0,0 @@
|
||||
#ifdef STM32L1
|
||||
#include "stm32l1xx.h"
|
||||
#define LEDPORT (GPIOB)
|
||||
#define LED1 (6)
|
||||
#define LED2 (7)
|
||||
#define ENABLE_GPIO_CLOCK (RCC->AHBENR |= RCC_AHBENR_GPIOBEN)
|
||||
#define GPIOMODER ((GPIO_MODER_MODER7_0|GPIO_MODER_MODER6_0))
|
||||
#elif STM32F3
|
||||
#include "stm32f3xx.h"
|
||||
#define LEDPORT (GPIOE)
|
||||
#define LED1 (8)
|
||||
#define LED2 (9)
|
||||
#define ENABLE_GPIO_CLOCK (RCC->AHBENR |= RCC_AHBENR_GPIOEEN)
|
||||
#define GPIOMODER ((GPIO_MODER_MODER9_0|GPIO_MODER_MODER8_0))
|
||||
#elif STM32F4
|
||||
#include "stm32f4xx.h"
|
||||
#define LEDPORT (GPIOD)
|
||||
#define LED1 (12)
|
||||
#define LED2 (13)
|
||||
#define ENABLE_GPIO_CLOCK (RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN)
|
||||
#define GPIOMODER ((GPIO_MODER_MODER13_0|GPIO_MODER_MODER12_0))
|
||||
#endif
|
||||
|
||||
|
||||
void ms_delay(int ms)
|
||||
{
|
||||
while (ms-- > 0) {
|
||||
volatile int x=500;
|
||||
while (x-- > 0)
|
||||
__asm("nop");
|
||||
}
|
||||
}
|
||||
|
||||
//Alternates blue and green LEDs quickly
|
||||
int main(void)
|
||||
{
|
||||
ENABLE_GPIO_CLOCK; // enable the clock to GPIO
|
||||
LEDPORT->MODER |= GPIOMODER; // set pins to be general purpose output
|
||||
for (;;) {
|
||||
ms_delay(500);
|
||||
LEDPORT->ODR ^= (1<<LED1|1<<LED2); // toggle diodes
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user