libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
led.h
Go to the documentation of this file.
1
2#pragma once
3#ifndef DSY_LED_H
4#define DSY_LED_H
5#include "daisy_core.h"
6#include "per/gpio.h"
7
8/* TODO - Get this set up to work with the dev_leddriver stuff as well
9- Setup Hardware PWM for pins that have it
10*/
11
12namespace daisy
13{
21class Led
22{
23 public:
24 Led() {}
25 ~Led() {}
26
33 void Init(dsy_gpio_pin pin, bool invert, float samplerate = 1000.0f);
34
40 void Set(float val);
41
46 void Update();
47
51 inline void SetSampleRate(float sample_rate) { samplerate_ = sample_rate; }
52
53 private:
54 size_t pwm_cnt_, pwm_thresh_;
55 float bright_;
56 float pwm_;
57 float samplerate_;
58 bool invert_, on_, off_;
59 dsy_gpio hw_pin_;
60};
61
62} // namespace daisy
63
64#endif
Definition leddriver.h:33
LED Class providing simple Software PWM ability, etc Eventually this will work with hardware PWM,...
Definition led.h:22
void Init(dsy_gpio_pin pin, bool invert, float samplerate=1000.0f)
void SetSampleRate(float sample_rate)
Definition led.h:51
void Set(float val)
Led()
Definition led.h:24
~Led()
Definition led.h:25
void Update()
Hardware defines and helpers for daisy field platform.
Definition index.h:2
Definition daisy_core.h:205
Definition gpio.h:175