-
-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of WB32 DFU for MacOs. (#320)
Co-authored-by: Ryan <[email protected]> Co-authored-by: Joy <[email protected]>
- Loading branch information
1 parent
7b113f5
commit d7f9c0f
Showing
8 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#import "BootloaderDevice.h" | ||
|
||
@interface WB32DFUDevice : BootloaderDevice | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#import "WB32DFUDevice.h" | ||
|
||
@implementation WB32DFUDevice | ||
|
||
- (id)initWithUSBDevice:(USBDevice *)usbDevice { | ||
if (self = [super initWithUSBDevice:usbDevice]) { | ||
self.name = @"WB32 DFU"; | ||
self.type = BootloaderTypeWB32DFU; | ||
self.resettable = YES; | ||
} | ||
return self; | ||
} | ||
|
||
-(void)flashWithMCU:(NSString *)mcu file:(NSString *)file { | ||
if([[[file pathExtension] lowercaseString] isEqualToString:@"bin"]) { | ||
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--toolbox-mode", @"--dfuse-address", @"0x08000000", @"--download", file]]; | ||
} else if([[[file pathExtension] lowercaseString] isEqualToString:@"hex"]) { | ||
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--toolbox-mode", @"--download", file]]; | ||
} else { | ||
[self printMessage:@"Only firmware files in .bin or .hex format can be flashed with wb32-dfu-updater_cli!" withType:MessageType_Error]; | ||
} | ||
} | ||
|
||
-(void)resetWithMCU:(NSString *)mcu { | ||
[self runProcess:@"wb32-dfu-updater_cli" withArgs:@[@"--reset"]]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters