Browse Source

Add delay after setting the pull ups for pin programming

Without it the bits are sometimes read incorrectly.
Bernd Gottschlag 5 years ago
parent
commit
fe5cd5fc86
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      weather-sensor/firmware/pin_programming.c

+ 4
- 1
weather-sensor/firmware/pin_programming.c View File

1
 #include <avr/io.h>
1
 #include <avr/io.h>
2
 #include <stdint.h>
2
 #include <stdint.h>
3
+#include <util/delay.h>
3
 
4
 
4
 #include "pin_programming.h"
5
 #include "pin_programming.h"
5
 
6
 
30
 	PIN_PROG_2_DDR &= ~(1 << PIN_PROG_2_PIN);
31
 	PIN_PROG_2_DDR &= ~(1 << PIN_PROG_2_PIN);
31
 	PIN_PROG_3_DDR &= ~(1 << PIN_PROG_3_PIN);
32
 	PIN_PROG_3_DDR &= ~(1 << PIN_PROG_3_PIN);
32
 
33
 
33
-	/* Enable pull-ups */ // TODO: enable once the boards have been fixed!
34
+	/* Enable pull-ups */
34
 	PIN_PROG_1_PORT |= (1 << PIN_PROG_1_PIN);
35
 	PIN_PROG_1_PORT |= (1 << PIN_PROG_1_PIN);
35
 	PIN_PROG_2_PORT |= (1 << PIN_PROG_2_PIN);
36
 	PIN_PROG_2_PORT |= (1 << PIN_PROG_2_PIN);
36
 	PIN_PROG_3_PORT |= (1 << PIN_PROG_3_PIN);
37
 	PIN_PROG_3_PORT |= (1 << PIN_PROG_3_PIN);
38
+
39
+	_delay_us(20);
37
 }
40
 }
38
 
41
 
39
 uint8_t Get_Own_Identifier(void)
42
 uint8_t Get_Own_Identifier(void)

Loading…
Cancel
Save