summaryrefslogtreecommitdiffstats
path: root/watch-library
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-08-29 15:42:37 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-08-29 15:42:37 -0400
commit74950b110ebed7baf5cd2fa9e86cbf6d40e0fcb1 (patch)
tree34f593daa9e3ded4a7d56dec93353f3741c7d72e /watch-library
parentef0ed276a54fa304cf865b52d3665fa1f2f83b47 (diff)
downloadSensor-Watch-74950b110ebed7baf5cd2fa9e86cbf6d40e0fcb1.tar.gz
Sensor-Watch-74950b110ebed7baf5cd2fa9e86cbf6d40e0fcb1.tar.bz2
Sensor-Watch-74950b110ebed7baf5cd2fa9e86cbf6d40e0fcb1.zip
enable USB earlier so app can log sooner
Diffstat (limited to 'watch-library')
-rwxr-xr-xwatch-library/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/watch-library/main.c b/watch-library/main.c
index 3133c2d2..af34d850 100755
--- a/watch-library/main.c
+++ b/watch-library/main.c
@@ -38,6 +38,15 @@ int main(void) {
// ASF code. Initialize the MCU with configuration options from Atmel Studio.
init_mcu();
+ // check if we are plugged into USB power.
+ watch_enable_digital_input(VBUS_DET);
+ watch_enable_pull_down(VBUS_DET);
+ if (watch_get_pin_level(VBUS_DET)) {
+ // if so, enable USB functionality.
+ _watch_enable_usb();
+ }
+ watch_disable_digital_input(VBUS_DET);
+
// User code. Give the app a chance to initialize its data structures and state.
app_init();
@@ -55,15 +64,6 @@ int main(void) {
// Watch library code. Set initial parameters for the device and enable the RTC.
_watch_init();
- // check if we are plugged into USB power.
- watch_enable_digital_input(VBUS_DET);
- watch_enable_pull_down(VBUS_DET);
- if (watch_get_pin_level(VBUS_DET)) {
- // if so, enable USB functionality.
- _watch_enable_usb();
- }
- watch_disable_digital_input(VBUS_DET);
-
// User code. Give the app a chance to enable and set up peripherals.
app_setup();