From: nathael Pajani Date: Thu, 19 Nov 2015 14:09:02 +0000 (+0100) Subject: Move the host app for microphone to the right app directory ... X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=6733e4b7e7be9664d3b6aba29c1ccc5d382b1d0f;p=soft%2Flpc122x%2Fexamples Move the host app for microphone to the right app directory ... --- diff --git a/adc/adc_rx/Makefile b/adc/adc_rx/Makefile deleted file mode 100644 index 42a7b1d..0000000 --- a/adc/adc_rx/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -#CROSS_COMPILE ?= arm-linux-gnueabihf- -CC = $(CROSS_COMPILE)gcc - -CFLAGS = -Wall -O2 -Wextra - -EXEC = adc_rx - -all: $(EXEC) - - -OBJDIR = objs -SRC = $(shell find . -name \*.c) -OBJS = ${SRC:%.c=${OBJDIR}/%.o} -INCLUDES = includes/ - -${OBJDIR}/%.o: %.c - @mkdir -p $(dir $@) - @echo "-- compiling" $< - @$(CC) -MMD -MP -MF ${OBJDIR}/$*.d $(CFLAGS) $< -c -o $@ -I$(INCLUDES) - -$(EXEC): $(OBJS) - @echo "Linking $@ ..." - @$(CC) $(LDFLAGS) -o $@ $(OBJS) - @echo Done. - - -clean: - find ${OBJDIR} -name "*.o" -exec rm {} \; - find ${OBJDIR} -name "*.d" -exec rm {} \; - -mrproper: clean - rm -f $(EXEC) diff --git a/adc/adc_rx/main.c b/adc/adc_rx/main.c deleted file mode 100644 index 43a3c2c..0000000 --- a/adc/adc_rx/main.c +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** - * ADC Rx test - * main.c - * - * Copyright 2013-2014 Nathael Pajani - * - * - * 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 2 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -#define SERIAL_BAUD B1152000 - -int serial_setup(char* name) -{ - struct termios tio; - int fd = -1; - - /* Open serial port */ - fd = open(name, O_RDWR | O_NONBLOCK); - if (fd < 0) { - perror("Unable to open communication with companion chip"); - return -1; - } - /* Setup serial port */ - memset(&tio, 0, sizeof(tio)); - tio.c_cflag = CS8 | CREAD | CLOCAL; /* 8n1, see termios.h for more information */ - tio.c_cc[VMIN] = 1; - tio.c_cc[VTIME] = 5; - cfsetospeed(&tio, SERIAL_BAUD); - cfsetispeed(&tio, SERIAL_BAUD); - tcsetattr(fd, TCSANOW, &tio); - - return fd; -} - - - -int main(int argc, char* argv[]) -{ - int tty_fd = -1; - int out_fd = 1; - - /* Need Serial port and destination file as parameter */ - if (argc != 3) { - printf("Need tty device number and destination file\n"); - printf("Please start with %s /dev/ttyUSB0 raw_audio (for example)\n", argv[0]); - return -1; - } - - /* Open tty */ - tty_fd = serial_setup(argv[1]); - if (tty_fd < 0) { - printf("Unable to open specified serial port %s\n", argv[1]); - return -4; - } - - /* And never stop getting data ! */ - while (1) { - char buf[BUF_SIZE]; - int ret = 0, len = 0; - - memset(buf, 0, BUF_SIZE); - len = read(tty_fd, buf, BUF_SIZE); - - } /* End of infinite loop */ - - close(tty_fd); - close(out_fd); - return 0; -} - -