Git Product home page Git Product logo

stm32-rc5's Introduction

stm32-rc5

My implementation of remote control communication protocol (RC5-extended) on the STM32 NUCLEO-F103RB board. I use in this project a TSOP22 IR receiver module.

How it works?

My implementation of RC5 is based on the EXTI (external interrupt) and the timer. EXTI will be executing on falling edge:

  • when start bit is received (10),
  • when next falling edge is detected.

This two points is used to measuring duration of a single bit. We consider three cases:

  • when a start bit is 1 (10) and a field bit is 1 (10):

case1

  • when a start bit is 1 (10), a field bit is 0 (01) and a control bit is 1 (10):

case2

  • when a start bit is 1 (10), a field bit is 0 (01) and a control bit is 0 (01):

case3

Example usage

#include "rc5.h"
#include "rgb.h"
...
int main(void) {
  struct RC5Struct rc;
  while(1){
    if([some_condition]) {
      printf("Waiting for pressing a button on the IR remote...\r\n");
      while(getRC5Signal(&rc,0)!=1);
      printf("%s\r\n", RC5toString(rc));
    }
    if(getRC5Signal(&rc, COOLDOWN)){
      switch(rc.data_bits){
        case RED:
          setColor(255,0,0);
          break;
        case GREEN:
          setColor(0,255,0);
          break;
        case BLUE:
          setColor(0,0,255);
          break;
        case YELLOW:
          setColor(255,255,0);
          break;
        case AV:
          setColor(255,0,0);
          c.r = getNumber(&rc, 3);
          setColor(0,255,0);
          c.g = getNumber(&rc, 3);
          setColor(0,0,255);
          c.b = getNumber(&rc, 3);
          setColorFromStruct(c);
          break;
      }
    }
  }
}

stm32-rc5's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

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.