5.2.1 - Updated I2C files

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Committer:
group-onsemi
Date:
Wed Jan 25 20:34:15 2017 +0000
Revision:
0:098463de4c5d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-onsemi 0:098463de4c5d 1 #! /usr/bin/env python2
group-onsemi 0:098463de4c5d 2 """
group-onsemi 0:098463de4c5d 3 mbed SDK
group-onsemi 0:098463de4c5d 4 Copyright (c) 2011-2013 ARM Limited
group-onsemi 0:098463de4c5d 5
group-onsemi 0:098463de4c5d 6 Licensed under the Apache License, Version 2.0 (the "License");
group-onsemi 0:098463de4c5d 7 you may not use this file except in compliance with the License.
group-onsemi 0:098463de4c5d 8 You may obtain a copy of the License at
group-onsemi 0:098463de4c5d 9
group-onsemi 0:098463de4c5d 10 http://www.apache.org/licenses/LICENSE-2.0
group-onsemi 0:098463de4c5d 11
group-onsemi 0:098463de4c5d 12 Unless required by applicable law or agreed to in writing, software
group-onsemi 0:098463de4c5d 13 distributed under the License is distributed on an "AS IS" BASIS,
group-onsemi 0:098463de4c5d 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
group-onsemi 0:098463de4c5d 15 See the License for the specific language governing permissions and
group-onsemi 0:098463de4c5d 16 limitations under the License.
group-onsemi 0:098463de4c5d 17 """
group-onsemi 0:098463de4c5d 18 import sys
group-onsemi 0:098463de4c5d 19 import os
group-onsemi 0:098463de4c5d 20 import re
group-onsemi 0:098463de4c5d 21
group-onsemi 0:098463de4c5d 22 ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
group-onsemi 0:098463de4c5d 23 sys.path.insert(0, ROOT)
group-onsemi 0:098463de4c5d 24
group-onsemi 0:098463de4c5d 25 from tools.options import get_default_options_parser
group-onsemi 0:098463de4c5d 26
group-onsemi 0:098463de4c5d 27 # Check: Extra modules which are required by core test suite
group-onsemi 0:098463de4c5d 28 from tools.utils import check_required_modules
group-onsemi 0:098463de4c5d 29 check_required_modules(['prettytable'])
group-onsemi 0:098463de4c5d 30
group-onsemi 0:098463de4c5d 31 # Imports related to mbed build api
group-onsemi 0:098463de4c5d 32 from tools.build_api import mcu_toolchain_matrix
group-onsemi 0:098463de4c5d 33 from tools.test_api import get_autodetected_MUTS_list
group-onsemi 0:098463de4c5d 34 from argparse import ArgumentParser
group-onsemi 0:098463de4c5d 35
group-onsemi 0:098463de4c5d 36
group-onsemi 0:098463de4c5d 37 def main():
group-onsemi 0:098463de4c5d 38 """Entry Point"""
group-onsemi 0:098463de4c5d 39 try:
group-onsemi 0:098463de4c5d 40 # Parse Options
group-onsemi 0:098463de4c5d 41 parser = ArgumentParser()
group-onsemi 0:098463de4c5d 42
group-onsemi 0:098463de4c5d 43 parser.add_argument("-S", "--supported-toolchains",
group-onsemi 0:098463de4c5d 44 action="store_true",
group-onsemi 0:098463de4c5d 45 dest="supported_toolchains",
group-onsemi 0:098463de4c5d 46 default=False,
group-onsemi 0:098463de4c5d 47 help="Displays supported matrix of"
group-onsemi 0:098463de4c5d 48 " targets and toolchains")
group-onsemi 0:098463de4c5d 49
group-onsemi 0:098463de4c5d 50 parser.add_argument('-f', '--filter',
group-onsemi 0:098463de4c5d 51 dest='general_filter_regex',
group-onsemi 0:098463de4c5d 52 default=None,
group-onsemi 0:098463de4c5d 53 help='Filter targets')
group-onsemi 0:098463de4c5d 54
group-onsemi 0:098463de4c5d 55 parser.add_argument("-v", "--verbose",
group-onsemi 0:098463de4c5d 56 action="store_true",
group-onsemi 0:098463de4c5d 57 dest="verbose",
group-onsemi 0:098463de4c5d 58 default=False,
group-onsemi 0:098463de4c5d 59 help="Verbose diagnostic output")
group-onsemi 0:098463de4c5d 60
group-onsemi 0:098463de4c5d 61 options = parser.parse_args()
group-onsemi 0:098463de4c5d 62
group-onsemi 0:098463de4c5d 63 # Only prints matrix of supported toolchains
group-onsemi 0:098463de4c5d 64 if options.supported_toolchains:
group-onsemi 0:098463de4c5d 65 print mcu_toolchain_matrix(
group-onsemi 0:098463de4c5d 66 platform_filter=options.general_filter_regex)
group-onsemi 0:098463de4c5d 67 exit(0)
group-onsemi 0:098463de4c5d 68
group-onsemi 0:098463de4c5d 69 # If auto_detect attribute is present, we assume other auto-detection
group-onsemi 0:098463de4c5d 70 # parameters like 'toolchains_filter' are also set.
group-onsemi 0:098463de4c5d 71 muts = get_autodetected_MUTS_list()
group-onsemi 0:098463de4c5d 72
group-onsemi 0:098463de4c5d 73 mcu_filter = options.general_filter_regex or ".*"
group-onsemi 0:098463de4c5d 74
group-onsemi 0:098463de4c5d 75 count = 0
group-onsemi 0:098463de4c5d 76 for mut in muts.values():
group-onsemi 0:098463de4c5d 77 if re.match(mcu_filter, mut['mcu']):
group-onsemi 0:098463de4c5d 78 print ""
group-onsemi 0:098463de4c5d 79 print "[mbed] Detected %s, port %s, mounted %s" % \
group-onsemi 0:098463de4c5d 80 (mut['mcu'], mut['port'], mut['disk'])
group-onsemi 0:098463de4c5d 81 print "[mbed] Supported toolchains for %s" % mut['mcu']
group-onsemi 0:098463de4c5d 82 print mcu_toolchain_matrix(platform_filter=mut['mcu'])
group-onsemi 0:098463de4c5d 83 count += 1
group-onsemi 0:098463de4c5d 84
group-onsemi 0:098463de4c5d 85 if count == 0:
group-onsemi 0:098463de4c5d 86 print "[mbed] No mbed targets where detected on your system."
group-onsemi 0:098463de4c5d 87
group-onsemi 0:098463de4c5d 88 except KeyboardInterrupt:
group-onsemi 0:098463de4c5d 89 print "\n[CTRL+c] exit"
group-onsemi 0:098463de4c5d 90 except Exception as exc:
group-onsemi 0:098463de4c5d 91 import traceback
group-onsemi 0:098463de4c5d 92 traceback.print_exc(file=sys.stdout)
group-onsemi 0:098463de4c5d 93 print "[ERROR] %s" % str(exc)
group-onsemi 0:098463de4c5d 94 sys.exit(1)
group-onsemi 0:098463de4c5d 95
group-onsemi 0:098463de4c5d 96 if __name__ == '__main__':
group-onsemi 0:098463de4c5d 97 main()