REQUIRES list

If you don’t have a REQUIRES list in CMakeLists.txt that is declaring dependencies on certain special components, you typically don’t have to add basic components as REQUIRES also, due to the implicit dependency behaviour of main component (for an Espressif ESP-IDF explanation see here). If you do have a REQUIRES section, you will need to add […]

Read More

File functions-Reading

fgetc fgets Return next line from a file, or the portion of it up to the buffer size limit: A better way of doing it fgets() doesn’t add a null character at the end of the read data and on some systems can fail to handle mac formatted text files correctly (0x0d only line endings). […]

Read More

File functions-Writing

fprintf() fprintf(FILE *stream, const char *StringAndAnyVariableTags); For the tags you can use see here. fputc fputs fwrite fflush() fflush(FILE *stream);

Read More

File functions

fopen() fopen(const char *filename, const char *access_mode) fseek ftell – get current position in file as an int long int ftell(FILE *stream) fgetpos fsetpos rewind fclose remove rename clearerr feof ferror

Read More

struct

See also typedef, struct union. Example struct that will be used multiple times Example struct for use as one object Checking a struct size On 16bit and 32bit platforms your struct may end up being bigger in memory that the sum of its individual variables due to padding bytes. This can be a useful check […]

Read More

Static

A static variable inside a function keeps its value between calls. A static global variable or function is “seen” only in the file it’s declared in. You can have a variable or function in some other file and it will be treated as a different global variable or function, the linker won’t match the two.

Read More

printf

Remember to include a terminating “\n” in your printf – stdout doesn’t flush until it encounters one by default!!!! If printf still doesn’t occur you may need fflush(stdout); or consider using std::cout instead printf format codes bool %dint %dint %iint8_t %hhduint8_t %hhuint16_t %hduint16_t %huint32_t %lduint32_t %luint64_t %llduint64_t %lluchar[] %sfloat %f (Decimal floating point)float %.3f (3 represents the number […]

Read More

“multiple definition of” errors

Using a local variable of the same name in another part of the application Declaring a variable like this: creates it as visible across all translation units. Even if you don’t use it as “extern int MyVariableName;” somewhere else, it’s still visible across all files. If you go and do the same thing again, create […]

Read More