Giter Club home page Giter Club logo

rc-switch-stm8s003's Introduction

Description

Reacts to switching the joystick stick switch.

Principle of work

The input receives a PWM signal from an RC receiver. For different stick positions there will be different duty cycle. By measuring its duration, you can determine the position of the stick and send a signal to the MC output.

Hardware

Since my option was needed to turn on the LED backlight, I do not use external power and a powerful transistor. I also needed only one position.

Firwmware

SDCC is used for compilation. You also need STM8S_SPL from ST - a library for working with peripherals.

How to flash

I use stm8flash for flash.

First of all, you need to configure Option bytes for hardware. For capturing, the 1st channel of the 1st timer is used (Channel 1 TIM1).

echo -ne '\x00\x00\xff\x01\xfe\x00\xff\x00\xff\x00\xff' > opt.bin
stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w opt.bin

This line activates alternative functions of the leg we need: Port C5 alternate function = TIM2_CH1; port C6 alternate function =TIM1_CH1; port C7 alternate function = TIM1_CH2.

Then we are already flashing the firmware itself (firmware.bin). Here you can already use: make upload, or manually download stm8flash.

./stm8flash -c stlinkv2 -p stm8s003f3 -w firmware.ihx

rc-switch-stm8s003's People

Contributors

shizacat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

xuwuyang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.