DIY Logging Volt/Ampmeter
|
U(S)ART functionality for high-precision logging voltage/current meter. More...
#include "usart.h"
#include <stdint.h>
#include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_gpio.h"
#include "stm32f1xx_ll_usart.h"
#include "SEGGER_RTT.h"
#include "util.h"
#include "main.h"
#include "conversion.h"
Go to the source code of this file.
Macros | |
#define | RX_BUFFER_SIZE 8 |
#define | RX_BUFFER_SIZE_UART1 3 |
#define | BAUDRATE_METER 9600 /* Baudrate of volt/currentmeter */ |
#define | BAUDRATE_LOGGER 115200 /* Baudrate of external datalogger */ |
Functions | |
void | USART_HandleContinuousReception (void) |
This function monitors USART1/2/3 buffer filling indication and moves data around accordingly. More... | |
void | USART2_SendCommand (uint8_t *command, uint8_t bytes) |
Send a byte (uint8_t ) command to USART2. More... | |
void | USART3_SendCommand (uint8_t *command, uint8_t bytes) |
Send a byte (uint8_t ) command to USART3. More... | |
void | USART1_INIT (void) |
USART1 Initialization Function. More... | |
void | USART2_INIT (void) |
USART2 Initialization Function. More... | |
void | USART3_INIT (void) |
USART3 Initialization Function. More... | |
void | USART1_print (char *message) |
Print a string (char array) to USARTx. More... | |
void | USART1_CharReception_Callback (void) |
Print a string (char array) to USART1. More... | |
void | USART2_CharReception_Callback (void) |
Function called from USART2 IRQ Handler when RXNE flag is set. Function is in charge of reading character received on USART2 RX line. More... | |
void | USART3_CharReception_Callback (void) |
Function called from USART3 IRQ Handler when RXNE flag is set. Function is in charge of reading character received on USART3 RX line. More... | |
void | USART1_Error_Callback (void) |
Function called in case of error detected in USART1 IT Handler. More... | |
void | USART2_Error_Callback (void) |
Function called in case of error detected in USART2 IT Handler. More... | |
void | USART3_Error_Callback (void) |
Function called in case of error detected in USART3 IT Handler. More... | |
Variables | |
uint8_t | aRXBufferA_USART1 [3] |
uint8_t | aRXBufferB_USART1 [3] |
__IO uint32_t | uwNbReceivedChars_USART1 |
__IO uint32_t | uwBufferReadyIndication_USART1 |
uint8_t * | pBufferReadyForUser_USART1 |
uint8_t * | pBufferReadyForReception_USART1 |
uint8_t | aRXBufferA_USART2 [8] |
uint8_t | aRXBufferB_USART2 [8] |
__IO uint32_t | uwNbReceivedChars_USART2 |
__IO uint32_t | uwBufferReadyIndication_USART2 |
uint8_t * | pBufferReadyForUser_USART2 |
uint8_t * | pBufferReadyForReception_USART2 |
uint8_t | aRXBufferA_USART3 [8] |
uint8_t | aRXBufferB_USART3 [8] |
__IO uint32_t | uwNbReceivedChars_USART3 |
__IO uint32_t | uwBufferReadyIndication_USART3 |
uint8_t * | pBufferReadyForUser_USART3 |
uint8_t * | pBufferReadyForReception_USART3 |
U(S)ART functionality for high-precision logging voltage/current meter.
data.current > 9.9999
, data.voltage > 99.999
(these checks are as of v1.1 of this file unnecessary...)USART_HandleContinuousReception();
)12<
.Copyright (C) 2021 - 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 also use code obtained from examples from STMicroelectronics.
Copyright (c) 2020 STMicroelectronics. All rights reserved.
These sections are licensed by ST under BSD 3-Clause license, the "License"; One may not use these example files except in compliance with the License. One may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause
Definition in file usart.c.
#define BAUDRATE_LOGGER 115200 /* Baudrate of external datalogger */ |
#define BAUDRATE_METER 9600 /* Baudrate of volt/currentmeter */ |
void USART1_CharReception_Callback | ( | void | ) |
Print a string (char array) to USART1.
[in] | string | The string to print to USART1. |
[in] | size | Length of the string in bytes. |
Print a string (char array) to USART2.
[in] | string | The string to print to USART2. |
[in] | size | Length of the string in bytes. |
Print a string (char array) to USART3.
[in] | string | The string to print to USART3. |
[in] | size | Length of the string in bytes. |
Function called from USART1 IRQ Handler when RXNE flag is set.
Function is in charge of reading character received on USART1 RX line.
Definition at line 670 of file usart.c.
void USART1_Error_Callback | ( | void | ) |
Function called in case of error detected in USART1 IT Handler.
Definition at line 750 of file usart.c.
void USART1_INIT | ( | void | ) |
void USART1_print | ( | char * | message | ) |
void USART2_CharReception_Callback | ( | void | ) |
void USART2_Error_Callback | ( | void | ) |
Function called in case of error detected in USART2 IT Handler.
Definition at line 779 of file usart.c.
void USART2_INIT | ( | void | ) |
void USART2_SendCommand | ( | uint8_t * | command, |
uint8_t | bytes | ||
) |
void USART3_CharReception_Callback | ( | void | ) |
void USART3_Error_Callback | ( | void | ) |
Function called in case of error detected in USART3 IT Handler.
Definition at line 808 of file usart.c.
void USART3_INIT | ( | void | ) |
void USART3_SendCommand | ( | uint8_t * | command, |
uint8_t | bytes | ||
) |
void USART_HandleContinuousReception | ( | void | ) |
This function monitors USART1/2/3 buffer filling indication and moves data around accordingly.
Format of the data coming from the meters:
Format of the data coming from the meters:
Definition at line 114 of file usart.c.