2015-04-07 17:02:27 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
|
|
# Author: Costin Constantin <costin.c.constantin@intel.com>
|
|
|
|
|
# Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
#
|
2019-05-09 09:47:11 -07:00
|
|
|
# SPDX-License-Identifier: MIT
|
2015-04-07 17:02:27 +03:00
|
|
|
|
2015-08-11 11:24:22 +01:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
2015-04-07 17:02:27 +03:00
|
|
|
import mraa as m
|
2015-08-11 11:24:22 +01:00
|
|
|
import unittest as u
|
2015-04-07 17:02:27 +03:00
|
|
|
|
2016-03-11 11:35:57 +00:00
|
|
|
@u.skipIf(m.getPlatformName() == "Unknown platform", "Not valid platform loaded")
|
2015-04-07 17:02:27 +03:00
|
|
|
class PlatformChecks(u.TestCase):
|
2017-03-23 16:01:58 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@u.skipUnless(m.getPlatformName() == "Intel Edison", "Only for edison Board")
|
|
|
|
|
class PlatformChecksEdison(u.TestCase):
|
2015-04-07 17:02:27 +03:00
|
|
|
def test_mraa_check_platform_no_of_pins(self):
|
|
|
|
|
pinCount = m.getPinCount()
|
|
|
|
|
self.assertEqual(pinCount, 20, "Wrong number. of pins. Check platform ...")
|
|
|
|
|
|
|
|
|
|
def test_mraa_check_platform_ADC_max_resolution(self):
|
|
|
|
|
self.p_ADC_mres = m.adcRawBits()
|
2015-08-11 11:24:22 +01:00
|
|
|
print("Platform ADC max. resolution is: " + str(self.p_ADC_mres) + " bits")
|
2015-04-07 17:02:27 +03:00
|
|
|
self.assertEqual(self.p_ADC_mres, 12, "Wrong ADC max. resolution. Check platform ...")
|
|
|
|
|
|
|
|
|
|
def test_mraa_check_platform_ADC_resolution(self):
|
|
|
|
|
self.p_ADC_res = m.adcSupportedBits()
|
2015-08-11 11:24:22 +01:00
|
|
|
print("Platform ADC resolution is: " + str(self.p_ADC_res) + " bits")
|
2017-03-23 16:01:58 +00:00
|
|
|
self.assertEqual(self.p_ADC_res, 10, "Wrong ADC supported resolution. Check platform ...")
|
2015-04-07 17:02:27 +03:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
u.main()
|