Skip to content

2. Introduction to Source files and the Building Process.

Animesh Srivastava edited this page Jul 5, 2019 · 7 revisions

The Arduino core contains all the built-in functions source files.

Source File Categorisation

The files have been categorized in the following types:

  1. General Source Files
  2. Port-related Source Files
  3. Timers/Timing Source Files
  4. Hardware Serial Source Files
  5. Wiring-related Source Files
  6. Others

General Source Files

The General Source Files category encapsulates all the source file that is related with built-in functions required for general Arduino Language Programming and core functioning.

We know that a .h file describes the structure of the library and declares all its variables and functions The Arduino.h files contain:

  • The declaration of mostly used built-in functions of the Arduino Programming Language. Example: digitalRead(), pinMode(), etc.
  • Macro functions for general functions, not limited to rand(), min(), etc.

ii). main.cpp

The main.cpp is very important as it describes the basic program structure:

int main(void)
{
	init();

	initVariant();

#if defined(USBCON)
	USBDevice.attach();
#endif
	
	setup();
    
	for (;;) {
		loop();
		if (serialEventRun) serialEventRun();
	}
        
	return 0;
}

Port Related Source Files

The Port Related Source Files category encapsulates all the source file that is related with built-in functions required for general port functioning. For example: digitalRead(), pinMode(), etc. We categorize the files in two sub-categories:

1). Digital Port Source File

2). Analog Port Source File

3). Other Port Related Files


Timers/Timing Source Files


Hardware Serial Source Files


Wiring-related Source Files


Others

See Also