X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fconrad-digi-35-cpu%2Fprotocol.c;h=caf1e85db17962d376a1777f9e012cbd6157eb81;hb=HEAD;hp=0937bf6d9081cb374197bc5504ea2771a7d2c9ee;hpb=c6a2843a58a398d0095291c2a1f397b419d164f4;p=libsigrok.git diff --git a/hardware/conrad-digi-35-cpu/protocol.c b/hardware/conrad-digi-35-cpu/protocol.c deleted file mode 100644 index 0937bf6d..00000000 --- a/hardware/conrad-digi-35-cpu/protocol.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of the libsigrok project. - * - * Copyright (C) 2014 Matthias Heidbrink - * - * 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 . - */ - -/** @file - * Conrad DIGI 35 CPU power supply driver - * @internal - */ - -#include "protocol.h" - -#include -#include - -/** Send command with parameter. - * - * @param[in] cmd Command - * @param[in] param Parameter (0..999, depending on command). - * - * @retval SR_OK Success - * @retval SR_ERR_ARG Invalid argument. - * @retval SR_ERR Error. - */ -SR_PRIV int send_msg1(const struct sr_dev_inst *sdi, char cmd, int param) -{ - struct sr_serial_dev_inst *serial; - char buf[5]; - - if (!sdi || !(serial = sdi->conn)) - return SR_ERR_ARG; - - snprintf(buf, sizeof(buf), "%c%03d", cmd, param); - buf[4] = '\r'; - - sr_spew("send_msg1(): %c%c%c%c\\r", buf[0], buf[1], buf[2], buf[3]); - - if (serial_write(serial, buf, sizeof(buf)) == -1) { - sr_err("Write error for cmd=%c: %d %s", cmd, errno, strerror(errno)); - return SR_ERR; - } - g_usleep(50000); /* Wait 50 ms to ensure that the device does not swallow following commands. */ - - return SR_OK; -}