Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
19f4cfe9
Verified
Commit
19f4cfe9
authored
Jul 04, 2019
by
Rahix
Browse files
feat(bootloader): Reset on power button press
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
339bc388
Changes
1
Hide whitespace changes
Inline
Side-by-side
bootloader/main.c
View file @
19f4cfe9
...
...
@@ -8,6 +8,7 @@
#include
"mxc_delay.h"
#include
"flc.h"
#include
"icc.h"
#include
"i2c.h"
#include
"crc.h"
#include
"board.h"
#include
"led.h"
...
...
@@ -15,6 +16,7 @@
#include
"crc16-ccitt.h"
#include
"pb.h"
#include
"pmic.h"
#define GPIO_PORT_IN PORT_1
#define GPIO_PIN_IN PIN_6
...
...
@@ -174,10 +176,25 @@ static inline void boot(const void * vtable){
#pragma GCC diagnostic pop
};
static
void
pmic_button
(
bool
falling
)
{
if
(
falling
)
{
MXC_GCR
->
rstr0
=
MXC_F_GCR_RSTR0_SYSTEM
;
}
}
/******************************************************************************/
int
main
(
void
)
{
/* Copied from card10_init() */
I2C_Shutdown
(
MXC_I2C0_BUS0
);
I2C_Init
(
MXC_I2C0_BUS0
,
I2C_FAST_MODE
,
NULL
);
I2C_Shutdown
(
MXC_I2C1_BUS0
);
I2C_Init
(
MXC_I2C1_BUS0
,
I2C_FAST_MODE
,
NULL
);
pmic_init
();
pmic_set_button_callback
(
pmic_button
);
printf
(
"
\n\n
Bootloader
\n
"
);
// If the button is pressed, we go into MSC mode.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment