mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.0 M5ANGLE8
This commit is contained in:
parent
5046b1a2af
commit
8516eab2c8
@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.3.0] - 2023-11-08
|
||||
- update readme.md
|
||||
- simplified begin()
|
||||
- add **bool writeBrightness(channel, brightness)**
|
||||
|
||||
----
|
||||
|
||||
## [0.2.0] - 2023-08-08
|
||||
- tested with hardware led to major changes.
|
||||
- add reverse flag
|
||||
@ -22,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- update readme.md
|
||||
- minor edits
|
||||
|
||||
----
|
||||
|
||||
## [0.1.0] - 2023-08-03
|
||||
- initial version
|
||||
|
@ -2,8 +2,11 @@
|
||||
[![Arduino CI](https://github.com/RobTillaart/M5ANGLE8/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/M5ANGLE8/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/M5ANGLE8/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/M5ANGLE8/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/M5ANGLE8/actions/workflows/jsoncheck.yml)
|
||||
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/M5ANGLE8.svg)](https://github.com/RobTillaart/M5ANGLES8/issues)
|
||||
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/M5ANGLE8/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/M5ANGLE8.svg?maxAge=3600)](https://github.com/RobTillaart/M5ANGLE8/releases)
|
||||
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/M5ANGLE8.svg)](https://registry.platformio.org/libraries/robtillaart/M5ANGLE8)
|
||||
|
||||
|
||||
# M5ANGLE8
|
||||
@ -86,8 +89,8 @@ Roughly determined with led_demo.
|
||||
|
||||
- **M5ANGLE8(uint8_t address = M5ANGLE8_DEFAULT_ADDRESS, TwoWire \*wire = &Wire)** constructor.
|
||||
Default address = 0x43, default Wire.
|
||||
- **bool begin(int sda, int scl)** ESP32 et al.
|
||||
- **bool begin()** initialize I2C, check if connected.
|
||||
- **bool begin()** check if device is connected.
|
||||
User must call wire.begin() before this one.
|
||||
- **bool isConnected()** checks if address is on the I2C bus.
|
||||
- **bool setAddress(uint8_t address = M5ANGLE8_DEFAULT_ADDRESS)** set a new address for the device.
|
||||
Default 0x43.
|
||||
@ -119,6 +122,7 @@ brightness - 0..100
|
||||
- **bool setAll(uint8_t R, uint8_t G, uint8_t B, uint8_t brightness)** set all LEDS.
|
||||
- **bool allOff()** switch all LEDs off.
|
||||
Returns true.
|
||||
- **bool writeBrightness(channel, uint8_t brightness)** Set brightness only.
|
||||
|
||||
|
||||
## Future
|
||||
@ -131,7 +135,6 @@ Returns true.
|
||||
#### Should
|
||||
|
||||
- error handling
|
||||
- **bool writeBrightness(channel)**
|
||||
- **bool readRGB(channel, &R, &G, &B, &brightness)**
|
||||
- or **uint32_t readRGB(uint8_t channel)**
|
||||
- improve on return values of functions.
|
||||
@ -163,3 +166,12 @@ Returns true.
|
||||
- version (not interesting),
|
||||
- RGB values = 32 bytes
|
||||
|
||||
|
||||
## Support
|
||||
|
||||
If you appreciate my libraries, you can support the development and maintenance.
|
||||
Improve the quality of the libraries by providing issues and Pull Requests, or
|
||||
donate through PayPal or GitHub sponsors.
|
||||
|
||||
Thank you,
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
# - uno
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
# - m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
# - rpipico
|
@ -0,0 +1,42 @@
|
||||
//
|
||||
// FILE: M5ANGLE8_wire1_esp32.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo (works well with build in plotter)
|
||||
// URL: https://github.com/RobTillaart/M5ANGLE8
|
||||
//
|
||||
// ESP32
|
||||
|
||||
#include "m5angle8.h"
|
||||
|
||||
|
||||
M5ANGLE8 MM(M5ANGLE8_DEFAULT_ADDRESS, &Wire1); // 0x43
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.print("M5ANGLE8_LIB_VERSION: ");
|
||||
Serial.println(M5ANGLE8_LIB_VERSION);
|
||||
delay(100);
|
||||
|
||||
Wire1.begin(22, 23); // adjust pins
|
||||
|
||||
MM.begin();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (int ch = 0; ch < 8; ch++)
|
||||
{
|
||||
Serial.print(MM.analogRead(ch));
|
||||
Serial.print("\t");
|
||||
delay(1);
|
||||
}
|
||||
Serial.print(MM.inputSwitch());
|
||||
Serial.print("\n");
|
||||
delay(10);
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
@ -21,8 +21,10 @@ inputSwitch KEYWORD2
|
||||
writeRGB KEYWORD2
|
||||
setAll KEYWORD2
|
||||
allOff KEYWORD2
|
||||
writeBrightness KEYWORD2
|
||||
|
||||
|
||||
# Constants (LITERAL1)
|
||||
M5ANGLE8_LIB_VERSION LITERAL1
|
||||
|
||||
M5ANGLE8_DEFAULT_ADDRESS LITERAL1
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/M5ANGLE8"
|
||||
},
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=M5ANGLE8
|
||||
version=0.2.0
|
||||
version=0.3.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for M5 8ANGLE 8x12 bit potentiometers.
|
||||
paragraph=
|
||||
paragraph=
|
||||
category=Signal Input/Output
|
||||
url=https://github.com/RobTillaart/M5ANGLE8
|
||||
architectures=*
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: m5angle8.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.3.0
|
||||
// PURPOSE: Arduino library for M5 8ANGLE 8x12 bit potentiometers
|
||||
// URL: https://github.com/RobTillaart/M5ANGLE8
|
||||
|
||||
@ -27,24 +27,8 @@ M5ANGLE8::M5ANGLE8(uint8_t address, TwoWire *wire)
|
||||
}
|
||||
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool M5ANGLE8::begin(int dataPin, int clockPin)
|
||||
{
|
||||
if ((dataPin < 255) && (clockPin < 255))
|
||||
{
|
||||
_wire->begin(dataPin, clockPin);
|
||||
} else {
|
||||
_wire->begin();
|
||||
}
|
||||
if (! isConnected()) return false;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool M5ANGLE8::begin()
|
||||
{
|
||||
_wire->begin();
|
||||
if (! isConnected()) return false;
|
||||
return true;
|
||||
}
|
||||
@ -166,6 +150,18 @@ bool M5ANGLE8::allOff()
|
||||
}
|
||||
|
||||
|
||||
bool M5ANGLE8::writeBrightness(uint8_t channel, uint8_t brightness)
|
||||
{
|
||||
if (channel > 8)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (brightness > 100) brightness = 100;
|
||||
write8(M5ANGLE8_REG_RGB + (channel << 2) + 3, brightness);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//
|
||||
// PRIVATE
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: m5angle8.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.3.0
|
||||
// PURPOSE: Arduino library for M58ANGLE 8x12 bit potentiometers
|
||||
// URL: https://github.com/RobTillaart/M5ANGLE8
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "Arduino.h"
|
||||
#include "Wire.h"
|
||||
|
||||
#define M5ANGLE8_LIB_VERSION (F("0.2.0"))
|
||||
#define M5ANGLE8_LIB_VERSION (F("0.3.0"))
|
||||
|
||||
#define M5ANGLE8_DEFAULT_ADDRESS 0x43
|
||||
|
||||
@ -25,9 +25,6 @@ class M5ANGLE8
|
||||
public:
|
||||
M5ANGLE8(uint8_t address = M5ANGLE8_DEFAULT_ADDRESS, TwoWire *wire = &Wire);
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool begin(int sda, int scl);
|
||||
#endif
|
||||
bool begin();
|
||||
bool isConnected();
|
||||
|
||||
@ -62,6 +59,8 @@ public:
|
||||
bool setAll(uint8_t R, uint8_t G, uint8_t B, uint8_t brightness);
|
||||
bool allOff();
|
||||
|
||||
bool writeBrightness(uint8_t channel, uint8_t brightness);
|
||||
|
||||
|
||||
private:
|
||||
uint8_t _address;
|
||||
|
Loading…
Reference in New Issue
Block a user