Git Product home page Git Product logo

loramesh_stm8l's Introduction

LoRaMESH STM8L Library

Library to configure EndDevice LoRaMESH GPIO pins, requesting and sending data from/to the nodes. It was based on the following Radioenge's Library

How to use

Download all the files from this root and include them into your project. This step is mandatory to use them with STM8L Discovery board and your "standard peripheral library".

Configuring USART Interface

As STM8L152C6T6 has only one USART interface and the LoRaMESH module has two, the choice of which interface will be used will be made through the hardware connection. It is possible to choose two ways to configure USART: using Arduino default or using manual configurations. Arduino's default mode works well with the LoRa MESH module. For manual configurations you may use the types defined in "stm8l15x_usart" provided by ST.

//Easy way
uint32_t baudrate = 9600;
ArduinoSerialCommandsInit(baudrate);

//Manual
/* USART configured as follow:
     - BaudRate = 9600 baud  
     - Word Length = 8 Bits
     - One Stop Bit
     - No parity
*/
  SerialCommandsInit(9600, USART_WordLength_8b, USART_StopBits_1,USART_Parity_No);

Main Features

The library main features are based on the functions to request and send data using the pins connected to other network modules.

/* GpioConfig */
GpioConfig(NODEID, PIN, GPIOMODE, PULL_R_TYPE);
/* GpioWrite */
GpioWrite(NODEID, PIN, ValueForWrite);
/* GpioRead */
GpioRead(NODEID, PIN, &ReturnedValue);

GPIO's modes

Configure the GPIO pins with the following modes:

/* DIGITAL_IN */
GpioConfig(NODEID, PIN, DIGITAL_IN, PULL_R_TYPE);
/* DIGITAL_OUT */
GpioConfig(NODEID, PIN, DIGITAL_OUT, PULL_R_TYPE);
/* ANALOG_IN */
GpioConfig(NODEID, PIN, ANALOG_IN, PULL_R_TYPE);

Pull Resistor Types

Configure the pull resistors with the following types

/* PULL_OFF */
GpioConfig(NODEID, PIN, DIGITAL_IN, PULL_OFF);
/* PULLUP */
GpioConfig(NODEID, PIN, DIGITAL_OUT, PULLUP);
/* PULLDOWN */
GpioConfig(NODEID, PIN, ANALOG_IN, PULLDOWN);

Request Status

The data request return is given by the following status to indicate error or not:

/* MESH_OK */
while(LocalRead(&localId, &localNet, &localUniqueId) != MESH_OK);
/* MESH_ERROR */
if(GpioRead(NODEID, PIN, &ReturnedValue)  == MESH_ERROR){
  //Invalid value
}

Running a example

Example code can be downloaded from this root following the instructions.

Documentation

Full documentation description here.

How to contribute

Read this guide.

Contributors


@vjpamorim

@Radioenge

Author


@MarcoAOC

Do you like this library? Please star this project on GitHub!

loramesh_stm8l's People

Contributors

marcoaoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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