Commit 5e1a4a16 authored by Leandro Lanzieri's avatar Leandro Lanzieri

Borro rasp pi vnc. Agrego copyright a prueba uart

parent dbd15924
......@@ -8,3 +8,7 @@ Debug/
Release/
.project
.cproject
# Otras reglas
Rasp Pi VNC
copyrightLog.txt/
<?xml version="1.0"?>
<XLaunch xmlns="http://www.straightrunning.com/XmingNotes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.straightrunning.com/XmingNotes XLaunch.xsd" WindowMode="Windowed" ClientMode="StartProgram" Program="startlxde" ClientStart="PuTTY" PasswordStart="true" RemoteHost="192.168.137.2" RemoteUser="pi" Display="1" Clipboard="true"/>
Old copyright not at start of file, new copyright replaces old in same location
/prueba-uart/configuracion.h
/prueba-uart/hardware.h
/prueba-uart/main.c
/prueba-uart/mcu.c
/prueba-uart/mcu.h
Failed to create internal source file for proccessing the file
/prueba-uart/.cproject
/prueba-uart/.project
/prueba-uart/.settings/de.innot.avreclipse.core.prefs
/prueba-uart/Release/main.d
/prueba-uart/Release/main.o
/prueba-uart/Release/mcu.d
/prueba-uart/Release/mcu.o
/prueba-uart/Release/objects.mk
/prueba-uart/Release/prueba-uart.eep
/prueba-uart/Release/prueba-uart.elf
/prueba-uart/Release/prueba-uart.hex
/prueba-uart/Release/prueba-uart.lss
/prueba-uart/Release/prueba-uart.map
/prueba-uart/Release/sources.mk
/prueba-uart/Release/subdir.mk
File has no extension. File UNCHANGED.
/prueba-uart/Release/makefile
/*
/* Proyecto Domotica | Prueba UART
* configuracion.h
*
* Created on: 1 de dic. de 2015
* Author: Leandro
* Importa las librerias propias de AVR. Define constantes de configuracion del funcionamiento
* general del programa, como la frecuencia del cristal utilizado y el baud rate para la
* comunicacion serial.
*/
/*******************************************************************************
* Proyecto Domotica
* Copyright (c) 2015 Martin Enriquez, Leandro Lanzieri Rodriguez
*
* This file is part of Proyecto Domotica.
*
* Proyecto Domotica 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.
*
* Proyecto Domotica 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 Proyecto Domotica. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef CONFIGURACION_H_
#define CONFIGURACION_H_
......@@ -11,12 +31,13 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdio.h>
#include <string.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#define FOSC 8000000 // Frecuencia de oscilacion
#define FOSC 8000000 // 8MHz Frecuencia de oscilacion
#define BAUD 9600 // Baud Rate
#define UBRRREG FOSC/16/BAUD-1 // El reultado debe ser el numero del registro UBRR para tener BAUD
#define UBRRREG ((FOSC/16)/BAUD)-1 // El reultado debe ser el numero del registro UBRR para tener BAUD
#endif /* CONFIGURACION_H_ */
/*
* Proyecto Domotica | Prueba UART
* hardware.h
* Contiene las definiciones de pines, puertos y registros que son propios de
* cada placa. Tambien una escructura de manejo de a bits.
*
* Created on: 1 de dic. de 2015
* Author: Leandro
*/
/*******************************************************************************
* Proyecto Domotica
* Copyright (c) 2015 Martin Enriquez, Leandro Lanzieri Rodriguez
*
* This file is part of Proyecto Domotica.
*
* Proyecto Domotica 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.
*
* Proyecto Domotica 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 Proyecto Domotica. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef HARDWARE_H_
#define HARDWARE_H_
......
/* Proyecto Domotica | Prueba UART
* main.c
* Archivo principal del proyecto. Inicializa el microcontrolador. Sirve como ejemplo de uso
* y para realizar varias pruebas sobre el modulo UART.
*/
/*******************************************************************************
* Proyecto Domotica
* Copyright (c) 2015 Martin Enriquez, Leandro Lanzieri Rodriguez
*
* This file is part of Proyecto Domotica.
*
* Proyecto Domotica 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.
*
* Proyecto Domotica 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 Proyecto Domotica. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
/*
* main.c
*
......@@ -20,11 +44,20 @@
int main (void) {
inicializarTodo();
ledBlink();
unsigned char string[] = "Probando";
while(1){
/*
// Si se recibe el caracter A por UART, se hace toggle al led
if(recibirUART() == 'A')
if(recibirByteUART() == 45)
LED ^= 1;
*/
// Envia cada medio segundo el byte con el valor 45 y hace toggle al led
transmitirByteUART(45);
LED ^= 1;
_delay_ms(500);
}
return 0;
}
/*
* Proyecto Domotica | Prueba UART
* mcu.c
*
* Created on: 1 de dic. de 2015
* Author: Leandro
* Contiene las funciones generales que se usan en el programa. En este caso de incializacion,
* uso de UART y encendido del led onboard.
*/
/*******************************************************************************
* Proyecto Domotica
* Copyright (c) 2015 Martin Enriquez, Leandro Lanzieri Rodriguez
*
* This file is part of Proyecto Domotica.
*
* Proyecto Domotica 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.
*
* Proyecto Domotica 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 Proyecto Domotica. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "mcu.h"
#include "hardware.h"
#include "configuracion.h"
......@@ -16,6 +36,7 @@ void inicializarTodo() {
void inicializarGPIO(void) {
LED_DDR |= (1 << LED_PIN); // Led como salida
LED = 1; // Se enciende con 0
}
void inicializarUART() {
......@@ -31,9 +52,17 @@ void inicializarUART() {
UCSRC = (1 << URSEL) | (1 << USBS) | (3 << UCSZ0);
}
/* Misc */
void ledBlink(void) {
char i;
for(i=0; i<6; i++) {
LED ^= 1; //Toggle Led
_delay_ms(155);
}
}
/* Funciones UART */
void transmitirUART(unsigned char dato) {
void transmitirByteUART(unsigned char dato) {
/* Espero a que este libre el buffer */
while(! (UCSRA & (1<<UDRE)));
......@@ -41,7 +70,7 @@ void transmitirUART(unsigned char dato) {
UDR = dato;
}
unsigned char recibirUART(void) {
unsigned char recibirByteUART(void) {
/* Espero a que este recibido el dato */
while(! (UCSRA & (1<<RXC)));
......@@ -53,3 +82,9 @@ unsigned char disponibleUART(void) {
return (! (UCSRA & (1<<RXC)));
}
void transmitirUART(unsigned char * datos) {
int i;
for(i=0; i<strlen(datos); i++) {
transmitirByteUART(datos[i]);
}
}
/*
* Proyecto Domotica | Prueba UART
* mcu.h
*
* Created on: 1 de dic. de 2015
* Author: Leandro
* Contiene las declaraciones de las funciones de mcu.c
*/
/*******************************************************************************
* Proyecto Domotica
* Copyright (c) 2015 Martin Enriquez, Leandro Lanzieri Rodriguez
*
* This file is part of Proyecto Domotica.
*
* Proyecto Domotica 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.
*
* Proyecto Domotica 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 Proyecto Domotica. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef MCU_H_
#define MCU_H_
......@@ -13,9 +32,13 @@ void inicializarTodo(void);
void inicializarUART(void);
void inicializarGPIO(void);
/* Misc */
void ledBlink(void);
/* Funciones de UART */
void transmitirUART(unsigned char);
unsigned char recibirUART(void);
void transmitirByteUART(unsigned char);
unsigned char recibirByteUART(void);
unsigned char disponibleUART(void);
void transmitirUART(unsigned char *);
#endif /* MCU_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment