GY-63_MS5611/libraries/TM1637_RT/TM1637.h

66 lines
1.5 KiB
C
Raw Normal View History

2021-04-25 13:56:44 -04:00
#pragma once
//
// FILE: TM1637.h
// AUTHOR: Rob Tillaart
// DATE: 2019-10-28
2022-04-21 10:40:24 -04:00
// VERSION: 0.3.2
2021-04-25 13:56:44 -04:00
// PUPROSE: TM1637 library for Arduino
// URL: https://github.com/RobTillaart/TM1637_RT
// only tested on 6 digit display yet
#include "Arduino.h"
2022-04-21 10:40:24 -04:00
#define TM1637_LIB_VERSION (F("0.3.2"))
2021-04-25 13:56:44 -04:00
class TM1637
{
public:
TM1637();
void init(uint8_t clockPin, uint8_t dataPin, uint8_t digits = 6);
void displayRaw(uint8_t * data, uint8_t pointPos);
void displayInt(long value);
void displayFloat(float value);
void displayHex(uint32_t value);
void displayClear();
void setBrightness(uint8_t b);
uint8_t getBrightness() { return _brightness; };
// tune the timing of writing bytes.
void setBitDelay(uint8_t bitDelay = 10) { _bitDelay = bitDelay; };
uint8_t getBitDelay() { return _bitDelay; };
2021-10-28 04:02:41 -04:00
uint8_t keyscan(void);
2021-04-25 13:56:44 -04:00
2022-04-21 10:40:24 -04:00
// the order the individual digits must be sent to the display.
void setDigitOrder(uint8_t a = 0, uint8_t b = 1,
uint8_t c = 2, uint8_t d = 3,
uint8_t e = 4, uint8_t f = 5,
uint8_t g = 6, uint8_t h = 7);
2021-12-29 06:48:28 -05:00
2021-04-25 13:56:44 -04:00
private:
uint8_t _clock = -1;
uint8_t _data = -1;
uint8_t _digits = 4;
uint8_t _brightness = 3;
uint8_t _bitDelay = 10;
2022-04-21 10:40:24 -04:00
uint8_t _digitOrder[8];
2021-04-25 13:56:44 -04:00
uint8_t writeByte(uint8_t data);
void start();
void stop();
2021-09-26 15:09:33 -04:00
void writeSync(uint8_t pin, uint8_t val);
void nanoDelay(uint16_t n);
2021-04-25 13:56:44 -04:00
};
2021-12-29 06:48:28 -05:00
2021-04-25 13:56:44 -04:00
// -- END OF FILE --
2021-12-29 06:48:28 -05:00