GY-63_MS5611/libraries/TLC5947/TLC5947.h

59 lines
1.1 KiB
C
Raw Normal View History

2023-06-18 04:51:50 -04:00
#pragma once
//
// FILE: TLC5947.h
// AUTHOR: Rob Tillaart
2023-11-22 11:13:58 -05:00
// VERSION: 0.1.2
2023-06-18 04:51:50 -04:00
// DATE: 2023-06-17
// PURPOSE: Arduino library for the TLC5947 24 channel PWM device
// URL: https://github.com/RobTillaart/TLC5947
2023-11-22 11:13:58 -05:00
#define TLC5947_LIB_VERSION (F("0.1.2"))
2023-06-18 04:51:50 -04:00
#include "Arduino.h"
#define TLC5947_MAX_CHANNELS 24
2023-06-22 11:44:23 -04:00
2023-11-22 11:13:58 -05:00
#define TLC5947_CHANNEL_ERROR 0xFFFF
2023-06-18 04:51:50 -04:00
class TLC5947
{
public:
TLC5947(uint8_t clock, uint8_t data, uint8_t latch, uint8_t blank);
~TLC5947();
bool begin();
// fill the buffer
2023-06-22 11:44:23 -04:00
bool setPWM(uint8_t channel, uint16_t PWM);
2023-06-18 04:51:50 -04:00
void setAll(uint16_t PWM);
// get from the buffer, might differ from device!
uint16_t getPWM(uint8_t channel);
2023-06-22 11:44:23 -04:00
// percentage wrappers
bool setPercentage(uint8_t channel, float perc);
void setPercentageAll(float perc);
float getPercentage(uint8_t channel);
2023-06-18 04:51:50 -04:00
// write the buffer to the device
void write();
// control the blank line.
void enable();
void disable();
private:
uint16_t *_buffer;
uint8_t _clock;
uint8_t _data;
uint8_t _latch;
uint8_t _blank;
};
// -- END OF FILE --