Permalink
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
- 10 commits
- 24 files changed
- 0 comments
- 3 contributors
Commits on Aug 10, 2016
…e the built-in LED via this constant, not BUILTIN_LED.
…es that only specify esp8266. The encourages the Arduino IDE to use these libraries in preference to any conflicting libraries supplied with the Arduino IDE, and also removes any warnings about 'library supports esp8266 architecture but compiling for oak'.
Added LED_BUILTIN to all three variant types
Commits on Aug 28, 2016
… conversion from string constant to 'char*'" warnings I was getting from the Arduino IDE, probably due to recent changes to the compiler toolchain, and showing warnings it never used to. Ammended some of the comments to better reflect the purpose of the code - just for the helper function calls in the setup block.
Commits on Oct 11, 2016
Removed compiler warnings and minor code comment changes
Unified
Split
Showing
with
484 additions
and 132 deletions.
- +0 −2 README.md
- +120 −39 cores/oak/Tone.cpp
- +1 −1 libraries/DNSServer/library.properties
- +1 −1 libraries/Dummy/library.properties
- +1 −1 libraries/EEPROM/library.properties
- +1 −1 libraries/ESP8266AVRISP/library.properties
- +1 −1 libraries/ESP8266HTTPClient/library.properties
- +1 −1 libraries/ESP8266WebServer/library.properties
- +1 −1 libraries/ESP8266WiFi/library.properties
- +1 −1 libraries/ESP8266WiFiMesh/library.properties
- +1 −1 libraries/GDBStub/library.properties
- +1 −1 libraries/Hash/library.properties
- +1 −1 libraries/SPI/library.properties
- +1 −1 libraries/Servo/library.properties
- +1 −1 libraries/SoftwareSerial/library.properties
- +1 −1 libraries/Ticker/library.properties
- +1 −1 libraries/Wire/library.properties
- +17 −17 libraries/_Oak_Examples/examples/OLED_minimal/OLED_minimal.ino
- +1 −1 libraries/esp8266/library.properties
- +327 −57 packages/package_digistump_index.json
- +1 −0 variants/oak/pins_arduino.h
- +1 −0 variants/oak1/pins_arduino.h
- +1 −0 variants/oak1_noauto/pins_arduino.h
- +1 −1 version.txt
| @@ -1,7 +1,5 @@ | ||
| ## You must update your Arduino Oak package to 1.0.0+ via the boards manager! | ||
|
|
||
| **Due to bugs in the Arduino 1.6.6 and 1.6.7 IDEs we strongly suggest using 1.6.5r2 (for all boards not just ours)** | ||
|
|
||
| **If you previously used an earlier Beta please do a factory reset here: http://github.com/digistump/OakRestore** | ||
|
|
||
| **MAKE SURE YOU USE THE LATEST OakSoftAP - force a browser refresh before using** | ||
| @@ -1,51 +1,132 @@ | ||
| /* Tone.cpp | ||
| A Tone Generator Library | ||
| Written by Brett Hagman | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| Version Modified By Date Comments | ||
| ------- ----------- -------- -------- | ||
| 0001 B Hagman 09/08/02 Initial coding | ||
| 0002 B Hagman 09/08/18 Multiple pins | ||
| 0003 B Hagman 09/08/18 Moved initialization from constructor to begin() | ||
| 0004 B Hagman 09/09/26 Fixed problems with ATmega8 | ||
| 0005 B Hagman 09/11/23 Scanned prescalars for best fit on 8 bit timers | ||
| 09/11/25 Changed pin toggle method to XOR | ||
| 09/11/25 Fixed timer0 from being excluded | ||
| 0006 D Mellis 09/12/29 Replaced objects with functions | ||
| 0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register | ||
| 0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY | ||
| *************************************************/ | ||
| /* | ||
| Tone.cpp | ||
| A Tone Generator Library for the ESP8266 | ||
| Copyright (c) 2016 Ben Pirt. All rights reserved. | ||
| This file is part of the esp8266 core for Arduino environment. | ||
| This library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| This library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with this library; if not, write to the Free Software | ||
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| */ | ||
|
|
||
| #include "Arduino.h" | ||
| #include "pins_arduino.h" | ||
|
|
||
| /* | ||
| #define AVAILABLE_TONE_PINS 1 | ||
| const uint8_t tone_timers[] = { 1 }; | ||
| static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255, }; | ||
| static long toggle_counts[AVAILABLE_TONE_PINS] = { 0, }; | ||
| #define T1INDEX 0 | ||
|
|
||
| void t1IntHandler(); | ||
|
|
||
| static int8_t toneBegin(uint8_t _pin) { | ||
| //TODO implement tone | ||
| return 0; | ||
| _pin = esp8266_pinToGpio[_pin]; | ||
| int8_t _index = -1; | ||
|
|
||
| // if we're already using the pin, reuse it. | ||
| for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { | ||
| if (tone_pins[i] == _pin) { | ||
| return i; | ||
| } | ||
| } | ||
|
|
||
| // search for an unused timer. | ||
| for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { | ||
| if (tone_pins[i] == 255) { | ||
| tone_pins[i] = _pin; | ||
| _index = i; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return _index; | ||
| } | ||
| */ | ||
|
|
||
| // frequency (in hertz) and duration (in milliseconds). | ||
| void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) { | ||
| //TODO implement tone | ||
| _pin = esp8266_pinToGpio[_pin]; | ||
| int8_t _index; | ||
|
|
||
| _index = toneBegin(_pin); | ||
|
|
||
| if (_index >= 0) { | ||
| // Set the pinMode as OUTPUT | ||
| pinMode(_pin, OUTPUT); | ||
|
|
||
| // Calculate the toggle count | ||
| if (duration > 0) { | ||
| toggle_counts[_index] = 2 * frequency * duration / 1000; | ||
| } else { | ||
| toggle_counts[_index] = -1; | ||
| } | ||
|
|
||
| // set up the interrupt frequency | ||
| switch (tone_timers[_index]) { | ||
| case 0: | ||
| // Not currently supported | ||
| break; | ||
|
|
||
| case 1: | ||
| timer1_disable(); | ||
| timer1_isr_init(); | ||
| timer1_attachInterrupt(t1IntHandler); | ||
| timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP); | ||
| timer1_write((clockCyclesPerMicrosecond() * 500000) / frequency); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| void disableTimer(uint8_t _index) { | ||
| tone_pins[_index] = 255; | ||
|
|
||
| switch (tone_timers[_index]) { | ||
| case 0: | ||
| // Not currently supported | ||
| break; | ||
|
|
||
| case 1: | ||
| timer1_disable(); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| void noTone(uint8_t _pin) { | ||
| //TODO implement tone | ||
| _pin = esp8266_pinToGpio[_pin]; | ||
| for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { | ||
| if (tone_pins[i] == _pin) { | ||
| tone_pins[i] = 255; | ||
| disableTimer(i); | ||
| break; | ||
| } | ||
| } | ||
| digitalWrite(_pin, LOW); | ||
| } | ||
|
|
||
| ICACHE_RAM_ATTR void t1IntHandler() { | ||
| if (toggle_counts[T1INDEX] != 0){ | ||
| // toggle the pin | ||
| digitalWrite(tone_pins[T1INDEX], toggle_counts[T1INDEX] % 2); | ||
| toggle_counts[T1INDEX]--; | ||
| // handle the case of indefinite duration | ||
| if (toggle_counts[T1INDEX] < -2){ | ||
| toggle_counts[T1INDEX] = -1; | ||
| } | ||
| }else{ | ||
| disableTimer(T1INDEX); | ||
| digitalWrite(tone_pins[T1INDEX], LOW); | ||
| } | ||
| } |
| @@ -6,4 +6,4 @@ sentence=A simple DNS server for ESP8266. | ||
| paragraph=This library implements a simple DNS server. | ||
| category=Communication | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Just a library which does nothing | ||
| paragraph= | ||
| category=Other | ||
| url=http://localhost | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Enables reading and writing data to the permanent FLASH storage, up to | ||
| paragraph= | ||
| category=Data Storage | ||
| url=http://arduino.cc/en/Reference/EEPROM | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=AVR In-System Programming over WiFi for ESP8266 | ||
| paragraph=This library allows programming 8-bit AVR ICSP targets via TCP over WiFi with ESP8266. | ||
| category=Communication | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=http Client for ESP8266 | ||
| paragraph= | ||
| category=Communication | ||
| url=https://github.com/Links2004/Arduino/tree/libraries/ESP8266HTTPClient | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Simple web server library | ||
| paragraph=The library supports HTTP GET and POST requests, provides argument parsing, handles one client at a time. | ||
| category=Communication | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Enables network connection (local and Internet) using the ESP8266 built | ||
| paragraph=With this library you can instantiate Servers, Clients and send/receive UDP packets through WiFi. The shield can connect either to open or encrypted networks (WEP, WPA). The IP address can be assigned statically or through a DHCP. The library can also manage DNS. | ||
| category=Communication | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Mesh network library | ||
| paragraph=The library sets up a Mesh Node which acts as a router, creating a Mesh Network with other nodes. | ||
| category=Communication | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=GDB server stub from Cesanta's Smart.js | ||
| paragraph=GDB server stub helps debug crashes when JTAG isn't an option. | ||
| category=Uncategorized | ||
| url=https://github.com/cesanta/smart.js | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Generate Hash from data | ||
| paragraph= | ||
| category=Data Processing | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Enables the communication with devices that use the Serial Peripheral I | ||
| paragraph= | ||
| category=Signal Input/Output | ||
| url=http://arduino.cc/en/Reference/SPI | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Allows Esp8266 boards to control a variety of servo motors. | ||
| paragraph=This library can control a great number of servos.<br />It makes careful use of timers: the library can control 12 servos using only 1 timer.<br /> | ||
| category=Device Control | ||
| url=http://arduino.cc/en/Reference/Servo | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Implementation of the Arduino software serial for ESP8266. | ||
| paragraph= | ||
| category=Signal Input/Output | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Allows to call functions with a given interval. | ||
| paragraph= | ||
| category=Timing | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -6,4 +6,4 @@ sentence=Allows the communication between devices or sensors connected via Two W | ||
| paragraph= | ||
| category=Signal Input/Output | ||
| url=http://arduino.cc/en/Reference/Wire | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
| @@ -9,28 +9,29 @@ Modified for Oak by Digistump | ||
|
|
||
| #include <Wire.h> | ||
| #include "font.h" | ||
|
|
||
| #define OLED_address 0x3c // all the OLED's I have seen have this address | ||
|
|
||
| uint8_t offset = 0; | ||
|
|
||
| void setup(void) { | ||
|
|
||
| Wire.begin(); // Initialize I2C and OLED Display | ||
| init_OLED(); // | ||
| reset_display(); | ||
| // Start the server | ||
| clear_display(); | ||
|
|
||
| delay(3000); | ||
| void setup(void) | ||
| { | ||
| Wire.begin(); // Initialise I2C | ||
|
|
||
| init_OLED(); // Initailise the OLED Display | ||
| reset_display(); // Make sure the display is blank | ||
|
|
||
| //clear_display(); // Reset does this, so no need to do twice | ||
|
|
||
| sendStrXY("OLED ready!",4,0); // OLED first message | ||
| delay(3000); // Give things time to settle | ||
|
|
||
| sendStrXY("OLED ready!",4,0); // Display a message on the OLED! | ||
| } | ||
|
|
||
|
|
||
| void loop(void) { | ||
| // checks for incoming messages | ||
| // empty loop function as everything is done in setup | ||
| // normally we would have our continously running stuff here | ||
| void loop(void) | ||
| { | ||
| } | ||
|
|
||
| //==========================================================// | ||
| @@ -126,7 +127,7 @@ static void setXY(unsigned char row,unsigned char col) | ||
|
|
||
| //==========================================================// | ||
| // Prints a string regardless the cursor position. | ||
| static void sendStr(char *string) | ||
| static void sendStr(char const* string) | ||
| { | ||
| unsigned char i=0; | ||
| while(*string) | ||
| @@ -142,7 +143,7 @@ static void sendStr(char *string) | ||
| //==========================================================// | ||
| // Prints a string in coordinates X Y, being multiples of 8. | ||
| // This means we have 16 COLS (0-15) and 8 ROWS (0-7). | ||
| static void sendStrXY( char *string, int X, int Y) | ||
| static void sendStrXY(char const* string, int X, int Y) | ||
| { | ||
| setXY(X,Y); | ||
| unsigned char i=0; | ||
| @@ -208,5 +209,4 @@ static void init_OLED(void) | ||
| sendcommand(0x00); //Set Memory Addressing Mode ab Horizontal addressing mode | ||
| // sendcommand(0x02); // Set Memory Addressing Mode ab Page addressing mode(RESET) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| @@ -6,4 +6,4 @@ sentence=ESP8266 sketches examples | ||
| paragraph= | ||
| category=Other | ||
| url= | ||
| architectures=esp8266 | ||
| architectures=esp8266,oak | ||
Oops, something went wrong.