Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expose MCUSR register to applications using GPIOR0#558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jpcornil-git wants to merge1 commit intoarduino:master
base:master
Choose a base branch
Loading
fromjpcornil-git:master
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletionsbootloaders/caterina/Caterina.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,7 +68,7 @@ uint16_t Timeout = 0;
uint16_t bootKey = 0x7777;
volatile uint16_t *const bootKeyPtr = (volatile uint16_t *)0x0800;

void StartSketch(void)
void StartSketch(uint8_t mcusr_state)
{
cli();

Expand All@@ -86,6 +86,8 @@ void StartSketch(void)
TX_LED_OFF();
RX_LED_OFF();

GPIOR0 = mcusr_state;

/* jump to beginning of application space */
__asm__ volatile("jmp 0x0000");
}
Expand DownExpand Up@@ -126,10 +128,10 @@ int main(void)
} else if ((mcusr_state & (1<<PORF)) && (pgm_read_word(0) != 0xFFFF)) {
// After a power-on reset skip the bootloader and jump straight to sketch
// if one exists.
StartSketch();
StartSketch(mcusr_state);
} else if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {
// If it looks like an "accidental" watchdog reset then start the sketch.
StartSketch();
StartSketch(mcusr_state);
}

/* Setup hardware required for the bootloader */
Expand All@@ -155,7 +157,7 @@ int main(void)
USB_Detach();

/* Jump to beginning of application space to run the sketch - do not reset */
StartSketch();
StartSketch(mcusr_state);
}

/** Configures all hardware required for the bootloader. */
Expand Down
2 changes: 1 addition & 1 deletionbootloaders/caterina/Caterina.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -86,7 +86,7 @@
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;

/* Function Prototypes: */
void StartSketch(void);
void StartSketch(uint8_t mcur_state);
void LEDPulse(void);

void CDC_Task(void);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp