From f17a13be4435412ac0253e08890c90825a604e1c Mon Sep 17 00:00:00 2001 From: "Mr.Blinky" <4971163+MrBlinky@users.noreply.github.com> Date: Fri, 1 May 2020 18:12:45 +0200 Subject: [PATCH] Changes for Arduboy FX Added SYS_FLAG_POWERON_MENU This bit determines if Arduboy FX/Cathy3K bootloader starts with the built in loader menu (1) or last loaded application(0) afte switching power on SPItransfer now returns the received SPI byte. This allowes the FX library to use SPItransfer from Arduboy2 library saving space. --- src/Arduboy2.h | 2 ++ src/Arduboy2Core.cpp | 3 ++- src/Arduboy2Core.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Arduboy2.h b/src/Arduboy2.h index 032a089..e0a26b5 100644 --- a/src/Arduboy2.h +++ b/src/Arduboy2.h @@ -53,6 +53,8 @@ #define SYS_FLAG_SHOW_LOGO_MASK _BV(SYS_FLAG_SHOW_LOGO) #define SYS_FLAG_SHOW_LOGO_LEDS 2 // Flash the RGB led during the boot logo #define SYS_FLAG_SHOW_LOGO_LEDS_MASK _BV(SYS_FLAG_SHOW_LOGO_LEDS) +#define SYS_FLAG_POWERON_MENU 7 // Start with FX loader menu after power on +#define SYS_FLAG_POWERON_MENU_MASK _BV(SYS_FLAG_POWERON_MENU) /** \brief * Start of EEPROM storage space for sketches. diff --git a/src/Arduboy2Core.cpp b/src/Arduboy2Core.cpp index 98bf257..0beb551 100644 --- a/src/Arduboy2Core.cpp +++ b/src/Arduboy2Core.cpp @@ -233,7 +233,7 @@ void Arduboy2Core::bootSPI() } // Write to the SPI bus (MOSI pin) -void Arduboy2Core::SPItransfer(uint8_t data) +uint8_t Arduboy2Core::SPItransfer(uint8_t data) { SPDR = data; /* @@ -244,6 +244,7 @@ void Arduboy2Core::SPItransfer(uint8_t data) */ asm volatile("nop"); while (!(SPSR & _BV(SPIF))) { } // wait + return SPDR; } void Arduboy2Core::safeMode() diff --git a/src/Arduboy2Core.h b/src/Arduboy2Core.h index 698c7a3..ad9c6c2 100644 --- a/src/Arduboy2Core.h +++ b/src/Arduboy2Core.h @@ -400,7 +400,7 @@ class Arduboy2Core * * \see LCDDataMode() LCDCommandMode() sendLCDCommand() */ - void static SPItransfer(uint8_t data); + uint8_t static SPItransfer(uint8_t data); /** \brief * Turn the display off.