- Notifications
You must be signed in to change notification settings - Fork1k
variant: WB: add STM32WB5MM-DK#1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletionsREADME.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletionsboards.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletionscores/arduino/stm32/lock_resource.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionlibraries/IWatchdog/src/IWatchdog.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletionslibraries/RGB_LED_TLC59731/examples/RGB_LED_TLC59731/RGB_LED_TLC59731.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
RGB_LED_TLC59731 | ||
This example code is in the public domain. | ||
Blink one RGB LED with different default colors: | ||
RGB_LED_TLC59731::OFF | ||
RGB_LED_TLC59731::RED | ||
RGB_LED_TLC59731::GREEN | ||
RGB_LED_TLC59731::BLUE | ||
RGB_LED_TLC59731::MAGENTA | ||
RGB_LED_TLC59731::CYAN | ||
RGB_LED_TLC59731::YELLOW | ||
RGB_LED_TLC59731::WHITE | ||
*/ | ||
#include <RGB_LED_TLC59731.h> | ||
static uint8_t step = 0; | ||
static uint8_t* sequence[] = { RGB_LED_TLC59731::RED, | ||
RGB_LED_TLC59731::GREEN, | ||
RGB_LED_TLC59731::BLUE, | ||
RGB_LED_TLC59731::MAGENTA, | ||
RGB_LED_TLC59731::CYAN, | ||
RGB_LED_TLC59731::YELLOW, | ||
RGB_LED_TLC59731::WHITE | ||
}; | ||
/** | ||
STM32WB5MM-DK have an RGB LED connected to TLC59731 | ||
It requires to enable it thanks LED_SELECT pin | ||
and to have JP5 on and JP4 off | ||
*/ | ||
#if defined(RGB_LED) && defined(LED_SELECT) | ||
RGB_LED_TLC59731 LED(RGB_LED, LED_SELECT); | ||
#else | ||
RGB_LED_TLC59731 LED; | ||
#endif | ||
void setup() { | ||
/* Change Brightness */ | ||
LED.setBrightness(0x10); | ||
} | ||
void loop() { | ||
/* Blink */ | ||
LED.on(sequence[step]); | ||
delay(500); | ||
LED.off(); | ||
delay(500); | ||
step = (step == 6) ? 0 : step + 1; | ||
} |
31 changes: 31 additions & 0 deletionslibraries/RGB_LED_TLC59731/keywords.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
####################################### | ||
# Syntax Coloring Map For RGB_LED_TLC59731 | ||
####################################### | ||
####################################### | ||
# Datatypes (KEYWORD1) | ||
####################################### | ||
RGB_LED_TLC59731KEYWORD1 | ||
####################################### | ||
# Methods and Functions (KEYWORD2) | ||
####################################### | ||
onKEYWORD2 | ||
offKEYWORD2 | ||
getBrightnessKEYWORD2 | ||
setBrightnessKEYWORD2 | ||
####################################### | ||
# Constants (LITERAL1) | ||
####################################### | ||
OFFLITERAL1 | ||
REDLITERAL1 | ||
GREENLITERAL1 | ||
BLUELITERAL1 | ||
MAGENTALITERAL1 | ||
CYANLITERAL1 | ||
YELLOWLITERAL1 | ||
WHITELITERAL |
9 changes: 9 additions & 0 deletionslibraries/RGB_LED_TLC59731/library.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=RGB LED TLC59731 | ||
version=1.0.0 | ||
author=Frederic Pillon | ||
maintainer=stm32duino | ||
sentence=Allows to control one RGB LED driven by TLC59731 PWM LED Driver | ||
paragraph=Control one RGB LED driven by TLC59731 PWM LED Driver | ||
category=Signal Input/Output | ||
url=https://github.com/stm32duino/Arduino_Core_STM32/tree/master/libraries/RGB_LED_TLC59731 | ||
architectures=stm32 |
142 changes: 142 additions & 0 deletionslibraries/RGB_LED_TLC59731/src/RGB_LED_TLC59731.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* | ||
******************************************************************************* | ||
* Copyright (c) 2021, STMicroelectronics | ||
* All rights reserved. | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
******************************************************************************* | ||
*/ | ||
#include "RGB_LED_TLC59731.h" | ||
#define WRITE_COMMAND 0x3A | ||
#ifndef DEFAULT_BRIGHTNESS | ||
#define DEFAULT_BRIGHTNESS 0x41 | ||
#endif | ||
uint8_t RGB_LED_TLC59731::brightness = DEFAULT_BRIGHTNESS; | ||
uint8_t RGB_LED_TLC59731::OFF[3] = {0, 0, 0 }; | ||
uint8_t RGB_LED_TLC59731::RED[3] = {DEFAULT_BRIGHTNESS, 0, 0 }; | ||
uint8_t RGB_LED_TLC59731::GREEN[3] = {0, DEFAULT_BRIGHTNESS, 0 }; | ||
uint8_t RGB_LED_TLC59731::BLUE[3] = {0, 0, DEFAULT_BRIGHTNESS}; | ||
uint8_t RGB_LED_TLC59731::MAGENTA[3] = {DEFAULT_BRIGHTNESS, 0, DEFAULT_BRIGHTNESS}; | ||
uint8_t RGB_LED_TLC59731::CYAN[3] = {0, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS}; | ||
uint8_t RGB_LED_TLC59731::YELLOW[3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, 0 }; | ||
uint8_t RGB_LED_TLC59731::WHITE[3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS}; | ||
/** | ||
* @brief Set RGB LED color | ||
* @param rgb[3]: red,green, blue value in range [0-255] | ||
* @retval None | ||
*/ | ||
void RGB_LED_TLC59731::on(uint8_t rgb[3]) | ||
{ | ||
on(rgb[0], rgb[1], rgb[2]); | ||
} | ||
/** | ||
* @brief Set RGB LED color | ||
* @param red: red value in range [0-255] | ||
* @param green: green value in range [0-255] | ||
* @param blue: blue value in range [0-255] | ||
* @retval None | ||
*/ | ||
void RGB_LED_TLC59731::on(uint8_t red, uint8_t green, uint8_t blue) | ||
{ | ||
if (!_enabled) { | ||
if (_enable_pin != NC) { | ||
pinMode(pinNametoDigitalPin(_enable_pin), OUTPUT); | ||
digitalWriteFast(_enable_pin, HIGH); | ||
} | ||
pinMode(pinNametoDigitalPin(_rgb_pin), OUTPUT); | ||
_enabled = true; | ||
} | ||
/* Data Transfer Rate (T_CYCLE) Measurement Sequence */ | ||
digitalWriteFast(_rgb_pin, HIGH); | ||
delayMicroseconds(_T_Rise); | ||
digitalWriteFast(_rgb_pin, LOW); | ||
delayMicroseconds(_T_Cycle0); | ||
/* Write command */ | ||
senByte(WRITE_COMMAND); | ||
/* Write the GS data */ | ||
senByte(red); | ||
senByte(green); | ||
senByte(blue); | ||
/* GS Latch */ | ||
delayMicroseconds(_T_GS_Lat); | ||
} | ||
/** | ||
* @brief Set RGB LED Off | ||
* @param None | ||
* @retval None | ||
*/ | ||
void RGB_LED_TLC59731::off(void) | ||
{ | ||
/* Set RGB LED off value */ | ||
on(RGB_LED_TLC59731::OFF); | ||
pinMode(pinNametoDigitalPin(_rgb_pin), INPUT_ANALOG); | ||
if (_enable_pin != NC) { | ||
digitalWriteFast(_enable_pin, LOW); | ||
pinMode(pinNametoDigitalPin(_enable_pin), INPUT_ANALOG); | ||
_enabled = false; | ||
} | ||
} | ||
/** | ||
* @brief Set brightness value | ||
* @param value: new brightness value | ||
* @retval None | ||
*/ | ||
void RGB_LED_TLC59731::setBrightness(uint8_t value) | ||
{ | ||
RGB_LED_TLC59731::brightness = value; | ||
RGB_LED_TLC59731::RED[0] = value; | ||
RGB_LED_TLC59731::GREEN[1] = value; | ||
RGB_LED_TLC59731::BLUE[2] = value; | ||
RGB_LED_TLC59731::MAGENTA[0] = value; | ||
RGB_LED_TLC59731::MAGENTA[2] = value; | ||
RGB_LED_TLC59731::CYAN[1] = value; | ||
RGB_LED_TLC59731::CYAN[2] = value; | ||
RGB_LED_TLC59731::YELLOW[0] = value; | ||
RGB_LED_TLC59731::YELLOW[1] = value; | ||
RGB_LED_TLC59731::WHITE[0] = value; | ||
RGB_LED_TLC59731::WHITE[1] = value; | ||
RGB_LED_TLC59731::WHITE[2] = value; | ||
} | ||
/* Private */ | ||
void RGB_LED_TLC59731::sendBit(uint8_t bit) | ||
{ | ||
/* Start next cycle */ | ||
digitalWriteFast(_rgb_pin, HIGH); | ||
delayMicroseconds(_T_Rise); | ||
digitalWriteFast(_rgb_pin, LOW); | ||
delayMicroseconds(_T_Rise); | ||
if (bit) { | ||
digitalWriteFast(_rgb_pin, HIGH); | ||
delayMicroseconds(_T_Rise); | ||
digitalWriteFast(_rgb_pin, LOW); | ||
delayMicroseconds(_T_Cycle1); | ||
} else { | ||
delayMicroseconds(_T_Cycle0); | ||
} | ||
} | ||
void RGB_LED_TLC59731::senByte(uint8_t byte) | ||
{ | ||
sendBit(byte & (1 << 7)); | ||
sendBit(byte & (1 << 6)); | ||
sendBit(byte & (1 << 5)); | ||
sendBit(byte & (1 << 4)); | ||
sendBit(byte & (1 << 3)); | ||
sendBit(byte & (1 << 2)); | ||
sendBit(byte & (1 << 1)); | ||
sendBit(byte & (1 << 0)); | ||
} |
57 changes: 57 additions & 0 deletionslibraries/RGB_LED_TLC59731/src/RGB_LED_TLC59731.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
******************************************************************************* | ||
* Copyright (c) 2021, STMicroelectronics | ||
* All rights reserved. | ||
* | ||
* This software component is licensed by ST under BSD 3-Clause license, | ||
* the "License"; You may not use this file except in compliance with the | ||
* License. You may obtain a copy of the License at: | ||
* opensource.org/licenses/BSD-3-Clause | ||
* | ||
******************************************************************************* | ||
*/ | ||
#ifndef __RGB_LED_TLC59731_H__ | ||
#define __RGB_LED_TLC59731_H__ | ||
#include "Arduino.h" | ||
class RGB_LED_TLC59731 { | ||
public: | ||
RGB_LED_TLC59731(uint32_t rgb_pin = LED_BUILTIN, uint32_t enable_pin = NC): | ||
_rgb_pin(digitalPinToPinName(rgb_pin)), _enable_pin(digitalPinToPinName(enable_pin)) {}; | ||
void on(uint8_t rgb[3]); | ||
void on(uint8_t red, uint8_t green, uint8_t blue); | ||
void off(void); | ||
inline uint8_t getBrightness(void) | ||
{ | ||
return brightness; | ||
} | ||
void setBrightness(uint8_t value); | ||
static uint8_t brightness; | ||
static uint8_t OFF[3]; | ||
static uint8_t RED[3]; | ||
static uint8_t GREEN[3]; | ||
static uint8_t BLUE[3]; | ||
static uint8_t MAGENTA[3]; | ||
static uint8_t CYAN[3]; | ||
static uint8_t YELLOW[3]; | ||
static uint8_t WHITE[3]; | ||
private: | ||
PinName _rgb_pin; | ||
PinName _enable_pin; | ||
bool _enabled{false}; | ||
const uint32_t _T_Rise{1}; | ||
const uint32_t _T_Cycle0{4}; | ||
const uint32_t _T_Cycle1{1}; | ||
// GS Data Latch (GSLAT) Sequence delay | ||
const uint32_t _T_GS_Lat{_T_Cycle0 * 8}; | ||
void sendBit(uint8_t bit); | ||
void senByte(uint8_t byte); | ||
}; | ||
#endif /* __RGB_LED_TLC59731_H__ */ |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.