add watch_reset_to_bootloader function (resolves #81)
This commit is contained in:
		
							parent
							
								
									e790a02578
								
							
						
					
					
						commit
						7fc4395298
					
				| @ -45,3 +45,9 @@ bool watch_is_buzzer_or_led_enabled(void){ | ||||
| bool watch_is_usb_enabled(void) { | ||||
|     return USB->DEVICE.CTRLA.bit.ENABLE; | ||||
| } | ||||
| 
 | ||||
| void watch_reset_to_bootloader(void) { | ||||
|     volatile uint32_t *dbl_tap_ptr = ((volatile uint32_t *)(HSRAM_ADDR + HSRAM_SIZE - 4)); | ||||
|     *dbl_tap_ptr = 0xf01669ef; // from the UF2 bootloaer: uf2.h line 255
 | ||||
|     NVIC_SystemReset(); | ||||
| } | ||||
|  | ||||
| @ -80,6 +80,10 @@ bool watch_is_buzzer_or_led_enabled(void); | ||||
|   */ | ||||
| bool watch_is_usb_enabled(void); | ||||
| 
 | ||||
| /** @brief Resets in the UF2 bootloader mode
 | ||||
|   */ | ||||
| void watch_reset_to_bootloader(void); | ||||
| 
 | ||||
| /** @brief Reads up to len bytes from the USB serial.
 | ||||
|   * @param file ignored, you can pass in 0 | ||||
|   * @param ptr pointer to a buffer of at least len bytes | ||||
|  | ||||
| @ -7,3 +7,7 @@ bool watch_is_buzzer_or_led_enabled(void) { | ||||
| bool watch_is_usb_enabled(void) { | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| void watch_reset_to_bootloader(void) { | ||||
|     // No bootloader in the simulator; nothing to do here
 | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user