- Notifications
You must be signed in to change notification settings - Fork6
📚 LoRaMESH library for STM8L.
License
MarcoAOC/LoRaMESH_STM8L
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Library to configureEndDevice LoRaMESH GPIO pins, requesting and sending data from/to the nodes. It was based on the followingRadioenge's Library
Download all the files fromthis root and include them into your project. This step is mandatory to use them with STM8L Discovery board and your"standard peripheral library".
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 wayuint32_tbaudrate=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);
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);
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);
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);
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}
Example code can be downloaded fromthis root following the instructions.
Full documentation descriptionhere.
Readthis guide.
@vjpamorim | @Radioenge |
---|
@MarcoAOC |
---|
Do you like this library? Pleasestar this project on GitHub!