GEX core repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-core/utils/avrlibc.h

60 lines
1.5 KiB

7 years ago
//
// Created by MightyPork on 2017/11/26.
//
// Those are low memory footprint implementations of some stdlib functions
// taken from the AVR libc. They are used instead of newlib versions.
//
7 years ago
#ifndef GEX_AVRLIBC_H_H
#define GEX_AVRLIBC_H_H
/**
* atoi() - parse decimal int from ASCII
*
* @param p - string
* @return int, 0 on failure
*/
7 years ago
int avr_atoi(const char *p);
/**
* atol() - parse decimal long int from ASCII
*
* @param p - string
* @return int, 0 on failure
*/
7 years ago
long avr_atol(const char *p);
/**
* strtol() - parse integer number form string.
* this is internally called by atol and atoi
*
* 0x is allowed for bases 0 and 16
*
* @param nptr - string to parse
* @param endptr - NULL or pointer to string where the end will be stored (first bad char)
* @param base - base 2, 10, 16.... 0 for auto
* @return the number
*/
long avr_strtol(const char *nptr, char **endptr, register int base);
/**
* Parse double from ASCII
*
* @param nptr - string to parse
* @param endptr - NULL or pointer to string where the end will be stored (first bad char)
* @return the number
*/
7 years ago
double avr_strtod (const char * nptr, char ** endptr);
/**
* like strtol(), but unsigned (and hence higher max value)
*
* @param nptr - string to parse
* @param endptr - NULL or pointer to string where the end will be stored (first bad char)
* @param base - base 2, 10, 16.... 0 for auto
* @return the number
*/
7 years ago
unsigned long avr_strtoul(const char *nptr, char **endptr, register int base);
#endif //GEX_AVRLIBC_H_H