File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
firmware/Serial 7-Segment Display/Serial_7_Segment_Display_Firmware Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 15
15
brightness, UART baud rate, i2c address or factory reset.
16
16
17
17
Note: To use the additional pins, PB6 and PB7, on the ATmega328 we have to add
18
- some maps to the pins_arduino.h file. This allows Arduino to identify PB6 and
18
+ some maps to the pins_arduino.h file. This allows Arduino to identify PB6 as
19
19
digital pin 22, and PB7 as digital pin 23. Because the Serial 7-Segment runs on
20
20
the ATmega328's internal oscillator, these two pins open up for our use.
21
21
@@ -35,7 +35,7 @@ SevSeg myDisplay; //Create an instance of the object
35
35
// OpenSegment uses PNP and NPN transistors to drive larger displays
36
36
#define S7S 1
37
37
#define OPENSEGMENT 2
38
- #define DISPLAY_TYPE S7S
38
+ #define DISPLAY_TYPE OPENSEGMENT
39
39
40
40
// Global variables
41
41
unsigned int analogValue6 = 0 ; // These are used in analog meter mode
Original file line number Diff line number Diff line change @@ -250,6 +250,31 @@ void setupMode()
250
250
deviceMode = MODE_DEFAULT;
251
251
EEPROM.write (MODE_ADDRESS, MODE_DEFAULT);
252
252
}
253
+
254
+ #if DISPLAY_TYPE == OPENSEGMENT
255
+ // See if any solder jumpers have been closed
256
+
257
+ // Arduino doesn't really support PB6 and PB7 and GPIOs (normally the 16MHz
258
+ // crystal is there) so let's do it the old school way
259
+ // digitalWrite(JUMPER_COUNTER, HIGH); //Enable internal pullup
260
+ // pinMode(JUMPER_METER, INPUT_PULLUP);
261
+
262
+ DDRB &= 0b00111111 ; // Set PB7 and PB6 to inputs
263
+ PORTB |= 0b11000000 ; // Enable external pull ups
264
+
265
+ Serial.println (" Jumper check:" );
266
+ if ( (PINB & 1 <<6 ) == 0 ) // If counter pin is low
267
+ {
268
+ deviceMode = MODE_COUNTER;
269
+ Serial.println (" PB6 jumper closed" );
270
+ }
271
+ else if ( (PINB & 1 <<7 ) == 0 ) // digitalRead(JUMPER_METER) == LOW)
272
+ {
273
+ deviceMode = MODE_ANALOG;
274
+ Serial.println (" PB7 jumper closed" );
275
+ }
276
+ #endif
277
+
253
278
}
254
279
255
280
// This sets up the two analog inputs
You can’t perform that action at this time.
0 commit comments