Browse Source

I2C not work?

Vladimir N. Shilov 3 years ago
parent
commit
00ba3a5d5f
4 changed files with 36 additions and 38 deletions
  1. 23 23
      Dryer.layout
  2. 10 12
      Makefile
  3. BIN
      hw/drayer.dch
  4. 3 3
      src/main.c

+ 23 - 23
Dryer.layout

@@ -2,19 +2,14 @@
 <CodeBlocks_layout_file>
 	<FileVersion major="1" minor="0" />
 	<ActiveTarget name="Debug" />
-	<File name="src\main.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
-		<Cursor>
-			<Cursor1 position="135" topLine="21" />
-		</Cursor>
-	</File>
-	<File name="src\i2c.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="lib\rtos\rtos.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="318" topLine="0" />
+			<Cursor1 position="2098" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="inc\i2c.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="inc\sensor.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="54" topLine="0" />
+			<Cursor1 position="393" topLine="0" />
 		</Cursor>
 	</File>
 	<File name="lib\tinyavrlib\num2str.c" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -22,24 +17,24 @@
 			<Cursor1 position="2700" topLine="43" />
 		</Cursor>
 	</File>
-	<File name="inc\sensor.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="inc\i2c.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="393" topLine="0" />
+			<Cursor1 position="54" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="inc\main.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="src\i2c.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="38" topLine="0" />
+			<Cursor1 position="318" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="lib\rtos\rtos.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="lib\ssd1306xled\ssd1306xledtx.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="72" topLine="0" />
+			<Cursor1 position="1053" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="lib\ssd1306xled\ssd1306xledtx.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="inc\main.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1053" topLine="0" />
+			<Cursor1 position="38" topLine="0" />
 		</Cursor>
 	</File>
 	<File name="lib\ssd1306xled\ssd1306xledtx.c" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@@ -47,19 +42,24 @@
 			<Cursor1 position="2433" topLine="14" />
 		</Cursor>
 	</File>
-	<File name="src\sensor.c" open="1" top="1" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="lib\rtos\rtos.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="1691" topLine="70" />
+			<Cursor1 position="72" topLine="0" />
 		</Cursor>
 	</File>
-	<File name="lib\rtos\rtos.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="lib\ssd1306xled\ssd1306xled.c" open="1" top="1" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="2098" topLine="0" />
+			<Cursor1 position="5489" topLine="113" />
+		</Cursor>
+	</File>
+	<File name="src\main.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+		<Cursor>
+			<Cursor1 position="421" topLine="8" />
 		</Cursor>
 	</File>
-	<File name="lib\ssd1306xled\ssd1306xled.c" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
+	<File name="src\sensor.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 		<Cursor>
-			<Cursor1 position="4706" topLine="122" />
+			<Cursor1 position="1465" topLine="13" />
 		</Cursor>
 	</File>
 </CodeBlocks_layout_file>

+ 10 - 12
Makefile

@@ -436,7 +436,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
 
 
 # Default target.
-all: begin gccversion sizebefore build sizeafter end
+all: dirs begin gccversion sizebefore build sizeafter end
 
 # Change the build target to build a HEX file or a library.
 build: elf hex eep lss sym
@@ -650,17 +650,15 @@ clean_list :
 	@$(REMOVE) $(CPPSRC:.c=.i)
 	@$(REMOVEDIR) .dep
 
-
-# Create object files directory
-$(shell mkdir $(OBJDIR) 2>/dev/null)
-
-# Create bin files directory
-$(shell mkdir $(BINDIR) 2>/dev/null)
-
-# Create lib files directory
-$(shell mkdir $(LIBDIR)/rtos 2>/dev/null)
-$(shell mkdir $(LIBDIR)/ssd1306xled 2>/dev/null)
-$(shell mkdir $(LIBDIR)/tinyavrlib 2>/dev/null)
+dirs:
+	# Create object files directory
+	$(shell mkdir $(OBJDIR) 2>/dev/null)
+	# Create bin files directory
+	$(shell mkdir $(BINDIR) 2>/dev/null)
+	# Create lib files directory
+	$(shell mkdir $(LIBDIR)/rtos 2>/dev/null)
+	$(shell mkdir $(LIBDIR)/ssd1306xled 2>/dev/null)
+	$(shell mkdir $(LIBDIR)/tinyavrlib 2>/dev/null)
 
 # Include the dependency files.
 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

BIN
hw/drayer.dch


+ 3 - 3
src/main.c

@@ -19,11 +19,11 @@ static void board_Init(void);
 int main(void) {
   board_Init();
   RTOS_Init();
-  AHT10_Init();
-
+  //AHT10_Init();
   tdelay_ms(40);
   ssd1306_init();
 
+PORTB |= 0x20; // Led On
   ssd1306_clear();
   ssd1306_fill2(0x80, 0x00);
   tdelay_ms(500);
@@ -75,7 +75,7 @@ static void board_Init(void) {
   ACSR = ACD;
 
   /* I/O-Ports */
-  DDRB = 0x02; // PB2 - Triac control
+  DDRB = 0x22; // PB2 - Triac control, PB5 - Green LED
   DDRC = 0x30; // I2C output
   DDRD = 0x03; // D2..D7 input / UART output
   PORTB = 0x02; // close Triac