BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Committer:
gustavatmel
Date:
Tue May 01 15:47:08 2018 +0000
Revision:
1:9c5af431a1f1
sdf

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gustavatmel 1:9c5af431a1f1 1 /*******************************************************************************
gustavatmel 1:9c5af431a1f1 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
gustavatmel 1:9c5af431a1f1 3 *
gustavatmel 1:9c5af431a1f1 4 * Permission is hereby granted, free of charge, to any person obtaining a
gustavatmel 1:9c5af431a1f1 5 * copy of this software and associated documentation files (the "Software"),
gustavatmel 1:9c5af431a1f1 6 * to deal in the Software without restriction, including without limitation
gustavatmel 1:9c5af431a1f1 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
gustavatmel 1:9c5af431a1f1 8 * and/or sell copies of the Software, and to permit persons to whom the
gustavatmel 1:9c5af431a1f1 9 * Software is furnished to do so, subject to the following conditions:
gustavatmel 1:9c5af431a1f1 10 *
gustavatmel 1:9c5af431a1f1 11 * The above copyright notice and this permission notice shall be included
gustavatmel 1:9c5af431a1f1 12 * in all copies or substantial portions of the Software.
gustavatmel 1:9c5af431a1f1 13 *
gustavatmel 1:9c5af431a1f1 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
gustavatmel 1:9c5af431a1f1 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
gustavatmel 1:9c5af431a1f1 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
gustavatmel 1:9c5af431a1f1 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
gustavatmel 1:9c5af431a1f1 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
gustavatmel 1:9c5af431a1f1 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
gustavatmel 1:9c5af431a1f1 20 * OTHER DEALINGS IN THE SOFTWARE.
gustavatmel 1:9c5af431a1f1 21 *
gustavatmel 1:9c5af431a1f1 22 * Except as contained in this notice, the name of Maxim Integrated
gustavatmel 1:9c5af431a1f1 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
gustavatmel 1:9c5af431a1f1 24 * Products, Inc. Branding Policy.
gustavatmel 1:9c5af431a1f1 25 *
gustavatmel 1:9c5af431a1f1 26 * The mere transfer of this software does not imply any licenses
gustavatmel 1:9c5af431a1f1 27 * of trade secrets, proprietary technology, copyrights, patents,
gustavatmel 1:9c5af431a1f1 28 * trademarks, maskwork rights, or any other form of intellectual
gustavatmel 1:9c5af431a1f1 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
gustavatmel 1:9c5af431a1f1 30 * ownership rights.
gustavatmel 1:9c5af431a1f1 31 *
gustavatmel 1:9c5af431a1f1 32 * $Date: 2016-04-27 15:26:08 -0500 (Wed, 27 Apr 2016) $
gustavatmel 1:9c5af431a1f1 33 * $Revision: 22543 $
gustavatmel 1:9c5af431a1f1 34 *
gustavatmel 1:9c5af431a1f1 35 ******************************************************************************/
gustavatmel 1:9c5af431a1f1 36
gustavatmel 1:9c5af431a1f1 37 #include <stddef.h>
gustavatmel 1:9c5af431a1f1 38 #include "mxc_config.h"
gustavatmel 1:9c5af431a1f1 39 #include "ioman.h"
gustavatmel 1:9c5af431a1f1 40
gustavatmel 1:9c5af431a1f1 41 /******************************************************************************/
gustavatmel 1:9c5af431a1f1 42 int IOMAN_Config(const ioman_cfg_t *cfg)
gustavatmel 1:9c5af431a1f1 43 {
gustavatmel 1:9c5af431a1f1 44 if(cfg == NULL) {
gustavatmel 1:9c5af431a1f1 45 return E_NULL_PTR;
gustavatmel 1:9c5af431a1f1 46 }
gustavatmel 1:9c5af431a1f1 47
gustavatmel 1:9c5af431a1f1 48 if (*cfg->ack_reg != cfg->req_val.value) {
gustavatmel 1:9c5af431a1f1 49 /* Request pin mapping */
gustavatmel 1:9c5af431a1f1 50 *cfg->req_reg = cfg->req_val.value;
gustavatmel 1:9c5af431a1f1 51
gustavatmel 1:9c5af431a1f1 52 /* Check for acknowledgment */
gustavatmel 1:9c5af431a1f1 53 if (*cfg->ack_reg != cfg->req_val.value) {
gustavatmel 1:9c5af431a1f1 54 return E_BUSY;
gustavatmel 1:9c5af431a1f1 55 }
gustavatmel 1:9c5af431a1f1 56 }
gustavatmel 1:9c5af431a1f1 57
gustavatmel 1:9c5af431a1f1 58 return E_NO_ERROR;
gustavatmel 1:9c5af431a1f1 59 }