mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
+148
@@ -0,0 +1,148 @@
|
||||
// Copyright (c) M5Stack. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#include "M5Stack.h"
|
||||
|
||||
void M5Stack::begin()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
// Beep init
|
||||
pinMode(BEEP_PIN, OUTPUT);
|
||||
digitalWrite(BEEP_PIN, 0);
|
||||
|
||||
// Setup the button with an internal pull-up
|
||||
btn_pins[BTN_A] = BUTTON_A_PIN;
|
||||
btn_pins[BTN_B] = BUTTON_B_PIN;
|
||||
btn_pins[BTN_C] = BUTTON_C_PIN;
|
||||
|
||||
// M5.lcd INIT
|
||||
lcd.begin();
|
||||
lcd.fillScreen(BLACK);
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.setTextColor(WHITE);
|
||||
lcd.setTextSize(1);
|
||||
|
||||
// m5.lcd.drawPicture(47, 38, 120, 96, gImage_logo);
|
||||
if(!SD.begin(TFCARD_CS_PIN)) {
|
||||
Serial.println("Card Mount Failed");
|
||||
}
|
||||
}
|
||||
|
||||
void M5Stack::loop()
|
||||
{
|
||||
// buttons reads each button btn_states and store it
|
||||
for (uint8_t thisButton = 0; thisButton < NUM_BTN; thisButton++) {
|
||||
pinMode(btn_pins[thisButton], INPUT_PULLUP); //enable internal pull up resistors
|
||||
if (digitalRead(btn_pins[thisButton]) == LOW) { //if button pressed
|
||||
btn_states[thisButton]++; //increase button hold time
|
||||
} else {
|
||||
if (btn_states[thisButton] == 0)//button idle
|
||||
continue;
|
||||
if (btn_states[thisButton] == 0xFF)//if previously released
|
||||
btn_states[thisButton] = 0; //set to idle
|
||||
else
|
||||
btn_states[thisButton] = 0xFF; //button just released
|
||||
}
|
||||
pinMode(btn_pins[thisButton], INPUT); //disable internal pull up resistors to save power
|
||||
}
|
||||
|
||||
// TFTLCD button update
|
||||
lcd.buttonUpdate();
|
||||
}
|
||||
|
||||
uint8_t M5Stack::bootSetup()
|
||||
{
|
||||
//-------BOOT MENU---------
|
||||
lcd.fillScreen(WHITE);
|
||||
lcd.setFont(&FreeSansOblique9pt7b);
|
||||
|
||||
//--------APP STORE---------
|
||||
lcd.drawPicture(0, 0, 220, 175, gImage_select_backguand);
|
||||
lcd.fillRect(0, 30, 219, 120, WHITE);
|
||||
uint8_t select_app_id = selectMenu();
|
||||
Serial.printf("downloading the app:%d\r\n", select_app_id);
|
||||
lcd.fillScreen(BLACK);
|
||||
lcd.setTextColor(WHITE);
|
||||
lcd.setFont();
|
||||
lcd.setTextSize(1);
|
||||
lcd.setCursor(2, 20);
|
||||
|
||||
//----------downloading----------
|
||||
lcd.fillScreen(WHITE);
|
||||
drawTitle("LOADING...", GRAY);
|
||||
lcd.drawPicture(47, 38, 120, 96, gImage_logo);
|
||||
|
||||
int progress_p=0;
|
||||
while(++progress_p < 100) {
|
||||
// Serial.printf("progress:%d%%\r\n", progress_p);
|
||||
lcd.ProgressBar(20, 146, 180, 13, progress_p);
|
||||
delay(1);
|
||||
}
|
||||
return select_app_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true when 'button' is pressed.
|
||||
* The button has to be released for it to be triggered again.
|
||||
*/
|
||||
bool M5Stack::pressed(uint8_t button) {
|
||||
if (btn_states[button] == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* return true if 'button' is released
|
||||
*/
|
||||
bool M5Stack::released(uint8_t button) {
|
||||
if (btn_states[button] == 0xFF)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true ONCE when 'button' is held for 'time' frames
|
||||
* @param button The button's ID
|
||||
* @param time How much frames button must be held, between 1 and 254.
|
||||
* @return true when 'button' is held for 'time' frames
|
||||
*/
|
||||
bool M5Stack::held(uint8_t button, uint8_t time){
|
||||
if(btn_states[button] == (time+1))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true every 'period' frames when 'button' is held
|
||||
* @param button The button's ID
|
||||
* @param period How much frames button must be held, between 1 and 254.
|
||||
* @return true if the button is held for the given time
|
||||
*/
|
||||
bool M5Stack::repeat(uint8_t button, uint8_t period) {
|
||||
if (period <= 1) {
|
||||
if ((btn_states[button] != 0xFF) && (btn_states[button]))
|
||||
return true;
|
||||
} else {
|
||||
if ((btn_states[button] != 0xFF) && ((btn_states[button] % period) == 1))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param button The button's ID
|
||||
* @return The number of frames during which the button has been held.
|
||||
*/
|
||||
uint8_t M5Stack::timeHeld(uint8_t button){
|
||||
if(btn_states[button] != 0xFF)
|
||||
return btn_states[button];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
M5Stack m5;
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) M5Stack. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#ifndef _M5STACK_H_
|
||||
#define _M5STACK_H_
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiMulti.h>
|
||||
#include <Wire.h>
|
||||
#include "FS.h"
|
||||
#include "SD.h"
|
||||
#include "utility/display.h"
|
||||
#include "utility/bmp_map.h"
|
||||
#include "utility/bootmenu.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
class M5Stack {
|
||||
public:
|
||||
void begin();
|
||||
uint8_t bootSetup();
|
||||
void loop();
|
||||
|
||||
// button API
|
||||
bool pressed(uint8_t button);
|
||||
bool released(uint8_t button);
|
||||
bool held(uint8_t button, uint8_t time);
|
||||
bool repeat(uint8_t button, uint8_t period);
|
||||
uint8_t timeHeld(uint8_t button);
|
||||
|
||||
M5STACK_TFTLCD lcd;
|
||||
|
||||
private:
|
||||
uint8_t btn_pins[NUM_BTN];
|
||||
uint8_t btn_states[NUM_BTN];
|
||||
};
|
||||
|
||||
extern M5Stack m5stack;
|
||||
#define m5 m5stack
|
||||
#define M5 m5stack
|
||||
|
||||
#endif
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,163 @@
|
||||
#include <M5Stack.h>
|
||||
#include "clock.h"
|
||||
#include "DHT.h"
|
||||
|
||||
#define DHTPIN 22 // what digital pin we're connected to
|
||||
#define DHTTYPE DHT11 // DHT 11
|
||||
DHT dht(DHTPIN, DHTTYPE);
|
||||
uint8_t select_app_id;
|
||||
|
||||
void setup()
|
||||
{
|
||||
m5.begin();
|
||||
select_app_id = m5.bootSetup();
|
||||
|
||||
m5.lcd.fillScreen(WHITE);
|
||||
m5.lcd.drawPicture(47, 38, 120, 96, gImage_logo);
|
||||
|
||||
switch (select_app_id) {
|
||||
case 0:
|
||||
wifi_scan_setup();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
DHT11_setup();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
clock_setup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
switch (select_app_id) {
|
||||
case 0:
|
||||
wifi_scan_loop();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
DHT11_loop();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
clock_loop();
|
||||
break;
|
||||
}
|
||||
|
||||
m5.loop();
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
void DHT11_setup()
|
||||
{
|
||||
dht.begin();
|
||||
m5.lcd.fillScreen(WHITE);
|
||||
m5.lcd.drawTitle("Environment", 0x09F1);
|
||||
#define X_OFFSET 40
|
||||
#define Y_POS 165
|
||||
}
|
||||
|
||||
void DHT11_loop()
|
||||
{
|
||||
static uint32_t sampling_tick;
|
||||
static float pre_hif, pre_hic;
|
||||
static bool f2c_flag=0;
|
||||
|
||||
if(millis() > sampling_tick) {
|
||||
sampling_tick = millis() + 1000;
|
||||
// Reading temperature or humidity takes about 250 milliseconds!
|
||||
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
|
||||
float h = dht.readHumidity();
|
||||
// Read temperature as Celsius (the default)
|
||||
float t = dht.readTemperature();
|
||||
// Read temperature as Fahrenheit (isFahrenheit = true)
|
||||
float f = dht.readTemperature(true);
|
||||
|
||||
// Check if any reads failed and exit early (to try again).
|
||||
if (isnan(h) || isnan(t) || isnan(f)) {
|
||||
Serial.println("Failed to read from DHT sensor!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute heat index in Fahrenheit (the default)
|
||||
float hif = dht.computeHeatIndex(f, h);
|
||||
// Compute heat index in Celsius (isFahreheit = false)
|
||||
float hic = dht.computeHeatIndex(t, h, false);
|
||||
|
||||
Serial.print("Humidity: ");
|
||||
Serial.print(h);
|
||||
Serial.print(" %\t");
|
||||
Serial.print("Temperature: ");
|
||||
Serial.print(t);
|
||||
Serial.print(" *C ");
|
||||
Serial.print(f);
|
||||
Serial.print(" *F\t");
|
||||
Serial.print("Heat index: ");
|
||||
Serial.print(hic);
|
||||
Serial.print(" *C ");
|
||||
Serial.print(hif);
|
||||
Serial.println(" *F");
|
||||
|
||||
if((pre_hif!=hif) || (pre_hic!=hic)) {
|
||||
pre_hif = hif;
|
||||
pre_hic = hic;
|
||||
|
||||
m5.lcd.setFont(&FreeMonoBoldOblique12pt7b);
|
||||
// m5.lcd.setFont(&FreeMonoBoldOblique18pt7b);
|
||||
m5.lcd.fillRect(19, 70, 190, 30, WHITE);
|
||||
m5.lcd.setTextColor(GRAY);
|
||||
m5.lcd.setTextSize(1);
|
||||
m5.lcd.setCursor(25, 90);
|
||||
if(f2c_flag) {
|
||||
m5.lcd.printf("%2.1fF %2.1f%%", hif, h);
|
||||
} else {
|
||||
m5.lcd.printf("%2.1fC %2.1f%%", hic, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m5.pressed(BUTTON_B)) {
|
||||
f2c_flag = !f2c_flag;
|
||||
sampling_tick = 0;
|
||||
pre_hif=0;
|
||||
}
|
||||
}
|
||||
|
||||
void wifi_scan_setup()
|
||||
{
|
||||
m5.lcd.setFont();
|
||||
}
|
||||
|
||||
void wifi_scan_loop()
|
||||
{
|
||||
m5.lcd.setCursor(0, 0);
|
||||
// m5.lcd.println("scan start");
|
||||
// WiFi.scanNetworks will return the number of networks found
|
||||
int n = WiFi.scanNetworks();
|
||||
m5.lcd.fillScreen(BLACK);
|
||||
m5.lcd.println("wifi scan done");
|
||||
if (n == 0)
|
||||
{
|
||||
m5.lcd.println("no networks found");
|
||||
}
|
||||
else
|
||||
{
|
||||
m5.lcd.print(n);
|
||||
m5.lcd.println(" networks found");
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
// Print SSID and RSSI for each network found
|
||||
m5.lcd.printf("%2d", i + 1);
|
||||
m5.lcd.print(": ");
|
||||
m5.lcd.print(WiFi.SSID(i));
|
||||
m5.lcd.print(" (");
|
||||
m5.lcd.print(WiFi.RSSI(i));
|
||||
m5.lcd.print(")");
|
||||
m5.lcd.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " " : "*");
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
Serial.println("");
|
||||
delay(3000);
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
WiFi Web Server LED Blink
|
||||
|
||||
A simple web server that lets you blink an LED via the web.
|
||||
This sketch will print the IP address of your WiFi Shield (once connected)
|
||||
to the Serial monitor. From there, you can open that address in a web browser
|
||||
to turn on and off the LED on pin 5.
|
||||
|
||||
If the IP address of your shield is yourAddress:
|
||||
http://yourAddress/H turns the LED on
|
||||
http://yourAddress/L turns it off
|
||||
|
||||
This example is written for a network using WPA encryption. For
|
||||
WEP or WPA, change the Wifi.begin() call accordingly.
|
||||
|
||||
Circuit:
|
||||
* WiFi shield attached
|
||||
* LED attached to pin 5
|
||||
|
||||
created for arduino 25 Nov 2012
|
||||
by Tom Igoe
|
||||
|
||||
ported for sparkfun esp32
|
||||
31.01.2017 by Jan Hendrik Berlin
|
||||
|
||||
*/
|
||||
#include "clock.h"
|
||||
|
||||
WiFiUDP ntpUDP;
|
||||
// NTPClient timeClient(ntpUDP);
|
||||
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000);
|
||||
|
||||
TimerObject *timer1 = new TimerObject(1000);
|
||||
TimerObject *timer_setting_select = new TimerObject(500);
|
||||
TimerObject *timer_button_draw = new TimerObject(10);
|
||||
|
||||
typedef void (*CallBackType)();
|
||||
#define X_POS_OFFSET 15
|
||||
#define Y_POS_OFFSET 45
|
||||
|
||||
// M5Stack_Button button[3];
|
||||
void upCursorBlink();
|
||||
|
||||
class AlarmClock {
|
||||
|
||||
enum week {SUN, MON, TUE, WED, THU, FRI, SAT, EVERYDAY};
|
||||
|
||||
public:
|
||||
AlarmClock() {
|
||||
state = 0;
|
||||
}
|
||||
|
||||
AlarmClock(uint8_t h, uint8_t m) {
|
||||
hours = h;
|
||||
minutes = m;
|
||||
// seconds = s;
|
||||
repeat_week_mask = EVERYDAY;
|
||||
state = 1;
|
||||
}
|
||||
|
||||
AlarmClock(uint8_t h, uint8_t m, uint8_t repeat_mask) {
|
||||
AlarmClock(h, m);
|
||||
repeat_week_mask = repeat_mask;
|
||||
state = 1;
|
||||
}
|
||||
|
||||
void setAlarmTime(uint8_t h, uint8_t m) {
|
||||
hours = h;
|
||||
minutes = m;
|
||||
// seconds = s;
|
||||
}
|
||||
|
||||
void setEnable() {
|
||||
state = 1;
|
||||
}
|
||||
|
||||
void setDisable() {
|
||||
state = 0;
|
||||
}
|
||||
|
||||
void setOnClock(CallBackType callback) {
|
||||
on_alarm_clock = callback;
|
||||
}
|
||||
|
||||
void update(uint64_t epoch_time) {
|
||||
if(state == 1) {
|
||||
unsigned long rawTime = epoch_time;
|
||||
unsigned long local_hours = (rawTime % 86400L) / 3600;
|
||||
unsigned long local_minutes = (rawTime % 3600) / 60;
|
||||
// unsigned long local_seconds = rawTime % 60;
|
||||
|
||||
if((local_minutes==minutes)&&(local_hours==hours)) {
|
||||
if(on_alarm_clock) {
|
||||
on_alarm_clock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private:
|
||||
bool state;
|
||||
int8_t hours;
|
||||
int8_t minutes;
|
||||
int8_t seconds;
|
||||
int8_t repeat_week_mask;
|
||||
CallBackType on_alarm_clock;
|
||||
};
|
||||
|
||||
AlarmClock alarm_clock(6, 30);
|
||||
|
||||
// AlarmClock alarm_clock; //= new AlarmClock(7, 30, 00);
|
||||
uint8_t alarm_state = 0;
|
||||
uint8_t setting_state = 0;
|
||||
#define ACLOCK_RUNING 0
|
||||
#define ACLOCK_SETTING 1
|
||||
|
||||
void upTimeDisplay()
|
||||
{
|
||||
m5.lcd.setTextSize(4);
|
||||
m5.lcd.setTextColor(BLACK, WHITE);
|
||||
m5.lcd.setCursor(X_POS_OFFSET, 45);
|
||||
m5.lcd.print(timeClient.getFormattedTime().c_str());
|
||||
}
|
||||
|
||||
void upCursorBlink()
|
||||
{
|
||||
static bool tg = 1;
|
||||
|
||||
m5.lcd.setTextSize(4);
|
||||
m5.lcd.setCursor(X_POS_OFFSET+35, 95);
|
||||
|
||||
if((setting_state == 1) && (tg)) {
|
||||
m5.lcd.setTextColor(WHITE, BLACK);
|
||||
} else {
|
||||
m5.lcd.setTextColor(BLACK, WHITE);
|
||||
}
|
||||
m5.lcd.printf("%2.2d", alarm_clock.hours);
|
||||
|
||||
m5.lcd.setTextColor(BLACK, WHITE);
|
||||
m5.lcd.printf(":");
|
||||
|
||||
if((setting_state == 2) && (tg)) {
|
||||
m5.lcd.setTextColor(WHITE, BLACK);
|
||||
} else {
|
||||
m5.lcd.setTextColor(BLACK, WHITE);
|
||||
}
|
||||
m5.lcd.printf("%2.2d", alarm_clock.minutes);
|
||||
}
|
||||
|
||||
void clock_setup()
|
||||
{
|
||||
|
||||
//---------------------------------------
|
||||
m5.lcd.setFont();
|
||||
m5.lcd.fillScreen(WHITE);
|
||||
m5.lcd.fillRect(0, 0, 220, 22, 0x09F1);
|
||||
m5.lcd.setCursor(4, 4);
|
||||
m5.lcd.setTextColor(WHITE);
|
||||
m5.lcd.setTextSize(2);
|
||||
m5.lcd.printf("Alarm Clock");
|
||||
|
||||
#define X_OFFSET 40
|
||||
#define Y_POS 165
|
||||
|
||||
m5.lcd.buttonSet(BTN_A, "+");
|
||||
m5.lcd.buttonSet(BTN_B, "-");
|
||||
m5.lcd.buttonSet(BTN_C, "+SET");
|
||||
|
||||
//---------------------------------------------
|
||||
|
||||
m5.lcd.setTextSize(4);
|
||||
m5.lcd.setCursor(X_POS_OFFSET, 45);
|
||||
// m5.lcd.setTextColor(BLACK);
|
||||
m5.lcd.setTextColor(BLACK, WHITE);
|
||||
|
||||
// m5.lcd.setTextWrap(boolean w);
|
||||
// m5.lcd.print("hello world!");
|
||||
// m5.lcd.print(timeClient.getFormattedTime().c_str());
|
||||
|
||||
// alarm_state = ACLOCK_SETTING;
|
||||
// setting_state = 1;
|
||||
|
||||
//--------timeClient------
|
||||
// wifi_connect();
|
||||
timeClient.begin();
|
||||
timeClient.setTimeOffset(28800);
|
||||
|
||||
timer1->setOnTimer(&upTimeDisplay);
|
||||
timer1->Start();
|
||||
timer_setting_select->setOnTimer(upCursorBlink);
|
||||
upTimeDisplay();
|
||||
upCursorBlink();
|
||||
}
|
||||
|
||||
|
||||
void clock_loop(){
|
||||
switch (alarm_state) {
|
||||
case ACLOCK_RUNING:
|
||||
if(m5.pressed(BTN_C)) {
|
||||
setting_state = 1;
|
||||
alarm_state = ACLOCK_SETTING;
|
||||
timer_setting_select->Start();
|
||||
}
|
||||
break;
|
||||
|
||||
case ACLOCK_SETTING:
|
||||
if(m5.pressed(BTN_C)) {
|
||||
if(++setting_state == 3) {
|
||||
setting_state = 0;
|
||||
alarm_state = ACLOCK_RUNING;
|
||||
// timer_setting_select->Stop();
|
||||
}
|
||||
}
|
||||
switch (setting_state) {
|
||||
case 1:
|
||||
if(m5.pressed(BTN_A)) {if(++alarm_clock.hours == 24) alarm_clock.hours = 0;}
|
||||
if(m5.pressed(BTN_B)) {if(--alarm_clock.hours == -1) alarm_clock.hours = 23;}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(m5.pressed(BTN_A)) {if(++alarm_clock.minutes == 60) alarm_clock.minutes = 0;}
|
||||
if(m5.pressed(BTN_B)) {if(--alarm_clock.minutes == -1) alarm_clock.minutes = 59;}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
timer1->Update();
|
||||
timer_setting_select->Update();
|
||||
// timer_button_draw->Update();
|
||||
timeClient.update();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef _CLOCK_H_
|
||||
#define _CLOCK_H_
|
||||
|
||||
#include "M5Stack.h"
|
||||
#include "NTPClient.h"
|
||||
#include "TimerObject.h"
|
||||
|
||||
void clock_setup();
|
||||
void clock_loop();
|
||||
|
||||
#endif
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
#include <M5Stack.h>
|
||||
|
||||
// the setup routine runs once when M5Stack starts up
|
||||
void setup(){
|
||||
// initialize the M5Stack object
|
||||
m5.begin();
|
||||
// lcd display
|
||||
m5.lcd.printf("button test\r\n");
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever
|
||||
void loop(){
|
||||
if(m5.pressed(BTN_A)) {
|
||||
m5.lcd.printf("Pressed A \r\n");
|
||||
}
|
||||
|
||||
if(m5.pressed(BTN_B)) {
|
||||
m5.lcd.printf("Pressed B \r\n");
|
||||
}
|
||||
|
||||
if(m5.pressed(BTN_C)) {
|
||||
m5.lcd.printf("Pressed C \r\n");
|
||||
}
|
||||
|
||||
m5.loop();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <M5Stack.h>
|
||||
|
||||
// the setup routine runs once when M5Stack starts up
|
||||
void setup(){
|
||||
// initialize the M5Stack object
|
||||
m5.begin();
|
||||
// lcd display
|
||||
m5.lcd.printf("hello world");
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever
|
||||
void loop(){
|
||||
|
||||
m5.loop();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
#include <M5Stack.h>
|
||||
|
||||
// the setup routine runs once when M5Stack starts up
|
||||
void setup(){
|
||||
// initialize the M5Stack object
|
||||
m5.begin();
|
||||
// lcd display
|
||||
m5.lcd.printf("hello world");
|
||||
}
|
||||
|
||||
// the loop routine runs over and over again forever
|
||||
void loop(){
|
||||
|
||||
m5.loop();
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* (C) Copyright 2014 Aurélien Rodot. All rights reserved.
|
||||
*
|
||||
* This file is part of the Gamebuino Library (http://gamebuino.com)
|
||||
*
|
||||
* The Gamebuino 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
M5Stack KEYWORD3
|
||||
display KEYWORD1
|
||||
buttons KEYWORD1
|
||||
|
||||
////////////////////////core
|
||||
begin KEYWORD1
|
||||
update KEYWORD1
|
||||
|
||||
////////////////////////buttons
|
||||
pressed KEYWORD1
|
||||
released KEYWORD1
|
||||
held KEYWORD1
|
||||
repeat KEYWORD1
|
||||
timeHeld KEYWORD1
|
||||
BTN_A LITERAL1
|
||||
BTN_B LITERAL1
|
||||
BTN_C LITERAL1
|
||||
|
||||
////////////////////////Display
|
||||
getBuffer KEYWORD1
|
||||
setContrast KEYWORD1
|
||||
clear KEYWORD1
|
||||
update KEYWORD1
|
||||
fillScreen KEYWORD1
|
||||
persistence KEYWORD1
|
||||
setColor KEYWORD1
|
||||
drawPixel KEYWORD1
|
||||
getPixel KEYWORD1
|
||||
drawLine KEYWORD1
|
||||
drawFastVLine KEYWORD1
|
||||
drawFastHLine KEYWORD1
|
||||
drawRect KEYWORD1
|
||||
fillRect KEYWORD1
|
||||
drawRoundRect KEYWORD1
|
||||
fillRoundRect KEYWORD1
|
||||
drawCircle KEYWORD1
|
||||
fillCircle KEYWORD1
|
||||
drawCircleHelper KEYWORD1
|
||||
fillCircleHelper KEYWORD1
|
||||
drawTriangle KEYWORD1
|
||||
fillTriangle KEYWORD1
|
||||
drawBitmap KEYWORD1
|
||||
drawChar KEYWORD1
|
||||
print KEYWORD1
|
||||
cursorX KEYWORD1
|
||||
cursorY KEYWORD1
|
||||
fontSize KEYWORD1
|
||||
textWrap KEYWORD1
|
||||
fontWidth KEYWORD1
|
||||
fontHeight KEYWORD1
|
||||
setFont KEYWORD1
|
||||
|
||||
WHITE LITERAL1
|
||||
BLACK LITERAL1
|
||||
INVERT LITERAL1
|
||||
GRAY LITERAL1
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "M5Stack",
|
||||
"description": "An ESP32 Arduino board",
|
||||
"keywords": "M5Stack",
|
||||
"authors": {
|
||||
"name": "Zibin Zheng",
|
||||
"url": "https://github.com/m5stack/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/m5stack/m5stack.git"
|
||||
},
|
||||
"version": "0.1",
|
||||
"framework": "arduino",
|
||||
"platforms": "esp32"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
name=M5Stack
|
||||
version=0.1
|
||||
author=Zibin Zheng
|
||||
maintainer=Zibin Zheng <bin@m5stack.com>
|
||||
sentence=.
|
||||
paragraph=See more on http://M5Stack.com
|
||||
category=Device Control
|
||||
url=https://github.com/m5stack/m5stack
|
||||
architectures=esp32
|
||||
includes=M5Stack.h
|
||||
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* (C) Copyright 2014 Aurélien Rodot. All rights reserved.
|
||||
*
|
||||
* This file is part of the Gamebuino Library (http://gamebuino.com)
|
||||
*
|
||||
* The Gamebuino 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#ifndef BATTERY_H
|
||||
#define BATTERY_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#endif /* BATTERY_H */
|
||||
|
||||
+7837
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user