Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
module_reset_silabs.py
00001 """ 00002 mbed SDK 00003 Copyright (c) 2011-2013 ARM Limited 00004 00005 Licensed under the Apache License, Version 2.0 (the "License"); 00006 you may not use this file except in compliance with the License. 00007 You may obtain a copy of the License at 00008 00009 http://www.apache.org/licenses/LICENSE-2.0 00010 00011 Unless required by applicable law or agreed to in writing, software 00012 distributed under the License is distributed on an "AS IS" BASIS, 00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 See the License for the specific language governing permissions and 00015 limitations under the License. 00016 """ 00017 00018 from host_test_plugins import HostTestPluginBase 00019 00020 00021 class HostTestPluginResetMethod_SiLabs(HostTestPluginBase): 00022 00023 # Plugin interface 00024 name = 'HostTestPluginResetMethod_SiLabs' 00025 type = 'ResetMethod' 00026 stable = True 00027 capabilities = ['eACommander', 'eACommander-usb'] 00028 required_parameters = ['disk'] 00029 00030 def setup(self, *args, **kwargs): 00031 """ Configure plugin, this function should be called before plugin execute() method is used. 00032 """ 00033 # Note you need to have eACommander.exe on your system path! 00034 self.EACOMMANDER_CMD = 'eACommander.exe' 00035 return True 00036 00037 def execute(self, capabilitity, *args, **kwargs): 00038 """ Executes capability by name. 00039 Each capability may directly just call some command line 00040 program or execute building pythonic function 00041 """ 00042 result = False 00043 if self.check_parameters(capabilitity, *args, **kwargs) is True: 00044 disk = kwargs['disk'].rstrip('/\\') 00045 00046 if capabilitity == 'eACommander': 00047 # For this copy method 'disk' will be 'serialno' for eACommander command line parameters 00048 # Note: Commands are executed in the order they are specified on the command line 00049 cmd = [self.EACOMMANDER_CMD, 00050 '--serialno', disk, 00051 '--resettype', '2', '--reset',] 00052 result = self.run_command(cmd) 00053 elif capabilitity == 'eACommander-usb': 00054 # For this copy method 'disk' will be 'usb address' for eACommander command line parameters 00055 # Note: Commands are executed in the order they are specified on the command line 00056 cmd = [self.EACOMMANDER_CMD, 00057 '--usb', disk, 00058 '--resettype', '2', '--reset',] 00059 result = self.run_command(cmd) 00060 return result 00061 00062 00063 def load_plugin (): 00064 """ Returns plugin available in this module 00065 """ 00066 return HostTestPluginResetMethod_SiLabs()
Generated on Sun Jul 17 2022 08:25:28 by 1.7.2