@@ -27,6 +27,60 @@ for others as well. The documentation is incomplete and written in a wild
2727mix of English and German, but hopefully you can still figure it out.
2828
2929
30+ ## Usage
31+
32+ If you have ever used the Arduino environment before you will feel at home
33+ right away. The compilation is controlled by a makefile based on the amazing
34+ [ Arduino.mk makefile] ( https://github.com/sudar/Arduino-Makefile ) by
35+ [ Sudar] ( http://sudarmuthu.com> ) .
36+
37+ Let's blink an LED using the Blink example from Arduino:
38+
39+ ```
40+ /*
41+ Blink
42+ Turns on an LED on for one second, then off for one second, repeatedly.
43+
44+ This example code is in the public domain.
45+ */
46+
47+ #include <Arduino.h>
48+
49+ // Pin 13 has an LED connected on most Arduino boards.
50+ // Pin 3 for the STM8S103 break out board
51+ // give it a name:
52+ int led = PIN_LED_BUILDIN;
53+
54+ // the setup routine runs once when you press reset:
55+ void setup() {
56+ // initialize the digital pin as an output.
57+ pinMode(led, OUTPUT);
58+ }
59+
60+ // the loop routine runs over and over again forever:
61+ void loop() {
62+ digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
63+ delay(1000); // wait for a second
64+ digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
65+ delay(1000); // wait for a second
66+ }
67+ ```
68+
69+ All we need for a full build is this very basic ` Makefile ` :
70+
71+ ```
72+ BOARD_TAG = stm8sblue
73+
74+ include ../../sduino/sduino.mk
75+ ```
76+
77+ Compile and upload it:
78+
79+ make upload
80+
81+ Done! Your first STM8 based project is up and running!
82+
83+
3084
3185## Tools used
3286
@@ -39,9 +93,9 @@ SDCC support for the STM8 is still quite fresh and not very mature. It
3993improves significantly from version to version. Be sure to use
4094[ the latest snapshot build] ( http://sdcc.sourceforge.net/snap.php ) from the
4195[ project site on sourceforge] ( http://sdcc.sourceforge.net/ ) , not the older
42- version that might be included in your distribution. Version 3.5.0 as included with
43- ubuntu 16.04 is definitly too old and compilation will fail due to some
44- compiler errors.
96+ version that might be included in your distribution. Version 3.5.0 as
97+ included with ubuntu 16.04 is definitly too old and compilation will fail
98+ due to some compiler errors.
4599
46100Support for the Cosmic compiler under Windows and integration into the ST
47101visual developer IDE might be possible, but is not done (yet?).
@@ -112,27 +166,22 @@ an option.
112166
113167
114168
115- ## Usage
116-
117- No real documentation yet. Have a look in the ` test ` directory and use one of the Makefiles as a template.
118-
119-
120169## Included libraries
121170
122- ** I2C** : The [ I2C master library ]
123- (http://www.dsscircuits.com/articles/arduino-i2c-master-library )
171+ ** I2C** : The
172+ [ I2C master library ] (http://www.dsscircuits.com/articles/arduino-i2c-master-library )
124173by Wayne Truchsess offers some significant advantages over the Wire/TWI
125174library included in the standard arduino environment: It fixes some possible
126175deadlock situations, it allows for communication using a repeated start
127176condition as required by some devices, the code is much more compact and the
128177structure is easier to understand.
129178
130- So I decided to port this library instead of the standard one. the current
131- state does not include the deadlock protection, though.
179+ The current state of the port does not include the deadlock protection,
180+ though.
132181
133182
134183** ssd1306** : Driver for SSD1306-based monochrome OLED display with 128x64
135- pixels. Based on the Adafruit-libray.
184+ pixels. I2C support only. Based on the Adafruit-libray.
136185
137186
138187## Why use a STM8 instead of an ATmega?
0 commit comments