mirror of https://github.com/MLXXXp/Arduboy2.git
Compare commits
12 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
bc460a2cff | |
|
|
ca1c3ae024 | |
|
|
031e9164aa | |
|
|
7f456cff69 | |
|
|
2374247788 | |
|
|
98afc7229f | |
|
|
4f0d802d50 | |
|
|
ccedf84434 | |
|
|
279fd9d0f4 | |
|
|
36cbdc734c | |
|
|
ab4df7c77a | |
|
|
b4b4d45009 |
|
|
@ -1,7 +1,30 @@
|
||||||
|
# Commit message style
|
||||||
When submitting changes via a pull request, or any other means, please format commit messages using ["50/72" guidelines, as suggested by Tim Pope](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
When submitting changes via a pull request, or any other means, please format commit messages using ["50/72" guidelines, as suggested by Tim Pope](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
||||||
|
|
||||||
Summary:
|
## Summary:
|
||||||
- Maximum 50 character first "title" line, written as a capitalized [imperative sentence](http://examples.yourdictionary.com/imperative-sentence-examples.html).
|
- Maximum 50 character first "title" line, written as a capitalized [imperative sentence](http://examples.yourdictionary.com/imperative-sentence-examples.html).
|
||||||
- If necessary, more detailed explanatory paragraphs following a blank line, with lines wrapped at maximum 72 characters.
|
- If necessary, more detailed explanatory paragraphs following a blank line, with lines wrapped at maximum 72 characters.
|
||||||
- If used, bullet points have a "hanging indent".
|
- If used, bullet points have a "hanging indent".
|
||||||
|
|
||||||
|
## Example 1:
|
||||||
|
```
|
||||||
|
Make state variables used by pollButtons() public
|
||||||
|
|
||||||
|
The variables currentButtonState and previousButtonState used by
|
||||||
|
pollButtons(), justPressed() and justReleased() have been made public.
|
||||||
|
This allows them to be manipulated if circumstances require it.
|
||||||
|
|
||||||
|
The documentation added for previousButtonState includes an example.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example 2:
|
||||||
|
```
|
||||||
|
Refactor text code and add char size functions
|
||||||
|
|
||||||
|
- Functions write() and drawChar() were refactored for smaller code
|
||||||
|
size and to make text wrapping operate more like what would normally
|
||||||
|
be expected.
|
||||||
|
|
||||||
|
- A new flag variable, textRaw, has been added, along with functions
|
||||||
|
setTextRawMode() and getTextRawMode() to set and read it.
|
||||||
|
```
|
||||||
|
|
@ -8,7 +8,7 @@ Software License Agreements
|
||||||
Licensed under the BSD 3-clause license:
|
Licensed under the BSD 3-clause license:
|
||||||
|
|
||||||
Arduboy2 library:
|
Arduboy2 library:
|
||||||
Copyright (c) 2016-2020, Scott Allen
|
Copyright (c) 2016-2021, Scott Allen
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
The Arduboy2 library was forked from the Arduboy library:
|
The Arduboy2 library was forked from the Arduboy library:
|
||||||
|
|
@ -18,7 +18,8 @@ Copyright (c) 2016, Chris Martinez
|
||||||
Copyright (c) 2016, Josh Goebel
|
Copyright (c) 2016, Josh Goebel
|
||||||
Copyright (c) 2016, Scott Allen
|
Copyright (c) 2016, Scott Allen
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
which is in turn partially based on the Adafruit_SSD1306 library
|
|
||||||
|
- which is in turn partially based on the Adafruit_SSD1306 library
|
||||||
https://github.com/adafruit/Adafruit_SSD1306
|
https://github.com/adafruit/Adafruit_SSD1306
|
||||||
Copyright (c) 2012, Adafruit Industries
|
Copyright (c) 2012, Adafruit Industries
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,7 @@ Arduboy2 arduboy;
|
||||||
ArduboyPlaytune tunes(arduboy.audio.enabled);
|
ArduboyPlaytune tunes(arduboy.audio.enabled);
|
||||||
```
|
```
|
||||||
|
|
||||||
The sound channels must then be initialzed and assigned to the speaker pins. This code would go in the *setup()* function:
|
The sound channels must then be initialized and assigned to the speaker pins. This code would go in the *setup()* function:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// audio setup
|
// audio setup
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ void moveBall()
|
||||||
topBrick = 6 * row + 1;
|
topBrick = 6 * row + 1;
|
||||||
bottomBrick = 6 * row + 7;
|
bottomBrick = 6 * row + 7;
|
||||||
|
|
||||||
//If A collison has occured
|
//If A collision has occurred
|
||||||
if (topBall <= bottomBrick && bottomBall >= topBrick &&
|
if (topBall <= bottomBrick && bottomBall >= topBrick &&
|
||||||
leftBall <= rightBrick && rightBall >= leftBrick)
|
leftBall <= rightBrick && rightBall >= leftBrick)
|
||||||
{
|
{
|
||||||
|
|
@ -293,7 +293,7 @@ void moveBall()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hoizontal collision
|
//Horizontal collision
|
||||||
if (leftBall < leftBrick || rightBall > rightBrick)
|
if (leftBall < leftBrick || rightBall > rightBrick)
|
||||||
{
|
{
|
||||||
//Only bounce once brick each ball move
|
//Only bounce once brick each ball move
|
||||||
|
|
@ -736,14 +736,14 @@ void enterHighScore(byte file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play a tone at a frequency coresponding to the specified precomputed count,
|
// Play a tone at a frequency corresponding to the specified precomputed count,
|
||||||
// for the specified number of frames.
|
// for the specified number of frames.
|
||||||
void playTone(uint16_t count, uint8_t frames)
|
void playTone(uint16_t count, uint8_t frames)
|
||||||
{
|
{
|
||||||
beep.tone(count, frames);
|
beep.tone(count, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play a tone at a frequency coresponding to the specified precomputed count,
|
// Play a tone at a frequency corresponding to the specified precomputed count,
|
||||||
// for the specified duration in milliseconds, using a delay.
|
// for the specified duration in milliseconds, using a delay.
|
||||||
// Used when beep.timer() isn't being called.
|
// Used when beep.timer() isn't being called.
|
||||||
void playToneTimed(uint16_t count, uint16_t duration)
|
void playToneTimed(uint16_t count, uint16_t duration)
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ char title[] = "Press Buttons!";
|
||||||
byte x;
|
byte x;
|
||||||
byte y;
|
byte y;
|
||||||
|
|
||||||
// Width of each charcter including inter-character space
|
// Width of each character including inter-character space
|
||||||
#define CHAR_WIDTH 6
|
#define CHAR_WIDTH 6
|
||||||
|
|
||||||
// Height of each charater
|
// Height of each character
|
||||||
#define CHAR_HEIGHT 8
|
#define CHAR_HEIGHT 8
|
||||||
|
|
||||||
// To get the number of characters, we subtract 1 from the length of
|
// To get the number of characters, we subtract 1 from the length of
|
||||||
|
|
@ -101,6 +101,6 @@ void loop() {
|
||||||
// then we print to screen what is stored in our title variable we declared earlier
|
// then we print to screen what is stored in our title variable we declared earlier
|
||||||
arduboy.print(title);
|
arduboy.print(title);
|
||||||
|
|
||||||
// then we finaly we tell the arduboy to display what we just wrote to the display.
|
// then we finally we tell the arduboy to display what we just wrote to the display.
|
||||||
arduboy.display();
|
arduboy.display();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
Buttons
|
Buttons
|
||||||
=======
|
=======
|
||||||
|
|
||||||
A an example that demonstrates how to capture input from the buttons.
|
An example that demonstrates how to capture input from the buttons.
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,6 @@ void loop() {
|
||||||
// then we print to screen what is in the Quotation marks ""
|
// then we print to screen what is in the Quotation marks ""
|
||||||
arduboy.print(F("Hello, world!"));
|
arduboy.print(F("Hello, world!"));
|
||||||
|
|
||||||
// then we finaly we tell the arduboy to display what we just wrote to the display
|
// then we finally we tell the arduboy to display what we just wrote to the display
|
||||||
arduboy.display();
|
arduboy.display();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ void drawBar(int y, Color color, byte value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the informaton for one digital color
|
// Draw the information for one digital color
|
||||||
void drawDigital(int y, Color color, const char* name) {
|
void drawDigital(int y, Color color, const char* name) {
|
||||||
byte state = digitalState[(byte)color];
|
byte state = digitalState[(byte)color];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -675,7 +675,7 @@ void screenSaveID() {
|
||||||
printIDLarge(ID_SAVE_X, ID_SAVE_Y);
|
printIDLarge(ID_SAVE_X, ID_SAVE_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DISPLAY: Propmt to reset the system EEPROM area
|
// DISPLAY: Prompt to reset the system EEPROM area
|
||||||
void screenResetSys() {
|
void screenResetSys() {
|
||||||
printStr_P(RESET_SYS_TEXT_1_X, RESET_SYS_TEXT_1_Y, StrResetSys1);
|
printStr_P(RESET_SYS_TEXT_1_X, RESET_SYS_TEXT_1_Y, StrResetSys1);
|
||||||
printStr_P(RESET_SYS_TEXT_2_X, RESET_SYS_TEXT_2_Y, StrResetSys2);
|
printStr_P(RESET_SYS_TEXT_2_X, RESET_SYS_TEXT_2_Y, StrResetSys2);
|
||||||
|
|
@ -685,7 +685,7 @@ void screenResetSys() {
|
||||||
printStr_P(RESET_SYS_BTN_NO_X, RESET_SYS_BTN_NO_Y, StrBtnResetNo);
|
printStr_P(RESET_SYS_BTN_NO_X, RESET_SYS_BTN_NO_Y, StrBtnResetNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DISPLAY: Propmt to reset the user EEPROM area
|
// DISPLAY: Prompt to reset the user EEPROM area
|
||||||
void screenResetUser() {
|
void screenResetUser() {
|
||||||
printStr_P(RESET_USER_TEXT_1_X, RESET_USER_TEXT_1_Y, StrResetUser1);
|
printStr_P(RESET_USER_TEXT_1_X, RESET_USER_TEXT_1_Y, StrResetUser1);
|
||||||
printStr_P(RESET_USER_TEXT_2_X, RESET_USER_TEXT_2_Y, StrResetUser2);
|
printStr_P(RESET_USER_TEXT_2_X, RESET_USER_TEXT_2_Y, StrResetUser2);
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 238 B |
Binary file not shown.
|
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 343 B |
|
|
@ -342,8 +342,8 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
rawlen = w * (h+7) / 8;
|
rawlen = w * (h+7) / 8;
|
||||||
|
|
||||||
bmp0 = malloc(rawlen); memset(bmp0, 0, rawlen);
|
bmp0 = (unsigned char *)malloc(rawlen); memset(bmp0, 0, rawlen);
|
||||||
bmp1 = malloc(rawlen); memset(bmp1, 0, rawlen);
|
bmp1 = (unsigned char *)malloc(rawlen); memset(bmp1, 0, rawlen);
|
||||||
|
|
||||||
printf("// %s width: %u height: %u\n", argv[1], w, h);
|
printf("// %s width: %u height: %u\n", argv[1], w, h);
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 199 B |
|
|
@ -6,7 +6,7 @@ Documentation for files contained in this repository that aren't self explanator
|
||||||
|
|
||||||
Provides information so that this library can be installed and updated in the Arduino IDE using the [Library Manager](https://www.arduino.cc/en/Guide/Libraries#toc3).
|
Provides information so that this library can be installed and updated in the Arduino IDE using the [Library Manager](https://www.arduino.cc/en/Guide/Libraries#toc3).
|
||||||
|
|
||||||
The value of *version* must be set to the latest stable tagged release. This should be changed and commited just before tagging the new release.
|
The value of *version* must be set to the latest stable tagged release. This should be changed and committed just before tagging the new release.
|
||||||
|
|
||||||
See the [Arduino IDE 1.5: Library specification](https://arduino.github.io/arduino-cli/library-specification/) for details.
|
See the [Arduino IDE 1.5: Library specification](https://arduino.github.io/arduino-cli/library-specification/) for details.
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ See the [Arduino IDE 1.5: Library specification](https://arduino.github.io/ardui
|
||||||
|
|
||||||
This JSON file is a manifest used by the [PlatformIO IDE](https://platformio.org/) to make this library available in its [Library Manager](https://docs.platformio.org/en/latest/librarymanager/index.html).
|
This JSON file is a manifest used by the [PlatformIO IDE](https://platformio.org/) to make this library available in its [Library Manager](https://docs.platformio.org/en/latest/librarymanager/index.html).
|
||||||
|
|
||||||
The value of *version* must be set to the latest stable tagged release. This should be changed and commited just before tagging the new release.
|
The value of *version* must be set to the latest stable tagged release. This should be changed and committed just before tagging the new release.
|
||||||
|
|
||||||
See the [PlatformIO library.json](https://docs.platformio.org/en/latest/librarymanager/config.html) documentation for details.
|
See the [PlatformIO library.json](https://docs.platformio.org/en/latest/librarymanager/config.html) documentation for details.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -581,10 +581,10 @@ void Arduboy2Base::drawFastHLine
|
||||||
w = xEnd - x;
|
w = xEnd - x;
|
||||||
|
|
||||||
// buffer pointer plus row offset + x offset
|
// buffer pointer plus row offset + x offset
|
||||||
register uint8_t *pBuf = sBuffer + ((y / 8) * WIDTH) + x;
|
uint8_t *pBuf = sBuffer + ((y / 8) * WIDTH) + x;
|
||||||
|
|
||||||
// pixel mask
|
// pixel mask
|
||||||
register uint8_t mask = 1 << (y & 7);
|
uint8_t mask = 1 << (y & 7);
|
||||||
|
|
||||||
switch (color)
|
switch (color)
|
||||||
{
|
{
|
||||||
|
|
@ -623,7 +623,7 @@ void Arduboy2Base::fillScreen(uint8_t color)
|
||||||
// {
|
// {
|
||||||
// color = 0xFF; // all pixels on
|
// color = 0xFF; // all pixels on
|
||||||
// }
|
// }
|
||||||
// for (int16_t i = 0; i < WIDTH * HEIGTH / 8; i++)
|
// for (int16_t i = 0; i < WIDTH * HEIGHT / 8; i++)
|
||||||
// {
|
// {
|
||||||
// sBuffer[i] = color;
|
// sBuffer[i] = color;
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@
|
||||||
* for. For example, with a rate of 60 frames per second a duration of 30
|
* for. For example, with a rate of 60 frames per second a duration of 30
|
||||||
* would be used to play a tone for half a second.
|
* would be used to play a tone for half a second.
|
||||||
*
|
*
|
||||||
* The variable named `#duration` is the counter that times the duration of a
|
* The variable named #duration is the counter that times the duration of a
|
||||||
* tone. A sketch can determine if a tone is currently playing by testing if
|
* tone. A sketch can determine if a tone is currently playing by testing if
|
||||||
* the `#duration` variable is non-zero (assuming it's a timed tone, not a
|
* the #duration variable is non-zero (assuming it's a timed tone, not a
|
||||||
* continuous tone).
|
* continuous tone).
|
||||||
*
|
*
|
||||||
* To keep the code small and efficient, the frequency of a tone is specified
|
* To keep the code small and efficient, the frequency of a tone is specified
|
||||||
|
|
|
||||||
|
|
@ -572,7 +572,7 @@ class Arduboy2Core : public Arduboy2NoUSB
|
||||||
* Invert the entire display or set it back to normal.
|
* Invert the entire display or set it back to normal.
|
||||||
*
|
*
|
||||||
* \param inverse `true` will invert the display. `false` will set the
|
* \param inverse `true` will invert the display. `false` will set the
|
||||||
* display to no-inverted.
|
* display to non-inverted.
|
||||||
*
|
*
|
||||||
* \details
|
* \details
|
||||||
* Calling this function with a value of `true` will set the display to
|
* Calling this function with a value of `true` will set the display to
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue