├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── board-manager ├── .gitignore ├── Makefile ├── Makefile.core ├── Makefile.sdcc ├── Makefile.tools ├── README.md ├── assemble.sh ├── gen_arduino_package_file.sh ├── gen_platform_entry.sh ├── gen_tools_entry.sh ├── minimize-sdcc.sh ├── package_template.json └── parts │ ├── platform-entry-sduino-0.3.0.txt │ ├── platform-entry-sduino-0.3.1.txt │ ├── platform-entry-sduino-0.3.2.txt │ ├── platform-entry-sduino-0.3.3.txt │ ├── tools-entry-sdcc-10088.txt │ ├── tools-entry-sduino-tools-2017.10.21.txt │ ├── tools-entry-sduino-tools-2017.11.06.txt │ └── tools-entry-sduino-tools-2017.11.13.txt ├── docs ├── about.md ├── api │ ├── HardwareSerial.md │ ├── I2C.md │ ├── LiquidCrystal.md │ ├── Mini_SSD1306.md │ ├── PCD8544.md │ ├── Print.md │ ├── SPI.md │ ├── Servo.md │ ├── Stepper.md │ ├── migration.md │ └── oled-ssd1306.jpg ├── contact.md ├── developer │ ├── bare-metal-programming.md │ ├── ide-integration.md │ ├── links.md │ ├── macro.md │ ├── performance.md │ ├── pin_mapping.md │ ├── sdcc.md │ └── spl.md ├── hardware │ ├── ST-LinkV2_pinout_01.jpg │ ├── Schematic1.png │ ├── esp14.md │ ├── esp14.png │ ├── esp14.svg │ ├── flashtool.md │ ├── st-link-v2-dongle.png │ ├── st-link_v2_baite.pdf │ ├── st-link_v2_baite.svg │ ├── stm8blue.md │ ├── stm8blue.png │ ├── stm8blue.svg │ ├── stm8board-pinout.jpg │ └── stm8sdiscovery.md ├── index.md └── usage │ ├── board-manager-install.md │ ├── build-cli.md │ ├── build-ide.md │ ├── limitations.md │ ├── manual-install.md │ ├── status-todo.md │ ├── update-to-manual.md │ └── why-stm8.md ├── examples ├── blink-spl │ ├── Makefile │ ├── README.md │ ├── blink_spl.c │ ├── stm8s_conf.h │ └── stm8s_it.h ├── fade-all-pins │ ├── Makefile │ └── fade-all-pins.c ├── ping-hc04 │ ├── Makefile │ ├── ping-hc04.c │ └── ping-hc04.txt ├── sdcc-examples-stm8 │ ├── Makefile │ ├── README.md │ ├── blinky.c │ ├── stm8l.h │ ├── stm8s.h │ └── uart.c ├── uart-int │ ├── Makefile │ ├── README.md │ ├── stm8s_conf.h │ ├── stm8s_it.h │ └── uart-int.c ├── uart-ringbuffer │ ├── Makefile │ ├── README.md │ ├── stm8s_conf.h │ ├── stm8s_it.h │ ├── uart-ringbuffer.c │ └── uart-ringbuffer.h └── uart-spl │ ├── Makefile │ ├── README.md │ ├── stm8s_conf.h │ ├── stm8s_it.h │ └── uart_spl.c ├── mkdocs.yml ├── package_sduino_stm8_index.json ├── sduino ├── Arduino.mk ├── Common.mk ├── hardware │ └── sduino │ │ ├── stm8 │ │ ├── boards.txt │ │ ├── cores │ │ │ └── sduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── HardwareSerial.c │ │ │ │ ├── HardwareSerial.h │ │ │ │ ├── Print-float.c │ │ │ │ ├── Print.c │ │ │ │ ├── Print.h │ │ │ │ ├── SPI.c │ │ │ │ ├── SPI.h │ │ │ │ ├── Serial.h │ │ │ │ ├── WInterrupts.c │ │ │ │ ├── WMath.c │ │ │ │ ├── binary.h │ │ │ │ ├── main.c │ │ │ │ ├── stm8 │ │ │ │ ├── pins_arduino.h │ │ │ │ ├── stm8.h │ │ │ │ ├── stm8_build_defines.h │ │ │ │ ├── stm8_tim4.h │ │ │ │ ├── stm8l_ini.h │ │ │ │ ├── stm8s_ini.h │ │ │ │ └── stm8s_legacy.h │ │ │ │ ├── utils │ │ │ │ ├── debug.h │ │ │ │ └── fastIO.h │ │ │ │ ├── weak_functions.c │ │ │ │ ├── wiring.c │ │ │ │ ├── wiring_analog.c │ │ │ │ ├── wiring_digital.c │ │ │ │ ├── wiring_private.h │ │ │ │ ├── wiring_pulse.c │ │ │ │ ├── wiring_shift.c │ │ │ │ └── xmacro.h │ │ ├── keywords.txt │ │ ├── libraries │ │ │ ├── Generic_Examples │ │ │ │ ├── empty.h │ │ │ │ └── examples │ │ │ │ │ ├── 01.Basics │ │ │ │ │ ├── AnalogReadSerial │ │ │ │ │ │ ├── AnalogReadSerial.ino │ │ │ │ │ │ ├── AnalogReadSerial.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── BareMinimum │ │ │ │ │ │ ├── BareMinimum.ino │ │ │ │ │ │ ├── BareMinimum.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Blink │ │ │ │ │ │ ├── Blink.ino │ │ │ │ │ │ ├── Blink.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── DigitalReadSerial │ │ │ │ │ │ ├── DigitalReadSerial.ino │ │ │ │ │ │ ├── DigitalReadSerial.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Fade │ │ │ │ │ │ ├── Fade.ino │ │ │ │ │ │ ├── Fade.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ └── ReadAnalogVoltage │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── ReadAnalogVoltage.ino │ │ │ │ │ │ └── ReadAnalogVoltage.txt │ │ │ │ │ ├── 02.Digital │ │ │ │ │ ├── BlinkWithoutDelay │ │ │ │ │ │ ├── BlinkWithoutDelay.ino │ │ │ │ │ │ ├── BlinkWithoutDelay.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Button │ │ │ │ │ │ ├── Button.ino │ │ │ │ │ │ ├── Button.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Debounce │ │ │ │ │ │ ├── Debounce.ino │ │ │ │ │ │ ├── Debounce.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── button.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── DigitalInputPullup │ │ │ │ │ │ ├── DigitalInputPullup.ino │ │ │ │ │ │ ├── DigitalInputPullup.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ └── StateChangeDetection │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── StateChangeDetection.ino │ │ │ │ │ │ ├── StateChangeDetection.txt │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── 03.Analog │ │ │ │ │ ├── AnalogInOutSerial │ │ │ │ │ │ ├── AnalogInOutSerial.ino │ │ │ │ │ │ ├── AnalogInOutSerial.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── AnalogInput │ │ │ │ │ │ ├── AnalogInput.ino │ │ │ │ │ │ ├── AnalogInput.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── Calibration │ │ │ │ │ │ ├── Calibration.ino │ │ │ │ │ │ ├── Calibration.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── Fading │ │ │ │ │ │ ├── Fading.ino │ │ │ │ │ │ ├── Fading.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ └── Smoothing │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── Smoothing.ino │ │ │ │ │ │ ├── Smoothing.txt │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── 04.Communication │ │ │ │ │ ├── ASCIITable │ │ │ │ │ │ ├── ASCIITable.ino │ │ │ │ │ │ ├── ASCIITable.txt │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Dimmer │ │ │ │ │ │ ├── Dimmer.ino │ │ │ │ │ │ ├── Dimmer.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── Graph │ │ │ │ │ │ ├── Graph.ino │ │ │ │ │ │ ├── Graph.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── SerialCallResponse │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── SerialCallResponse.ino │ │ │ │ │ │ ├── SerialCallResponse.txt │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ └── SerialCallResponseASCII │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── SerialCallResponseASCII.ino │ │ │ │ │ │ ├── SerialCallResponseASCII.txt │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── 06.Sensors │ │ │ │ │ └── Ping │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── Ping.ino │ │ │ │ │ │ ├── Ping.txt │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ ├── 07.Display │ │ │ │ │ └── barGraph │ │ │ │ │ │ ├── LEDBarGraph.txt │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── barGraph.ino │ │ │ │ │ │ ├── layout.png │ │ │ │ │ │ └── schematic.png │ │ │ │ │ └── 08.extend │ │ │ │ │ ├── Blink │ │ │ │ │ ├── Blink.ino │ │ │ │ │ ├── Blink.txt │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Blink_FastIO │ │ │ │ │ └── Blink_FastIO.ino │ │ │ │ │ ├── Blink_MACRO │ │ │ │ │ └── Blink_MACRO.ino │ │ │ │ │ ├── Blink_SPL │ │ │ │ │ └── Blink_SPL.ino │ │ │ │ │ ├── showPortLever │ │ │ │ │ └── showPortLever.ino │ │ │ │ │ ├── systic_callback │ │ │ │ │ └── systic_callback.ino │ │ │ │ │ └── testPin │ │ │ │ │ └── testPin.ino │ │ │ ├── I2C │ │ │ │ ├── I2C.c │ │ │ │ ├── I2C.h │ │ │ │ ├── examples │ │ │ │ │ └── HMC5883L │ │ │ │ │ │ └── HMC5883L.pde │ │ │ │ └── keywords.txt │ │ │ ├── LiquidCrystal │ │ │ │ ├── README.adoc │ │ │ │ ├── examples │ │ │ │ │ ├── Autoscroll │ │ │ │ │ │ ├── Autoscroll.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Blink │ │ │ │ │ │ ├── Blink.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Cursor │ │ │ │ │ │ ├── Cursor.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── CustomCharacter │ │ │ │ │ │ ├── CustomCharacter.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Display │ │ │ │ │ │ ├── Display.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── HelloWorld │ │ │ │ │ │ ├── HelloWorld.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ ├── Scroll │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── Scroll.ino │ │ │ │ │ ├── SerialDisplay │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── SerialDisplay.ino │ │ │ │ │ ├── TextDirection │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── TextDirection.ino │ │ │ │ │ └── setCursor │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── setCursor.ino │ │ │ │ ├── keywords.txt │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ │ ├── LiquidCrystal.c │ │ │ │ │ └── LiquidCrystal.h │ │ │ ├── Mini_SSD1306 │ │ │ │ ├── Mini_SSD1306.c │ │ │ │ ├── Mini_SSD1306.h │ │ │ │ └── examples │ │ │ │ │ └── oled-mini │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── Makefile.classic │ │ │ │ │ └── oled-mini.ino │ │ │ ├── PCD8544 │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── PCD8544.c │ │ │ │ ├── PCD8544.h │ │ │ │ ├── README.md │ │ │ │ ├── charset.inc │ │ │ │ ├── examples │ │ │ │ │ ├── HelloWorld │ │ │ │ │ │ ├── HelloWorld.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ └── Thermometer │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── Thermometer.ino │ │ │ │ └── library.properties │ │ │ ├── Servo │ │ │ │ ├── README.adoc │ │ │ │ ├── examples │ │ │ │ │ ├── Knob │ │ │ │ │ │ ├── Knob.ino │ │ │ │ │ │ └── Makefile │ │ │ │ │ └── Sweep │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ └── Sweep.ino │ │ │ │ ├── keywords.txt │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ │ ├── Servo.h │ │ │ │ │ └── stm8 │ │ │ │ │ ├── Servo.c │ │ │ │ │ └── ServoTimers.h │ │ │ ├── SevenSegment │ │ │ │ ├── Example │ │ │ │ │ ├── VCmeter_vc288 │ │ │ │ │ │ └── VCmeter_vc288.ino │ │ │ │ │ ├── Vmeter_3digits │ │ │ │ │ │ ├── Vmeter_3digits.ino │ │ │ │ │ │ └── vmeter_3digs_1.jpg │ │ │ │ │ ├── showFloat │ │ │ │ │ │ ├── showFloat.ino │ │ │ │ │ │ └── vmeter_3digs_1.jpg │ │ │ │ │ └── shownum │ │ │ │ │ │ ├── shownum.ino │ │ │ │ │ │ └── vmeter_3digs_1.jpg │ │ │ │ ├── Extras │ │ │ │ │ ├── 108_2120928_55847cda17808de.jpg │ │ │ │ │ ├── 108_2120928_e6d09e566145f10.jpg │ │ │ │ │ ├── 67cb579dc52a.png │ │ │ │ │ └── SM41056_Datasheet.png │ │ │ │ ├── SevenSegment.c │ │ │ │ ├── SevenSegment.h │ │ │ │ └── keywords.txt │ │ │ └── Stepper │ │ │ │ ├── README.adoc │ │ │ │ ├── examples │ │ │ │ ├── MotorKnob │ │ │ │ │ ├── Makefile │ │ │ │ │ └── MotorKnob.ino │ │ │ │ ├── stepper_oneRevolution │ │ │ │ │ ├── Makefile │ │ │ │ │ └── stepper_oneRevolution.ino │ │ │ │ ├── stepper_oneStepAtATime │ │ │ │ │ ├── Makefile │ │ │ │ │ └── stepper_oneStepAtATime.ino │ │ │ │ └── stepper_speedControl │ │ │ │ │ ├── Makefile │ │ │ │ │ └── stepper_speedControl.ino │ │ │ │ ├── keywords.txt │ │ │ │ ├── library.properties │ │ │ │ └── src │ │ │ │ ├── Stepper.c │ │ │ │ └── Stepper.h │ │ ├── platform.txt │ │ ├── system │ │ │ ├── STM8L_StdPeriph_Driver │ │ │ │ ├── Release_Notes.html │ │ │ │ ├── compilelib.sh │ │ │ │ ├── inc │ │ │ │ │ ├── stm8l15x.h │ │ │ │ │ ├── stm8l15x_adc.h │ │ │ │ │ ├── stm8l15x_aes.h │ │ │ │ │ ├── stm8l15x_beep.h │ │ │ │ │ ├── stm8l15x_clk.h │ │ │ │ │ ├── stm8l15x_comp.h │ │ │ │ │ ├── stm8l15x_conf.h │ │ │ │ │ ├── stm8l15x_dac.h │ │ │ │ │ ├── stm8l15x_dma.h │ │ │ │ │ ├── stm8l15x_exti.h │ │ │ │ │ ├── stm8l15x_flash.h │ │ │ │ │ ├── stm8l15x_gpio.h │ │ │ │ │ ├── stm8l15x_i2c.h │ │ │ │ │ ├── stm8l15x_irtim.h │ │ │ │ │ ├── stm8l15x_it.h │ │ │ │ │ ├── stm8l15x_itc.h │ │ │ │ │ ├── stm8l15x_iwdg.h │ │ │ │ │ ├── stm8l15x_lcd.h │ │ │ │ │ ├── stm8l15x_pwr.h │ │ │ │ │ ├── stm8l15x_rst.h │ │ │ │ │ ├── stm8l15x_rtc.h │ │ │ │ │ ├── stm8l15x_spi.h │ │ │ │ │ ├── stm8l15x_syscfg.h │ │ │ │ │ ├── stm8l15x_tim1.h │ │ │ │ │ ├── stm8l15x_tim2.h │ │ │ │ │ ├── stm8l15x_tim3.h │ │ │ │ │ ├── stm8l15x_tim4.h │ │ │ │ │ ├── stm8l15x_tim5.h │ │ │ │ │ ├── stm8l15x_usart.h │ │ │ │ │ ├── stm8l15x_wfe.h │ │ │ │ │ └── stm8l15x_wwdg.h │ │ │ │ ├── lib │ │ │ │ │ ├── stm8l15x_hd.lib │ │ │ │ │ ├── stm8l15x_ld.lib │ │ │ │ │ ├── stm8l15x_md.lib │ │ │ │ │ └── stm8l15x_mdp.lib │ │ │ │ ├── src │ │ │ │ │ ├── stm8l15x_adc.c │ │ │ │ │ ├── stm8l15x_aes.c │ │ │ │ │ ├── stm8l15x_beep.c │ │ │ │ │ ├── stm8l15x_clk.c │ │ │ │ │ ├── stm8l15x_comp.c │ │ │ │ │ ├── stm8l15x_dac.c │ │ │ │ │ ├── stm8l15x_dma.c │ │ │ │ │ ├── stm8l15x_exti.c │ │ │ │ │ ├── stm8l15x_flash.c │ │ │ │ │ ├── stm8l15x_gpio.c │ │ │ │ │ ├── stm8l15x_i2c.c │ │ │ │ │ ├── stm8l15x_irtim.c │ │ │ │ │ ├── stm8l15x_itc.c │ │ │ │ │ ├── stm8l15x_iwdg.c │ │ │ │ │ ├── stm8l15x_lcd.c │ │ │ │ │ ├── stm8l15x_pwr.c │ │ │ │ │ ├── stm8l15x_rst.c │ │ │ │ │ ├── stm8l15x_rtc.c │ │ │ │ │ ├── stm8l15x_spi.c │ │ │ │ │ ├── stm8l15x_syscfg.c │ │ │ │ │ ├── stm8l15x_tim1.c │ │ │ │ │ ├── stm8l15x_tim2.c │ │ │ │ │ ├── stm8l15x_tim3.c │ │ │ │ │ ├── stm8l15x_tim4.c │ │ │ │ │ ├── stm8l15x_tim5.c │ │ │ │ │ ├── stm8l15x_usart.c │ │ │ │ │ ├── stm8l15x_wfe.c │ │ │ │ │ └── stm8l15x_wwdg.c │ │ │ │ └── stm8l15x-16x-05x_al31-l_stdperiph_drivers_um.chm │ │ │ ├── STM8S_StdPeriph_Driver │ │ │ │ ├── README.md │ │ │ │ ├── Release_Notes.html │ │ │ │ ├── compilelib.sh │ │ │ │ ├── correct_stm8s908.patch │ │ │ │ ├── inc │ │ │ │ │ ├── stm8s.h │ │ │ │ │ ├── stm8s_adc1.h │ │ │ │ │ ├── stm8s_adc2.h │ │ │ │ │ ├── stm8s_awu.h │ │ │ │ │ ├── stm8s_beep.h │ │ │ │ │ ├── stm8s_can.h │ │ │ │ │ ├── stm8s_clk.h │ │ │ │ │ ├── stm8s_conf.h │ │ │ │ │ ├── stm8s_exti.h │ │ │ │ │ ├── stm8s_flash.h │ │ │ │ │ ├── stm8s_gpio.h │ │ │ │ │ ├── stm8s_i2c.h │ │ │ │ │ ├── stm8s_it.h │ │ │ │ │ ├── stm8s_itc.h │ │ │ │ │ ├── stm8s_iwdg.h │ │ │ │ │ ├── stm8s_rst.h │ │ │ │ │ ├── stm8s_spi.h │ │ │ │ │ ├── stm8s_tim1.h │ │ │ │ │ ├── stm8s_tim2.h │ │ │ │ │ ├── stm8s_tim3.h │ │ │ │ │ ├── stm8s_tim4.h │ │ │ │ │ ├── stm8s_tim5.h │ │ │ │ │ ├── stm8s_tim6.h │ │ │ │ │ ├── stm8s_uart1.h │ │ │ │ │ ├── stm8s_uart2.h │ │ │ │ │ ├── stm8s_uart3.h │ │ │ │ │ ├── stm8s_uart4.h │ │ │ │ │ └── stm8s_wwdg.h │ │ │ │ ├── lib │ │ │ │ │ ├── STM8AF52Ax.lib │ │ │ │ │ ├── STM8AF622x.lib │ │ │ │ │ ├── STM8AF626x.lib │ │ │ │ │ ├── STM8AF62Ax.lib │ │ │ │ │ ├── STM8S003.lib │ │ │ │ │ ├── STM8S005.lib │ │ │ │ │ ├── STM8S007.lib │ │ │ │ │ ├── STM8S103.lib │ │ │ │ │ ├── STM8S105.lib │ │ │ │ │ ├── STM8S207.lib │ │ │ │ │ ├── STM8S208.lib │ │ │ │ │ └── STM8S903.lib │ │ │ │ ├── peripherie.ods │ │ │ │ ├── peripherie.png │ │ │ │ ├── src │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── doit │ │ │ │ │ ├── spl-splitprepare.patch │ │ │ │ │ ├── stm8s_adc1.c │ │ │ │ │ ├── stm8s_adc2.c │ │ │ │ │ ├── stm8s_awu.c │ │ │ │ │ ├── stm8s_beep.c │ │ │ │ │ ├── stm8s_can.c │ │ │ │ │ ├── stm8s_clk.c │ │ │ │ │ ├── stm8s_exti.c │ │ │ │ │ ├── stm8s_flash.c │ │ │ │ │ ├── stm8s_gpio.c │ │ │ │ │ ├── stm8s_i2c.c │ │ │ │ │ ├── stm8s_itc.c │ │ │ │ │ ├── stm8s_iwdg.c │ │ │ │ │ ├── stm8s_rst.c │ │ │ │ │ ├── stm8s_spi.c │ │ │ │ │ ├── stm8s_tim1.c │ │ │ │ │ ├── stm8s_tim2.c │ │ │ │ │ ├── stm8s_tim3.c │ │ │ │ │ ├── stm8s_tim4.c │ │ │ │ │ ├── stm8s_tim5.c │ │ │ │ │ ├── stm8s_tim6.c │ │ │ │ │ ├── stm8s_uart1.c │ │ │ │ │ ├── stm8s_uart2.c │ │ │ │ │ ├── stm8s_uart3.c │ │ │ │ │ ├── stm8s_uart4.c │ │ │ │ │ └── stm8s_wwdg.c │ │ │ │ ├── stm8s-a_stdperiph_drivers_um.chm │ │ │ │ └── tools │ │ │ │ │ └── showdeps.sh │ │ │ └── stm8chips │ │ │ │ ├── stm8_GpioVariant_20_1.h │ │ │ │ ├── stm8_GpioVariant_32_1.h │ │ │ │ ├── stm8_GpioVariant_32_2.h │ │ │ │ ├── stm8_GpioVariant_32_3.h │ │ │ │ ├── stm8_GpioVariant_32_4.h │ │ │ │ ├── stm8_GpioVariant_44_1.h │ │ │ │ ├── stm8_GpioVariant_48_1.h │ │ │ │ ├── stm8_GpioVariant_48_2.h │ │ │ │ ├── stm8_GpioVariant_64_1.h │ │ │ │ ├── stm8_GpioVariant_64_2.h │ │ │ │ ├── stm8_GpioVariant_80_1.h │ │ │ │ ├── stm8_Tim_20_1.h │ │ │ │ ├── stm8_Tim_20_2.h │ │ │ │ ├── stm8_Tim_32_1.h │ │ │ │ ├── stm8_Tim_32_2.h │ │ │ │ ├── stm8_Tim_32_3.h │ │ │ │ ├── stm8_Tim_32_4.h │ │ │ │ ├── stm8_Tim_44_1.h │ │ │ │ ├── stm8_Tim_48_1.h │ │ │ │ ├── stm8_Tim_48_2.h │ │ │ │ ├── stm8_Tim_64_1.h │ │ │ │ ├── stm8_Tim_64_2.h │ │ │ │ ├── stm8_Tim_80_1.h │ │ │ │ └── stm8_pinNum.h │ │ └── variants │ │ │ ├── l152c6t6_uda │ │ │ └── variant.h │ │ │ ├── l152r8t6_5d1 │ │ │ ├── doc │ │ │ │ ├── STM8L152R8.pdf │ │ │ │ ├── TS5A4595技术手册.pdf │ │ │ │ ├── l152_1.jpg │ │ │ │ ├── l152_2.jpg │ │ │ │ ├── l152_3.jpg │ │ │ │ ├── 引脚定义.jpg │ │ │ │ ├── 引脚定义.txt │ │ │ │ ├── 引脚定义.xlsx │ │ │ │ └── 怡成血糖仪电路.pdf │ │ │ └── variant.h │ │ │ ├── s003_vc288 │ │ │ ├── doc │ │ │ │ ├── 3digs.jpg │ │ │ │ ├── vc288-0.jpg │ │ │ │ ├── vc288-1.jpg │ │ │ │ └── vc288.jpg │ │ │ └── variant.h │ │ │ ├── s003_vmeter │ │ │ ├── doc │ │ │ │ ├── 3digs.jpg │ │ │ │ ├── 4digs.jpg │ │ │ │ ├── F3P6.jpg │ │ │ │ └── vmeter_3digs_1.jpg │ │ │ └── variant.h │ │ │ ├── stm8l152c │ │ │ └── variant.h │ │ │ ├── stm8l152r │ │ │ ├── variant.c │ │ │ └── variant.h │ │ │ ├── stm8s103f │ │ │ ├── doc │ │ │ │ └── F3P6.jpg │ │ │ └── variant.h │ │ │ ├── stm8s103k │ │ │ ├── doc │ │ │ │ ├── S103K3T6_PIN.jpg │ │ │ │ ├── STM8S103K3T6.jpg │ │ │ │ ├── s103k3t6.pdf │ │ │ │ └── stm8s103k3t6.xlsx │ │ │ └── variant.h │ │ │ ├── stm8s105c │ │ │ └── variant.h │ │ │ ├── stm8s105c_disco │ │ │ └── variant.h │ │ │ ├── stm8s105k │ │ │ ├── doc │ │ │ │ ├── stm8s_black_pinout.pdf │ │ │ │ └── stm8s_black_sch.pdf │ │ │ └── variant.h │ │ │ └── stm8s105k6 │ │ │ └── variant.h │ │ └── tools │ │ ├── linux32 │ │ ├── stm8flash │ │ └── stm8gal │ │ ├── linux64 │ │ ├── stm8flash │ │ └── stm8gal │ │ ├── macosx │ │ ├── stm8flash │ │ └── stm8gal │ │ └── wrapper │ │ ├── sdar.sh │ │ ├── sdcc-link.sh │ │ └── sdcc.sh ├── lib │ └── version.txt └── sduino.mk ├── test ├── adc1 │ ├── Makefile │ ├── Makefile.classic │ └── adc1.c ├── digitalWrite │ ├── Makefile │ ├── Makefile.classic │ ├── digitalWrite.c │ ├── stm8s_conf.h │ └── stm8s_it.h ├── iolib │ ├── Makefile │ ├── iolib.c │ ├── printhex.h │ └── printhex.s ├── libmake │ ├── Makefile │ ├── Makefile.classic │ ├── README.md │ ├── libmake.c │ └── stat.awk ├── print │ ├── Makefile │ ├── Makefile.classic │ └── print.c ├── pwm1 │ ├── Makefile │ ├── Makefile.classic │ └── pwm1.c ├── serial │ ├── Makefile │ ├── serial.c │ ├── stm8s_conf.h │ └── stm8s_it.h ├── serial2 │ ├── Makefile │ ├── Makefile.classic │ └── serial2.c ├── serialEvent │ ├── Makefile │ └── serialEvent.c ├── spi │ ├── Makefile │ ├── Makefile.classic │ └── spi.c ├── timer1 │ ├── Makefile │ ├── Makefile.classic │ └── timer1.c ├── timer2 │ ├── Makefile │ ├── Makefile.classic │ └── timer2.c ├── uart-nospl │ ├── Makefile │ └── uart-nospl.c └── valist │ ├── Makefile │ └── main.c └── tools └── sdcc-critcal.patch /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *bak 3 | .*.swp 4 | *.jsone 5 | # ignore all kinds of binary files: 6 | *.o 7 | *.bin 8 | *.ihx 9 | *.hex 10 | *.exe 11 | tags 12 | # ignore files generated by sdcc: 13 | *.cdb 14 | *.adb 15 | *.ihx 16 | *.asm 17 | *.lst 18 | *.rel 19 | *.rst 20 | *.sym 21 | *.lk 22 | *.map 23 | # ignore files generated by the Arduino make system: 24 | build-*/ 25 | # ignore files generated by patch: 26 | *.orig 27 | *.rej 28 | # ignore mkdocs build directory 29 | site/ 30 | # ignore my scratch directory 31 | notes/ 32 | -------------------------------------------------------------------------------- /board-manager/.gitignore: -------------------------------------------------------------------------------- 1 | package_testserver_index.json 2 | release 3 | -------------------------------------------------------------------------------- /board-manager/Makefile: -------------------------------------------------------------------------------- 1 | # the required versions for the new build 2 | COREVERSION=0.4.0-pre1 3 | SDCCVERSION=10088 4 | TOOLSVERSION=2017.11.13 5 | 6 | BASEURL=https://github.com/tenbaht/sduino/releases/download/v$(COREVERSION) 7 | 8 | PACKAGEFILE=package_sduino_stm8_index.json 9 | 10 | # version for pre-release testing on my private server at home 11 | TESTPACKAGEFILE=package_testserver_index.json 12 | TESTBASEURL=http://knecht.fritz.box/sduino 13 | TESTBASEDIR=knecht:/var/www/html/sduino 14 | 15 | # make sure these definitions are visible for the sub-makes 16 | export 17 | 18 | .PHONY: core tools sdcc clean upload release 19 | 20 | 21 | $(TESTPACKAGEFILE): ../$(PACKAGEFILE) 22 | sed 's#http.*/download/#$(TESTBASEURL)/release/#' $^ > $@ 23 | 24 | ../$(PACKAGEFILE): core tools sdcc 25 | @echo "Generating the package_index file." 26 | ./assemble.sh $@ 27 | 28 | core tools sdcc: 29 | make -f Makefile.$@ 30 | 31 | clean: 32 | rm -rf *~ *.jsone *.bak *.orig *.rej 33 | 34 | 35 | # upload to my private test server, totally useless for anybody else. 36 | upload: $(TESTPACKAGEFILE) 37 | @echo "uploading to $(TESTBASEDIR)" 38 | rsync -av -rsh=ssh --delete release $(TESTPACKAGEFILE) $(TESTBASEDIR) 39 | @echo "URL for board manager: $(TESTBASEURL)/$(TESTPACKAGEFILE)" 40 | 41 | DATE=$(shell date '+%F') 42 | 43 | release: 44 | # update the version number in the changelog if not already done: 45 | grep -q "$(COREVERSION)" ../CHANGELOG.md || \ 46 | sed "/^## \[Unreleased\]/ a\\\n\n## [$(COREVERSION) - $(DATE)]" ../CHANGELOG.md 47 | git add ../CHANGELOG.md 48 | git add parts/tools-*-$(SDCCVERSION).txt parts/tools-*-$(TOOLSVERSION).txt parts/platform-*-$(COREVERSION).txt 49 | git commit 50 | git tag v$(COREVERSION) 51 | -------------------------------------------------------------------------------- /board-manager/Makefile.core: -------------------------------------------------------------------------------- 1 | NAME=sduino 2 | COREVERSION?=0.3.2 3 | SDCCVERSION?=10088 4 | TOOLSVERSION?=2017.11.06 5 | 6 | # where to put the generated files 7 | COREDIR?=release/v$(COREVERSION) 8 | PARTSDIR?=parts 9 | 10 | # subtree of the repository to be included in the archive 11 | SUBTREE=sduino/hardware/sduino/stm8 12 | 13 | # 14 | ### No user serviceable part below here. ################################ 15 | # 16 | 17 | # filename for the generated core file 18 | COREFILE=$(COREDIR)/$(NAME)-core-$(COREVERSION).tar.bz2 19 | 20 | # filename for the new platform entry 21 | PLATFORM_ENTRY=$(PARTSDIR)/platform-entry-$(NAME)-$(COREVERSION).txt 22 | 23 | EXCLUDES=$(addprefix --exclude=, $(IGNORE)) 24 | 25 | # 26 | # The actual rules 27 | # 28 | 29 | # generate one platform entry for the new core file 30 | $(PLATFORM_ENTRY): $(COREFILE) 31 | ./gen_platform_entry.sh $^ "$(COREVERSION)" "$(SDCCVERSION)" "$(TOOLSVERSION)" |\ 32 | sed "s/^/ /" > $@ 33 | 34 | $(COREFILE): | $(COREDIR) 35 | echo "Generating the core archive file." 36 | (cd ..; git archive -v --prefix=./ --format=tar HEAD:$(SUBTREE))|\ 37 | bzip2 > $(COREFILE) 38 | 39 | # make a new release directory if not present 40 | # 41 | # make sure to define an order-only dependency on this rule by placing it on 42 | # the right side of a pipe symbol. This prevents rebuilding the archives 43 | # every time. 44 | $(COREDIR): 45 | mkdir -p $@ 46 | -------------------------------------------------------------------------------- /board-manager/Makefile.sdcc: -------------------------------------------------------------------------------- 1 | NAME=sdcc 2 | COREVERSION?=0.3.0 3 | SDCCVERSION?=10088 4 | 5 | # where to look for the original SDCC snapshot files 6 | #SNAPSHOTDIR=sdcc-snapshots 7 | 8 | # where to put the generated files 9 | SDCCDIR=release/v$(COREVERSION) 10 | PARTSDIR=parts 11 | 12 | VERSION=$(SDCCVERSION) 13 | 14 | # 15 | ### No user serviceable part below here. Only generated content. ######## 16 | # 17 | 18 | # The filename stem of the tools archives to be generated 19 | # (up to the first dash '-') 20 | TOOLS_STEM=$(SDCCDIR)/$(NAME) 21 | 22 | # The individual filenames for the different sdcc archives 23 | SDCC_TARS=$(wildcard $(TOOLS_STEM)-*-$(VERSION).*) 24 | 25 | # filename for the new tools entries 26 | TOOLS_ENTRY=$(PARTSDIR)/tools-entry-$(NAME)-$(VERSION).txt 27 | 28 | 29 | $(TOOLS_ENTRY) : $(SDCC_TARS) 30 | ./gen_tools_entry.sh "$(TOOLS_STEM)" "$(VERSION)" "$(COREVERSION)" > $@ 31 | -------------------------------------------------------------------------------- /board-manager/assemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is a very basic template "engine" to generate a full platform index 4 | # file. 5 | 6 | 7 | if [ $# -ne 1 ]; then 8 | echo " 9 | usage: $0 packagefile 10 | 11 | Insert all objects from parts/ directory in the platform and tools field 12 | of the json template file to assemble the final package file. 13 | " 14 | exit 1 15 | fi 16 | 17 | PACKAGEFILE=$1 18 | 19 | cp -a package_template.json ${PACKAGEFILE} 20 | 21 | for i in parts/platform*.txt; do 22 | sed -ie "/\"platforms\" : \[/r $i" ${PACKAGEFILE}; 23 | done; 24 | 25 | for i in parts/tools*.txt; do 26 | sed -ie "/\"tools\" : \[/r $i" ${PACKAGEFILE}; 27 | done; 28 | 29 | # The template contains an empty {} as a 'end of list' marker. We need to 30 | # remove this marker and the comma right before it. This can be done by some 31 | # sed magic: 32 | # 33 | # compact: sed -e '/},/{N;s/},\s*{}/}/}' package_sduino_stm8_index.json 34 | # (slightly) more readable: 35 | sed -ie '/},/{ 36 | N; 37 | s/},\s*{}/}/ 38 | }' ${PACKAGEFILE} 39 | -------------------------------------------------------------------------------- /board-manager/minimize-sdcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -lt 1 ]; then 4 | echo "Minimize a SDCC snapshot build by leaving out all non-STM8 files." 5 | echo 6 | echo "usage: $0 sdcc-snapshot-filename" 7 | exit 1 8 | fi 9 | 10 | 11 | #FILE=~/Downloads/sdcc-snapshot-amd64-unknown-linux2.5-20170919-9998.tar.bz2 12 | FILE=$(realpath $1) 13 | 14 | case "$FILE" in 15 | *.tar.bz2 | *.tbz) 16 | TARFLAG=j 17 | ;; 18 | *.tar.gz | *.tgz) 19 | TARFLAG=z 20 | ;; 21 | *.zip) 22 | TARFLAG=zip 23 | ;; 24 | esac 25 | 26 | # set to v for verbose mode 27 | VERBOSE= 28 | 29 | # transform the filename from "*-snapshot-*" to "*-stm8-*" 30 | NAME=$(basename "$FILE") 31 | NAME=${NAME/snapshot/stm8} 32 | 33 | # patterns to exclude all unneeded files from unpacking 34 | TAR_EXCLUDE='--exclude=doc --exclude=src --exclude=non-free 35 | --exclude=stlcs --exclude=ds80c390.h --exclude=pic* 36 | --exclude=*00 --exclude=*08 --exclude=*2k 37 | --exclude=*51 --exclude=*80 --exclude=*90 38 | --exclude=*gb --exclude=*ka --exclude=*.info 39 | --exclude=large* --exclude=medium --exclude=small*' 40 | 41 | ZIP_EXCLUDE='-x */non-free/* */src/* *stlcs* */pic* 42 | *00* *08* *80* *90* *51* *2k* *gb* *ka* */info/* 43 | */large* */medium/* */small*' 44 | 45 | TMP=$(mktemp -d sdcc-repack-XXXXXX --tmpdir) 46 | 47 | echo "Unpacking into $TMP..." 48 | if [ $TARFLAG == zip ]; then 49 | # unzip "$FILE" -d "$TMP" $ZIP_EXCLUDE 50 | cd "$TMP" 51 | unzip "$FILE" $ZIP_EXCLUDE 52 | cd - 53 | else 54 | tar x${VERBOSE}${TARFLAG}f "$FILE" -C "$TMP" $TAR_EXCLUDE 55 | fi 56 | 57 | echo "Repacking into file $NAME" 58 | tar c${VERBOSE}${TARFLAG}f "$NAME" -C "$TMP" sdcc 59 | 60 | echo "cleaning up temporary files" 61 | rm -rf "$TMP" 62 | 63 | echo "done." 64 | -------------------------------------------------------------------------------- /board-manager/package_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "name": "sduino", 5 | "maintainer": "Michael Mayer", 6 | "websiteURL": "https://tenbaht.github.io/sduino/", 7 | "email": "michael-mayer@gmx.de", 8 | "help": { 9 | "online": "http://www.stm32duino.com/viewforum.php?f=52" 10 | }, 11 | "platforms" : [ 12 | {} 13 | ], 14 | "tools" : [ 15 | {} 16 | ] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /board-manager/parts/platform-entry-sduino-0.3.0.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sduino STM8 plain C core (non-C++)", 3 | "architecture": "stm8", 4 | "version": "0.3.0", 5 | "category": "Contributed", 6 | "boards": [ 7 | {"name": "STM8S103F3 Breakout Board"}, 8 | {"name": "STM8S105C6 Discovery Board"} 9 | ], 10 | "toolsDependencies": [ 11 | { 12 | "name": "STM8Tools", 13 | "version": "2017.10.21", 14 | "packager": "sduino" 15 | }, 16 | { 17 | "name": "sdcc", 18 | "version": "build.10088", 19 | "packager": "sduino" 20 | } 21 | ], 22 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.0/sduino-core-0.3.0.tar.bz2", 23 | "archiveFileName": "sduino-core-0.3.0.tar.bz2", 24 | "checksum": "SHA-256:5e3b2b950954e1004ef78084063374c59b37f682ba43f1789bc40d66d88e9994", 25 | "size": "4261038" 26 | }, 27 | -------------------------------------------------------------------------------- /board-manager/parts/platform-entry-sduino-0.3.1.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sduino STM8 plain C core (non-C++)", 3 | "architecture": "stm8", 4 | "version": "0.3.1", 5 | "category": "Contributed", 6 | "boards": [ 7 | {"name": "STM8S103F3 Breakout Board"}, 8 | {"name": "STM8S105C6 Discovery Board"} 9 | ], 10 | "toolsDependencies": [ 11 | { 12 | "name": "STM8Tools", 13 | "version": "2017.11.06", 14 | "packager": "sduino" 15 | }, 16 | { 17 | "name": "sdcc", 18 | "version": "build.10088", 19 | "packager": "sduino" 20 | } 21 | ], 22 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.1/sduino-core-0.3.1.tar.bz2", 23 | "archiveFileName": "sduino-core-0.3.1.tar.bz2", 24 | "checksum": "SHA-256:9d5c5d0c96c8e18efc16820f17d88ec59c48ba59a84ce46dc9ccd8fc45c59016", 25 | "size": "4347217" 26 | }, 27 | -------------------------------------------------------------------------------- /board-manager/parts/platform-entry-sduino-0.3.2.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sduino STM8 plain C core (non-C++)", 3 | "architecture": "stm8", 4 | "version": "0.3.2", 5 | "category": "Contributed", 6 | "boards": [ 7 | {"name": "STM8S103F3 Breakout Board"}, 8 | {"name": "STM8S105C6 Discovery Board"} 9 | ], 10 | "toolsDependencies": [ 11 | { 12 | "name": "STM8Tools", 13 | "version": "2017.11.06", 14 | "packager": "sduino" 15 | }, 16 | { 17 | "name": "sdcc", 18 | "version": "build.10088", 19 | "packager": "sduino" 20 | } 21 | ], 22 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.2/sduino-core-0.3.2.tar.bz2", 23 | "archiveFileName": "sduino-core-0.3.2.tar.bz2", 24 | "checksum": "SHA-256:dc10f5b21030db9ccc1cc8b935a7f2cf48bc1226629b3e7c87e7047c79b5c9ae", 25 | "size": "5627842" 26 | }, 27 | -------------------------------------------------------------------------------- /board-manager/parts/platform-entry-sduino-0.3.3.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sduino STM8 plain C core (non-C++)", 3 | "architecture": "stm8", 4 | "version": "0.3.3", 5 | "category": "Contributed", 6 | "boards": [ 7 | {"name": "STM8S103F3 Breakout Board"}, 8 | {"name": "STM8S105C6 Discovery Board"} 9 | ], 10 | "toolsDependencies": [ 11 | { 12 | "name": "STM8Tools", 13 | "version": "2017.11.13", 14 | "packager": "sduino" 15 | }, 16 | { 17 | "name": "sdcc", 18 | "version": "build.10088", 19 | "packager": "sduino" 20 | } 21 | ], 22 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.3/sduino-core-0.3.3.tar.bz2", 23 | "archiveFileName": "sduino-core-0.3.3.tar.bz2", 24 | "checksum": "SHA-256:58f2f08a3172cff3575ec0aa412b248a7c9b5f4c1c5a6aa91dc55d7133c4d5a6", 25 | "size": "5643135" 26 | }, 27 | -------------------------------------------------------------------------------- /board-manager/parts/tools-entry-sduino-tools-2017.10.21.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "STM8Tools", 3 | "version": "2017.10.21", 4 | "systems": [ 5 | { 6 | "host": "i686-pc-linux-gnu", 7 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.0/sduino-tools_linux32-2017.10.21.tar.bz2", 8 | "archiveFileName": "sduino-tools_linux32-2017.10.21.tar.bz2", 9 | "checksum": "SHA-256:5f10d3de3e044e03160e63252ed818754c177afe5e9b5ce73a656f779193cffe", 10 | "size": "44516" 11 | },{ 12 | "host": "x86_64-pc-linux-gnu", 13 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.0/sduino-tools_linux64-2017.10.21.tar.bz2", 14 | "archiveFileName": "sduino-tools_linux64-2017.10.21.tar.bz2", 15 | "checksum": "SHA-256:0943f76ad2a7eef325e1ab858212c2413123521768ea9a06f946a2b238e0a100", 16 | "size": "49065" 17 | },{ 18 | "host": "i686-mingw32", 19 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.0/sduino-tools_mingw32-2017.10.21.tar.bz2", 20 | "archiveFileName": "sduino-tools_mingw32-2017.10.21.tar.bz2", 21 | "checksum": "SHA-256:dfdc7364a0d6749d3d1693ce5b5311ace4d80425225c98a90c5c527e375d1ecd", 22 | "size": "5541472" 23 | } 24 | ] 25 | }, 26 | -------------------------------------------------------------------------------- /board-manager/parts/tools-entry-sduino-tools-2017.11.06.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "STM8Tools", 3 | "version": "2017.11.06", 4 | "systems": [ 5 | { 6 | "host": "i686-pc-linux-gnu", 7 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.1/sduino-tools_linux32-2017.11.06.tar.bz2", 8 | "archiveFileName": "sduino-tools_linux32-2017.11.06.tar.bz2", 9 | "checksum": "SHA-256:c0af0be23db870d66f5342e29deb803df006d361345526095cc03ec9998f5c88", 10 | "size": "45294" 11 | },{ 12 | "host": "x86_64-pc-linux-gnu", 13 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.1/sduino-tools_linux64-2017.11.06.tar.bz2", 14 | "archiveFileName": "sduino-tools_linux64-2017.11.06.tar.bz2", 15 | "checksum": "SHA-256:c5235baa3f9cc37029fbd81858a9af08e37f76550d5c82e3faf920a4f094c561", 16 | "size": "49872" 17 | },{ 18 | "host": "i686-mingw32", 19 | "url": "https://github.com/tenbaht/sduino/releases/download/v0.3.1/sduino-tools_mingw32-2017.11.06.tar.bz2", 20 | "archiveFileName": "sduino-tools_mingw32-2017.11.06.tar.bz2", 21 | "checksum": "SHA-256:2209dcc01827e9e0de2c6ece40de1fc40d0d86d4537413fdd30329fb8decbd25", 22 | "size": "5541339" 23 | } 24 | ] 25 | }, 26 | -------------------------------------------------------------------------------- /docs/api/HardwareSerial.md: -------------------------------------------------------------------------------- 1 | # HardwareSerial 2 | 3 | Uses the UART. API similar to Arduino. Single instance only. 4 | Pre-instanciated. 5 | 6 | This page is only a stub. 7 | 8 | 9 | ## API 10 | ## Example 11 | ## Implementation details 12 | ## Possible impovements 13 | -------------------------------------------------------------------------------- /docs/api/I2C.md: -------------------------------------------------------------------------------- 1 | # I2C 2 | 3 | The 4 | [I2C master library](http://www.dsscircuits.com/articles/arduino-i2c-master-library) 5 | by Wayne Truchsess offers some significant advantages over the Wire/TWI 6 | library included in the standard arduino environment: It fixes some possible 7 | deadlock situations, it allows for communication using a repeated start 8 | condition as required by some devices, the code is much more compact and the 9 | structure is easier to understand. 10 | 11 | The current state of the port does not include the deadlock protection, 12 | though. 13 | -------------------------------------------------------------------------------- /docs/api/Print.md: -------------------------------------------------------------------------------- 1 | # Print 2 | 3 | Formatting functions for use with other output libraries. Involves serious 4 | preprocessor magic. See the [migration guidelines](../api/migration.md) and 5 | the [xmacro description](../developer/macro.md) 6 | 7 | This page is only a stub. 8 | 9 | 10 | ## API 11 | ## Example 12 | ## Implementation details 13 | ## Possible impovements 14 | -------------------------------------------------------------------------------- /docs/api/SPI.md: -------------------------------------------------------------------------------- 1 | # SPI 2 | 3 | Real hardware-SPI up to 10MHz. No interrupt support yet. 4 | 5 | This page is only a stub. 6 | 7 | 8 | ## API 9 | ## Example 10 | ## Implementation details 11 | ## Possible impovements 12 | -------------------------------------------------------------------------------- /docs/api/oled-ssd1306.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/api/oled-ssd1306.jpg -------------------------------------------------------------------------------- /docs/contact.md: -------------------------------------------------------------------------------- 1 | # Contact 2 | 3 | 4 | ### Bug reports and other issues tightly related to the repository 5 | 6 | [github issue tracker](https://github.com/tenbaht/sduino/issues). 7 | 8 | 9 | ### More general topics and suggestions 10 | 11 | The [STM8 board](http://stm32duino.com/viewforum.php?f=52) of the 12 | stm32duino forum. It will help to catch my attention to prefix your topic 13 | with "[sduino]". 14 | 15 | Please note that after registering on that forum, you are 16 | **required** to post an introduction in the new user board first in order to 17 | aquire the right to post or reply in any other board. Roger is strict on 18 | that. 19 | 20 | 21 | ### email 22 | 23 | Please find my address in the commit messages of the repository (as a simple 24 | captcha test) or use the alias address sduino@gmx.de 25 | -------------------------------------------------------------------------------- /docs/developer/bare-metal-programming.md: -------------------------------------------------------------------------------- 1 | # Bare metal programming 2 | 3 | It all started by compiling some plain example programs without using any 4 | libraries. This avoids the code overhead of the Arduino libraries. 5 | 6 | Lujji posted a [series of 7 | articles](https://lujji.github.io/blog/bare-metal-programming-stm8/) on bare 8 | metal programming of the STM8S CPUs. This is by far the best introduction I 9 | found so far. It would have helped me a lot if it would have been around at 10 | the time when I started this project. 11 | 12 | 13 | 14 | 15 | ## Modifications for the sdcc example programs 16 | 17 | I started my journey into the STM8 world with the 18 | [stm8-examples-sdcc](https://github.com/vdudouyt/sdcc-examples-stm8) by 19 | Valentin Dudouyt (vdudouyt), the author of 20 | [stm8flash](https://github.com/vdudouyt/stm8flash). 21 | 22 | These examples are still part of the repository in 23 | examples/sdcc-examples-stm8. To compile for my STM8S103F3 board they 24 | required some modifications: 25 | 26 | **blinky.c**: LED pin assignment 27 | 28 | **uart.c**: pin assignment (TX is at PD5, RX is at PD6). 29 | The UART is sending at 1200 Baud => CPU clock only 2MHz instead of 16MHz. 30 | The clock divider needs to be configured or a different baud rate prescale value 31 | has to be used. Pitfall: The register address for the clock divider is 32 | different for the STM8S and the STM8L. 33 | 34 | -------------------------------------------------------------------------------- /docs/hardware/ST-LinkV2_pinout_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/ST-LinkV2_pinout_01.jpg -------------------------------------------------------------------------------- /docs/hardware/Schematic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/Schematic1.png -------------------------------------------------------------------------------- /docs/hardware/esp14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/esp14.png -------------------------------------------------------------------------------- /docs/hardware/st-link-v2-dongle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/st-link-v2-dongle.png -------------------------------------------------------------------------------- /docs/hardware/st-link_v2_baite.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/st-link_v2_baite.pdf -------------------------------------------------------------------------------- /docs/hardware/stm8blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/stm8blue.png -------------------------------------------------------------------------------- /docs/hardware/stm8board-pinout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/docs/hardware/stm8board-pinout.jpg -------------------------------------------------------------------------------- /docs/usage/board-manager-install.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | 4 | ## Using the Arduino Board Manager 5 | 6 | This is the recommanded way of installation now. 7 | 8 | - Open the Settings tab of the Preferences dialog 9 | - Enter 10 | `https://github.com/tenbaht/sduino/raw/master/package_sduino_stm8_index.json` 11 | as an Additional Boards Manager URL 12 | - Select *sduino* in the Boards Manager list (Tools->Board:...->Boards Manager) 13 | - Click on Install 14 | 15 | Wait for the download to finsh and you are ready to blink: 16 | 17 | - Open the Boards list at Tools->Board:... 18 | - You should find a new entry "STM8S Boards". 19 | - Choose *STM8S103F3 Breakout Board* from the list 20 | - Open the standard Blink example from File->Examples->01. Basics->Blink 21 | - Compile it by hitting 'Verify' 22 | 23 | Easy, isn't it? 24 | 25 | In order to upload the compiled sketch to a connected board you need to 26 | [install your flash tool](../hardware/flashtool/#installation-for-windows). 27 | 28 | 29 | 30 | ## Manual install 31 | 32 | Only if you prefer a Makefile based build over using the Arduino IDE or if 33 | you would like to help with the development of Sduino you will have to do a 34 | [manual installation](manual-install.md) instead. 35 | -------------------------------------------------------------------------------- /docs/usage/build-ide.md: -------------------------------------------------------------------------------- 1 | # Building with the Arduino IDE 2 | 3 | Sduino now blends in smoothly with the Arduino IDE. Just choose a matching 4 | board type from the list of supported boards at Tools->Board and work as 5 | usual. 6 | 7 | 8 | - Open the Boards list at Tools->Board:... 9 | - You should find a new entry "STM8S Boards". 10 | - Choose *STM8S103F3 Breakout Board* from the list 11 | - Open the standard Blink example from File->Examples->01. Basics->Blink 12 | - Compile it by clickin 'Verify' 13 | - Or upload it to the connected board by clicking 'Upload' 14 | 15 | Done! Your first STM8 based project is up and running! 16 | 17 | But keep in mind that it still based on plain C and not 100% Arduino syntax. 18 | It is close enough, that even some of the stock example sketches work right 19 | out of the box, but others will require small modifications. 20 | 21 | FIXME: How to access the Sduino adopted example sketches 22 | 23 | -------------------------------------------------------------------------------- /examples/blink-spl/Makefile: -------------------------------------------------------------------------------- 1 | SDCCBASE=/opt/sdcc 2 | BINDIR=$(SDCCBASE)/bin 3 | SDCC=$(BINDIR)/sdcc 4 | SDLD=$(BINDIR)/sdld 5 | 6 | OBJECT=blink 7 | OBJECTS=blink_spl.rel 8 | 9 | LIBDIR=../../STM8S_StdPeriph_Driver/src 10 | #LIBFILES=$(LIBDIR)/stm8s_gpio.rel 11 | LIBFILES=$(LIBDIR)/stm8s.lib 12 | 13 | CFLAGS=-DSTM8S103 -I. -I../../STM8S_StdPeriph_Driver/inc --debug 14 | 15 | 16 | .PHONY: all clean flash 17 | 18 | all: $(OBJECT).ihx 19 | 20 | clean: 21 | rm -f *.asm *.ihx *.rel *.sym *.map *.cdb *.lk *.lst *.rst *~ 22 | 23 | flash: $(OBJECT).ihx 24 | stm8flash -cstlinkv2 -pstm8s103?3 -w $(OBJECT).ihx 25 | 26 | $(OBJECT).ihx: $(OBJECTS) $(LIBFILES) 27 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(LDFLAGS) $^ -o $@ 28 | 29 | %.rel: %.c 30 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(CFLAGS) $(LDFLAGS) -c $< 31 | -------------------------------------------------------------------------------- /examples/blink-spl/README.md: -------------------------------------------------------------------------------- 1 | # blink_spl.c 2 | 3 | Blink a LED using SPL functions and the SDCC compiler. Example from 4 | http://www.mikrocontroller.net/articles/STM8S-Discovery 5 | modified for the stm8s103f3 board (LED at PD5). 6 | -------------------------------------------------------------------------------- /examples/blink-spl/blink_spl.c: -------------------------------------------------------------------------------- 1 | #include "stm8s.h" // (1) 2 | 3 | main() // (2) 4 | { 5 | GPIO_DeInit(GPIOB); // (3) 6 | GPIO_Init(GPIOB, GPIO_PIN_5,GPIO_MODE_OUT_PP_LOW_SLOW); // (4) 7 | 8 | while (1) // (5) 9 | { 10 | u16 i; // (6) 11 | 12 | for(i = 0; i < 60000; i++) // (7) 13 | { 14 | nop(); // (8) 15 | } 16 | 17 | GPIO_WriteReverse(GPIOB, GPIO_PIN_5); // (9) 18 | } // (10) 19 | } // (11) 20 | 21 | -------------------------------------------------------------------------------- /examples/fade-all-pins/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /examples/fade-all-pins/fade-all-pins.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fade-all-pins 3 | * 4 | * This example shows how to fade an LED on all PWM-capable pins 5 | * using the analogWrite() function. (Derived from 01.Basics/Fade) 6 | * 7 | * This example code is in the public domain. 8 | */ 9 | 10 | #include 11 | 12 | int brightness = 0; // how bright the LED is 13 | int fadeAmount = 5; // how many points to fade the LED by 14 | char i; 15 | 16 | // the setup routine runs once when you press reset: 17 | void setup() { 18 | // declare all pin to be an output: 19 | for (i=0; i 2 | #include "stm8s.h" 3 | 4 | int uart_write(const char *str) { 5 | char i; 6 | for(i = 0; i < strlen(str); i++) { 7 | while(!(USART1_SR & USART_SR_TXE)); 8 | USART1_DR = str[i]; 9 | } 10 | return(i); // Bytes sent 11 | } 12 | 13 | 14 | int main() { 15 | unsigned long i = 0; 16 | 17 | CLK_CKDIVR = 0x00; // Set the frequency to 16 MHz 18 | CLK_PCKENR1 = 0xFF; // Enable peripherals 19 | 20 | PD_DDR = 0x20; // Put TX line on 21 | PD_CR1 = 0x20; 22 | 23 | USART1_CR2 = USART_CR2_TEN; // Allow TX & RX 24 | USART1_CR3 &= ~(USART_CR3_STOP1 | USART_CR3_STOP2); // 1 stop bit 25 | USART1_BRR2 = 0x03; USART1_BRR1 = 0x68; // 9600 baud 26 | 27 | do { 28 | uart_write("Hello World!\r\n"); 29 | for(i = 0; i < 147456; i++) { } // Sleep 30 | } while(1); 31 | } 32 | -------------------------------------------------------------------------------- /examples/uart-int/Makefile: -------------------------------------------------------------------------------- 1 | SDCCBASE=/opt/sdcc 2 | BINDIR=$(SDCCBASE)/bin 3 | SDCC=$(BINDIR)/sdcc 4 | SDLD=$(BINDIR)/sdld 5 | 6 | OBJECT=uart 7 | OBJECTS=uart-int.rel 8 | 9 | LIBDIR=../../STM8S_StdPeriph_Driver/src 10 | #LIBFILES=$(LIBDIR)/stm8s_gpio.rel 11 | LIBFILES=$(LIBDIR)/stm8s.lib 12 | 13 | CFLAGS=-DSTM8S103 -I. -I../../STM8S_StdPeriph_Driver/inc --debug 14 | 15 | 16 | .PHONY: all clean flash 17 | 18 | all: $(OBJECT).ihx 19 | 20 | clean: 21 | rm -f *.asm *.ihx *.rel *.sym *.map *.cdb *.lk *.lst *.rst *~ 22 | 23 | flash: $(OBJECT).ihx 24 | stm8flash -cstlinkv2 -pstm8s103?3 -w $(OBJECT).ihx 25 | 26 | $(OBJECT).ihx: $(OBJECTS) $(LIBFILES) 27 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(LDFLAGS) $^ -o $@ 28 | 29 | %.rel: %.c 30 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(CFLAGS) $(LDFLAGS) -c $< 31 | -------------------------------------------------------------------------------- /examples/uart-int/README.md: -------------------------------------------------------------------------------- 1 | # uart-int 2 | 3 | simple uart example using interrupts and SPL functions. 4 | -------------------------------------------------------------------------------- /examples/uart-int/uart-int.c: -------------------------------------------------------------------------------- 1 | #include"stm8s.h" 2 | 3 | volatile char buf=0; 4 | volatile char transmitting=0; 5 | 6 | //void TIM4_ISR(void) __interrupt(23); 7 | //INTERRUPT void UART1_TX_IRQHandler(void); /* UART1 TX */ 8 | void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX); /* UART1 TX */ 9 | //void UART_TX_vector(void) __interrupt(UART1_TX_vector) 10 | 11 | 12 | void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX) /* UART1 TX */ 13 | { 14 | if (buf) { 15 | // es wartet noch etwas, sofort senden 16 | UART1_SendData8(buf); 17 | buf = 0; 18 | } else { 19 | // Puffer leergelaufen, Übertragung beenden, Interrupt deaktivieren 20 | transmitting = 0; 21 | UART1_ITConfig(UART1_IT_TXE, DISABLE); 22 | } 23 | } 24 | 25 | 26 | 27 | void send_char(uint8_t val) 28 | { 29 | if (!transmitting) { 30 | transmitting = 1; 31 | UART1_SendData8(val); 32 | UART1_ITConfig(UART1_IT_TXE, ENABLE); 33 | } else { 34 | // while (!UART1_GetFlagStatus(UART1_FLAG_TXE)); 35 | while (buf); 36 | buf = val; 37 | } 38 | } 39 | 40 | 41 | void send_string(char *str) 42 | { 43 | char c; 44 | 45 | if (!str) return; 46 | 47 | while ( c=*str++ ) send_char(c); // assignment intented 48 | } 49 | 50 | 51 | void main (void) 52 | { 53 | uint32_t i; 54 | 55 | UART1_DeInit(); 56 | // ITC_DeInit(); 57 | // ITC_SetSoftwarePriority(ITC_IRQ_UART1_TX, ITC_PRIORITYLEVEL_2); 58 | 59 | // UART1_ITConfig(UART1_IT_TXE, ENABLE); 60 | enableInterrupts(); 61 | 62 | UART1_Init(9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, 63 | UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE); 64 | 65 | while (1) { 66 | send_string("Hello World!\n"); 67 | for (i=30000; i; i--); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /examples/uart-ringbuffer/Makefile: -------------------------------------------------------------------------------- 1 | SDCC=sdcc 2 | SDLD=sdld 3 | OBJECT=uart 4 | OBJECTS=uart-ringbuffer.rel 5 | 6 | LIBDIR=../../STM8S_StdPeriph_Driver/src 7 | #LIBFILES=$(LIBDIR)/stm8s_gpio.rel 8 | LIBFILES=$(LIBDIR)/stm8s.lib 9 | 10 | CFLAGS=-DSTM8S103 -I. -I../../STM8S_StdPeriph_Driver/inc 11 | 12 | 13 | .PHONY: all clean flash 14 | 15 | all: $(OBJECT).ihx 16 | 17 | clean: 18 | rm -f *.asm *.ihx *.rel *.sym *.map *.cdb *.lk *.lst *.rst *~ 19 | 20 | flash: $(OBJECT).ihx 21 | stm8flash -cstlinkv2 -pstm8s103?3 -w $(OBJECT).ihx 22 | 23 | $(OBJECT).ihx: $(OBJECTS) $(LIBFILES) 24 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(LDFLAGS) $^ -o $@ 25 | 26 | %.rel: %.c 27 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(CFLAGS) $(LDFLAGS) -c $< 28 | -------------------------------------------------------------------------------- /examples/uart-ringbuffer/README.md: -------------------------------------------------------------------------------- 1 | # uart-ringbuffer.c 2 | 3 | Adopted HardwareSerial.cpp from arduino-1.0 for use with the STM8S and SDCC 4 | using SPL functions. 5 | -------------------------------------------------------------------------------- /examples/uart-ringbuffer/uart-ringbuffer.h: -------------------------------------------------------------------------------- 1 | // Define config for Serial.begin(baud, config); 2 | /* coding of the bit field: 0www pp ss 3 | * wordlength www: 0:8 1:9 (5,6,7 not supported) 4 | * parity pp: 0:n 2:e 3:o 5 | * stopbits ss: 0:1 1:0.5 2:2 3:1.5 6 | * => 8:0x3x 9:0x4x 7 | * => n1:1 n2:2 e1:8 e2:A o1:C o2:E 8 | */ 9 | #define SERIAL_8N1 0x01 10 | #define SERIAL_9N1 0x11 11 | #define SERIAL_8N2 0x02 12 | #define SERIAL_9N2 0x12 13 | #define SERIAL_8E1 0x08 14 | #define SERIAL_9E1 0x18 15 | #define SERIAL_8E2 0x0A 16 | #define SERIAL_9E2 0x1A 17 | #define SERIAL_8O1 0x0C 18 | #define SERIAL_9O1 0x1C 19 | #define SERIAL_8O2 0x0E 20 | #define SERIAL_9O2 0x1E 21 | -------------------------------------------------------------------------------- /examples/uart-spl/Makefile: -------------------------------------------------------------------------------- 1 | SDCCBASE=/opt/sdcc 2 | BINDIR=$(SDCCBASE)/bin 3 | SDCC=$(BINDIR)/sdcc 4 | SDLD=$(BINDIR)/sdld 5 | 6 | OBJECT=uart 7 | OBJECTS=uart_spl.rel 8 | 9 | LIBDIR=../../STM8S_StdPeriph_Driver/src 10 | #LIBFILES=$(LIBDIR)/stm8s_gpio.rel 11 | LIBFILES=$(LIBDIR)/stm8s.lib 12 | 13 | CFLAGS=-DSTM8S103 -I. -I../../STM8S_StdPeriph_Driver/inc --debug 14 | 15 | 16 | .PHONY: all clean flash 17 | 18 | all: $(OBJECT).ihx 19 | 20 | clean: 21 | rm -f *.asm *.ihx *.rel *.sym *.map *.cdb *.lk *.lst *.rst *~ 22 | 23 | flash: $(OBJECT).ihx 24 | stm8flash -cstlinkv2 -pstm8s103?3 -w $(OBJECT).ihx 25 | 26 | $(OBJECT).ihx: $(OBJECTS) $(LIBFILES) 27 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(LDFLAGS) $^ -o $@ 28 | 29 | %.rel: %.c 30 | $(SDCC) -lstm8 -mstm8 --out-fmt-ihx $(CFLAGS) $(LDFLAGS) -c $< 31 | -------------------------------------------------------------------------------- /examples/uart-spl/README.md: -------------------------------------------------------------------------------- 1 | # uart-spl 2 | 3 | simple uart example using SPL functions. Sending only, polling only, no 4 | interrupts. 5 | 6 | -------------------------------------------------------------------------------- /examples/uart-spl/uart_spl.c: -------------------------------------------------------------------------------- 1 | #include"stm8s.h" 2 | 3 | void send_string(char *str) 4 | { 5 | char c; 6 | 7 | if (!str) return; 8 | 9 | while ( c=*str++ ) { // assignment intented 10 | while (!UART1_GetFlagStatus(UART1_FLAG_TXE)); 11 | UART1_SendData8(c); 12 | } 13 | } 14 | 15 | 16 | void main (void) 17 | { 18 | uint32_t i; 19 | 20 | UART1_DeInit(); 21 | UART1_Init(9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, 22 | UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE); 23 | 24 | while (1) { 25 | send_string("Hello World!\n"); 26 | for (i=30000; i; i--); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/cores/sduino/Serial.h: -------------------------------------------------------------------------------- 1 | #ifndef _SERIAL_H_ 2 | #define _SERIAL_H_ 3 | 4 | /* 5 | * not more than a convininience module to smoothen the transition from 6 | * real Arduino to sduino syntax for existing sketches. 7 | * 8 | * All it does is to include HardwareSerial.h, so it doesn't matter if you 9 | * include HardwareSerial or Serial into your code. 10 | * 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | // Public Methods ////////////////////////////////////////////////////////////// 19 | 20 | // Alias Definitions for a more Arduino-like look //////////////////////////// 21 | 22 | /* 23 | * all empty. 24 | * 25 | * so far, the alias definitions are done in HardwareSerial and not here. 26 | * This file is supposed to be a kind of intermediate switch to choose the 27 | * serial module depending on the configured CPU. 28 | * 29 | */ 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/cores/sduino/WMath.c: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | */ 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #include "stdlib.h" 27 | } 28 | #else 29 | #include "stdlib.h" 30 | #endif 31 | 32 | void randomSeed(unsigned long seed) 33 | { 34 | if (seed != 0) { 35 | srand(seed); 36 | } 37 | } 38 | 39 | long random(long howbig) 40 | { 41 | if (howbig == 0) { 42 | return 0; 43 | } 44 | return rand() % howbig; 45 | } 46 | 47 | long random_minmax(long howsmall, long howbig) 48 | { 49 | long diff; 50 | 51 | if (howsmall >= howbig) { 52 | return howsmall; 53 | } 54 | diff = howbig - howsmall; 55 | return random(diff) + howsmall; 56 | } 57 | 58 | long map(long x, long in_min, long in_max, long out_min, long out_max) 59 | { 60 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 61 | } 62 | 63 | //unsigned int makeWord(unsigned int w) { return w; } 64 | //unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } 65 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/cores/sduino/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | main.cpp - Main loop for Arduino sketches 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. 14 | 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 | */ 19 | 20 | #include 21 | 22 | // make sure to define prototypes for all used interrupts 23 | //#include "stm8s_it.h" 24 | 25 | unsigned char runSerialEvent; 26 | 27 | int main(void) 28 | { 29 | init(); 30 | 31 | initVariant(); 32 | 33 | setup(); 34 | 35 | for (;;) { 36 | loop(); 37 | if (runSerialEvent) serialEvent(); 38 | } 39 | 40 | // return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/cores/sduino/weak_functions.c: -------------------------------------------------------------------------------- 1 | /** 2 | * "weak" functions to be used if no user-defined function is defined. 3 | * 4 | * This function stub is compiled into the core library. Functions from 5 | * libraries are only linked if a referenced function isnt't defined any other 6 | * object file. This way all library function are a kind of "weak" functions. 7 | * 8 | * This function is defined in a separate source file to avoid pulling in 9 | * other unrelated definitions. 10 | */ 11 | 12 | // Declared weak in Arduino.h to allow user redefinitions. 13 | int atexit(void (*func)()) { return 0; } 14 | void initVariant() {} /*move here from file:weak_initVariant.c*/ 15 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/cores/sduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | */ 22 | 23 | #include "wiring_private.h" 24 | 25 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 26 | uint8_t value = 0; 27 | uint8_t i; 28 | 29 | for (i = 0; i < 8; ++i) { 30 | digitalWrite(clockPin, HIGH); 31 | if (bitOrder == LSBFIRST) 32 | value |= digitalRead(dataPin) << i; 33 | else 34 | value |= digitalRead(dataPin) << (7 - i); 35 | digitalWrite(clockPin, LOW); 36 | } 37 | return value; 38 | } 39 | 40 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 41 | { 42 | uint8_t i; 43 | 44 | for (i = 0; i < 8; i++) { 45 | if (bitOrder == LSBFIRST) 46 | digitalWrite(dataPin, !!(val & (1 << i))); 47 | else 48 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 49 | 50 | digitalWrite(clockPin, HIGH); 51 | digitalWrite(clockPin, LOW); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/empty.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/empty.h -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/AnalogReadSerial/AnalogReadSerial.ino: -------------------------------------------------------------------------------- 1 | /* 2 | AnalogReadSerial 3 | 4 | Reads an analog input on pin 0, prints the result to the Serial Monitor. 5 | Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). 6 | Attach the center pin of a potentiometer to pin A0, and the outside pins to +3.3V and ground. 7 | 8 | This example code is in the public domain. 9 | 10 | http://www.arduino.cc/en/Tutorial/AnalogReadSerial 11 | */ 12 | 13 | #include 14 | 15 | // the setup routine runs once when you press reset: 16 | void setup() { 17 | // initialize serial communication at 9600 bits per second: 18 | Serial_begin(9600); 19 | } 20 | 21 | // the loop routine runs over and over again forever: 22 | void loop() { 23 | // read the input on analog pin 0: 24 | int sensorValue = analogRead(A0); 25 | // print out the value you read: 26 | Serial_println_u(sensorValue); 27 | delay(1); // delay in between reads for stability 28 | } 29 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/AnalogReadSerial/AnalogReadSerial.txt: -------------------------------------------------------------------------------- 1 | Read a potentiometer, print its state out to the Arduino Serial Monitor. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/AnalogReadSerial/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/BareMinimum/BareMinimum.ino: -------------------------------------------------------------------------------- 1 | void setup() { 2 | // put your setup code here, to run once: 3 | 4 | } 5 | 6 | void loop() { 7 | // put your main code here, to run repeatedly: 8 | 9 | } 10 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/BareMinimum/BareMinimum.txt: -------------------------------------------------------------------------------- 1 | The bare minimum of code needed to start an Arduino sketch. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/BareMinimum/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink 3 | 4 | Turns an LED on for one second, then off for one second, repeatedly. 5 | 6 | Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO 7 | it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to 8 | the correct LED pin independent of which board is used. 9 | If you want to know what pin the on-board LED is connected to on your Arduino 10 | model, check the Technical Specs of your board at: 11 | https://www.arduino.cc/en/Main/Products 12 | 13 | modified 8 May 2014 14 | by Scott Fitzgerald 15 | modified 2 Sep 2016 16 | by Arturo Guadalupi 17 | modified 8 Sep 2016 18 | by Colby Newman 19 | 20 | This example code is in the public domain. 21 | 22 | http://www.arduino.cc/en/Tutorial/Blink 23 | */ 24 | 25 | // the setup function runs once when you press reset or power the board 26 | void setup() { 27 | // initialize digital pin LED_BUILTIN as an output. 28 | pinMode(LED_BUILTIN, OUTPUT); 29 | } 30 | 31 | // the loop function runs over and over again forever 32 | void loop() { 33 | digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) 34 | delay(1000); // wait for a second 35 | digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW 36 | delay(1000); // wait for a second 37 | } 38 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Blink/Blink.txt: -------------------------------------------------------------------------------- 1 | Turn an LED on and off. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Blink/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/DigitalReadSerial/DigitalReadSerial.ino: -------------------------------------------------------------------------------- 1 | /* 2 | DigitalReadSerial 3 | 4 | Reads a digital input on pin 2, prints the result to the Serial Monitor 5 | 6 | This example code is in the public domain. 7 | 8 | http://www.arduino.cc/en/Tutorial/DigitalReadSerial 9 | */ 10 | 11 | #include 12 | 13 | // digital pin 2 has a pushbutton attached to it. Give it a name: 14 | int pushButton = 2; 15 | 16 | // the setup routine runs once when you press reset: 17 | void setup() { 18 | // initialize serial communication at 9600 bits per second: 19 | Serial_begin(9600); 20 | // make the pushbutton's pin an input: 21 | pinMode(pushButton, INPUT); 22 | } 23 | 24 | // the loop routine runs over and over again forever: 25 | void loop() { 26 | // read the input pin: 27 | int buttonState = digitalRead(pushButton); 28 | // print out the state of the button: 29 | Serial_println_u(buttonState); 30 | delay(1); // delay in between reads for stability 31 | } 32 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/DigitalReadSerial/DigitalReadSerial.txt: -------------------------------------------------------------------------------- 1 | Read a switch, print the state out to the Arduino Serial Monitor. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/DigitalReadSerial/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Fade/Fade.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Fade 3 | 4 | This example shows how to fade an LED on pin 5 using the analogWrite() 5 | function. 6 | 7 | The analogWrite() function uses PWM, so if you want to change the pin you're 8 | using, be sure to use another PWM capable pin. On most Arduino, the PWM pins 9 | are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. 10 | 11 | This example code is in the public domain. 12 | 13 | http://www.arduino.cc/en/Tutorial/Fade 14 | */ 15 | 16 | int led = 5; // the PWM pin the LED is attached to 17 | int brightness = 0; // how bright the LED is 18 | int fadeAmount = 5; // how many points to fade the LED by 19 | 20 | // the setup routine runs once when you press reset: 21 | void setup() { 22 | // declare pin 9 to be an output: 23 | pinMode(led, OUTPUT); 24 | } 25 | 26 | // the loop routine runs over and over again forever: 27 | void loop() { 28 | // set the brightness of pin 9: 29 | analogWrite(led, brightness); 30 | 31 | // change the brightness for next time through the loop: 32 | brightness = brightness + fadeAmount; 33 | 34 | // reverse the direction of the fading at the ends of the fade: 35 | if (brightness <= 0 || brightness >= 255) { 36 | fadeAmount = -fadeAmount; 37 | } 38 | // wait for 30 milliseconds to see the dimming effect 39 | delay(30); 40 | } 41 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Fade/Fade.txt: -------------------------------------------------------------------------------- 1 | Demonstrates the use of analogWrite() to fade an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/Fade/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/ReadAnalogVoltage/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/ReadAnalogVoltage/ReadAnalogVoltage.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ReadAnalogVoltage 3 | 4 | Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor. 5 | Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). 6 | Attach the center pin of a potentiometer to pin A0, and the outside pins to +3.3V and ground. 7 | 8 | This example code is in the public domain. 9 | 10 | http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage 11 | */ 12 | 13 | #include 14 | 15 | // the setup routine runs once when you press reset: 16 | void setup() { 17 | // initialize serial communication at 9600 bits per second: 18 | Serial_begin(9600); 19 | } 20 | 21 | // the loop routine runs over and over again forever: 22 | void loop() { 23 | // read the input on analog pin 0: 24 | int sensorValue = analogRead(A0); 25 | // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 3.3V): 26 | float voltage = sensorValue * (3.3 / 1023.0); 27 | // print out the value you read: 28 | Serial_println_f(voltage); 29 | } 30 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/01.Basics/ReadAnalogVoltage/ReadAnalogVoltage.txt: -------------------------------------------------------------------------------- 1 | Reads an analog input and prints the voltage to the Serial Monitor. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/BlinkWithoutDelay/BlinkWithoutDelay.txt: -------------------------------------------------------------------------------- 1 | Blinking an LED without using the delay() function. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/BlinkWithoutDelay/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Button/Button.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Button 3 | 4 | Turns on and off a light emitting diode(LED) connected to digital pin 3, 5 | when pressing a pushbutton attached to pin 2. 6 | 7 | The circuit: 8 | - LED attached from pin 3 to VCC 9 | - pushbutton attached to pin 2 from +5V 10 | - 10K resistor attached to pin 2 from ground 11 | 12 | - Note: on the STM8S103 breakout board there is already an LED on the board 13 | attached to pin 3. 14 | 15 | created 2005 16 | by DojoDave 17 | modified 30 Aug 2011 18 | by Tom Igoe 19 | modified 13 Feb 2017 for use with sduino 20 | by Michael Mayer 21 | 22 | This example code is in the public domain. 23 | 24 | http://www.arduino.cc/en/Tutorial/Button 25 | */ 26 | 27 | // constants won't change. They're used here to set pin numbers: 28 | const int buttonPin = 2; // the number of the pushbutton pin 29 | const int ledPin = 3; // the number of the LED pin 30 | 31 | // variables will change: 32 | int buttonState = 0; // variable for reading the pushbutton status 33 | 34 | void setup() { 35 | // initialize the LED pin as an output: 36 | pinMode(ledPin, OUTPUT); 37 | // initialize the pushbutton pin as an input: 38 | pinMode(buttonPin, INPUT); 39 | } 40 | 41 | void loop() { 42 | // read the state of the pushbutton value: 43 | buttonState = digitalRead(buttonPin); 44 | 45 | // check if the pushbutton is pressed. If it is, the buttonState is HIGH: 46 | if (buttonState == HIGH) { 47 | // turn LED on: 48 | digitalWrite(ledPin, HIGH); 49 | } else { 50 | // turn LED off: 51 | digitalWrite(ledPin, LOW); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Button/Button.txt: -------------------------------------------------------------------------------- 1 | Use a pushbutton to control an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Button/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/Debounce.txt: -------------------------------------------------------------------------------- 1 | Read a pushbutton, filtering noise. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/button.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/Debounce/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/DigitalInputPullup.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Input Pull-up Serial 3 | 4 | This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a digital 5 | input on pin 2 and prints the results to the Serial Monitor. 6 | 7 | The circuit: 8 | - momentary switch attached from pin 2 to ground 9 | - built-in LED on pin 3 10 | 11 | Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal 12 | 20K-ohm resistor is pulled to 3.3V. This configuration causes the input to read 13 | HIGH when the switch is open, and LOW when it is closed. 14 | 15 | created 14 Mar 2012 16 | by Scott Fitzgerald 17 | modified 13 Feb 2017 for use with sduino 18 | by Michael Mayer 19 | 20 | This example code is in the public domain. 21 | 22 | http://www.arduino.cc/en/Tutorial/InputPullupSerial 23 | */ 24 | 25 | #include 26 | 27 | void setup() { 28 | //start serial connection 29 | Serial_begin(9600); 30 | //configure pin 2 as an input and enable the internal pull-up resistor 31 | pinMode(2, INPUT_PULLUP); 32 | pinMode(3, OUTPUT); 33 | 34 | } 35 | 36 | void loop() { 37 | //read the pushbutton value into a variable 38 | int sensorVal = digitalRead(2); 39 | //print out the value of the pushbutton 40 | Serial_println_u(sensorVal); 41 | 42 | // Keep in mind the pull-up means the pushbutton's logic is inverted. It goes 43 | // HIGH when it's open, and LOW when it's pressed. Turn on pin 3 when the 44 | // button's pressed, and off when it's not: 45 | if (sensorVal == HIGH) { 46 | digitalWrite(3, LOW); 47 | } else { 48 | digitalWrite(3, HIGH); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/DigitalInputPullup.txt: -------------------------------------------------------------------------------- 1 | Demonstrates the use of INPUT_PULLUP with pinMode(). -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/DigitalInputPullup/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/StateChangeDetection.txt: -------------------------------------------------------------------------------- 1 | Counting the number of button pushes. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/02.Digital/StateChangeDetection/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/AnalogInOutSerial.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Analog input, analog output, serial output 3 | 4 | Reads an analog input pin, maps the result to a range from 0 to 255 and uses 5 | the result to set the pulse width modulation (PWM) of an output pin. 6 | Also prints the results to the Serial Monitor. 7 | 8 | The circuit: 9 | - potentiometer connected to analog pin 0. 10 | Center pin of the potentiometer goes to the analog pin. 11 | side pins of the potentiometer go to +3.3V and ground 12 | - LED connected from digital pin 9 to ground 13 | 14 | created 29 Dec. 2008 15 | modified 9 Apr 2012 16 | by Tom Igoe 17 | modified 28 Feb 2017 for use with sduino 18 | by Michael Mayer 19 | 20 | This example code is in the public domain. 21 | 22 | http://www.arduino.cc/en/Tutorial/AnalogInOutSerial 23 | */ 24 | 25 | // These constants won't change. They're used to give names to the pins used: 26 | const int analogInPin = A0; // Analog input pin that the potentiometer is attached to 27 | const int analogOutPin = 9; // Analog output pin that the LED is attached to 28 | 29 | int sensorValue = 0; // value read from the pot 30 | int outputValue = 0; // value output to the PWM (analog out) 31 | 32 | void setup() { 33 | // initialize serial communications at 9600 bps: 34 | Serial_begin(9600); 35 | } 36 | 37 | void loop() { 38 | // read the analog in value: 39 | sensorValue = analogRead(analogInPin); 40 | // map it to the range of the analog out: 41 | outputValue = map(sensorValue, 0, 1023, 0, 255); 42 | // change the analog out value: 43 | analogWrite(analogOutPin, outputValue); 44 | 45 | // print the results to the Serial Monitor: 46 | Serial_print_s("sensor = "); 47 | Serial_print_u(sensorValue); 48 | Serial_print_s("\t output = "); 49 | Serial_println_u(outputValue); 50 | 51 | // wait 2 milliseconds before the next loop for the analog-to-digital 52 | // converter to settle after the last reading: 53 | delay(2); 54 | } 55 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/AnalogInOutSerial.txt: -------------------------------------------------------------------------------- 1 | Read an analog input pin, map the result, and then use that data to dim or brighten an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInOutSerial/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/AnalogInput.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Analog Input 3 | 4 | Demonstrates analog input by reading an analog sensor on analog pin 0 and 5 | turning on and off a light emitting diode(LED) connected to digital pin 3. 6 | The amount of time the LED will be on and off depends on the value obtained 7 | by analogRead(). 8 | 9 | The circuit: 10 | - potentiometer 11 | center pin of the potentiometer to the analog input 0 12 | one side pin (either one) to ground 13 | the other side pin to +5V 14 | - LED 15 | anode (long leg) attached to digital output 13 16 | cathode (short leg) attached to ground 17 | 18 | - Note: because the STM8S103 breakout board has a built-in LED attached to 19 | pin 3 on the board, the LED is optional. 20 | 21 | created by David Cuartielles 22 | modified 30 Aug 2011 23 | By Tom Igoe 24 | 25 | This example code is in the public domain. 26 | 27 | http://www.arduino.cc/en/Tutorial/AnalogInput 28 | */ 29 | 30 | int sensorPin = A0; // select the input pin for the potentiometer 31 | int ledPin = LED_BUILTIN; // select the pin for the LED 32 | int sensorValue = 0; // variable to store the value coming from the sensor 33 | 34 | void setup() { 35 | // declare the ledPin as an OUTPUT: 36 | pinMode(ledPin, OUTPUT); 37 | } 38 | 39 | void loop() { 40 | // read the value from the sensor: 41 | sensorValue = analogRead(sensorPin); 42 | // turn the ledPin on 43 | digitalWrite(ledPin, HIGH); 44 | // stop the program for milliseconds: 45 | delay(sensorValue); 46 | // turn the ledPin off: 47 | digitalWrite(ledPin, LOW); 48 | // stop the program for for milliseconds: 49 | delay(sensorValue); 50 | } 51 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/AnalogInput.txt: -------------------------------------------------------------------------------- 1 | Use a potentiometer to control the blinking of an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/AnalogInput/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/Calibration.txt: -------------------------------------------------------------------------------- 1 | Define a maximum and minimum for expected analog sensor values. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Calibration/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/Fading.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Fading 3 | 4 | This example shows how to fade an LED using the analogWrite() function. 5 | 6 | The circuit: 7 | - LED attached from digital pin 9 to ground. 8 | 9 | created 1 Nov 2008 10 | by David A. Mellis 11 | modified 30 Aug 2011 12 | by Tom Igoe 13 | modified 28 Feb 2017 for use with sduino 14 | by Michael Mayer 15 | 16 | This example code is in the public domain. 17 | 18 | http://www.arduino.cc/en/Tutorial/Fading 19 | */ 20 | 21 | int ledPin = 9; // LED connected to digital pin 9 22 | 23 | void setup() { 24 | // nothing happens in setup 25 | } 26 | 27 | void loop() { 28 | // fade in from min to max in increments of 5 points: 29 | for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) { 30 | // sets the value (range from 0 to 255): 31 | analogWrite(ledPin, fadeValue); 32 | // wait for 30 milliseconds to see the dimming effect 33 | delay(30); 34 | } 35 | 36 | // fade out from max to min in increments of 5 points: 37 | for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) { 38 | // sets the value (range from 0 to 255): 39 | analogWrite(ledPin, fadeValue); 40 | // wait for 30 milliseconds to see the dimming effect 41 | delay(30); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/Fading.txt: -------------------------------------------------------------------------------- 1 | Use an analog output (PWM pin) to fade an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Fading/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/Smoothing.txt: -------------------------------------------------------------------------------- 1 | Smooth multiple readings of an analog input. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/03.Analog/Smoothing/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/ASCIITable/ASCIITable.txt: -------------------------------------------------------------------------------- 1 | Demonstrates Arduino's advanced serial output functions. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/ASCIITable/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/Dimmer.txt: -------------------------------------------------------------------------------- 1 | Move the mouse to change the brightness of an LED. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Dimmer/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/Graph.txt: -------------------------------------------------------------------------------- 1 | Send data to the computer and graph it in Processing. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/Graph/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/SerialCallResponse.txt: -------------------------------------------------------------------------------- 1 | Send multiple variables using a call-and-response (handshaking) method. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponse/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/SerialCallResponseASCII.txt: -------------------------------------------------------------------------------- 1 | Send multiple variables using a call-and-response (handshaking) method, and ASCII-encode the values before sending. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/04.Communication/SerialCallResponseASCII/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/Ping.txt: -------------------------------------------------------------------------------- 1 | Detecting objects with an ultrasonic range finder. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/06.Sensors/Ping/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/LEDBarGraph.txt: -------------------------------------------------------------------------------- 1 | How to make an LED bar graph. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/layout.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/07.Display/barGraph/schematic.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink use digitalToggle 3 | 4 | Turns an LED on for one second, then off for one second, repeatedly. 5 | 6 | Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO 7 | it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to 8 | the correct LED pin independent of which board is used. 9 | If you want to know what pin the on-board LED is connected to on your Arduino 10 | model, check the Technical Specs of your board at: 11 | https://www.arduino.cc/en/Main/Products 12 | 13 | modified 8 May 2014 14 | by Scott Fitzgerald 15 | modified 2 Sep 2016 16 | by Arturo Guadalupi 17 | modified 8 Sep 2016 18 | by Colby Newman 19 | 20 | This example code is in the public domain. 21 | 22 | http://www.arduino.cc/en/Tutorial/Blink 23 | */ 24 | 25 | // the setup function runs once when you press reset or power the board 26 | void setup() { 27 | // initialize digital pin LED_BUILTIN as an output. 28 | pinMode(LED_BUILTIN, OUTPUT); 29 | } 30 | 31 | // the loop function runs over and over again forever 32 | void loop() { 33 | delay(1000); // wait for a second 34 | } 35 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink/Blink.txt: -------------------------------------------------------------------------------- 1 | Turn an LED on and off. -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink_FastIO/Blink_FastIO.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink use fastIO macro PorPin demo 3 | huaweiwx@sina.com 2018.4.08 4 | 5 | fastIO macro list:(Pxx as PA2/PB/2/PC3//PD4/PE5/PF2..) 6 | pinMode_Pxx(mode) 7 | digitalRead_Pxx() 8 | digitalWrite_Pxx(n) 9 | digitalToggle_Pxx() 10 | */ 11 | 12 | void setup() { 13 | // initialize digital pin LED_BUILTIN as an output. 14 | pinMode_PD7(OUTPUT); 15 | } 16 | 17 | //LED_BUILTIN is PD7 18 | // the loop function runs over and over again forever 19 | void loop() { 20 | digitalToggle_PD7(); // turn the LED on/off 21 | delay(1000); // wait for a second 22 | } 23 | 24 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink_MACRO/Blink_MACRO.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink use fastIO macro GPIO_ALIAS_ASSIGN_POLARITY demo 3 | huaweiwx@sina.com 2018.4.08 4 | 5 | Macro: GPIO_ALIAS_ASSIGN_POLARITY(name[s],port[A...I],pin[0..7],polarity[0/1]) 6 | exp: GPIO_ALIAS_ASSIGN_POLARITY(LED,D,7,0) assign 7 | */ 8 | 9 | #define LED PD7 //LED is PD7 10 | 11 | GPIO_ALIAS_ASSIGN_POLARITY(Led,B,3,0)/*name Led/port GPIOD/pin 7 / & On is Low */ 12 | 13 | void setup() { 14 | // initialize digital pin LED_BUILTIN as an output. 15 | Led_OUTPUT(); 16 | // pinMode(LED_BUILTIN,OUTPUT); 17 | } 18 | 19 | // the loop function runs over and over again forever 20 | void loop() { 21 | Led_On(); // turn the LED on/off 22 | delay(1000); // wait for a second 23 | Led_Off(); 24 | delay(1000); 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/Blink_SPL/Blink_SPL.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Blink use fastIO macro GPIO_ALIAS_ASSIGN_POLARITY demo 3 | huaweiwx@sina.com 2018.4.08 4 | 5 | Macro: GPIO_ALIAS_ASSIGN_POLARITY(name[s],port[A...I],pin[0..7],polarity[0/1]) 6 | exp: GPIO_ALIAS_ASSIGN_POLARITY(LED,D,7,0) assign 7 | */ 8 | 9 | #ifdef PD7 10 | GPIO_ALIAS_ASSIGN_POLARITY(Led,D, 7, 0) /*name Led/port GPIOD/pin 7 / & On is Low */ 11 | #else 12 | #error #!his board hav'nt PG2 pin! 13 | #endif 14 | 15 | void setup() { 16 | Led_OUTPUT(); 17 | } 18 | 19 | // the loop function runs over and over again forever 20 | void loop() { 21 | Led_Toggle(); // turn the LED on/off 22 | delay(1000); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/showPortLever/showPortLever.ino: -------------------------------------------------------------------------------- 1 | /* 2 | showPortLever 3 | huaweiwx@sina.com 2018.4.08 4 | */ 5 | 6 | // the setup routine runs once when you press reset: 7 | void setup() { 8 | // initialize serial communication at 115200 bits per second: 9 | pinMode(LED_BUILTIN, OUTPUT); 10 | pinMode(PE0, INPUT); 11 | pinMode(PE1, INPUT); 12 | pinMode(PE2, INPUT); 13 | pinMode(PE3, INPUT); 14 | pinMode(PE4, INPUT); 15 | pinMode(PE5, INPUT); 16 | pinMode(PE6, INPUT); 17 | pinMode(PE7, INPUT); 18 | for (uint8_t i = 6; i > 0; i--) { 19 | digitalToggle(LED_BUILTIN); 20 | delay(200); 21 | } 22 | Serial_begin(115200); 23 | } 24 | 25 | // the loop routine runs over and over again forever: 26 | void loop() { 27 | // read the input on analog pin 0: 28 | uint8_t porte = GPIOE->IDR; 29 | digitalToggle(LED_BUILTIN); 30 | Serial_println_ib(porte, HEX); 31 | delay(1000); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/systic_callback/systic_callback.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * systic_callback.ino: TIM4(timebase) interrupt callback demo; 3 | * 2018.3.22 huaweiwx@sina.com 4 | */ 5 | 6 | // the setup routine runs once when you press reset: 7 | void setup() { 8 | // initialize serial communication at 115200 bits per second: 9 | pinMode(LED_BUILTIN, OUTPUT); 10 | } 11 | 12 | // the loop routine runs over and over again forever: 13 | void loop() { 14 | } 15 | 16 | 17 | /*TIM4 1ms interrupt callback func: void systic_callback() */ 18 | uint16_t count = 0; 19 | void systic_callback(void) 20 | { 21 | if (count >= 1000) { 22 | digitalToggle(LED_BUILTIN); 23 | count = 0; 24 | } else { 25 | count++; 26 | } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Generic_Examples/examples/08.extend/testPin/testPin.ino: -------------------------------------------------------------------------------- 1 | /* 2 | testPin.ino 对每个脚翻转电平,通过示波器检测波形,探测引脚 3 | for stm8s003f/103f 示例针对 stm8s003f/103f 4 | 5 | by huaweiwx@sina.com 2018.4.2 6 | */ 7 | 8 | // the setup function runs once when you press reset or power the board 9 | void setup() { 10 | // initialize digital pin LED_BUILTIN as an output. 11 | pinMode(PA1, OUTPUT); //set all pins as OUTPUT 将所有脚设定为输出 12 | pinMode(PA2, OUTPUT); 13 | pinMode(PA3, OUTPUT); 14 | pinMode(PB4, OUTPUT); 15 | pinMode(PB5, OUTPUT); 16 | pinMode(PC3, OUTPUT); 17 | pinMode(PC4, OUTPUT); 18 | pinMode(PC5, OUTPUT); 19 | pinMode(PC6, OUTPUT); 20 | pinMode(PC7, OUTPUT); 21 | pinMode(PD1, OUTPUT); 22 | pinMode(PD2, OUTPUT); 23 | pinMode(PD3, OUTPUT); 24 | pinMode(PD4, OUTPUT); 25 | pinMode(PD5, OUTPUT); 26 | pinMode(PD6, OUTPUT); 27 | } 28 | 29 | void blink(uint8_t pin, uint8_t n) { 30 | for (uint8_t i = 0; i < n; i++) { 31 | digitalToggle(pin); 32 | delay(1); 33 | } 34 | } 35 | // the loop function runs over and over again forever 36 | 37 | void loop() { 38 | blink(PA1, 2); //每个脚不同的翻转次数,可通过示波器检测判别 39 | blink(PA2, 4); 40 | blink(PA3, 6); 41 | blink(PB4, 8); 42 | blink(PB5, 10); 43 | blink(PC3, 12); 44 | blink(PC4, 14); 45 | blink(PC5, 16); 46 | blink(PC6, 18); 47 | blink(PC7, 20); 48 | blink(PD1, 22); 49 | blink(PD2, 24); 50 | blink(PD3, 26); 51 | blink(PD4, 28); 52 | blink(PD5, 30); 53 | blink(PD6, 32); 54 | } 55 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/I2C/examples/HMC5883L/HMC5883L.pde: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | Sample sketch that configures an HMC5883L 3 axis 3 | magnetometer to continuous mode and reads back 4 | the three axis of data. 5 | Code compiles to a size of 1500 bytes 6 | Equivalent Wire Library code compiles to 2032 bytes 7 | *******************************************/ 8 | 9 | #include 10 | 11 | #define HMC5883L 0x1E 12 | 13 | int x = 0; 14 | int y = 0; 15 | int z = 0; 16 | 17 | 18 | void setup() 19 | { 20 | I2C_begin(); 21 | I2C_write_c(HMC5883L,0x02,0x00); //configure device for continuous mode 22 | } 23 | 24 | void loop() 25 | { 26 | I2C_read(HMC5883L,0x03,6); //read 6 bytes (x,y,z) from the device 27 | x = I2C_receive() << 8; 28 | x |= I2C_receive(); 29 | y = I2C_receive() << 8; 30 | y |= I2C_receive(); 31 | z = I2C_receive() << 8; 32 | z |= I2C_receive(); 33 | } 34 | 35 | 36 | /* Wire library equivalent would be this 37 | 38 | //#include 39 | 40 | #define HMC5883L 0x1E 41 | 42 | int x = 0; 43 | int y = 0; 44 | int z = 0; 45 | 46 | 47 | void setup() 48 | { 49 | Wire.begin(); 50 | Wire.beginTransmission(HMC5883L); 51 | Wire.send(0x02); 52 | Wire.send(0x00); 53 | Wire.endTransmission(); 54 | } 55 | 56 | void loop() 57 | { 58 | Wire.beginTransmission(HMC5883L); 59 | Wire.send(0x03); 60 | Wire.endTransmission(); 61 | Wire.requestFrom(HMC5883L,6); 62 | x = Wire.receive() << 8; 63 | x |= Wire.receive(); 64 | y = Wire.receive() << 8; 65 | y |= Wire.receive(); 66 | z = Wire.receive() << 8; 67 | z |= Wire.receive(); 68 | } 69 | 70 | ********************************************/ 71 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/I2C/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For I2C 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | I2C KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | 14 | begin KEYWORD2 15 | end KEYWORD2 16 | timeOut KEYWORD2 17 | setSpeed KEYWORD2 18 | pullup KEYWORD2 19 | scan KEYWORD2 20 | write KEYWORD2 21 | read KEYWORD2 22 | available KEYWORD2 23 | receive KEYWORD2 24 | 25 | ####################################### 26 | # Instances (KEYWORD2) 27 | ####################################### 28 | 29 | I2c KEYWORD2 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/README.adoc: -------------------------------------------------------------------------------- 1 | = Liquid Crystal Library for Arduino = 2 | 3 | This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. 4 | 5 | For more information about this library please visit us at 6 | http://www.arduino.cc/en/Reference/LiquidCrystal 7 | 8 | == License == 9 | 10 | Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved. 11 | Copyright (c) 2010 Arduino LLC. All right reserved. 12 | 13 | This library is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Autoscroll/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | LiquidCrystal Library - Blink 3 | 4 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 5 | library works with all LCD displays that are compatible with the 6 | Hitachi HD44780 driver. There are many of them out there, and you 7 | can usually tell them by the 16-pin interface. 8 | 9 | This sketch prints "Hello World!" to the LCD and makes the 10 | cursor block blink. 11 | 12 | The circuit: 13 | * LCD RS pin to PA1 (digital pin 0) 14 | * LCD Enable pin to PA2 (digital pin 1) 15 | * LCD D4 pin to PA3 (digital pin 2) 16 | * LCD D5 pin to PD2 (digital pin 11) 17 | * LCD D6 pin to PD3 (digital pin 12) 18 | * LCD D7 pin to PD4 (digital pin 13) 19 | * LCD R/W pin to ground 20 | * LCD VSS pin to ground 21 | * LCD VCC pin to 5V 22 | * 10K potentiometer:: 23 | * ends to +5V and ground 24 | * wiper to LCD VO pin (pin 3) 25 | 26 | Library originally added 18 Apr 2008 27 | by David A. Mellis 28 | library modified 5 Jul 2009 29 | by Limor Fried (http://www.ladyada.net) 30 | example added 9 Jul 2009 31 | by Tom Igoe 32 | modified 22 Nov 2010 33 | by Tom Igoe 34 | modified 23 Jan 2017 35 | by Michael Mayer 36 | 37 | This example code is in the public domain. 38 | 39 | http://www.arduino.cc/en/Tutorial/LiquidCrystalBlink 40 | 41 | */ 42 | 43 | // include the library code: 44 | #include 45 | 46 | // initialize the library with the numbers of the interface pins 47 | LiquidCrystal (lcd,PA1,PA2, PA3,PD2,PD3,PD4); 48 | 49 | void setup() { 50 | // set up the LCD's number of columns and rows: 51 | lcd_begin(16, 2); 52 | // Print a message to the LCD. 53 | lcd_print_s("hello, world!"); 54 | } 55 | 56 | 57 | void loop() { 58 | // Turn off the blinking cursor: 59 | lcd_noBlink(); 60 | delay(3000); 61 | // Turn on the blinking cursor: 62 | lcd_blink(); 63 | delay(3000); 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Blink/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Cursor/Cursor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | LiquidCrystal Library - Cursor 3 | 4 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 5 | library works with all LCD displays that are compatible with the 6 | Hitachi HD44780 driver. There are many of them out there, and you 7 | can usually tell them by the 16-pin interface. 8 | 9 | This sketch prints "Hello World!" to the LCD and 10 | uses the cursor() and noCursor() methods to turn 11 | on and off the cursor. 12 | 13 | The circuit: 14 | * LCD RS pin to PA1 (digital pin 0) 15 | * LCD Enable pin to PA2 (digital pin 1) 16 | * LCD D4 pin to PA3 (digital pin 2) 17 | * LCD D5 pin to PD2 (digital pin 11) 18 | * LCD D6 pin to PD3 (digital pin 12) 19 | * LCD D7 pin to PD4 (digital pin 13) 20 | * LCD R/W pin to ground 21 | * LCD VSS pin to ground 22 | * LCD VCC pin to 5V 23 | * 10K potentiometer:: 24 | * ends to +5V and ground 25 | * wiper to LCD VO pin (pin 3) 26 | 27 | Library originally added 18 Apr 2008 28 | by David A. Mellis 29 | library modified 5 Jul 2009 30 | by Limor Fried (http://www.ladyada.net) 31 | example added 9 Jul 2009 32 | by Tom Igoe 33 | modified 22 Nov 2010 34 | by Tom Igoe 35 | modified 23 Jan 2017 36 | by Michael Mayer 37 | 38 | This example code is in the public domain. 39 | 40 | http://www.arduino.cc/en/Tutorial/LiquidCrystalCursor 41 | 42 | */ 43 | 44 | // include the library code: 45 | #include 46 | 47 | // initialize the library with the numbers of the interface pins 48 | LiquidCrystal (lcd,PA1,PA2, PA3,PD2,PD3,PD4); 49 | 50 | void setup() { 51 | // set up the LCD's number of columns and rows: 52 | lcd_begin(16, 2); 53 | // Print a message to the LCD. 54 | lcd_print_s("hello, world!"); 55 | } 56 | 57 | 58 | void loop() { 59 | // Turn off the cursor: 60 | lcd_noCursor(); 61 | delay(500); 62 | // Turn on the cursor: 63 | lcd_cursor(); 64 | delay(500); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Cursor/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/CustomCharacter/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Display/Display.ino: -------------------------------------------------------------------------------- 1 | /* 2 | LiquidCrystal Library - display() and noDisplay() 3 | 4 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 5 | library works with all LCD displays that are compatible with the 6 | Hitachi HD44780 driver. There are many of them out there, and you 7 | can usually tell them by the 16-pin interface. 8 | 9 | This sketch prints "Hello World!" to the LCD and uses the 10 | display() and noDisplay() functions to turn on and off 11 | the display. 12 | 13 | The circuit: 14 | * LCD RS pin to PA1 (digital pin 0) 15 | * LCD Enable pin to PA2 (digital pin 1) 16 | * LCD D4 pin to PA3 (digital pin 2) 17 | * LCD D5 pin to PD2 (digital pin 11) 18 | * LCD D6 pin to PD3 (digital pin 12) 19 | * LCD D7 pin to PD4 (digital pin 13) 20 | * LCD R/W pin to ground 21 | * LCD VSS pin to ground 22 | * LCD VCC pin to 5V 23 | * 10K potentiometer: 24 | * ends to +5V and ground 25 | * wiper to LCD VO pin (pin 3) 26 | 27 | Library originally added 18 Apr 2008 28 | by David A. Mellis 29 | library modified 5 Jul 2009 30 | by Limor Fried (http://www.ladyada.net) 31 | example added 9 Jul 2009 32 | by Tom Igoe 33 | modified 22 Nov 2010 34 | by Tom Igoe 35 | modified 26 Jan 2017 36 | by Michael Mayer 37 | 38 | This example code is in the public domain. 39 | 40 | http://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay 41 | 42 | */ 43 | 44 | // include the library code: 45 | #include 46 | 47 | // initialize the library with the numbers of the interface pins 48 | LiquidCrystal (lcd,PA1,PA2, PA3,PD2,PD3,PD4); 49 | 50 | void setup() { 51 | // set up the LCD's number of columns and rows: 52 | lcd_begin(16, 2); 53 | // Print a message to the LCD. 54 | lcd_print_s("hello, world!"); 55 | } 56 | 57 | void loop() { 58 | // Turn off the display: 59 | lcd_noDisplay(); 60 | delay(500); 61 | // Turn on the display: 62 | lcd_display(); 63 | delay(500); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Display/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | /* 2 | LiquidCrystal Library - Hello World 3 | 4 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 5 | library works with all LCD displays that are compatible with the 6 | Hitachi HD44780 driver. There are many of them out there, and you 7 | can usually tell them by the 16-pin interface. 8 | 9 | This sketch prints "Hello World!" to the LCD 10 | and shows the time. 11 | 12 | The circuit: 13 | * LCD RS pin to PA1 (digital pin 0) 14 | * LCD Enable pin to PA2 (digital pin 1) 15 | * LCD D4 pin to PA3 (digital pin 2) 16 | * LCD D5 pin to PD2 (digital pin 11) 17 | * LCD D6 pin to PD3 (digital pin 12) 18 | * LCD D7 pin to PD4 (digital pin 13) 19 | * LCD R/W pin to ground 20 | * LCD VSS pin to ground 21 | * LCD VCC pin to 5V 22 | * 10K potentiometer: 23 | * ends to +5V and ground 24 | * wiper to LCD VO pin (pin 3) 25 | 26 | Library originally added 18 Apr 2008 27 | by David A. Mellis 28 | library modified 5 Jul 2009 29 | by Limor Fried (http://www.ladyada.net) 30 | example added 9 Jul 2009 31 | by Tom Igoe 32 | modified 22 Nov 2010 33 | by Tom Igoe 34 | modified 23 Jan 2017 35 | by Michael Mayer 36 | 37 | This example code is in the public domain. 38 | 39 | http://www.arduino.cc/en/Tutorial/LiquidCrystal 40 | */ 41 | 42 | // include the library code: 43 | #include 44 | 45 | // initialize the library with the numbers of the interface pins 46 | LiquidCrystal (lcd,PA1,PA2, PA3,PD2,PD3,PD4); 47 | 48 | void setup() { 49 | // set up the LCD's number of columns and rows: 50 | lcd_begin(16, 2); 51 | // Print a message to the LCD. 52 | lcd_print_s("hello, world!"); 53 | } 54 | 55 | 56 | void loop() { 57 | // set the cursor to column 0, line 1 58 | // (note: line 1 is the second row, since counting begins with 0): 59 | lcd_setCursor(0, 1); 60 | // print the number of seconds since reset: 61 | lcd_print_u(millis() / 1000); 62 | } 63 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/HelloWorld/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/Scroll/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/SerialDisplay/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/TextDirection/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/examples/setCursor/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For LiquidCrystal 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | LiquidCrystal KEYWORD1 LiquidCrystal 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | clear KEYWORD2 17 | home KEYWORD2 18 | print KEYWORD2 19 | setCursor KEYWORD2 20 | cursor KEYWORD2 21 | noCursor KEYWORD2 22 | blink KEYWORD2 23 | noBlink KEYWORD2 24 | display KEYWORD2 25 | noDisplay KEYWORD2 26 | autoscroll KEYWORD2 27 | noAutoscroll KEYWORD2 28 | leftToRight KEYWORD2 29 | rightToLeft KEYWORD2 30 | scrollDisplayLeft KEYWORD2 31 | scrollDisplayRight KEYWORD2 32 | createChar KEYWORD2 33 | setRowOffsets KEYWORD2 34 | 35 | ####################################### 36 | # Constants (LITERAL1) 37 | ####################################### 38 | 39 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/LiquidCrystal/library.properties: -------------------------------------------------------------------------------- 1 | name=LiquidCrystal 2 | version=1.0.5 3 | author=Arduino, Adafruit 4 | maintainer=Arduino 5 | sentence=Allows communication with alphanumerical liquid crystal displays (LCDs). 6 | paragraph=This library allows an Arduino/Genuino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines). 7 | category=Display 8 | url=http://www.arduino.cc/en/Reference/LiquidCrystal 9 | architectures=* 10 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Mini_SSD1306/examples/oled-mini/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Mini_SSD1306/examples/oled-mini/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DARDUINO=180 \ 14 | -I. -I$(SDUINO) -I$(SDUINO)/libraries/I2C -I$(LIBBASE)/inc \ 15 | -I/usr/share/sdcc/include/ 16 | # -DSUPPORT_ALTERNATE_MAPPINGS 17 | 18 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 19 | 20 | OBJECTS=$(BASENAME).rel ssd1306.rel 21 | #SDLIBS=I2C 22 | SDOBJECTS=main.rel wiring.rel wiring_digital.rel 23 | SDLIBOBJECTS=I2C.rel 24 | 25 | .PHONY: all clean flash 26 | 27 | #all: $(OBJECTS) 28 | 29 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) $(SDLIBOBJECTS) 30 | #test.rel wiring_digital.rel 31 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 32 | 33 | $(OBJECTS) : %.rel : %.c 34 | $(CC) -c $(CFLAGS) $^ -o $@ 35 | 36 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 37 | $(CC) -c $(CFLAGS) $^ -o $@ 38 | 39 | $(SDLIBOBJECTS) : %.rel : $(SDUINO)/libraries/I2C/%.c 40 | $(CC) -c $(CFLAGS) $^ -o $@ 41 | 42 | flash: $(EXECUTABLE) 43 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 44 | 45 | readopt: 46 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 47 | 48 | 49 | clean: 50 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 51 | *.cdb *.adb *~ *.bak 52 | rm -f $(EXECUTABLE) 53 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/PCD8544/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Carlos Rodrigues 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/PCD8544/examples/HelloWorld/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/PCD8544/examples/Thermometer/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/PCD8544/library.properties: -------------------------------------------------------------------------------- 1 | name=PCD8544 2 | version=1.4.3 3 | author=Carlos Rodrigues 4 | maintainer=Carlos Rodrigues 5 | sentence=Philips PCD8544 or compatible LCD library. 6 | paragraph=PCD8544 supports monochrome LCDs most commonly found on old Nokia phones. This is a minimal library intended for low memory usage. 7 | category=Display 8 | url=https://github.com/carlosefr/pcd8544 9 | architectures=* 10 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/README.adoc: -------------------------------------------------------------------------------- 1 | = Servo Library for Arduino = 2 | 3 | This library allows an Arduino board to control RC (hobby) servo motors. 4 | 5 | For more information about this library please visit us at 6 | http://www.arduino.cc/en/Reference/Servo 7 | 8 | == License == 9 | 10 | Copyright (c) 2013 Arduino LLC. All right reserved. 11 | Copyright (c) 2009 Michael Margolis. All right reserved. 12 | 13 | This library is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/examples/Knob/Knob.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Controlling a servo position using a potentiometer (variable resistor) 3 | by Michal Rinott 4 | 5 | modified on 8 Nov 2013 6 | by Scott Fitzgerald 7 | http://www.arduino.cc/en/Tutorial/Knob 8 | modified to C syntax on 30 Jan 2017 for use with the sdunio environment 9 | by Michael Mayer 10 | */ 11 | 12 | #include 13 | 14 | Servo(myservo); // create servo "object" to control a servo 15 | 16 | int potpin = 0; // analog pin used to connect the potentiometer 17 | int val; // variable to read the value from the analog pin 18 | 19 | void setup() { 20 | myservo_attach(9); // attaches the servo on pin 9 to the servo object 21 | } 22 | 23 | 24 | void loop() { 25 | 26 | val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 27 | val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) 28 | myservo_write(val); // sets the servo position according to the scaled value 29 | delay(15); // waits for the servo to get there 30 | } 31 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/examples/Knob/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/examples/Sweep/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/examples/Sweep/Sweep.ino: -------------------------------------------------------------------------------- 1 | /* Sweep 2 | by BARRAGAN 3 | This example code is in the public domain. 4 | 5 | modified 8 Nov 2013 6 | by Scott Fitzgerald 7 | http://www.arduino.cc/en/Tutorial/Sweep 8 | modified to C syntax on 30 Jan 2017 for use with the sdunio environment 9 | by Michael Mayer 10 | */ 11 | 12 | #include 13 | 14 | Servo(myservo); // create servo "object" to control a servo 15 | // twelve servo objects can be created on most boards 16 | 17 | int pos = 0; // variable to store the servo position 18 | 19 | void setup() { 20 | myservo_attach(9); // attaches the servo on pin 9 to the servo object 21 | } 22 | 23 | void loop() { 24 | for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees 25 | // in steps of 1 degree 26 | myservo_write(pos); // tell servo to go to position in variable 'pos' 27 | delay(15); // waits 15ms for the servo to reach the position 28 | } 29 | for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees 30 | myservo_write(pos); // tell servo to go to position in variable 'pos' 31 | delay(15); // waits 15ms for the servo to reach the position 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map Servo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Servo KEYWORD1 Servo 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | attach KEYWORD2 15 | detach KEYWORD2 16 | write KEYWORD2 17 | read KEYWORD2 18 | attached KEYWORD2 19 | writeMicroseconds KEYWORD2 20 | readMicroseconds KEYWORD2 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Servo/library.properties: -------------------------------------------------------------------------------- 1 | name=Servo 2 | version=1.1.2 3 | author=Michael Margolis, Arduino 4 | maintainer=Arduino 5 | sentence=Allows Arduino/Genuino boards to control a variety of servo motors. 6 | paragraph=This library can control a great number of servos.
It makes careful use of timers: the library can control 12 servos using only 1 timer.
On the Arduino Due you can control up to 60 servos.
7 | category=Device Control 8 | url=http://www.arduino.cc/en/Reference/Servo 9 | architectures=stm8 10 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/Vmeter_3digits/vmeter_3digs_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/Vmeter_3digits/vmeter_3digs_1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/showFloat/showFloat.ino: -------------------------------------------------------------------------------- 1 | /* 2 | showFloat.ino: SevenSegment show Float demo by huaweiwx@sina.com 2018.3.8 3 | */ 4 | 5 | // VC288 3DigitsVolt : 6 | //A PD1 PC4 7 | //B PA3 PB5 8 | //C PC3 PC7 9 | //D PC6 PD1 10 | //E PC7 PD3 11 | //F PC4 PC3 12 | //G PA2 PB4 13 | //DP PC5 PD2 14 | //D1 PD4 PC6 15 | //D2 PD6 PC5 16 | //D3 PD5 PA3 17 | //D4 PB5 18 | //D5 PB4 19 | //D6 PA1 20 | 21 | #include 22 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d01, d02, d03, d04, d11, d12, d13, d14); // 2*4 23 | 24 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d01, d02, d03, d11, d12, d13); // 2*3 25 | // SevenSegment(seg7d3, PD1, PA3, PC3, PC6, PC7, PC4, PA2, PC5, PD4 , PD6, PD5, PB5, PB4, PA1); /*VC288 board use 2*3 digits*/ 26 | 27 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d1, d2, d3, d4); // 1*4 28 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d1, d2, d3); // 1*3 29 | SevenSegment(seg7d3, PC4, PB5, PC7, PD1, PD3, PC3, PB4, PD2, PC6 , PC5, PA3); /*3DigitsVolt board use 1*3 digits*/ 30 | 31 | void setup() { 32 | seg7d3_begin(1); //0/1 共阳/阴7段数码管 33 | } 34 | 35 | void loop() { 36 | for (uint16_t j = 0; j < 1000; j++) { 37 | seg7d3_showFloat(j/100.0); 38 | for (uint8_t i = 0; i < 100; i++) seg7d3_display(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/showFloat/vmeter_3digs_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/showFloat/vmeter_3digs_1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/shownum/shownum.ino: -------------------------------------------------------------------------------- 1 | /* 2 | shownum.ino: SevenSegment show a DEC num demo by huaweiwx@sina.com 2018.3.8 3 | */ 4 | 5 | // VC288 3DigitsVolt : 6 | //A PD1 PC4 7 | //B PA3 PB5 8 | //C PC3 PC7 9 | //D PC6 PD1 10 | //E PC7 PD3 11 | //F PC4 PC3 12 | //G PA2 PB4 13 | //DP PC5 PD2 14 | //D1 PD4 PC6 15 | //D2 PD6 PC5 16 | //D3 PD5 PA3 17 | //D4 PB5 18 | //D5 PB4 19 | //D6 PA1 20 | 21 | #include 22 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d01, d02, d03, d04, d11, d12, d13, d14); // 2*4 23 | 24 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d01, d02, d03, d11, d12, d13); // 2*3 25 | // SevenSegment(seg7d3, PD1, PA3, PC3, PC6, PC7, PC4, PA2, PC5, PD4 , PD6, PD5, PB5, PB4, PA1); /*VC288 board use 2*3 digits*/ 26 | 27 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d1, d2, d3, d4); // 1*4 28 | // SevenSegment (instancename,da, db, dc, dd, de, df, dg, dp, d1, d2, d3); // 1*3 29 | SevenSegment(seg7d3, PC4, PB5, PC7, PD1, PD3, PC3, PB4, PD2, PC6 , PC5, PA3); /*3DigitsVolt board use 1*3 digits*/ 30 | 31 | void setup() { 32 | seg7d3_begin(1); //0/1 共阳/阴7段数码管 33 | } 34 | 35 | void loop() { 36 | for (uint8_t i3 = 0; i3 < 10; i3++) { 37 | for (uint8_t i2 = 0; i2 < 10; i2++) { 38 | for (uint8_t i1 = 0; i1 < 10; i1++) { 39 | seg7d3_showDEC(i3 * 100 + i2 * 10 + i1); 40 | for (uint8_t i = 0; i < 100; i++) seg7d3_display(); 41 | } 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/shownum/vmeter_3digs_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Example/shownum/vmeter_3digs_1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/108_2120928_55847cda17808de.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/108_2120928_55847cda17808de.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/108_2120928_e6d09e566145f10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/108_2120928_e6d09e566145f10.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/67cb579dc52a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/67cb579dc52a.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/SM41056_Datasheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/libraries/SevenSegment/Extras/SM41056_Datasheet.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/README.adoc: -------------------------------------------------------------------------------- 1 | = Stepper Library for Arduino = 2 | 3 | This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it. 4 | 5 | For more information about this library please visit us at 6 | http://www.arduino.cc/en/Reference/Stepper 7 | 8 | == License == 9 | 10 | Copyright (c) Arduino LLC. All right reserved. 11 | Copyright (c) Sebastian Gassner. All right reserved. 12 | Copyright (c) Noah Shibley. All right reserved. 13 | 14 | This library is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Lesser General Public 16 | License as published by the Free Software Foundation; either 17 | version 2.1 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Lesser General Public License for more details. 23 | 24 | You should have received a copy of the GNU Lesser General Public 25 | License along with this library; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/MotorKnob/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/MotorKnob/MotorKnob.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * MotorKnob 3 | * 4 | * A stepper motor follows the turns of a potentiometer 5 | * (or other sensor) on analog input 0. 6 | * 7 | * http://www.arduino.cc/en/Reference/Stepper 8 | * This example code is in the public domain. 9 | */ 10 | 11 | #include 12 | 13 | // change this to the number of steps on your motor 14 | #define STEPS 200 15 | 16 | Stepper(myStepper); 17 | 18 | // the previous reading from the analog input 19 | int previous = 0; 20 | 21 | void setup() { 22 | // create an instance of the stepper class, specifying 23 | // the number of steps of the motor and the pins it's 24 | // attached to 25 | myStepper_4phase(STEPS, 8, 9, 10, 11); 26 | // set the speed of the motor to 30 RPMs 27 | myStepper_setSpeed(30); 28 | } 29 | 30 | void loop() { 31 | // get the sensor value 32 | int val = analogRead(0); 33 | 34 | // move a number of steps equal to the change in the 35 | // sensor reading 36 | myStepper_step(val - previous); 37 | 38 | // remember the previous value of the sensor 39 | previous = val; 40 | } 41 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_oneRevolution/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | #CFLAGS = -DNO_5PHASE 3 | 4 | include ../../../../../../../sduino.mk 5 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_oneRevolution/stepper_oneRevolution.ino: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Stepper Motor Control - one revolution 4 | 5 | This program drives a unipolar or bipolar stepper motor. 6 | The motor is attached to digital pins 8 - 11 of the Arduino. 7 | 8 | The motor should revolve one revolution in one direction, then 9 | one revolution in the other direction. 10 | 11 | 12 | Created 11 Mar. 2007 13 | Modified 30 Nov. 2009 14 | by Tom Igoe 15 | Modified 28 Jan. 2017 to C syntax for use with sduino environment 16 | by Michael Mayer 17 | 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | // change this to fit the number of steps per revolution for your motor 24 | #define stepsPerRevolution 200 25 | 26 | // initialize the stepper library on pins 8 through 11: 27 | Stepper (myStepper,stepsPerRevolution, 8, 9, 10, 11); 28 | 29 | void setup() { 30 | // set the speed at 60 rpm: 31 | myStepper_setSpeed(60); 32 | // initialize the serial port: 33 | Serial_begin(9600); 34 | } 35 | 36 | void loop() { 37 | // step one revolution in one direction: 38 | Serial_println_s("clockwise"); 39 | myStepper_step(stepsPerRevolution); 40 | delay(500); 41 | 42 | // step one revolution in the other direction: 43 | Serial_println_s("counterclockwise"); 44 | myStepper_step(-stepsPerRevolution); 45 | delay(500); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_oneStepAtATime/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_oneStepAtATime/stepper_oneStepAtATime.ino: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Stepper Motor Control - one step at a time 4 | 5 | This program drives a unipolar or bipolar stepper motor. 6 | The motor is attached to digital pins 8 - 11 of the Arduino. 7 | 8 | The motor will step one step at a time, very slowly. You can use this to 9 | test that you've got the four wires of your stepper wired to the correct 10 | pins. If wired correctly, all steps should be in the same direction. 11 | 12 | Use this also to count the number of steps per revolution of your motor, 13 | if you don't know it. Then plug that number into the oneRevolution 14 | example to see if you got it right. 15 | 16 | Created 30 Nov. 2009 17 | by Tom Igoe 18 | Modified 28 Jan. 2017 to C syntax for use with sduino environment 19 | by Michael Mayer 20 | 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #define stepsPerRevolution 200 // change this to fit the number of steps per revolution 27 | // for your motor 28 | 29 | // initialize the stepper library on pins 8 through 11: 30 | Stepper (myStepper,stepsPerRevolution, 8, 9, 10, 11); 31 | 32 | int stepCount = 0; // number of steps the motor has taken 33 | 34 | void setup() { 35 | // initialize the serial port: 36 | Serial_begin(9600); 37 | } 38 | 39 | void loop() { 40 | // step one step: 41 | myStepper_step(1); 42 | Serial_print_s("steps:"); 43 | Serial_println_u(stepCount); 44 | stepCount++; 45 | delay(500); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_speedControl/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../../../../../../sduino.mk 4 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/examples/stepper_speedControl/stepper_speedControl.ino: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Stepper Motor Control - speed control 4 | 5 | This program drives a unipolar or bipolar stepper motor. 6 | The motor is attached to digital pins 8 - 11 of the Arduino. 7 | A potentiometer is connected to analog input 0. 8 | 9 | The motor will rotate in a clockwise direction. The higher the potentiometer value, 10 | the faster the motor speed. Because setSpeed() sets the delay between steps, 11 | you may notice the motor is less responsive to changes in the sensor value at 12 | low speeds. 13 | 14 | Created 30 Nov. 2009 15 | Modified 28 Oct 2010 16 | by Tom Igoe 17 | Modified 28 Jan. 2017 to C syntax for use with sduino environment 18 | by Michael Mayer 19 | 20 | */ 21 | 22 | #include 23 | 24 | #define stepsPerRevolution 200 // change this to fit the number of steps per revolution 25 | // for your motor 26 | 27 | 28 | // initialize the stepper library on pins 8 through 11: 29 | Stepper (myStepper,stepsPerRevolution, 8, 9, 10, 11); 30 | 31 | int stepCount = 0; // number of steps the motor has taken 32 | 33 | void setup() { 34 | // nothing to do inside the setup 35 | } 36 | 37 | void loop() { 38 | // read the sensor value: 39 | int sensorReading = analogRead(A0); 40 | // map it to a range from 0 to 100: 41 | int motorSpeed = map(sensorReading, 0, 1023, 0, 100); 42 | // set the motor speed: 43 | if (motorSpeed > 0) { 44 | myStepper_setSpeed(motorSpeed); 45 | // step 1/100 of a revolution: 46 | myStepper_step(stepsPerRevolution / 100); 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Test 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Stepper KEYWORD1 Stepper 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | step KEYWORD2 16 | setSpeed KEYWORD2 17 | version KEYWORD2 18 | 19 | ###################################### 20 | # Instances (KEYWORD2) 21 | ####################################### 22 | direction KEYWORD2 23 | speed KEYWORD2 24 | 25 | 26 | ####################################### 27 | # Constants (LITERAL1) 28 | ####################################### 29 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/libraries/Stepper/library.properties: -------------------------------------------------------------------------------- 1 | name=Stepper 2 | version=1.1.3 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Allows Arduino boards to control a variety of stepper motors. 6 | paragraph=This library allows you to control unipolar or bipolar stepper motors. To use it you will need a stepper motor, and the appropriate hardware to control it. 7 | category=Device Control 8 | url=http://www.arduino.cc/en/Reference/Stepper 9 | architectures=* 10 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/inc/stm8l15x_rtc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/inc/stm8l15x_rtc.h -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_adc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_adc.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_comp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_comp.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_dma.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_dma.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_flash.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_i2c.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_rst.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_rst.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim1.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim2.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim3.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim4.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_tim5.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/src/stm8l15x_usart.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/stm8l15x-16x-05x_al31-l_stdperiph_drivers_um.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8L_StdPeriph_Driver/stm8l15x-16x-05x_al31-l_stdperiph_drivers_um.chm -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/Release_Notes.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/Release_Notes.html -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/correct_stm8s908.patch: -------------------------------------------------------------------------------- 1 | diff --git a/STM8S_StdPeriph_Driver/src/stm8s_conf.h b/STM8S_StdPeriph_Driver/src/stm8s_conf.h 2 | index 111047b..152fdfb 100644 3 | --- a/STM8S_StdPeriph_Driver/src/stm8s_conf.h 4 | +++ b/STM8S_StdPeriph_Driver/src/stm8s_conf.h 5 | @@ -56,14 +56,14 @@ 6 | #include "stm8s_rst.h" 7 | #include "stm8s_spi.h" 8 | #include "stm8s_tim1.h" 9 | -#if !defined(STM8S903) || !defined(STM8AF622x) 10 | +#if !defined(STM8S903) && !defined(STM8AF622x) 11 | #include "stm8s_tim2.h" 12 | #endif /* (STM8S903) || (STM8AF622x) */ 13 | #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) ||\ 14 | defined(STM8S005) || defined (STM8AF52Ax) || defined (STM8AF62Ax) || defined (STM8AF626x) 15 | #include "stm8s_tim3.h" 16 | #endif /* (STM8S208) ||defined(STM8S207) || defined(STM8S007) ||defined(STM8S105) */ 17 | -#if !defined(STM8S903) || !defined(STM8AF622x) 18 | +#if !defined(STM8S903) && !defined(STM8AF622x) 19 | #include "stm8s_tim4.h" 20 | #endif /* (STM8S903) || (STM8AF622x) */ 21 | #if defined(STM8S903) || defined(STM8AF622x) 22 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF52Ax.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF52Ax.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF622x.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF622x.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF626x.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF626x.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF62Ax.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8AF62Ax.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S003.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S003.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S005.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S005.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S007.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S007.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S103.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S103.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S105.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S105.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S207.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S207.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S208.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S208.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S903.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/lib/STM8S903.lib -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/peripherie.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/peripherie.ods -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/peripherie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/peripherie.png -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/Makefile: -------------------------------------------------------------------------------- 1 | CC=sdcc 2 | AR=sdar 3 | CFLAGS=-c -mstm8 -DSTM8S103 -I ../../inc -I../../src --opt-code-size -I. 4 | LDFLAGS=-rc 5 | SOURCES=$(wildcard stm*.c) 6 | 7 | LIBSOURCES= \ 8 | stm8s_adc1.c \ 9 | stm8s_awu.c \ 10 | stm8s_beep.c \ 11 | stm8s_clk.c \ 12 | stm8s_exti.c \ 13 | stm8s_flash.c \ 14 | stm8s_gpio.c \ 15 | stm8s_i2c.c \ 16 | stm8s_itc.c \ 17 | stm8s_iwdg.c \ 18 | stm8s_rst.c \ 19 | stm8s_spi.c \ 20 | stm8s_tim1.c \ 21 | stm8s_tim2.c \ 22 | stm8s_tim4.c \ 23 | stm8s_uart1.c \ 24 | stm8s_wwdg.c 25 | # not used for stm8s103: 26 | #stm8s_adc2.c 27 | #stm8s_can.c \ 28 | #stm8s_tim3.c \ 29 | #stm8s_tim5.c \ 30 | #stm8s_tim6.c \ 31 | #stm8s_uart2.c \ 32 | #stm8s_uart3.c \ 33 | #stm8s_uart4.c 34 | 35 | OBJECTS=$(SOURCES:.c=.o) 36 | OBJECTS_LINK=$(SOURCES:.c=.rel) 37 | EXECUTABLE=stm8s103.lib 38 | 39 | all: $(SOURCES) $(EXECUTABLE) 40 | 41 | $(EXECUTABLE): $(OBJECTS) 42 | $(AR) $(LDFLAGS) $(EXECUTABLE) $(OBJECTS_LINK) 43 | 44 | .c.o: 45 | $(CC) $(CFLAGS) $< -o $@ 46 | 47 | clean: 48 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map 49 | rm -f $(EXECUTABLE) 50 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/doit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # split the library into individual source files for every single function, 4 | # compile them seperately and pack them all together into one big library. 5 | 6 | 7 | LIBSOURCES="stm8s_adc1.c stm8s_awu.c stm8s_beep.c stm8s_clk.c stm8s_exti.c stm8s_flash.c stm8s_gpio.c 8 | stm8s_i2c.c 9 | stm8s_itc.c 10 | stm8s_iwdg.c 11 | stm8s_rst.c 12 | stm8s_spi.c 13 | stm8s_tim1.c 14 | stm8s_tim2.c 15 | stm8s_tim4.c 16 | stm8s_uart1.c 17 | stm8s_wwdg.c" 18 | 19 | # not used for stm8s103: 20 | #stm8s_adc2.c 21 | #stm8s_can.c \ 22 | #stm8s_tim3.c \ 23 | #stm8s_tim5.c \ 24 | #stm8s_tim6.c \ 25 | #stm8s_uart2.c \ 26 | #stm8s_uart3.c \ 27 | #stm8s_uart4.c 28 | 29 | 30 | splitit() { 31 | #awk '/\/\*\*\r/{n++; file="x/$1-" n ".c";print "#include \"inc.h\"">file}{print >file }' $1 32 | awk "/\/\*\*\r/{n++; file=\"$TMPDIR/$1-\" n \".c\";print \"#include \\\"$1.h\\\"\">file}{print >file }" $1 33 | cd $TMPDIR 34 | sed "1 d" $1-1.c > $1.h 35 | rm $1-1.c 36 | cd - 37 | } 38 | 39 | TMPDIR=$(mktemp -dp.) 40 | echo "using $TMPDIR" 41 | for i in $LIBSOURCES; do splitit $i; done 42 | cp Makefile $TMPDIR 43 | make -C $TMPDIR 44 | mv $TMPDIR/stm8s103.lib . 45 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_can.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_can.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_clk.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_clk.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_flash.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_i2c.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim1.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim2.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim3.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim4.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim5.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_tim6.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart1.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart2.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/src/stm8s_uart4.c -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/stm8s-a_stdperiph_drivers_um.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/stm8s-a_stdperiph_drivers_um.chm -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/STM8S_StdPeriph_Driver/tools/showdeps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if [ $# -ne 1 ]; then 5 | cat << EOF 6 | split the library into individual source files for every single function, 7 | compile them seperately and pack them all together into one big library. 8 | 9 | usage: $0 cputype 10 | 11 | supported cpu types as found in inc/stm8s.h: 12 | EOF 13 | grep defined inc/stm8s.h|fmt -1|sed -n 's,.*(STM8,\tSTM8,p'|sed 's,).*,,'|sort|uniq 14 | cat << EOF 15 | 16 | These cpus are known to use identical libraries: 17 | Low density devices: STM8S003, STM8S103 18 | Medium density devices: STM8S005, STM8S105, STM8AF626x 19 | High density devices without CAN: STM8S007, STM8S207, STM8AF62Ax 20 | High density devices with CAN: STM8S208, STM8AF52Ax 21 | App. specific low density devices:STM8S903 22 | STM8AF622x 23 | EOF 24 | exit 1 25 | fi 26 | 27 | CPU=$1 28 | 29 | HFILES=$(sdcc -mstm8 -Iinc -Isrc -D$CPU "-Wp-MM" -E inc/stm8s.h|fmt -1|sed -n 's, *inc/stm8s_,stm8s_,p') 30 | CFILES=${HFILES//.h/.c} 31 | 32 | echo "Needed source code modules for CPU $CPU:" 33 | echo $CFILES 34 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_32_3.h: -------------------------------------------------------------------------------- 1 | // tim_32_3.h 2 | // STM8S903K3B/T/Ux 32PINS 3 | // huaweiwx@sina.com 2018.4.08 4 | 5 | 6 | #ifndef _STM8_TIM32_3_h 7 | #define _STM8_TIM32_3_h 8 | #ifndef SDUINOPINS_DEF 9 | #ifdef ARDUINO_MAIN 10 | 11 | 12 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { 13 | NOT_ON_TIMER, /* 0 PA1 OSC IN */ 14 | NOT_ON_TIMER, /* 1 PA2 OSC OUT */ 15 | NOT_ON_TIMER, /* 2 PA3 UART1_TX */ 16 | NOT_ON_TIMER, /* 3 PB0 AIN0/[TIM1_CH1N] */ 17 | NOT_ON_TIMER, /* 4 PB1 AIN1/[TIM1_CH2N] */ 18 | NOT_ON_TIMER, /* 5 PB2 AIN2/[TIM2_CH3N] */ 19 | NOT_ON_TIMER, /* 6 PB3 AIN3/[TIM1_ETR] */ 20 | NOT_ON_TIMER, /* 7 PB4 I2C_SCL/[ADC_ETR]*/ 21 | NOT_ON_TIMER, /* 8 PB5 PB5/I2C_SDA/[TIM1_BKIN] */ 22 | NOT_ON_TIMER, /* 7 PB6 */ 23 | NOT_ON_TIMER, /* 8 PB7 */ 24 | TIMER11, /* 9 PC1 TIM1_CH1/UART1_CK */ 25 | TIMER12, /* 10 PC2 TIM1_CH2 */ 26 | TIMER13, /* 11 PC3 TIM1_CH3 */ 27 | TIMER14, /* 12 PC4 TIM1_CH4 */ 28 | NOT_ON_TIMER, /* 13 PC5 SPI_SCK/[TIM5_CH1]*/ 29 | NOT_ON_TIMER, /* 14 PC6 SPI_MOSI/[TIM1_CH1] */ 30 | NOT_ON_TIMER, /* 15 PC7 SPI_MISO/[TIM1_CH2] */ 31 | NOT_ON_TIMER, /* 16 PD0 TIM1_BKIN */ 32 | NOT_ON_TIMER, /* 16 PD1 SWIM */ 33 | NOT_ON_TIMER, /* 17 PD2 TIM5_CH3/[AIN3]*/ 34 | NOT_ON_TIMER, /* 18 PD3 TIM5_CH2/[AIN4]/[ADC_ETR] */ 35 | NOT_ON_TIMER, /* 19 PD4 TIM5_CH1/[BEEP]/[UART1_CK] */ 36 | NOT_ON_TIMER, /* 20 PD5 UART2_TX */ 37 | NOT_ON_TIMER, /* 21 PD6 UART2_RX */ 38 | NOT_ON_TIMER, /* 22 PD7 TLI/[TIM1_CH4] */ 39 | NOT_ON_TIMER, /* 23 PE5 SPI_NSS */ 40 | NOT_ON_TIMER, /* 24 PF4 UART1_RX */ 41 | }; 42 | 43 | const uint8_t digitalPinToAnalogChannelMap[] = { 44 | PB0, // A0 PB0/Ain0 45 | PB1, // A1 PB1/Ain1 46 | PB2, // A2 PB2/Ain2 47 | PB3, // A3 PB3/Ain3 48 | // PD4, // A4 PD4[AIN4] 49 | }; 50 | 51 | #endif 52 | #define digitalPinHasPWM(p) (((p)==PC1)|((p)==PC2)|((p)==PC3)|((p)==PC4)) 53 | 54 | #endif //SDUINOPINS_DEF 55 | 56 | #endif //_STM8_TIM32_3_h 57 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_32_4.h: -------------------------------------------------------------------------------- 1 | // tim_32_4.h 2 | // STM8S903K3B/T/Ux 32PINS 3 | // huaweiwx@sina.com 2018.4.08 4 | 5 | 6 | #ifndef _STM8_TIM32_4_h 7 | #define _STM8_TIM32_4_h 8 | #ifndef SDUINOPINS_DEF 9 | #ifdef ARDUINO_MAIN 10 | 11 | 12 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { 13 | NOT_ON_TIMER, /* 0 PA1 OSC IN */ 14 | NOT_ON_TIMER, /* 1 PA2 OSC OUT */ 15 | NOT_ON_TIMER, /* 2 PA3 UART1_TX */ 16 | NOT_ON_TIMER, /* 3 PB0 AIN0/[TIM1_CH1N] */ 17 | NOT_ON_TIMER, /* 4 PB1 AIN1/[TIM1_CH2N] */ 18 | NOT_ON_TIMER, /* 5 PB2 AIN2/[TIM2_CH3N] */ 19 | NOT_ON_TIMER, /* 6 PB3 AIN3/[TIM1_ETR] */ 20 | NOT_ON_TIMER, /* 7 PB4 I2C_SCL/[ADC_ETR]*/ 21 | NOT_ON_TIMER, /* 8 PB5 PB5/I2C_SDA/[TIM1_BKIN] */ 22 | NOT_ON_TIMER, /* 7 PB6 */ 23 | NOT_ON_TIMER, /* 8 PB7 */ 24 | TIMER11, /* 9 PC1 TIM1_CH1/UART1_CK */ 25 | TIMER12, /* 10 PC2 TIM1_CH2 */ 26 | TIMER13, /* 11 PC3 TIM1_CH3 */ 27 | TIMER14, /* 12 PC4 TIM1_CH4 */ 28 | NOT_ON_TIMER, /* 13 PC5 SPI_SCK/[TIM5_CH1]*/ 29 | NOT_ON_TIMER, /* 14 PC6 SPI_MOSI/[TIM1_CH1] */ 30 | NOT_ON_TIMER, /* 15 PC7 SPI_MISO/[TIM1_CH2] */ 31 | NOT_ON_TIMER, /* 16 PD0 TIM1_BKIN */ 32 | NOT_ON_TIMER, /* 16 PD1 SWIM */ 33 | NOT_ON_TIMER, /* 17 PD2 TIM5_CH3/[AIN3]*/ 34 | NOT_ON_TIMER, /* 18 PD3 TIM5_CH2/[AIN4]/[ADC_ETR] */ 35 | NOT_ON_TIMER, /* 19 PD4 TIM5_CH1/[BEEP]/[UART1_CK] */ 36 | NOT_ON_TIMER, /* 20 PD5 UART2_TX */ 37 | NOT_ON_TIMER, /* 21 PD6 UART2_RX */ 38 | NOT_ON_TIMER, /* 22 PD7 TLI/[TIM1_CH4] */ 39 | NOT_ON_TIMER, /* 23 PE5 SPI_NSS */ 40 | NOT_ON_TIMER, /* 24 PF4 UART1_RX */ 41 | }; 42 | 43 | const uint8_t digitalPinToAnalogChannelMap[] = { 44 | PB0, // A0 PB0/Ain0 45 | PB1, // A1 PB1/Ain1 46 | PB2, // A2 PB2/Ain2 47 | PB3, // A3 PB3/Ain3 48 | // PD4, // A4 PD4[AIN4] 49 | }; 50 | 51 | #endif 52 | 53 | #define digitalPinHasPWM(p) (((p)==PC1)|((p)==PC2)|((p)==PC3)|((p)==PC4)) 54 | 55 | #endif //SDUINOPINS_DEF 56 | #endif //_STM8_TIM32_4_h 57 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_44_1.h: -------------------------------------------------------------------------------- 1 | //tim48_1.h 2 | //STM8S005C6Tx 48pins 3 | //STM8S105C6 48pins 4 | // huaweiwx@sina.com 2018.4.08 5 | 6 | #ifndef _STM8_TIM48_1_h 7 | #define _STM8_TIM48_1_h 8 | 9 | 10 | #endif //_STM8_TIM48_1_h 11 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_48_1.h: -------------------------------------------------------------------------------- 1 | // tim48_1.h 2 | // STM8S005C6Tx 48pins 3 | // STM8S105C6 48pins 4 | // huaweiwx@sina.com 2018.4.08 5 | 6 | #ifndef _STM8_TIM48_1_h 7 | #define _STM8_TIM48_1_h 8 | 9 | 10 | #endif //_STM8_TIM48_1_h 11 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_64_1.h: -------------------------------------------------------------------------------- 1 | // tim64_1.h 2 | // STM8S207/208R 6/8/BTx 64pins 3 | // huaweiwx@sina.com 2018.4.08 4 | 5 | #ifndef _STM8_TIM64_1_h 6 | #define _STM8_TIM64_1_h 7 | 8 | //TIM1 9 | //TIM2 10 | //TIM3 11 | 12 | #endif //_STM8_TIM64_1_h 13 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_Tim_80_1.h: -------------------------------------------------------------------------------- 1 | // tim48_1.h 2 | // STM8S208MBTx 80pins 3 | // STM8S208MBTx 80pins 4 | // huaweiwx@sina.com 2018.4.08 5 | 6 | #ifndef _STM8_TIM48_1_h 7 | #define _STM8_TIM48_1_h 8 | 9 | 10 | #endif //_STM8_TIM48_1_h 11 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/system/stm8chips/stm8_pinNum.h: -------------------------------------------------------------------------------- 1 | //huaweiwx@sina.com 2018.4.08 2 | #ifndef _STM8PINSNUM_H_ 3 | #define _STM8PINSNUM_H_ 4 | 5 | //A 6 | #define _PA0 0 7 | #define _PA1 1 8 | #define _PA2 2 9 | #define _PA3 3 10 | #define _PA4 4 11 | #define _PA5 5 12 | #define _PA6 6 13 | #define _PA7 7 14 | 15 | //B 16 | #define _PB0 8 17 | #define _PB1 9 18 | #define _PB2 10 19 | #define _PB3 11 20 | #define _PB4 12 21 | #define _PB5 13 22 | #define _PB6 14 23 | #define _PB7 15 24 | 25 | //C 26 | #define _PC0 16 27 | #define _PC1 17 28 | #define _PC2 18 29 | #define _PC3 19 30 | #define _PC4 20 31 | #define _PC5 21 32 | #define _PC6 22 33 | #define _PC7 23 34 | 35 | //D 36 | #define _PD0 24 37 | #define _PD1 25 38 | #define _PD2 26 39 | #define _PD3 27 40 | #define _PD4 28 41 | #define _PD5 29 42 | #define _PD6 30 43 | #define _PD7 31 44 | 45 | //E 46 | #define _PE0 32 47 | #define _PE1 33 48 | #define _PE2 34 49 | #define _PE3 35 50 | #define _PE4 36 51 | #define _PE5 37 52 | #define _PE6 38 53 | #define _PE7 39 54 | 55 | //F 56 | #define _PF0 40 57 | #define _PF1 41 58 | #define _PF2 42 59 | #define _PF3 43 60 | #define _PF4 44 61 | #define _PF5 45 62 | #define _PF6 46 63 | #define _PF7 47 64 | 65 | //G 66 | #define _PG0 48 67 | #define _PG1 49 68 | #define _PG2 50 69 | #define _PG3 51 70 | #define _PG4 52 71 | #define _PG5 53 72 | #define _PG6 54 73 | #define _PG7 55 74 | 75 | //H 76 | #define _PH0 56 77 | #define _PH1 57 78 | #define _PH2 58 79 | #define _PH3 59 80 | #define _PH4 60 81 | #define _PH5 61 82 | #define _PH6 62 83 | #define _PH7 63 84 | 85 | //I 86 | #define _PI0 64 87 | #define _PI1 65 88 | #define _PI2 66 89 | #define _PI3 67 90 | #define _PI4 68 91 | #define _PI5 69 92 | #define _PI6 70 93 | #define _PI7 71 94 | 95 | #endif //_STM8PINSNUM_H_ 96 | 97 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/STM8L152R8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/STM8L152R8.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/TS5A4595技术手册.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/TS5A4595技术手册.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_2.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/l152_3.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.txt -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/引脚定义.xlsx -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/怡成血糖仪电路.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/doc/怡成血糖仪电路.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/l152r8t6_5d1/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pin definition functions for generic STM8L152R 3 | 2 February 2018 for STM8L by huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #define BEEP PA0 10 | #define TD1 PG2 11 | #define LED_BUILTIN (PG2) // pin for the buildin LED 12 | #define LED_BUILTIN_MASK 0x00 13 | 14 | #define BOARD_NR_KEY 2 15 | #define BOTTON PF1 16 | #define BOTTON1 PF0 17 | #define BOTTON_MASK 0x00 18 | 19 | 20 | #define SERIAL_PORT_MONITOR Serial 21 | #define SERIAL_PORT_HARDWARE Serial 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vc288/doc/3digs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vc288/doc/3digs.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288-0.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288-1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vc288/doc/vc288.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vc288/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pins generic definition for STM8S003/103Fx 3 | 2 February 2018 huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | 10 | 11 | #ifndef LED_BUILTIN 12 | # define LED_BUILTIN (PB5) // pin for the buildin LED 13 | # define LED_BUILTIN_MASK 0x00 // low in on 14 | #endif 15 | 16 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 17 | # define NEED_TIMER_11_12 18 | #endif 19 | 20 | #define SERIAL_PORT_MONITOR Serial 21 | #define SERIAL_PORT_HARDWARE Serial 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/3digs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/3digs.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/4digs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/4digs.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/F3P6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/F3P6.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/vmeter_3digs_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/s003_vmeter/doc/vmeter_3digs_1.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/s003_vmeter/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pins generic definition for STM8S003/103Fx 3 | 2 February 2018 huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | //3digits 7seg 10 | #define SEG_A PC4 11 | #define SEG_B PB5 12 | #define SEG_C PC7 13 | #define SEG_D PD1 14 | #define SEG_E PD3 15 | #define SEG_F PC3 16 | #define SEG_G PB4 17 | #define SEG_DP PD2 18 | #define DIG_1 PC6 19 | #define DIG_2 PC5 20 | #define DIG_3 PA3 21 | 22 | #define ANALOG_BUILTIN PD6 23 | #define ANALOG_10DIV 307 24 | 25 | 26 | #define LED_BUILTIN SEG_A // pin for the buildin LED 27 | 28 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 29 | # define NEED_TIMER_11_12 30 | #endif 31 | 32 | #define SERIAL_PORT_MONITOR Serial 33 | #define SERIAL_PORT_HARDWARE Serial 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8l152r/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pin definition functions for generic STM8L152R 3 | 2 February 2018 for STM8L by huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #ifndef LED_BUILTIN 10 | #define LED_BUILTIN (PG2) // pin for the buildin LED 11 | #endif 12 | 13 | #define NEED_TIMER_11_12 14 | #define NEED_TIMER_31_32 15 | 16 | #define SERIAL_PORT_MONITOR Serial 17 | #define SERIAL_PORT_HARDWARE Serial 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103f/doc/F3P6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s103f/doc/F3P6.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103f/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pins generic definition for STM8S003/103Fx 3 | 2 February 2018 huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #ifndef LED_BUILTIN 10 | # define LED_BUILTIN (PB5) // pin for the buildin LED 11 | # define LED_BUILTIN_MASK 0x00 // low in on 12 | #endif 13 | 14 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 15 | # define NEED_TIMER_11_12 16 | #endif 17 | 18 | #define SERIAL_PORT_MONITOR Serial 19 | #define SERIAL_PORT_HARDWARE Serial 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103k/doc/S103K3T6_PIN.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s103k/doc/S103K3T6_PIN.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103k/doc/STM8S103K3T6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s103k/doc/STM8S103K3T6.jpg -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103k/doc/s103k3t6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s103k/doc/s103k3t6.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103k/doc/stm8s103k3t6.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s103k/doc/stm8s103k3t6.xlsx -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s103k/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h - Pins generic definition for stm8s103k3 3 | 2 February 2018 huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #ifndef LED_BUILTIN 10 | # define LED_BUILTIN (PD7) // pin for the buildin LED, not pin 13! 11 | # define LED_BUILTIN_MASK 0x00 // on lever bit 0 is Low 12 | #endif 13 | 14 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 15 | # define NEED_TIMER_11_12 16 | # define NEED_TIMER_31_32 17 | #endif 18 | 19 | // 20 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 21 | // 22 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 23 | // 24 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 25 | // 26 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 27 | // 28 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 29 | // pins are NOT connected to anything by default. 30 | 31 | #define SERIAL_PORT_MONITOR Serial 32 | #define SERIAL_PORT_HARDWARE Serial 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s105c/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h Pins generic definition for STM8S105C boards 3 | 2 February 2018 by huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #ifndef LED_BUILTIN 10 | # define LED_BUILTIN (PD0) // pin for the buildin LED 11 | # define LED_BUILTIN_MASK 0x00 // on lever bit 0 is Low 12 | #endif 13 | 14 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 15 | # define NEED_TIMER_11_12 16 | # define NEED_TIMER_31_32 17 | #endif 18 | 19 | // These serial port names are intended to allow libraries and architecture-neutral 20 | // sketches to automatically default to the correct port name for a particular type 21 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 22 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 23 | // 24 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 25 | // 26 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 27 | // 28 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 29 | // 30 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 31 | // 32 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 33 | // pins are NOT connected to anything by default. 34 | 35 | #define SERIAL_PORT_MONITOR Serial 36 | #define SERIAL_PORT_HARDWARE Serial 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s105k/doc/stm8s_black_pinout.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s105k/doc/stm8s_black_pinout.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s105k/doc/stm8s_black_sch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/stm8/variants/stm8s105k/doc/stm8s_black_sch.pdf -------------------------------------------------------------------------------- /sduino/hardware/sduino/stm8/variants/stm8s105k/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | variant.h Pins generic definition for STM8S105K 3 | 2 February 2018 by huaweiwx 4 | */ 5 | 6 | #ifndef _VARINAT_H_ 7 | #define _VARINAT_H_ 8 | 9 | #ifndef LED_BUILTIN 10 | # define LED_BUILTIN (PE5) // pin for the buildin LED, can be replace by board.txt 11 | # define LED_BUILTIN_MASK 0x00 // on lever bit 0 is Low 12 | #endif 13 | 14 | #ifdef SUPPORT_ALTERNATE_MAPPINGS 15 | # define NEED_TIMER_11_12 16 | # define NEED_TIMER_31_32 17 | #endif 18 | 19 | // These serial port names are intended to allow libraries and architecture-neutral 20 | // sketches to automatically default to the correct port name for a particular type 21 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, 22 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. 23 | // 24 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor 25 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial 26 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library 27 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. 28 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX 29 | // pins are NOT connected to anything by default. 30 | 31 | #define SERIAL_PORT_MONITOR Serial 32 | #define SERIAL_PORT_HARDWARE Serial 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/linux32/stm8flash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/linux32/stm8flash -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/linux32/stm8gal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/linux32/stm8gal -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/linux64/stm8flash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/linux64/stm8flash -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/linux64/stm8gal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/linux64/stm8gal -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/macosx/stm8flash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/macosx/stm8flash -------------------------------------------------------------------------------- /sduino/hardware/sduino/tools/macosx/stm8gal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huaweiwx/sduino/7cd9930b5d871b4ee5328ae3eb69f42b9c35461f/sduino/hardware/sduino/tools/macosx/stm8gal -------------------------------------------------------------------------------- /sduino/lib/version.txt: -------------------------------------------------------------------------------- 1 | 2:1.6.0+sduino 2 | -------------------------------------------------------------------------------- /test/adc1/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | CFLAGS= --debug -DSUPPORT_ALTERNATE_MAPPINGS 4 | 5 | include ../../sduino/sduino.mk 6 | -------------------------------------------------------------------------------- /test/adc1/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DSUPPORT_ALTERNATE_MAPPINGS \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS=main.rel wiring.rel wiring_digital.rel wiring_analog.rel \ 20 | HardwareSerial.rel Print.rel 21 | 22 | .PHONY: all clean flash 23 | 24 | #all: $(OBJECTS) 25 | 26 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 27 | #test.rel wiring_digital.rel 28 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 29 | 30 | $(OBJECTS) : %.rel : %.c 31 | $(CC) -c $(CFLAGS) $^ -o $@ 32 | 33 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 34 | $(CC) -c $(CFLAGS) $^ -o $@ 35 | 36 | flash: $(EXECUTABLE) 37 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 38 | 39 | readopt: 40 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 41 | 42 | 43 | clean: 44 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 45 | *.cdb *.adb *~ *.bak 46 | rm -f $(EXECUTABLE) 47 | -------------------------------------------------------------------------------- /test/adc1/adc1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test adc1, read all five channels 3 | * 4 | * But skip channel 4, as it is used as TX. analogRead would mess up the 5 | * send data while the ADC is active. 6 | */ 7 | 8 | #include "Arduino.h" 9 | #include "Serial.h" 10 | 11 | 12 | void setup(void) 13 | { 14 | Serial_begin(115200); 15 | Serial_println_s("ADC test"); 16 | 17 | // configure analog pins for input 18 | pinMode(A0, INPUT); 19 | pinMode(A1, INPUT); 20 | pinMode(A2, INPUT); 21 | pinMode(A3, INPUT); // this pin is used as TX 22 | pinMode(A4, INPUT); // this pin is used as RX 23 | } 24 | 25 | 26 | void loop (void) 27 | { 28 | uint8_t i; 29 | uint16_t val; 30 | 31 | for (i=0; i
© COPYRIGHT 2014 STMicroelectronics
12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM8S_IT_H 30 | #define __STM8S_IT_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm8s.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | #endif /* __STM8S_IT_H */ 41 | 42 | 43 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 44 | -------------------------------------------------------------------------------- /test/iolib/Makefile: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | AS=$(BINDIR)/sdasstm8 10 | 11 | LIBBASE=../../STM8S_StdPeriph_Driver 12 | SDUINO=../../sduino 13 | 14 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DSUPPORT_ALTERNATE_MAPPINGS \ 15 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 16 | 17 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 18 | ASFLAGS= 19 | 20 | OBJECTS=$(BASENAME).rel 21 | ASMOBJECTS=printhex.rel 22 | SDOBJECTS= 23 | # main.rel wiring.rel wiring_digital.rel wiring_analog.rel \ 24 | # HardwareSerial.rel Print.rel 25 | 26 | .PHONY: all clean flash 27 | 28 | #all: $(OBJECTS) 29 | 30 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) $(ASMOBJECTS) 31 | #test.rel wiring_digital.rel 32 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 33 | 34 | $(OBJECTS) : %.rel : %.c 35 | $(CC) -c $(CFLAGS) $^ -o $@ 36 | 37 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 38 | $(CC) -c $(CFLAGS) $^ -o $@ 39 | 40 | $(ASMOBJECTS) : %.rel : %.s 41 | $(AS) -o -l -s $(ASFLAGS) $^ 42 | 43 | flash: $(EXECUTABLE) 44 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 45 | 46 | readopt: 47 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 48 | 49 | 50 | clean: 51 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 52 | *.cdb *.adb *~ *.bak 53 | rm -f $(EXECUTABLE) 54 | -------------------------------------------------------------------------------- /test/iolib/iolib.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #include "printhex.h" 5 | 6 | #define PRINTHEX16(V) __asm__("ldw\tx,#" #V "\ncall\t_asm_printhex16") 7 | 8 | #define ASMCALL_A(F,A) __asm__("ld\ta,#" #A "\ncall\t_" #F) 9 | #define ASMCALL_AX(F,A,X) __asm__("ld\ta,#" #A "\nldw\tx,#" #X "\ncall\t_" #F) 10 | #define ASMCALL_X(F,X) __asm__("ldw\tx,#" #X "\ncall\t_" #F) 11 | #define ASMCALL_XY(F,X,Y) __asm__("ldw\tx,#" #X "\nldw\ty,#" #Y "\ncall\t_" #F) 12 | 13 | void stacktest(unsigned int v1, unsigned int v2); 14 | 15 | void main(void) 16 | { 17 | stacktest(0x1234, 0x5678); 18 | __asm__("ldw\tx,#0x1234"); 19 | asm_printhex16(0x1234); 20 | PRINTHEX16(0x89ab); 21 | __asm__("ldw\tx,#1234"); 22 | asm_printdec16(1234); 23 | ASMCALL_X(asm_printdec16, 12345); 24 | } 25 | -------------------------------------------------------------------------------- /test/iolib/printhex.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTHEX_H_ 2 | #define _PRINTHEX_H_ 3 | 4 | // functions for base 16 (hexadecimal) 5 | void asm_printhex32(unsigned long val); 6 | void asm_printhex16(unsigned int val); 7 | void asm_printhex8(unsigned char val); 8 | void asm_printhex4(unsigned char val); 9 | 10 | // functions for base 10 (decimal) 11 | void asm_printdec16(unsigned int val); // print a 16 bit value X to base 10 12 | void asm_printdec8(unsigned char val); // print a 8 bit value A to base 10 (note: printdec16 is more efficient) 13 | 14 | // functions for arbitrary base (base 2..26) 15 | void asm_print16(unsigned int val); // print a 16 bit value X to base A 16 | 17 | // functions for single digits 18 | void asm_print_digit(unsigned char val); 19 | void asm_putchar(char c); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /test/libmake/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/libmake/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DARDUINO=180 \ 14 | -I. -I$(SDUINO) \ 15 | -I$(SDUINO)/hardware/sduino/stm8/libraries/I2C \ 16 | -I$(SDUINO)/hardware/sduino/stm8/libraries/ssd1306 \ 17 | -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 18 | # -DSUPPORT_ALTERNATE_MAPPINGS 19 | 20 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 21 | 22 | OBJECTS=$(BASENAME).rel 23 | #SDLIBS=I2C 24 | SDOBJECTS=main.rel wiring.rel wiring_digital.rel 25 | SDLIBOBJECTS=I2C/I2C.rel ssd1306/ssd1306.rel 26 | 27 | .PHONY: all clean flash 28 | 29 | #all: $(OBJECTS) 30 | 31 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) $(SDLIBOBJECTS) 32 | #test.rel wiring_digital.rel 33 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 34 | 35 | $(OBJECTS) : %.rel : %.c 36 | $(CC) -c $(CFLAGS) $^ -o $@ 37 | 38 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 39 | $(CC) -c $(CFLAGS) $^ -o $@ 40 | 41 | $(SDLIBOBJECTS) : %.rel : $(SDUINO)/hardware/sduino/stm8/libraries/%.c 42 | mkdir -p $(dir $@) 43 | $(CC) -c $(CFLAGS) $^ -o $@ 44 | 45 | flash: $(EXECUTABLE) 46 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 47 | 48 | readopt: 49 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 50 | 51 | 52 | clean: 53 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 54 | *.cdb *.adb *~ *.bak 55 | rm -f $(EXECUTABLE) 56 | -------------------------------------------------------------------------------- /test/libmake/README.md: -------------------------------------------------------------------------------- 1 | ## Defined new parameters in boards.txt 2 | 3 | `BOARD.upload.mcu` cpu specifier for avrdude/stm8flash. Defines AVRDUDE_MCU 4 | 5 | 6 | ## Problems with SDCC and Arduino.mk 7 | 8 | ### missing/non-supported compiler flags 9 | 10 | `-dumpversion` 11 | 12 | `-mmcu=xxxx` wird nicht unterstützt, `-mxxx` hat kein Gleichheitszeichen 13 | 14 | CPPFLAGS lässt sich zwar vorbelegen, dann werden die normalen Argumente aber 15 | immer noch hinten dran gehängt. 16 | -> irgendwie müsste sich die Standardbelegung einstellbar oder ganz abstellbar 17 | machen. 18 | 19 | dependencies: 20 | Compilieren und Dependencies gleichzeitig geht mit: 21 | `sdcc -Wp"-MMD abc" .....` (mit filename für dep.) 22 | 23 | erwartet wird: 24 | `sdcc -MMD .....` (ohne filename für dep.) 25 | dieser Aufruf erzeugt aber nur die dep. in der rel-Datei und kein Object file 26 | 27 | Der Assembler erzeugt immer .rel-Files, es werden aber .o-Files erwartet. 28 | 29 | 30 | 31 | ### general suggestions for Arduino.mk: 32 | 33 | - rename the programmer specific variables from AVRDUDE_xxxx to a more 34 | generic PROGRAMMER_xxxx 35 | - allow predefined AVRDUDE_xxxx definitions from the Makefile to override 36 | the PROGRAMMER_xxxx definitions 37 | 38 | -------------------------------------------------------------------------------- /test/libmake/stat.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gawk -f 2 | 3 | # text data bss dec hex filename 4 | # 0 4673 0 4673 1241 build-stm8sblue/libmake.ihx 5 | 6 | 7 | / [ls]_/ { 8 | v=strtonum("0x"$1); 9 | type=substr($2,1,1); 10 | name=substr($2,3); 11 | arr[name][type]=v; 12 | # print v,type,name,$0 13 | } 14 | 15 | END { 16 | bss = arr["DATA"]["l"]+arr["INITIALIZED"]["l"]; 17 | rom = arr["CODE"]["l"]+arr["INITIALIZER"]["l"]; 18 | 19 | for (n in arr) 20 | print arr[n]["l"] "\t" n; 21 | # print n, arr[n]["s"],arr[n]["l"]; 22 | print "memory usage statics" 23 | print "--------------------" 24 | print "RAM:\t\t" arr["DATA"]["l"]+arr["INITIALIZED"]["l"]; 25 | print "Flash:\t\t" arr["CODE"]["l"]+arr["INITIALIZER"]["l"]; 26 | for (n in arr) printf("%s\t",n); 27 | for (n in arr) print arr[n]["l"] "\t"; 28 | 29 | print " text\t data\t bss\t dec\t hex\tfilename"; 30 | printf ("%7i\t%7i\t%7i\t%7i\t%7x\t%s\n",0,rom,bss,rom,rom,FILENAME); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/print/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/print/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=2000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I$(SDCCBASE)/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L$(SDCCBASE)/share/sdcc/lib/stm8 -lstm8s 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS=main.rel wiring.rel \ 20 | HardwareSerial.rel Print.rel 21 | 22 | .PHONY: all clean flash 23 | 24 | #all: $(OBJECTS) 25 | 26 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 27 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 28 | 29 | $(OBJECTS) : %.rel : %.c 30 | $(CC) -c $(CFLAGS) $^ -o $@ 31 | 32 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 33 | $(CC) -c $(CFLAGS) $^ -o $@ 34 | 35 | flash: $(EXECUTABLE) 36 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 37 | 38 | 39 | clean: 40 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 41 | *.cdb *.adb *~ *.bak 42 | rm -f $(EXECUTABLE) 43 | -------------------------------------------------------------------------------- /test/print/print.c: -------------------------------------------------------------------------------- 1 | #include "Arduino.h" 2 | #include "Serial.h" 3 | 4 | void setup (void) 5 | { 6 | Serial_begin(115200); 7 | Serial_println_s("\nPrint test"); 8 | 9 | Serial_println_ib(1234,10); 10 | Serial_println_ib(1234,16); 11 | Serial_println_ib(1234,2); 12 | 13 | Serial_println_u(2345); 14 | Serial_println_u(-3); 15 | Serial_println_i(-3); 16 | 17 | Serial_println_fd(PI,10); 18 | Serial_println_fd(PI,11); 19 | Serial_println_fd(PI,12); 20 | Serial_println_fd(-PI,13); 21 | } 22 | 23 | void loop() 24 | { 25 | char c; 26 | 27 | if (Serial_available()) { 28 | c = Serial_read(); 29 | Serial_print_s("character read: 0x"); 30 | Serial_println_ub(c,HEX); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/pwm1/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/pwm1/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | # -DSUPPORT_ALTERNATE_MAPPINGS 16 | 17 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 18 | 19 | OBJECTS=$(BASENAME).rel 20 | SDOBJECTS=main.rel wiring.rel wiring_digital.rel wiring_analog.rel \ 21 | HardwareSerial.rel Print.rel 22 | 23 | .PHONY: all clean flash 24 | 25 | #all: $(OBJECTS) 26 | 27 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 28 | #test.rel wiring_digital.rel 29 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 30 | 31 | $(OBJECTS) : %.rel : %.c 32 | $(CC) -c $(CFLAGS) $^ -o $@ 33 | 34 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 35 | $(CC) -c $(CFLAGS) $^ -o $@ 36 | 37 | flash: $(EXECUTABLE) 38 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 39 | 40 | readopt: 41 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 42 | 43 | 44 | clean: 45 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 46 | *.cdb *.adb *~ *.bak 47 | rm -f $(EXECUTABLE) 48 | -------------------------------------------------------------------------------- /test/serial/Makefile: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino/hardware/sduino/stm8/cores/sduino 12 | PINS=../../sduino/hardware/sduino/stm8/variants/standard 13 | 14 | CFLAGS= --debug -mstm8 -DF_CPU=2000000L -DSTM8S103 \ 15 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I$(PINS) -I/usr/share/sdcc/include/ 16 | 17 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s 18 | 19 | OBJECTS=$(BASENAME).rel 20 | SDOBJECTS=HardwareSerial.rel 21 | 22 | .PHONY: all clean flash 23 | 24 | #all: $(OBJECTS) 25 | 26 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 27 | #test.rel wiring_digital.rel 28 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 29 | 30 | $(OBJECTS) : %.rel : %.c 31 | $(CC) -c $(CFLAGS) $^ -o $@ 32 | 33 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 34 | $(CC) -c $(CFLAGS) $^ -o $@ 35 | 36 | flash: $(EXECUTABLE) 37 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 38 | 39 | 40 | clean: 41 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 42 | *.cdb *.adb *~ *.bak 43 | rm -f $(EXECUTABLE) 44 | -------------------------------------------------------------------------------- /test/serial/serial.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test HardwareSerial.c using spl functions 3 | * no dependencies to wiring 4 | */ 5 | 6 | #include "stm8s.h" 7 | #include "HardwareSerial.h" 8 | 9 | void UART1_RX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_RX); /* UART1 RX */ 10 | void UART1_TX_IRQHandler(void) __interrupt(ITC_IRQ_UART1_TX); /* UART1 TX */ 11 | 12 | 13 | 14 | void send_string(char *str) 15 | { 16 | char c; 17 | 18 | if (!str) return; 19 | 20 | while ( c=*str++ ) HardwareSerial_write(c); // assignment intented 21 | } 22 | 23 | 24 | void main (void) 25 | { 26 | uint32_t i; 27 | 28 | UART1_DeInit(); 29 | enableInterrupts(); 30 | 31 | HardwareSerial_begin(9600); 32 | 33 | while (1) { 34 | send_string("Hello World!\r\n"); 35 | for (i=15000; i; i--); 36 | while(HardwareSerial_available()) { 37 | HardwareSerial_write('.'); 38 | HardwareSerial_write(HardwareSerial_read()); 39 | }; 40 | for (i=15000; i; i--); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/serial/stm8s_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm8s_it.h 4 | * @author MCD Application Team 5 | * @version V2.2.0 6 | * @date 30-September-2014 7 | * @brief This file contains the headers of the interrupt handlers 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM8S_IT_H 30 | #define __STM8S_IT_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm8s.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | #endif /* __STM8S_IT_H */ 41 | 42 | 43 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 44 | -------------------------------------------------------------------------------- /test/serial2/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/serial2/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=2000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS=main.rel wiring.rel HardwareSerial.rel 20 | 21 | .PHONY: all clean flash 22 | 23 | #all: $(OBJECTS) 24 | 25 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 26 | #test.rel wiring_digital.rel 27 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 28 | 29 | $(OBJECTS) : %.rel : %.c 30 | $(CC) -c $(CFLAGS) $^ -o $@ 31 | 32 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 33 | $(CC) -c $(CFLAGS) $^ -o $@ 34 | 35 | flash: $(EXECUTABLE) 36 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 37 | 38 | 39 | clean: 40 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 41 | *.cdb *.adb *~ *.bak 42 | rm -f $(EXECUTABLE) 43 | -------------------------------------------------------------------------------- /test/serial2/serial2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test HardwareSerial.c using sduino functions 3 | */ 4 | 5 | #include "Arduino.h" 6 | #include "HardwareSerial.h" 7 | 8 | 9 | 10 | void send_string(char *str) 11 | { 12 | char c; 13 | 14 | if (!str) return; 15 | 16 | while ( c=*str++ ) HardwareSerial_write(c); // assignment intented 17 | } 18 | 19 | 20 | void setup(void) 21 | { 22 | HardwareSerial_begin(9600); 23 | } 24 | 25 | 26 | void loop (void) 27 | { 28 | uint32_t i; 29 | 30 | send_string("Hello World!\r\n"); 31 | 32 | for (i=60000; i; i--); 33 | while(HardwareSerial_available()) { 34 | HardwareSerial_write('.'); 35 | HardwareSerial_write(HardwareSerial_read()); 36 | }; 37 | 38 | for (i=60000; i; i--); 39 | } 40 | -------------------------------------------------------------------------------- /test/serialEvent/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/serialEvent/serialEvent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test serialEvent() 3 | * 4 | * Read data from the serial interface an echo it back using the serialEvent() 5 | * function. 6 | * 7 | * written Sep. 2017 by Michael Mayer for the SDuino project 8 | * Code is in the public domain. 9 | */ 10 | 11 | #include "Arduino.h" 12 | 13 | 14 | void setup(void) 15 | { 16 | Serial_begin(9600); 17 | Serial_println_s("Hello World!"); 18 | } 19 | 20 | 21 | void loop (void) 22 | { 23 | } 24 | 25 | void serialEvent(void) 26 | { 27 | while(HardwareSerial_available()) { 28 | Serial_write(Serial_read()); 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /test/spi/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/spi/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | # -DSUPPORT_ALTERNATE_MAPPINGS 16 | 17 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 18 | 19 | OBJECTS=$(BASENAME).rel 20 | SDOBJECTS=main.rel wiring.rel wiring_digital.rel SPI.rel \ 21 | HardwareSerial.rel Print.rel 22 | 23 | .PHONY: all clean flash 24 | 25 | #all: $(OBJECTS) 26 | 27 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 28 | #test.rel wiring_digital.rel 29 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 30 | 31 | $(OBJECTS) : %.rel : %.c 32 | $(CC) -c $(CFLAGS) $^ -o $@ 33 | 34 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 35 | $(CC) -c $(CFLAGS) $^ -o $@ 36 | 37 | flash: $(EXECUTABLE) 38 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 39 | 40 | readopt: 41 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 42 | 43 | 44 | clean: 45 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 46 | *.cdb *.adb *~ *.bak 47 | rm -f $(EXECUTABLE) 48 | -------------------------------------------------------------------------------- /test/spi/spi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test spi functions 3 | */ 4 | 5 | #include "Arduino.h" 6 | #include "SPI.h" 7 | #include "Serial.h" 8 | 9 | // pin number for the status LED 10 | #define LED 3 11 | 12 | /* 13 | // 9 PC7 MISO 14 | // 8 PC6 MOSI 15 | // 7 PC5 SCK 16 | // 3 PB5 LED/SS 17 | */ 18 | 19 | //const char testdata[]="ABCDEFGH"; 20 | const char testdata[]="UUUUUUUU"; // regular bit pattern 01010101 21 | char buf[16]; 22 | 23 | uint8_t ledstatus; 24 | 25 | /* 26 | * simple test using single byte transfers 27 | */ 28 | void SPI_transfer_loop(uint8_t *buf, size_t n) 29 | { 30 | while (--n) { 31 | *buf = SPI_transfer(*buf); 32 | buf++; 33 | } 34 | } 35 | 36 | 37 | void setup(void) 38 | { 39 | pinMode(LED, OUTPUT); 40 | Serial_begin(115200); 41 | Serial_println_s("SPI test"); 42 | } 43 | 44 | 45 | void loop (void) 46 | { 47 | uint8_t i; 48 | 49 | Serial_println_s("loop"); 50 | strcpy(buf, testdata); 51 | delay(100); 52 | 53 | digitalWrite(LED,1);//ledstatus); 54 | ledstatus = 1-ledstatus; 55 | 56 | 57 | SPI_begin(); 58 | SPI_beginTransaction(SPISettings(8000000L,MSBFIRST,SPI_MODE0)); 59 | Serial_print_c('a'); 60 | // SPI_transfer(0xaa); 61 | // SPI_transfer(0x55); 62 | Serial_print_c('b'); 63 | 64 | SPI_transfer_asm(buf, sizeof(testdata)-1); 65 | SPI_endTransaction(); 66 | Serial_print_c('c'); 67 | SPI_end(); 68 | Serial_print_c('d'); 69 | 70 | digitalWrite(LED,0); 71 | 72 | for (i=0; i<8; i++) { 73 | Serial_print_ub(buf[i],HEX); 74 | Serial_print_c(' '); 75 | } 76 | 77 | delay(100); 78 | } 79 | -------------------------------------------------------------------------------- /test/timer1/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/timer1/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS=main.rel wiring.rel HardwareSerial.rel Print.rel 20 | 21 | .PHONY: all clean flash 22 | 23 | #all: $(OBJECTS) 24 | 25 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 26 | #test.rel wiring_digital.rel 27 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 28 | 29 | $(OBJECTS) : %.rel : %.c 30 | $(CC) -c $(CFLAGS) $^ -o $@ 31 | 32 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 33 | $(CC) -c $(CFLAGS) $^ -o $@ 34 | 35 | flash: $(EXECUTABLE) 36 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 37 | 38 | 39 | clean: 40 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 41 | *.cdb *.adb *~ *.bak 42 | rm -f $(EXECUTABLE) 43 | -------------------------------------------------------------------------------- /test/timer1/timer1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * test timer4, show the value for millis() over time 3 | */ 4 | 5 | #include "Arduino.h" 6 | #include "HardwareSerial.h" 7 | #include "Print.h" 8 | 9 | 10 | void setup(void) 11 | { 12 | HardwareSerial_begin(115200); 13 | } 14 | 15 | 16 | void loop (void) 17 | { 18 | uint32_t i; 19 | 20 | Print_print_s("millis()="); 21 | Print_print_u(millis()); 22 | Print_print_s("\tTIM4_CNTR="); 23 | Print_println_u(TIM4->CNTR); 24 | 25 | for (i=40000; i; i--); 26 | } 27 | -------------------------------------------------------------------------------- /test/timer2/Makefile: -------------------------------------------------------------------------------- 1 | BOARD_TAG = stm8sblue 2 | 3 | include ../../sduino/sduino.mk 4 | -------------------------------------------------------------------------------- /test/timer2/Makefile.classic: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS=main.rel wiring.rel HardwareSerial.rel Print.rel 20 | 21 | .PHONY: all clean flash 22 | 23 | #all: $(OBJECTS) 24 | 25 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 26 | #test.rel wiring_digital.rel 27 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 28 | 29 | $(OBJECTS) : %.rel : %.c 30 | $(CC) -c $(CFLAGS) $^ -o $@ 31 | 32 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 33 | $(CC) -c $(CFLAGS) $^ -o $@ 34 | 35 | flash: $(EXECUTABLE) 36 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 37 | 38 | 39 | clean: 40 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 41 | *.cdb *.adb *~ *.bak 42 | rm -f $(EXECUTABLE) 43 | -------------------------------------------------------------------------------- /test/uart-nospl/Makefile: -------------------------------------------------------------------------------- 1 | BASENAME=$(shell basename $$(pwd)) 2 | EXECUTABLE=$(BASENAME).ihx 3 | 4 | #SDCCBASE=/usr/local 5 | SDCCBASE=/opt/sdcc 6 | BINDIR=$(SDCCBASE)/bin 7 | CC=$(BINDIR)/sdcc 8 | LD=$(BINDIR)/sdld 9 | 10 | LIBBASE=../../STM8S_StdPeriph_Driver 11 | SDUINO=../../sduino 12 | 13 | CFLAGS= --debug -mstm8 -DF_CPU=16000000L -DSTM8S103 -DSUPPORT_ALTERNATE_MAPPINGS \ 14 | -I. -I$(SDUINO) -I$(LIBBASE)/inc -I/usr/share/sdcc/include/ 15 | 16 | LDFLAGS=-L$(LIBBASE)/src -L/opt/sdcc/share/sdcc/lib/stm8 -lstm8s103 17 | 18 | OBJECTS=$(BASENAME).rel 19 | SDOBJECTS= 20 | # main.rel wiring.rel wiring_digital.rel wiring_analog.rel \ 21 | # HardwareSerial.rel Print.rel 22 | 23 | .PHONY: all clean flash 24 | 25 | #all: $(OBJECTS) 26 | 27 | $(EXECUTABLE): $(OBJECTS) $(SDOBJECTS) 28 | #test.rel wiring_digital.rel 29 | $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ 30 | 31 | $(OBJECTS) : %.rel : %.c 32 | $(CC) -c $(CFLAGS) $^ -o $@ 33 | 34 | $(SDOBJECTS) : %.rel : $(SDUINO)/%.c 35 | $(CC) -c $(CFLAGS) $^ -o $@ 36 | 37 | flash: $(EXECUTABLE) 38 | stm8flash -cstlinkv2 -pstm8s103?3 -w $^ 39 | 40 | readopt: 41 | stm8flash -c stlinkv2 -p stm8s103?3 -s opt -r opt.bin 42 | 43 | 44 | clean: 45 | rm -f *.lib *.rst *.rel *.lst *.ihx *.sym *.asm *.lk *.map \ 46 | *.cdb *.adb *~ *.bak 47 | rm -f $(EXECUTABLE) 48 | -------------------------------------------------------------------------------- /test/uart-nospl/uart-nospl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * using the UART1 without any SPL functions. 5 | * 6 | * simple testbed to test the simplyfied initialization function. 7 | * 8 | */ 9 | 10 | #define UART1_CR2_RIEN 0x20 11 | #define UART1_TEN 0x08 12 | #define UART1_REN 0x04 13 | 14 | unsigned char 15 | UART1_BRR1, 16 | UART1_BRR2, 17 | UART1_CR1, 18 | UART1_CR2, 19 | UART1_CR3; 20 | 21 | 22 | unsigned long CLK_GetClockFreq(void) 23 | { 24 | return 10000000UL; 25 | } 26 | 27 | 28 | void HardwareSerial_begin(unsigned long baud) 29 | { 30 | uint16_t divider; 31 | uint8_t tmp; 32 | 33 | /* Set the UART1 BaudRates in BRR1 and BRR2 registers according to UART1_BaudRate value */ 34 | divider = (uint16_t) ((uint32_t)CLK_GetClockFreq() / (uint32_t) baud); 35 | 36 | UART1_BRR2 = divider & 0x0f; 37 | divider >>= 4; 38 | UART1_BRR1 = divider & 0xff; 39 | divider >>= 4; 40 | UART1_BRR2 |= (uint8_t) divider & 0xf0; 41 | 42 | UART1_CR1 = 0; // 8 Bit, no parity 43 | UART1_CR3 = 0; // one stop bit 44 | // enable RXNE interrupt, enable transmitter, enable receiver 45 | UART1_CR2 = UART1_CR2_RIEN | UART1_TEN | UART1_REN; 46 | } 47 | 48 | 49 | void main (void) 50 | { 51 | HardwareSerial_begin(9600); 52 | } 53 | -------------------------------------------------------------------------------- /test/valist/Makefile: -------------------------------------------------------------------------------- 1 | CC=sdcc 2 | CFLAGS=-mstm8 -I /opt/sdcc/share/sdcc/include 3 | 4 | main: 5 | -------------------------------------------------------------------------------- /test/valist/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | 4 | int a_function ( int x, ... ) 5 | { 6 | va_list a_list; 7 | int sum=0; 8 | 9 | va_start( a_list, x ); 10 | 11 | while (x--) sum += va_arg(a_list, int); 12 | 13 | return sum; 14 | } 15 | 16 | void main() 17 | { 18 | a_function(2, 11,22); 19 | a_function(3, 11,22,33); 20 | } 21 | -------------------------------------------------------------------------------- /tools/sdcc-critcal.patch: -------------------------------------------------------------------------------- 1 | --- sdcc/src/stm8/gen.c.orig 2016-10-23 19:12:25.000000000 +0200 2 | +++ sdcc/src/stm8/gen.c 2016-12-13 15:27:19.756097765 +0100 3 | @@ -2980,6 +2980,7 @@ 4 | static void 5 | genCritical (iCode * ic) 6 | { 7 | + emit2("push cc", ""); 8 | emit2("sim", ""); 9 | cost (1, 1); 10 | } 11 | @@ -2987,7 +2988,7 @@ 12 | static void 13 | genEndCritical (iCode * ic) 14 | { 15 | - emit2("rim", ""); 16 | + emit2("pop cc", ""); 17 | cost (1, 1); 18 | } 19 | 20 | --------------------------------------------------------------------------------