mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ad...@apache.org
Subject [1/2] incubator-mynewt-site git commit: Add pin-wheel mod link
Date Tue, 07 Jun 2016 00:20:54 GMT
Repository: incubator-mynewt-site
Updated Branches:
  refs/heads/master 56239e786 -> 76edc440a


Add pin-wheel mod link

Add a link to the pin-wheel modifications


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/5c891057
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/5c891057
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/5c891057

Branch: refs/heads/master
Commit: 5c8910572b3af080b92b2fdac04b45f034813c90
Parents: 56239e7
Author: David G. Simmons <santafen@mac.com>
Authored: Mon Jun 6 17:38:13 2016 -0400
Committer: David G. Simmons <santafen@mac.com>
Committed: Mon Jun 6 17:38:13 2016 -0400

----------------------------------------------------------------------
 docs/os/tutorials/STM32F303.md        |  2 +
 docs/os/tutorials/pin-wheel-blinky.md | 99 ++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/5c891057/docs/os/tutorials/STM32F303.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/STM32F303.md b/docs/os/tutorials/STM32F303.md
index 4e546b5..9a79e58 100644
--- a/docs/os/tutorials/STM32F303.md
+++ b/docs/os/tutorials/STM32F303.md
@@ -203,6 +203,8 @@ $ newt -v load stmf3_blinky
 
 Congratulations! You have built, downloaded, and run your first application using mynewt
for the stm32f3 discovery board. One of the LEDs on the LED wheel should be blinking at 1
Hz.
 
+Want to make your board do something a little more exciting withthe LEDs? Then Try making
the modifications to the Blinky app to make it a [pin-wheel app](pin-wheel-mods.md) and you
can light all the LEDs in a pin-wheel fashion.
+
 We have more fun tutorials for you to get your hands dirty. Be bold and try other Blinky-like
[tutorials](../tutorials/nRF52.md) or try enabling additional functionality such as [remote
comms](project-target-slinky.md) on the current board.
 
 If you see anything missing or want to send us feedback, please do so by signing up for appropriate
mailing lists on our [Community Page](../../community.md).

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/5c891057/docs/os/tutorials/pin-wheel-blinky.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/pin-wheel-blinky.md b/docs/os/tutorials/pin-wheel-blinky.md
new file mode 100644
index 0000000..abc8202
--- /dev/null
+++ b/docs/os/tutorials/pin-wheel-blinky.md
@@ -0,0 +1,99 @@
+## Pin Wheel Modifications to "Blinky" on STM32F3 Discovery
+<br>
+### Objective
+
+Learn how to modify an existing app -- the [blinky](STM32F303.md) app -- to light all the
LEDs on the STM32F3 Discovery board. 
+
+<br>
+
+### What you need
+
+* Discovery kit with STM32F303VC MCU
+* Laptop running Mac OSX. 
+* It is assumed you have already installed and run the [blinky](STM32F303.md) app succesfully.
+
+<br>
+
+Since you've already successfully created your blinky app project, you'll need to modify
only one file, main.c, in order to get this app working.
+
+<br>
+
+The main.c file resides in the apps/blinky/src directory in your project folder so you can
edit it with your favorite editor. You'll make the following changes:
+
+<br>
+
+Replace the line:
+
+
+``
+int g_led_pin;
+``
+
+With the line:
+
+``
+int g_led_pins[8] = {LED_BLINK_PIN_1, LED_BLINK_PIN_2, LED_BLINK_PIN_3, LED_BLINK_PIN_4,
LED_BLINK_PIN_5, LED_BLINK_PIN_6, LED_BLINK_PIN_7, LED_BLINK_PIN_8};
+``
+
+So that you now have an array of all 8 LED Pins on the board.
+
+Delete the line:
+
+``
+g_led_pin = LED_BLINK_PIN;
+``
+
+And in its place, add the following lines to initialize all the LED_PINS correctly:
+
+``
+int x;
+for(x = 0; x < 8; x++){
+    hal_gpio_init_out(g_led_pins[x], 1);
+}
+int p = 0;
+``
+
+We'll use that 'p' later. Next you'll want to change the line:
+
+``
+os_time_delay(1000);
+``
+
+to a shorter time in order to make it a little more interesting. A full 1 second delay doesn't
look great, so try 100 for starters and then you can adjust it to your liking.
+
+Finally, change the line:
+
+``
+hal_gpio_toggle(g_led_pin);
+``
+
+to look like this:
+
+``
+hal_gpio_toggle(g_led_pins[p++]);
+p = (p > 7) ? 0 : p;
+``
+
+<br>
+
+### Build the target and executables and download the images
+
+Run the same commands you used on the blinky app to build and load this one:
+
+```no-highlight
+$ newt create-image stmf3_blinky 1.2.3
+App image successfully generated: ~/dev/myproj/bin/stmf3_blinky/apps/blinky/blinky.img
+Build manifest:~/dev/myproj/bin/stmf3_blinky/apps/blinky/manifest.json
+$ newt -v load stmf3_boot
+$ newt -v load stmf3_blinky
+```
+
+<br>
+
+### Watch the LEDs go round and round
+
+The colored LEDs should now all light up in succession, and once they're all lit, they should
then go off in the same order. This should repeat continuously.
+
+If you see anything missing or want to send us feedback, please do so by signing up for appropriate
mailing lists on our [Community Page](../../community.md).
+
+Keep on hacking and blinking!


Mime
View raw message