Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
tools/compliance/ioper_base.py@3:1198227e6421, 2016-12-16 (annotated)
- Committer:
- switches
- Date:
- Fri Dec 16 16:27:57 2016 +0000
- Revision:
- 3:1198227e6421
- Parent:
- 0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:5c4d7b2438d3 | 1 | """ |
switches | 0:5c4d7b2438d3 | 2 | mbed SDK |
switches | 0:5c4d7b2438d3 | 3 | Copyright (c) 2011-2015 ARM Limited |
switches | 0:5c4d7b2438d3 | 4 | |
switches | 0:5c4d7b2438d3 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
switches | 0:5c4d7b2438d3 | 6 | you may not use this file except in compliance with the License. |
switches | 0:5c4d7b2438d3 | 7 | You may obtain a copy of the License at |
switches | 0:5c4d7b2438d3 | 8 | |
switches | 0:5c4d7b2438d3 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
switches | 0:5c4d7b2438d3 | 10 | |
switches | 0:5c4d7b2438d3 | 11 | Unless required by applicable law or agreed to in writing, software |
switches | 0:5c4d7b2438d3 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
switches | 0:5c4d7b2438d3 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
switches | 0:5c4d7b2438d3 | 14 | See the License for the specific language governing permissions and |
switches | 0:5c4d7b2438d3 | 15 | limitations under the License. |
switches | 0:5c4d7b2438d3 | 16 | |
switches | 0:5c4d7b2438d3 | 17 | Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com> |
switches | 0:5c4d7b2438d3 | 18 | |
switches | 0:5c4d7b2438d3 | 19 | """ |
switches | 0:5c4d7b2438d3 | 20 | |
switches | 0:5c4d7b2438d3 | 21 | import sys |
switches | 0:5c4d7b2438d3 | 22 | |
switches | 0:5c4d7b2438d3 | 23 | try: |
switches | 0:5c4d7b2438d3 | 24 | from colorama import Fore |
switches | 0:5c4d7b2438d3 | 25 | except: |
switches | 0:5c4d7b2438d3 | 26 | pass |
switches | 0:5c4d7b2438d3 | 27 | |
switches | 0:5c4d7b2438d3 | 28 | COLORAMA = 'colorama' in sys.modules |
switches | 0:5c4d7b2438d3 | 29 | |
switches | 0:5c4d7b2438d3 | 30 | |
switches | 0:5c4d7b2438d3 | 31 | class IOperTestCaseBase(): |
switches | 0:5c4d7b2438d3 | 32 | """ Interoperability test case base class |
switches | 0:5c4d7b2438d3 | 33 | @return list of tuple (severity, Description) |
switches | 0:5c4d7b2438d3 | 34 | Example: (result.append((IOperTestSeverity.INFO, "")) |
switches | 0:5c4d7b2438d3 | 35 | """ |
switches | 0:5c4d7b2438d3 | 36 | |
switches | 0:5c4d7b2438d3 | 37 | def __init__(self, scope=None): |
switches | 0:5c4d7b2438d3 | 38 | self.PASS = 'PASS' |
switches | 0:5c4d7b2438d3 | 39 | self.INFO = 'INFO' |
switches | 0:5c4d7b2438d3 | 40 | self.ERROR = 'ERROR' |
switches | 0:5c4d7b2438d3 | 41 | self.WARN = 'WARN' |
switches | 0:5c4d7b2438d3 | 42 | |
switches | 0:5c4d7b2438d3 | 43 | self.scope = scope # Default test scope (basic, pedantic, mbed-enabled etc...) |
switches | 0:5c4d7b2438d3 | 44 | |
switches | 0:5c4d7b2438d3 | 45 | def test(self, param=None): |
switches | 0:5c4d7b2438d3 | 46 | result = [] |
switches | 0:5c4d7b2438d3 | 47 | return result |
switches | 0:5c4d7b2438d3 | 48 | |
switches | 0:5c4d7b2438d3 | 49 | def RED(self, text): |
switches | 0:5c4d7b2438d3 | 50 | return self.color_text(text, color=Fore.RED, delim=Fore.RESET) if COLORAMA else text |
switches | 0:5c4d7b2438d3 | 51 | |
switches | 0:5c4d7b2438d3 | 52 | def GREEN(self, text): |
switches | 0:5c4d7b2438d3 | 53 | return self.color_text(text, color=Fore.GREEN, delim=Fore.RESET) if COLORAMA else text |
switches | 0:5c4d7b2438d3 | 54 | |
switches | 0:5c4d7b2438d3 | 55 | def YELLOW(self, text): |
switches | 0:5c4d7b2438d3 | 56 | return self.color_text(text, color=Fore.YELLOW, delim=Fore.RESET) if COLORAMA else text |
switches | 0:5c4d7b2438d3 | 57 | |
switches | 0:5c4d7b2438d3 | 58 | def color_text(self, text, color='', delim=''): |
switches | 0:5c4d7b2438d3 | 59 | return color + text + color + delim |
switches | 0:5c4d7b2438d3 | 60 | |
switches | 0:5c4d7b2438d3 | 61 | def COLOR(self, severity, text): |
switches | 0:5c4d7b2438d3 | 62 | colors = { |
switches | 0:5c4d7b2438d3 | 63 | self.PASS : self.GREEN, |
switches | 0:5c4d7b2438d3 | 64 | self.ERROR : self.RED, |
switches | 0:5c4d7b2438d3 | 65 | self.WARN : self.YELLOW |
switches | 0:5c4d7b2438d3 | 66 | } |
switches | 0:5c4d7b2438d3 | 67 | if severity in colors: |
switches | 0:5c4d7b2438d3 | 68 | return colors[severity](text) |
switches | 0:5c4d7b2438d3 | 69 | return text |