Code Monkey home page Code Monkey logo

hcs301's Introduction

A simple C library (STM32 HAL) for reading and sending code for HCS301 433Mhz Keeloq 66 bit.

This library use for control automation garage door and road barriers.

Receive code

Config you RX433 PIN with "GPIO_EXTI":

  • External Interrupt Mode with Rising/Falling edge trigger detection;
  • No pull up no pull down.

and add NVIC global interrupt for you RXPIN.

Copy the library header and source file to the appropriate project directories (Inc, Src).

Config you RX433 and TX433 PORT and PIN on hcs301.h file

#define RX_PORT         You_RX_GPIO_Port
#define RX_PIN          You_Rx_Pin

In the main file of your project (main.c), include the header files.

Micros library download from https://github.com/leech001/micros

/ * USER CODE BEGIN Includes * /
#include "micros.h"		      
#include "hcs301.h"
/ * USER CODE END Includes * /

add HCS301 structure to the section

/ * USER CODE BEGIN PV * /
HCS301_t hcs301;
/ * USER CODE END PV * /

add RX433 receive interrupt

/* USER CODE BEGIN 0 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
	if (GPIO_Pin == You_Rx_Pin){
	    HCS301_Int()
	}
}
/* USER CODE END 0 */

add in main function section for initial initialization of the DWT (Data Watchpoint and Trace unit) (https://github.com/leech001/micros)

/ * USER CODE BEGIN 2 * /
  DWT_Init();
/ * USER CODE END 2 * /

On this project setup is ready. After starting the program, information from RX433(HCS301) will be available through the hcs301 structure

...
hcs301.SerialNum
...

Send code

Config you TX433 PIN with "Output Push Pull":

  • Speed Very High;
  • No pull up no pull down.

Copy the library header and source file to the appropriate project directories (Inc, Src).

Config you RX433 and TX433 PORT and PIN on hcs301.h file

#define TX_PORT         You_TX_GPIO_Port
#define TX_PIN          You_TX_Pin

In the main file of your project (main.c), include the header files.

Micros library download from https://github.com/leech001/micros

/ * USER CODE BEGIN Includes * /
#include "micros.h"		      
#include "hcs301.h"
/ * USER CODE END Includes * /

For send code HCS301 use function

HCS301_Send(you_code);

hcs301's People

Contributors

leech001 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.