|
IoT-MBBR (masterthesis)
Masterthesis upgrading a Moving Bed BioReactor with extra sensors and cloud connectivity.
|
BG96 AT-command driver functionality. More...
#include <stdint.h>#include <stdbool.h>#include "em_device.h"#include "em_gpio.h"#include "datatypes.h"Go to the source code of this file.
Macros | |
| #define | UART_BUFFER_SIZE 100 |
Functions | |
| void | initBG96 (void) |
| Initialize the GPIO pins and UART0 module necessary to communicate with the BG96 module. More... | |
| void | sendMeasurements (MeasurementData_t *data) |
| Send measurements to the cloud using NB-IoT. More... | |
| void | sendStatus (int8_t status) |
| Send status to the cloud using NB-IoT. More... | |
| void | sendPulse (uint8_t number, uint8_t pulse) |
| Send current pulses to the cloud using NB-IoT. More... | |
| void | powerBG96 (void) |
Method to enable the power key for 100ms to enable/disable the module. More... | |
| void | disableEcho (void) |
| Disable echo. More... | |
| void | sendCMD (char *message) |
| Print a string (char array) to USARTx. More... | |
| void | readResponse (char *buf) |
| Read a string (char array) from USARTx. More... | |
| bool | waitForResponse (char *response, uint8_t timeout) |
| Wait for the correct response using sleep/timeout functionality. More... | |
BG96 AT-command driver functionality.
Copyright (C) 2020 - Brecht Van Eeckhoudt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A copy of the GNU General Public License can be found in the LICENSE file along with this source code.
Some methods use code obtained from examples from Silicon Labs' GitHub. These sections are licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.
Definition in file BG96_at_driver.h.
| #define UART_BUFFER_SIZE 100 |
Public definition to configure the buffer size.
Definition at line 51 of file BG96_at_driver.h.
| void disableEcho | ( | void | ) |
Disable echo.
Definition at line 592 of file BG96_at_driver.c.
| void initBG96 | ( | void | ) |
Initialize the GPIO pins and UART0 module necessary to communicate with the BG96 module.
Definition at line 82 of file BG96_at_driver.c.
| void powerBG96 | ( | void | ) |
Method to enable the power key for 100ms to enable/disable the module.
Definition at line 579 of file BG96_at_driver.c.
| void readResponse | ( | char * | buf | ) |
Read a string (char array) from USARTx.
"LF" (Line Feed) character is received or the maximum length (UART_BUFFER_SIZE) is reached.| [in] | buf | The buffer to put the resulting string in. This needs to have a length of UART_BUFFER_SIZE for the function to work properly: char buf[UART_BUFFER_SIZE];! |
Definition at line 647 of file BG96_at_driver.c.
| void sendCMD | ( | char * | message | ) |
Print a string (char array) to USARTx.
"Hello world!") but a char array, the input message (array) needs to end with NULL ("\0")!| [in] | message | The string to print to USARTx. |
Definition at line 623 of file BG96_at_driver.c.
| void sendMeasurements | ( | MeasurementData_t * | data | ) |
Send measurements to the cloud using NB-IoT.
| [in] | data | The measurements to send |
Definition at line 230 of file BG96_at_driver.c.
Send current pulses to the cloud using NB-IoT.
| [in] | number |
|
| [in] | pulse | The pulse value to send |
Definition at line 412 of file BG96_at_driver.c.
| void sendStatus | ( | int8_t | status | ) |
Send status to the cloud using NB-IoT.
| [in] | status | The status value to send |
Definition at line 349 of file BG96_at_driver.c.
| bool waitForResponse | ( | char * | response, |
| uint8_t | timeout | ||
| ) |
Wait for the correct response using sleep/timeout functionality.
| [in] | response | The correct response to look for. |
| [in] | timeout | The timeout value. |
true - Module responded correctly before timeout. false - The module timed out or gave only incorrect responses. Definition at line 682 of file BG96_at_driver.c.