Skip to content

Commit

Permalink
Merge pull request #1 from andium/v1.0.1
Browse files Browse the repository at this point in the history
V1.0.1
  • Loading branch information
briancarbs authored Mar 10, 2017
2 parents 9c487e7 + b337b2a commit 50ee350
Show file tree
Hide file tree
Showing 30 changed files with 1,258 additions and 94 deletions.
4 changes: 2 additions & 2 deletions libraries/AnduinoEEPROM/library.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=AnduinoEEPROM
version=1.0
version=1.0.1
author=Brian Carbonette
maintainer=Brian Carbonette <bcarbonette@andium.com>
sentence=EEPROM library for Anduino Shield.
paragraph=EEPROM library for Anduino Shield.
category=Uncategorized
url=http://www.andium.com/AnduinoEEPROM
url=https://github.com/Andium/anduino
architectures=*
50 changes: 25 additions & 25 deletions libraries/AnduinoEEPROM/src/AnduinoEEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ void AnduinoEEPROM::begin()
Serial.print("EEPROM Ready! \n");
#endif

Wire1.begin(); //begin I2C
Wire1.setClock(1000000); //set clock freq to 1Mhz
WIRE.begin(); //begin I2C
WIRE.setClock(1000000); //set clock freq to 1Mhz

}

Expand Down Expand Up @@ -92,11 +92,11 @@ void AnduinoEEPROM::storeImg(unsigned int eeaddress)
void AnduinoEEPROM::write(unsigned int eeaddress, byte data )
{

Wire1.beginTransmission(EEPROM_ADDR);
Wire1.write((int)(eeaddress >> 8)); // MSB
Wire1.write((int)(eeaddress & 0xFF)); // LSB
Wire1.write(data);
Wire1.endTransmission();
WIRE.beginTransmission(EEPROM_ADDR);
WIRE.write((int)(eeaddress >> 8)); // MSB
WIRE.write((int)(eeaddress & 0xFF)); // LSB
WIRE.write(data);
WIRE.endTransmission();

delay(5);
}
Expand All @@ -106,31 +106,31 @@ byte AnduinoEEPROM::read(unsigned int eeaddress )
{
byte rdata = 0xFF;

Wire1.beginTransmission(EEPROM_ADDR);
Wire1.write((int)(eeaddress >> 8)); // MSB
Wire1.write((int)(eeaddress & 0xFF)); // LSB
Wire1.endTransmission();
WIRE.beginTransmission(EEPROM_ADDR);
WIRE.write((int)(eeaddress >> 8)); // MSB
WIRE.write((int)(eeaddress & 0xFF)); // LSB
WIRE.endTransmission();

Wire1.requestFrom(EEPROM_ADDR,1);
WIRE.requestFrom(EEPROM_ADDR,1);

return rdata = Wire1.read();
return rdata = WIRE.read();

}

/*read a page sized chunk of EEPROM starting at eeaddress and store in buffer*/
void AnduinoEEPROM::readPage(unsigned int eeaddress, byte buffer[], int pageSize)
{
Wire1.beginTransmission(EEPROM_ADDR);
Wire1.write((int)(eeaddress >> 8)); // MSB
Wire1.write((int)(eeaddress & 0xFF)); // LSB
Wire1.endTransmission();
Wire1.requestFrom(EEPROM_ADDR, pageSize);
WIRE.beginTransmission(EEPROM_ADDR);
WIRE.write((int)(eeaddress >> 8)); // MSB
WIRE.write((int)(eeaddress & 0xFF)); // LSB
WIRE.endTransmission();
WIRE.requestFrom(EEPROM_ADDR, pageSize);

//Read one PAGE_SIZE page from EEPROM and store in buffer
for (int i=0; i<pageSize; i++){
if (Wire1.available())
if (WIRE.available())
{
buffer[i] = Wire1.read();
buffer[i] = WIRE.read();
}
}
}
Expand All @@ -146,13 +146,13 @@ int AnduinoEEPROM::writePage(unsigned int eeaddress, byte* buffer, int pageSize)
return 1;
}

Wire1.beginTransmission(EEPROM_ADDR);
Wire1.write((int)(eeaddress >> 8)); // MSB
Wire1.write((int)(eeaddress & 0xFF)); // LSB
WIRE.beginTransmission(EEPROM_ADDR);
WIRE.write((int)(eeaddress >> 8)); // MSB
WIRE.write((int)(eeaddress & 0xFF)); // LSB

Wire1.write(buffer, pageSize);
WIRE.write(buffer, pageSize);

Wire1.endTransmission();
WIRE.endTransmission();

delay(5); //give EEPROM time to complete write before utilizing data

Expand Down
6 changes: 6 additions & 0 deletions libraries/AnduinoEEPROM/src/AnduinoEEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
#define EEPROM_SIZE 32768 //bytes
#define PAGE_SIZE 64 //bytes

#if defined(__AVR__) || defined(__i386__) || defined(ARDUINO_ARCH_SAMD) || defined(ESP8266) || defined(ARDUINO_ARCH_STM32)
#define WIRE Wire
#else // Arduino Due
#define WIRE Wire1
#endif

/*In order to utilize a PAGE_SIZE of 64bytes BUFFER_LENGTH in the Wire.h must be edited
to 66 in order to store the buffer and two address bytes
#define BUFFER_LENGTH 66 edited in /wire.h
Expand Down
11 changes: 6 additions & 5 deletions libraries/AnduinoLCD/examples/digitalGauge/digitalGauge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@

/* Include the AnduinoLCD ST7735 specific library */
#include "AnduinoLCD.h"
#include <SPI.h>

/*Create an instance of the AnduinoLCD */
AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN);
Expand All @@ -36,9 +35,11 @@ void setup() {

//Setup static text
LCD.showBanner(); //load Andium Banner
LCD.stroke(255, 255, 255); //white
LCD.setTextColor(ST7735_WHITE); //white
LCD.setTextSize(2);
LCD.text("Sensor Value :\n ", 0, 40); //positioned just under banner
LCD.setCursor(0,40);
LCD.print("Sensor Value:"); //positioned just under banner
LCD.println();
LCD.setTextSize(5); // set the font size larger for the digital reading

}
Expand All @@ -47,4 +48,4 @@ void loop() {

LCD.digitalGauge(A1);

}
}
6 changes: 2 additions & 4 deletions libraries/AnduinoLCD/examples/splashScreen/splashScreen.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@

/* Include the AnduinoLCD ST7735 specific library */
#include "AnduinoLCD.h"
#include <SPI.h>

/*Create an instance of the AnduinoLCD */
AnduinoLCD LCD = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN);
Expand All @@ -34,12 +33,11 @@ void setup() {
LCD.fillScreen(ST7735_BLACK); //clear the screen
LCD.setBacklight(ON);


LCD.splashScreen(); //load Andium splash screen

}

void loop() {

//nothing to do!
}
}
4 changes: 1 addition & 3 deletions libraries/AnduinoLCD/examples/waveform/waveform.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@

/* Include the AnduinoLCD ST7735 specific library */
#include "AnduinoLCD.h"
#include <SPI.h>

AnduinoLCD screen = AnduinoLCD(ST7735_CS_PIN, ST7735_DC_PIN, PERIPH_RST_PIN);

Expand Down Expand Up @@ -59,4 +58,3 @@ delay(250); //delay can be used as a pseudo-sample rate adjustment

}


4 changes: 2 additions & 2 deletions libraries/AnduinoLCD/library.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=AnduinoLCD
version=1.0
version=1.0.1
author=Brian Carbonette
maintainer=Brian Carbonette <bcarbonette@andium.com>
sentence=LCD library for Anduino Shield.
paragraph=LCD library for Anduino Shield.
category=Display
url=http://www.andium.com/AnduinoLCD
url=https://github.com/Andium/Anduino
architectures=*
22 changes: 10 additions & 12 deletions libraries/AnduinoLCD/src/AnduinoLCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -45,7 +45,7 @@ void AnduinoLCD::begin(void)

// initialize a ST7735S chip, black tab
initR(INITR_BLACKTAB);
setRotation(1);
setRotation(3);
fillScreen(ST7735_BLACK);


Expand Down Expand Up @@ -149,16 +149,12 @@ void AnduinoLCD::waveform(uint8_t analogPin, uint8_t px)
int drawHeight = map(sensor, 0, 1023, 0, height()-60); //map range for sensor trend
int xPos = px; //pixel position counter

// (r , g, b)
stroke(250, 180, 10);
line(xPos, height() - drawHeight, xPos, height()-drawHeight+5);
drawLine(xPos, height() - drawHeight, xPos, height()-drawHeight+5, 0xFD20);

//If the line has reached the end of the screen
//refresh the screen less the banner
if (xPos >= 160) {
stroke(1,1,1);
fill(1,1,1);
rect(0,40,width(),100); //screen size less banner
fillRect(0,40,width(),100,ST7735_BLACK); //clear the screen size less banner
}

delay(15); //sample rate as a function of loop iterations
Expand All @@ -175,12 +171,14 @@ void AnduinoLCD::digitalGauge(uint8_t analogPin)
// convert the reading to a char array
sensorVal.toCharArray(sensorPrintout, 4);

stroke(255, 255, 255);
text(sensorPrintout, 0, 60);
setTextColor(ST7735_WHITE);
setCursor(0,60);
print(sensorPrintout);
delay(250); //refresh reate
//refresh screen by blacking out previous reading
stroke(0, 0, 0);
text(sensorPrintout, 0, 60);
setTextColor(ST7735_BLACK);
setCursor(0,60);
print(sensorPrintout);
}


Expand Down
4 changes: 2 additions & 2 deletions libraries/AnduinoLCD/src/AnduinoLCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -31,11 +31,11 @@
#include "AnduinoPins.h"
#include "AnduinoErrorCodes.h"
#include "GimpImageFormat.h"
#include <SPI.h>

/*#define DEBUG_AnduinoLCD*/



typedef enum
{
ON,
Expand Down
24 changes: 24 additions & 0 deletions libraries/AnduinoLCD/src/gfxfont.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Font structures for newer Adafruit_GFX (1.1 and later).
// Example fonts are included in 'Fonts' directory.
// To use a font in your Arduino sketch, #include the corresponding .h
// file and pass address of GFXfont struct to setFont(). Pass NULL to
// revert to 'classic' fixed-space bitmap font.

#ifndef _GFXFONT_H_
#define _GFXFONT_H_

typedef struct { // Data stored PER GLYPH
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
uint8_t width, height; // Bitmap dimensions in pixels
uint8_t xAdvance; // Distance to advance cursor (x axis)
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
} GFXglyph;

typedef struct { // Data stored for FONT AS A WHOLE:
uint8_t *bitmap; // Glyph bitmaps, concatenated
GFXglyph *glyph; // Glyph array
uint8_t first, last; // ASCII extents
uint8_t yAdvance; // Newline distance (y axis)
} GFXfont;

#endif // _GFXFONT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
get started!
https://github.com/andium/Anduino/wiki
Written by Brian Carbonette Copyright © 2016 Andium
Written by Brian Carbonette Copyright © 2017 Andium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 50ee350

Please # to comment.