/*
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
Copyright (C) 2016..2019 Thomas Schöpping et al.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#if ((AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_TPS20xxB) && (AMIROLLD_CFG_TPS20xxB == 1)) || defined(__DOXYGEN__)
#include
/******************************************************************************/
/* LOCAL DEFINITIONS */
/******************************************************************************/
/******************************************************************************/
/* EXPORTED VARIABLES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL TYPES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL VARIABLES */
/******************************************************************************/
/******************************************************************************/
/* LOCAL FUNCTIONS */
/******************************************************************************/
/******************************************************************************/
/* EXPORTED FUNCTIONS */
/******************************************************************************/
/**
* @brief TPS20xxB unit test function.
*
* @param[in] stream Stream for input/output.
* @param[in] ut Unit test object.
*
* @return Unit test result value.
*/
aos_utresult_t utAlldTps20xxbFunc(BaseSequentialStream* stream, aos_unittest_t* ut)
{
aosDbgCheck(ut->data != NULL);
// local variables
aos_utresult_t result = {0, 0};
uint32_t status = AOS_OK;
tps20xxb_lld_enable_t en;
tps20xxb_lld_overcurrent_t oc;
chprintf(stream, "write laser enable...\n");
status = tps20xxb_lld_set_enable((TPS20xxBDriver*)ut->data, TPS20xxB_LLD_ENABLE);
if (status == APAL_STATUS_SUCCESS) {
aosUtPassed(stream, &result);
} else {
aosUtFailed(stream, &result);
}
chprintf(stream, "read laser enable...\n");
status = tps20xxb_lld_read_enable((TPS20xxBDriver*)ut->data, &en);
if (status == APAL_STATUS_SUCCESS && en == TPS20xxB_LLD_ENABLE) {
aosUtPassed(stream, &result);
} else {
aosUtFailed(stream, &result);
}
chprintf(stream, "read laser oc...\n");
status = tps20xxb_lld_read_overcurrent((TPS20xxBDriver*)ut->data, &oc);
if (status == APAL_STATUS_SUCCESS && oc == TPS20xxB_LLD_NO_OVERCURRENT) {
aosUtPassed(stream, &result);
} else {
aosUtFailed(stream, &result);
}
chprintf(stream, "disable laser...\n");
status = tps20xxb_lld_set_enable((TPS20xxBDriver*)ut->data, TPS20xxB_LLD_DISABLE);
if (status == APAL_STATUS_SUCCESS) {
aosUtPassed(stream, &result);
} else {
aosUtFailed(stream, &result);
}
aosUtInfoMsg(stream,"driver object memory footprint: %u bytes\n", sizeof(TPS20xxBDriver));
return result;
}
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_TPS20xxB) && (AMIROLLD_CFG_TPS20xxB == 1) */