Arduboy2 Library  6.0.0
Arduboy2Core.h File Reference

The Arduboy2Core class for Arduboy hardware initilization and control. More...

#include <Arduino.h>
#include <avr/power.h>
#include <avr/sleep.h>
+ Include dependency graph for Arduboy2Core.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Arduboy2Core
 Lower level functions generally dealing directly with the hardware. More...
 

Macros

#define RGB_ON   LOW
 
#define RGB_OFF   HIGH
 
#define RED_LED   10
 
#define GREEN_LED   11
 
#define BLUE_LED   9
 
#define LEFT_BUTTON   _BV(5)
 
#define RIGHT_BUTTON   _BV(6)
 
#define UP_BUTTON   _BV(7)
 
#define DOWN_BUTTON   _BV(4)
 
#define A_BUTTON   _BV(3)
 
#define B_BUTTON   _BV(2)
 
#define PIN_SPEAKER_1   5
 
#define PIN_SPEAKER_2   13
 
#define WIDTH   128
 
#define HEIGHT   64
 
#define ARDUBOY_NO_USB
 Eliminate the USB stack to free up code space. More...
 

Detailed Description

The Arduboy2Core class for Arduboy hardware initilization and control.

Definition in file Arduboy2Core.h.

Macro Definition Documentation

◆ A_BUTTON

#define A_BUTTON   _BV(3)

The A button value for functions requiring a bitmask

Definition at line 72 of file Arduboy2Core.h.

◆ ARDUBOY_NO_USB

#define ARDUBOY_NO_USB
Value:
int main() __attribute__ ((OS_main)); \
int main() { \
Arduboy2NoUSB::mainNoUSB(); \
return 0; \
}

Eliminate the USB stack to free up code space.

Warning
Removing the USB code will make it impossible for sketch uploader programs to automatically force a reset into the bootloader! This means that a user will manually have to invoke a reset in order to upload a new sketch, after one without USB has be been installed. Be aware that the timing for the point that a reset must be initiated can be tricky, which could lead to some frustration on the user's part.

This macro will cause the USB code, normally included in the sketch as part of the standard Arduino environment, to be eliminated. This will free up a fair amount of program space, and some RAM space as well, at the expense of disabling all USB functionality within the sketch (except as power input).

The macro should be placed before the setup() function definition:

#include <Arduboy2.h>
Arduboy2 arduboy;
// (Other variable declarations, etc.)
// Eliminate the USB stack
void setup() {
arduboy.begin();
// any additional setup code
}

As stated in the warning above, without the USB code an uploader program will be unable to automatically force a reset into the bootloader to upload a new sketch. The user will have to manually invoke a reset. In addition to eliminating the USB code, this macro will check if the DOWN button is held when the sketch first starts and, if so, will call exitToBootloader() to start the bootloader for uploading. This makes it easier for the user than having to press the reset button.

However, to make it even more convenient for a user to invoke the bootloader it is highly recommended that a sketch using this macro include a menu or prompt that allows the user to press the DOWN button within the sketch, which should cause exitToBootloader() to be called.

At a minimum, the documentation for the sketch should clearly state that a manual reset will be required, and give detailed instructions on what the user must do to upload a new sketch.

See also
Arduboy2Core::exitToBootloader()

Definition at line 305 of file Arduboy2Core.h.

◆ B_BUTTON

#define B_BUTTON   _BV(2)

The B button value for functions requiring a bitmask

Definition at line 73 of file Arduboy2Core.h.

◆ BLUE_LED

#define BLUE_LED   9

The pin number for the blue color in the RGB LED.

Definition at line 55 of file Arduboy2Core.h.

◆ DOWN_BUTTON

#define DOWN_BUTTON   _BV(4)

The Down button value for functions requiring a bitmask

Definition at line 71 of file Arduboy2Core.h.

◆ GREEN_LED

#define GREEN_LED   11

The pin number for the greem color in the RGB LED.

Definition at line 54 of file Arduboy2Core.h.

◆ HEIGHT

#define HEIGHT   64

The height of the display in pixels

Definition at line 244 of file Arduboy2Core.h.

◆ LEFT_BUTTON

#define LEFT_BUTTON   _BV(5)

The Left button value for functions requiring a bitmask

Definition at line 68 of file Arduboy2Core.h.

◆ PIN_SPEAKER_1

#define PIN_SPEAKER_1   5

The pin number of the first lead of the speaker

Definition at line 111 of file Arduboy2Core.h.

◆ PIN_SPEAKER_2

#define PIN_SPEAKER_2   13

The pin number of the second lead of the speaker

Definition at line 112 of file Arduboy2Core.h.

◆ RED_LED

#define RED_LED   10

The pin number for the red color in the RGB LED.

Definition at line 53 of file Arduboy2Core.h.

◆ RGB_OFF

#define RGB_OFF   HIGH

For digitially setting an RGB LED off using digitalWriteRGB()

Definition at line 36 of file Arduboy2Core.h.

◆ RGB_ON

#define RGB_ON   LOW

For digitially setting an RGB LED on using digitalWriteRGB()

Definition at line 35 of file Arduboy2Core.h.

◆ RIGHT_BUTTON

#define RIGHT_BUTTON   _BV(6)

The Right button value for functions requiring a bitmask

Definition at line 69 of file Arduboy2Core.h.

◆ UP_BUTTON

#define UP_BUTTON   _BV(7)

The Up button value for functions requiring a bitmask

Definition at line 70 of file Arduboy2Core.h.

◆ WIDTH

#define WIDTH   128

The width of the display in pixels

Definition at line 243 of file Arduboy2Core.h.

Arduboy2
The main functions provided for writing sketches for the Arduboy, including text output.
Definition: Arduboy2.h:1576
Arduboy2::begin
void begin()
Initialize the hardware, display the boot logo, provide boot utilities, etc.
Definition: Arduboy2.cpp:1170
Arduboy2.h
The Arduboy2Base and Arduboy2 classes and support objects and definitions.
ARDUBOY_NO_USB
#define ARDUBOY_NO_USB
Eliminate the USB stack to free up code space.
Definition: Arduboy2Core.h:304