PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1/*-
2 * BSD 2-Clause License
3 *
4 * Copyright (c) 2012-2018, Jan Breuer
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
36
37#ifndef SCPI_UTILS_H
38#define SCPI_UTILS_H
39
40#include <stdint.h>
41#include "../../../../libraries/scpi-parser/inc/scpi/types.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47 size_t SCPI_UInt32ToStrBase(uint32_t val, char * str, size_t len, int8_t base);
48 size_t SCPI_Int32ToStr(int32_t val, char * str, size_t len);
49 size_t SCPI_UInt64ToStrBase(uint64_t val, char * str, size_t len, int8_t base);
50 size_t SCPI_Int64ToStr(int64_t val, char * str, size_t len);
51 size_t SCPI_FloatToStr(float val, char * str, size_t len);
52 size_t SCPI_DoubleToStr(double val, char * str, size_t len);
53
54 /* deprecated finction, should be removed later */
55#define SCPI_LongToStr(val, str, len, base) SCPI_Int32ToStr((val), (str), (len), (base), TRUE)
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif /* SCPI_UTILS_H */
62
size_t SCPI_Int64ToStr(int64_t val, char *str, size_t len)
Converts signed 64 bit integer value to string.
Definition utils.c:227
size_t SCPI_FloatToStr(float val, char *str, size_t len)
Converts float (32 bit) value to string.
Definition utils.c:250
size_t SCPI_UInt32ToStrBase(uint32_t val, char *str, size_t len, int8_t base)
Converts unsigned 32 bit integer value to string in specific base.
Definition utils.c:153
size_t SCPI_UInt64ToStrBase(uint64_t val, char *str, size_t len, int8_t base)
Converts signed/unsigned 64 bit integer value to string in specific base.
Definition utils.c:239
size_t SCPI_Int32ToStr(int32_t val, char *str, size_t len)
Converts signed 32 bit integer value to string.
Definition utils.c:141
size_t SCPI_DoubleToStr(double val, char *str, size_t len)
Converts double (64 bit) value to string.
Definition utils.c:262