Skip to content

Commit 61d72df

Browse files
authored
Merge pull request #78 from e-radionicacom/dev
Dev
2 parents 05216b9 + 5e0003e commit 61d72df

File tree

569 files changed

+156319
-693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

569 files changed

+156319
-693
lines changed

examples/Inkplate10/Others/Inkplate_Factory_Programming_VCOM/Inkplate_Factory_Programming_VCOM.ino

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,29 @@ int EEPROMaddress = 0;
1313
char commandBuffer[BUFFER_SIZE + 1];
1414
char strTemp[2001];
1515

16+
//Internal registers of MCP
17+
uint8_t mcpRegsInt[22];
18+
1619
void setup()
1720
{
1821
display.begin();
1922
Serial.begin(115200);
2023
EEPROM.begin(64);
2124

25+
vcomVoltage = -1.23;
26+
2227
if (EEPROM.read(EEPROMaddress) != 170)
2328
{
24-
display.digitalWriteMCP(3, HIGH);
25-
display.digitalWriteMCP(4, HIGH);
26-
display.digitalWriteMCP(5, HIGH);
27-
display.pinModeMCP(6, INPUT_PULLUP);
28-
display.display();
29-
display.einkOn();
30-
delay(100);
31-
vcomVoltage = readVCOM();
32-
display.einkOff();
33-
delay(1000);
34-
Serial.print("\n\nStarting VCOM measurment...");
35-
Serial.print("\nVCOM: ");
36-
Serial.print(vcomVoltage, 2);
37-
Serial.println("V");
38-
delay(1000);
29+
display.pinModeInternal(MCP23017_INT_ADDR, mcpRegsInt, 6, INPUT_PULLUP);
3930
writeVCOMToEEPROM(vcomVoltage);
4031
EEPROM.write(EEPROMaddress, 170);
4132
EEPROM.commit();
4233
display.selectDisplayMode(INKPLATE_1BIT);
4334
}
4435
else
4536
{
46-
vcomVoltage = (double)EEPROM.read(EEPROMaddress) / 100;
37+
Serial.println("Vcom already set!");
38+
//vcomVoltage = (double)EEPROM.read(EEPROMaddress) / 100;
4739
}
4840
memset(commandBuffer, 0, BUFFER_SIZE);
4941

@@ -402,10 +394,10 @@ uint8_t readReg(uint8_t _reg)
402394

403395
void showSplashScreen()
404396
{
405-
display.clean();
397+
display.clean(0, 1);
406398
display.display();
407399
display.selectDisplayMode(INKPLATE_3BIT);
408-
display.drawBitmap3Bit(0, 0, picture1, picture1_w, picture1_h);
400+
display.drawBitmap3Bit(0, 0, demo_image, demo_image_w, demo_image_h);
409401
display.setTextColor(0, 7);
410402
display.setTextSize(1);
411403
display.setCursor(760, 57);
@@ -414,14 +406,16 @@ void showSplashScreen()
414406
display.display();
415407
}
416408

409+
//Need to be changed to inkplate 10 Null waveform
417410
void writeToScreen()
418411
{
419-
display.cleanFast(1, 8);
420-
display.cleanFast(0, 2);
421-
display.cleanFast(2, 10);
412+
display.clean(1, 8);
413+
display.clean(0, 2);
414+
display.clean(2, 10);
422415
// delay(10);
423416
}
424417

418+
//Do not use until until null waveform is set correctly
425419
double readVCOM()
426420
{
427421
double vcomVolts;
@@ -449,10 +443,10 @@ void writeVCOMToEEPROM(double v)
449443
vcomL = vcom & 0xFF;
450444
// First, we have to power up TPS65186
451445
// Pull TPS65186 WAKEUP pin to High
452-
display.digitalWriteMCP(3, HIGH);
446+
display.digitalWriteInternal(MCP23017_INT_ADDR, mcpRegsInt,3, HIGH);
453447

454448
// Pull TPS65186 PWR pin to High
455-
display.digitalWriteMCP(4, HIGH);
449+
display.digitalWriteInternal(MCP23017_INT_ADDR, mcpRegsInt, 4, HIGH);
456450
delay(10);
457451

458452
// Send to TPS65186 first 8 bits of VCOM
@@ -470,29 +464,33 @@ void writeVCOMToEEPROM(double v)
470464
do
471465
{
472466
delay(1);
473-
} while (display.digitalReadMCP(6));
467+
} while (display.digitalReadInternal(MCP23017_INT_ADDR, mcpRegsInt, 6));
474468

475469
// Clear Interrupt flag by reading INT1 register
476470
readReg(0x07);
477471

478472
// Now, power off whole TPS
479473
// Pull TPS65186 WAKEUP pin to Low
480-
display.digitalWriteMCP(3, LOW);
474+
display.digitalWriteInternal(MCP23017_INT_ADDR, mcpRegsInt, 3, LOW);
481475

482476
// Pull TPS65186 PWR pin to Low
483-
display.digitalWriteMCP(4, LOW);
477+
display.digitalWriteInternal(MCP23017_INT_ADDR, mcpRegsInt, 4, LOW);
484478

485479
// Wait a little bit...
486480
delay(1000);
487481

488482
// Power up TPS again
489-
display.digitalWriteMCP(3, HIGH);
483+
display.digitalWriteInternal(MCP23017_INT_ADDR, mcpRegsInt, 3, HIGH);
490484

491485
delay(10);
492486

493487
// Read VCOM valuse from registers
494488
vcomL = readReg(0x03);
495489
vcomH = readReg(0x04);
490+
Serial.print("Vcom: ");
491+
Serial.println(vcom);
492+
Serial.print("Vcom register: ");
493+
Serial.println(vcomL | (vcomH << 8));
496494

497495
if (vcom != (vcomL | (vcomH << 8)))
498496
{
449 KB
Loading

examples/Inkplate10/Others/Inkplate_Factory_Programming_VCOM/image.h

Lines changed: 828 additions & 603 deletions
Large diffs are not rendered by default.

examples/Inkplate10/Projects/Daily_weather_station_example/Daily_weather_station_example.ino

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ const uint8_t *logos[16] = {icon_sn, icon_sl, icon_h, icon_t, icon_hr, icon_lr,
6565
const uint8_t *s_logos[16] = {icon_s_sn, icon_s_sl, icon_s_h, icon_s_t, icon_s_hr,
6666
icon_s_lr, icon_s_s, icon_s_hc, icon_s_lc, icon_s_c};
6767

68-
char abbr1[16];
69-
char abbr2[16];
70-
char abbr3[16];
71-
char abbr4[16];
68+
RTC_DATA_ATTR char abbr1[16];
69+
RTC_DATA_ATTR char abbr2[16];
70+
RTC_DATA_ATTR char abbr3[16];
71+
RTC_DATA_ATTR char abbr4[16];
7272

7373
// Variables for storing temperature
74-
char temps[8][4] = {
74+
RTC_DATA_ATTR char temps[8][4] = {
7575
"0F",
7676
"0F",
7777
"0F",
7878
"0F",
7979
};
8080

8181
// Variables for storing days of the week
82-
char days[8][4] = {
82+
RTC_DATA_ATTR char days[8][4] = {
8383
"",
8484
"",
8585
"",
@@ -93,13 +93,13 @@ RTC_DATA_ATTR unsigned refreshes = 0;
9393
const int fullRefresh = 5;
9494

9595
// Variables for storing current time and weather info
96-
char currentTemp[16] = "0F";
97-
char currentWind[16] = "0m/s";
96+
RTC_DATA_ATTR char currentTemp[16] = "0F";
97+
RTC_DATA_ATTR char currentWind[16] = "0m/s";
9898

99-
char currentTime[16] = "9:41";
99+
RTC_DATA_ATTR char currentTime[16] = "9:41";
100100

101-
char currentWeather[32] = "-";
102-
char currentWeatherAbbr[8] = "th";
101+
RTC_DATA_ATTR char currentWeather[32] = "-";
102+
RTC_DATA_ATTR char currentWeatherAbbr[8] = "th";
103103

104104
// functions defined below
105105
void drawWeather();
@@ -119,7 +119,7 @@ void setup()
119119
// Welcome screen
120120
display.setCursor(250, 370);
121121
display.setTextSize(3);
122-
display.print(F("Welcome to Inkplate 6 plus weather example!"));
122+
display.print(F("Welcome to Inkplate 10 weather example!"));
123123
display.display();
124124

125125
display.clearDisplay();
@@ -164,17 +164,11 @@ void setup()
164164
// Refresh only the clock
165165
network.getTime(currentTime);
166166

167-
int16_t x1, y1;
168-
uint16_t w1, h1;
169-
display.setFont(&Roboto_Light_36);
170-
display.setTextSize(1);
171-
display.getTextBounds(currentTime, 1024 - 20 * strlen(currentTime), 35, &x1, &y1, &w1, &h1);
172-
173-
display.fillRect(x1, y1, w1 + 30, h1 + 30, BLACK);
174-
display.partialUpdate();
175-
176-
display.fillRect(x1, y1, w1 + 30, h1 + 30, WHITE);
177167
drawTime();
168+
drawWeather();
169+
drawCurrent();
170+
drawTemps();
171+
drawCity();
178172

179173
display.partialUpdate();
180174
}

examples/Inkplate6/Others/Inkplate_Factory_Programming_VCOM/Inkplate_Factory_Programming_VCOM.ino

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ int EEPROMaddress = 0;
1313
char commandBuffer[BUFFER_SIZE + 1];
1414
char strTemp[2001];
1515

16+
uint8_t mcpRegsInt[22];
17+
1618
void setup()
1719
{
1820
display.begin();
@@ -21,10 +23,10 @@ void setup()
2123

2224
if (EEPROM.read(EEPROMaddress) != 170)
2325
{
24-
display.digitalWriteMCP(3, HIGH);
25-
display.digitalWriteMCP(4, HIGH);
26-
display.digitalWriteMCP(5, HIGH);
27-
display.pinModeMCP(6, INPUT_PULLUP);
26+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
27+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, HIGH);
28+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 5, HIGH);
29+
display.pinModeInternal(MCP23017_ADDR, mcpRegsInt, 6, INPUT_PULLUP);
2830
display.display();
2931
display.einkOn();
3032
delay(100);
@@ -36,6 +38,7 @@ void setup()
3638
Serial.print(vcomVoltage, 2);
3739
Serial.println("V");
3840
delay(1000);
41+
display.pinModeInternal(MCP23017_INT_ADDR, mcpRegsInt, 6, INPUT_PULLUP);
3942
writeVCOMToEEPROM(vcomVoltage);
4043
EEPROM.write(EEPROMaddress, 170);
4144
EEPROM.commit();
@@ -402,7 +405,7 @@ uint8_t readReg(uint8_t _reg)
402405

403406
void showSplashScreen()
404407
{
405-
display.clean();
408+
display.clean(0, 1);
406409
display.display();
407410
display.selectDisplayMode(INKPLATE_3BIT);
408411
display.drawBitmap3Bit(0, 0, picture1, picture1_w, picture1_h);
@@ -414,11 +417,12 @@ void showSplashScreen()
414417
display.display();
415418
}
416419

420+
//Inkplate 6 Null waveform
417421
void writeToScreen()
418422
{
419-
display.cleanFast(1, 8);
420-
display.cleanFast(0, 2);
421-
display.cleanFast(2, 10);
423+
display.clean(1, 8);
424+
display.clean(0, 2);
425+
display.clean(2, 10);
422426
// delay(10);
423427
}
424428

@@ -430,7 +434,7 @@ double readVCOM()
430434
writeToScreen();
431435
writeReg(0x04, (readReg(0x04) | B10000000));
432436
delay(10);
433-
while (display.digitalReadMCP(6))
437+
while (display.digitalReadInternal(MCP23017_ADDR, mcpRegsInt,6))
434438
{
435439
delay(1);
436440
};
@@ -449,10 +453,10 @@ void writeVCOMToEEPROM(double v)
449453
vcomL = vcom & 0xFF;
450454
// First, we have to power up TPS65186
451455
// Pull TPS65186 WAKEUP pin to High
452-
display.digitalWriteMCP(3, HIGH);
456+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
453457

454458
// Pull TPS65186 PWR pin to High
455-
display.digitalWriteMCP(4, HIGH);
459+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, HIGH);
456460
delay(10);
457461

458462
// Send to TPS65186 first 8 bits of VCOM
@@ -470,30 +474,35 @@ void writeVCOMToEEPROM(double v)
470474
do
471475
{
472476
delay(1);
473-
} while (display.digitalReadMCP(6));
477+
} while (display.digitalReadInternal(MCP23017_ADDR, mcpRegsInt, 6));
474478

475479
// Clear Interrupt flag by reading INT1 register
476480
readReg(0x07);
477481

478482
// Now, power off whole TPS
479483
// Pull TPS65186 WAKEUP pin to Low
480-
display.digitalWriteMCP(3, LOW);
484+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, LOW);
481485

482486
// Pull TPS65186 PWR pin to Low
483-
display.digitalWriteMCP(4, LOW);
487+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 4, LOW);
484488

485489
// Wait a little bit...
486490
delay(1000);
487491

488492
// Power up TPS again
489-
display.digitalWriteMCP(3, HIGH);
493+
display.digitalWriteInternal(MCP23017_ADDR, mcpRegsInt, 3, HIGH);
490494

491495
delay(10);
492496

493497
// Read VCOM valuse from registers
494498
vcomL = readReg(0x03);
495499
vcomH = readReg(0x04);
496500

501+
Serial.print("Vcom: ");
502+
Serial.println(vcom);
503+
Serial.print("Vcom register: ");
504+
Serial.println((vcomL | (vcomH << 8)));
505+
497506
if (vcom != (vcomL | (vcomH << 8)))
498507
{
499508
Serial.println("\nVCOM EEPROM PROGRAMMING FAILED!\n");

0 commit comments

Comments
 (0)