Skip to content
Browse files

code update

  • Loading branch information...
1 parent b44363b commit 647944149505b5b60e19bbc438f1d2b7b55ef686 @gentijo committed
Showing with 6 additions and 105 deletions.
  1. +0 −3 .cproject
  2. +1 −1 .settings/de.innot.avreclipse.core.prefs
  3. +2 −1 src/main/iotest.c
  4. +3 −100 src/main/main.c
View
3 .cproject
@@ -57,9 +57,6 @@
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.1905928185" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/>
</toolChain>
</folderInfo>
- <fileInfo id="de.innot.avreclipse.configuration.app.debug.1932411829.1664667954" name="main.c" rcbsApplicability="disable" resourcePath="src/main/main.c" toolsToInvoke="de.innot.avreclipse.tool.compiler.winavr.app.debug.1749749762.111648418">
- <tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1749749762.111648418" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug.1749749762"/>
- </fileInfo>
<sourceEntries>
<entry excluding="src/main/sensors_rc.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
View
2 .settings/de.innot.avreclipse.core.prefs
@@ -1,4 +1,4 @@
-#Sun Apr 29 19:00:11 PDT 2012
+#Sun May 06 00:13:24 PDT 2012
avrtarget/ClockFrequency=18432000
avrtarget/ExtRAMSize=0
avrtarget/ExtendedRAM=false
View
3 src/main/iotest.c
@@ -30,7 +30,7 @@ int wifi_test()
int connid;
for (int x=0; x< 3; x++)
{
- connid = gs_open_connection("at+NCTCP=192.168.1.250,8125");
+ connid = gs_open_connection("at+NCTCP=192.168.1.238,8125");
if (connid >= 0) break;
}
@@ -41,6 +41,7 @@ int wifi_test()
}
+
uartLoopBack();
return 0;
View
103 src/main/main.c
@@ -1,35 +1,15 @@
-#include <avr/io.h>
#include <stdio.h>
#include <util/delay.h>
-#include "../lib/Util.h"
-#include "../lib/Comm.h"
-#include "../avr/driver/i2c.h"
-#include "../device/HMC5843/HMC5843.h"
-#include "../device/bma180/bma180_i2c.h"
-#include "../avr/driver/uart2.h"
-#include "../avr/rprintf.h"
#include "sensors.h"
+#include "ioinit.h"
#include "iotest.h"
#include "../lib/timer128.h"
-void ioinit (void);
-
-static int uart0_putchar (char c, FILE *stream);
-static int uart0_getchar (FILE *stream);
-static int uart1_putchar (char c, FILE *stream);
-static int uart1_getchar (FILE *stream);
-
-FILE Serial0 = FDEV_SETUP_STREAM (uart0_putchar, uart0_getchar, _FDEV_SETUP_RW);
-FILE Serial1 = FDEV_SETUP_STREAM (uart1_putchar, uart1_getchar, _FDEV_SETUP_RW);
-
int main()
{
ioinit();
- uart0Init();
- uart1Init();
- stdout = &Serial0;
initSensorTimers();
@@ -42,6 +22,8 @@ int main()
printf("\nInit Complete\n");
+// wifi_test();
+
initSensorModule();
sensorMainLoop();
@@ -49,82 +31,3 @@ int main()
}
-
-void ioinit (void)
-{
-
- // uartInit();
-
- CLKPR = 0x80;
- CLKPR = 0x81;
-
- // Set up Data Direction Register
- // 1 = output, 0 = input
- DDRA = 0;
- DDRB = 0; //PORTB4, B5 output
- DDRD = 0; //PORTD (RX on PD0), PD2 is status output
-
- // TWI is PC0 & PC1
- DDRC = 0; // All Inputs
- PORTC = 0b00000011; //pullups on the I2C bus
-
- // PRTWI: Power Reduction TWI
- // PRTIM2: Power Reduction Timer/Counter2
- // PRTIM0: Power Reduction Timer/Counter0
- // PRUSART1: Power Reduction USART1
- // PRTIM1: Power Reduction Timer/Counter1
- // PRSPI: Power Reduction Serial Peripheral Interface
- // PRUSART0: Power Reduction USART0
- // PRADC: Power Reduction ADC
- // PRR = (1<<PRTIM2) | (1<<PRTIM0) | (1<<PRUSART1) | (1<<PRTIM1) | (1<<PRSPI) | (1<<PRADC);
-
- i2cInit();
-
- _delay_ms(100);
-
-}
-
-static int uart0_putchar (char c, FILE *stream)
-{
- if (c == '\n')
- uart0_putchar('\r', stream);
-
- uartAddToTxBuffer(0, c);
- uartSendTxBuffer(0);
-
- return 0;
-}
-
-static int uart0_getchar (FILE *stream)
-{
- u08 data;
-
- if (uartReceiveByte(0, &data))
- {
- return (int) data;
- }
-
- return EOF;
-}
-
-static int uart1_putchar (char c, FILE *stream)
-{
- if (c == '\n')
- uart1_putchar('\r', stream);
-
- uartAddToTxBuffer(1, c);
-
- uartSendTxBuffer(1);
- return 0;
-}
-
-static int uart1_getchar (FILE *stream)
-{
- u08 data;
-
- if (uartReceiveByte(1, &data))
- {
- return (int) data;
- }
- return EOF;
-}

0 comments on commit 6479441

Please sign in to comment.
Something went wrong with that request. Please try again.