MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
Me7SegmentDisplay.h
Go to the documentation of this file.
1
82/* Define to prevent recursive inclusion -------------------------------------*/
83#ifndef Me7SegmentDisplay_H
84#define Me7SegmentDisplay_H
85
86//************definitions for TM1637*********************
87#include <stdint.h>
88#include <stdbool.h>
89#include <Arduino.h>
90#include "MeConfig.h"
91
92#ifdef ME_PORT_DEFINED
93#include "MePort.h"
94#endif // ME_PORT_DEFINED
95
96/* Exported constants --------------------------------------------------------*/
97/******************definitions for TM1637**********************/
98 const uint8_t ADDR_AUTO = 0x40; //Automatic address increment mode
99 const uint8_t ADDR_FIXED = 0x44; //Fixed address mode
100 const uint8_t STARTADDR = 0xc0; //start address of display register
101 const uint8_t SEGDIS_ON = 0x88; //diplay on
102 const uint8_t SEGDIS_OFF = 0x80; //diplay off
103/**** definitions for the clock point of the digit tube *******/
104 const uint8_t POINT_ON = 1;
105 const uint8_t POINT_OFF = 0;
106/**************definitions for brightness***********************/
107 const uint8_t BRIGHTNESS_0 = 0;
108 const uint8_t BRIGHTNESS_1 = 1;
109 const uint8_t BRIGHTNESS_2 = 2;
110 const uint8_t BRIGHTNESS_3 = 3;
111 const uint8_t BRIGHTNESS_4 = 4;
112 const uint8_t BRIGHTNESS_5 = 5;
113 const uint8_t BRIGHTNESS_6 = 6;
114 const uint8_t BRIGHTNESS_7 = 7;
116
122#ifndef ME_PORT_DEFINED
123 class Me7SegmentDisplay
124#else // ME_PORT_DEFINED
125class Me7SegmentDisplay :public MePort
126#endif // ME_PORT_DEFINED
127{
128 public:
129#ifdef ME_PORT_DEFINED
136 Me7SegmentDisplay(void);
137
144 Me7SegmentDisplay(uint8_t port);
145#else // ME_PORT_DEFINED
153 Me7SegmentDisplay(uint8_t dataPin, uint8_t clkPin);
154#endif // ME_PORT_DEFINED
155#ifdef ME_PORT_DEFINED
170 void reset(uint8_t port);
171#endif // ME_PORT_DEFINED
184 void init(void); // Clear display
185
206 void set(uint8_t = BRIGHTNESS_2, uint8_t = ADDR_AUTO, uint8_t = STARTADDR);// Take effect next display cycle.
207
224 void setpin(uint8_t dataPin, uint8_t clkPin);
225
240 void write(uint8_t SegData[]);
241
258 void write(uint8_t BitAddr, uint8_t SegData);
259
274 void display(uint16_t value);
275
290 void display(int16_t value);
291
306 void display(float value);
307
322 void display(long value);
323
340 int16_t checkNum(float v,int16_t b);
341
358 void display(double value, uint8_t = 1);
359
374 void display(uint8_t DispData[]);
375
392 void display(uint8_t BitAddr, uint8_t DispData);
393
412 void display(uint8_t BitAddr, uint8_t DispData, uint8_t point_on);
413
426 void clearDisplay(void);
427
442 void setBrightness(uint8_t brightness);
443
458 void coding(uint8_t DispData[]);
459
474 uint8_t coding(uint8_t DispData);
475 private:
476 uint8_t Cmd_SetData;
477 uint8_t Cmd_SetAddr;
478 uint8_t Cmd_DispCtrl;
479 bool _PointFlag; //_PointFlag=1:the clock point on
480
495 void writeByte(uint8_t wr_data);// Write 8 bits data to tm1637.
496
511 void start(void);// Send start bits
512 void point(bool PointFlag);// Whether to light the clock point ":". Take effect next display cycle.
513
528 void stop(void); // Send stop bits.
529 uint8_t _clkPin;
530 uint8_t _dataPin;
531};
532#endif
MeConfig.h
Configuration file of library.
MePort.h
Header for MePort.cpp module.
Me7SegmentDisplay
Class for numeric display module.
Definition Me7SegmentDisplay.h:127
Me7SegmentDisplay::Me7SegmentDisplay
Me7SegmentDisplay(void)
Definition Me7SegmentDisplay.cpp:102
Me7SegmentDisplay::write
void write(uint8_t SegData[])
Definition Me7SegmentDisplay.cpp:342
Me7SegmentDisplay::checkNum
int16_t checkNum(float v, int16_t b)
Definition Me7SegmentDisplay.cpp:518
Me7SegmentDisplay::set
void set(uint8_t=BRIGHTNESS_2, uint8_t=ADDR_AUTO, uint8_t=STARTADDR)
Definition Me7SegmentDisplay.cpp:750
Me7SegmentDisplay::setpin
void setpin(uint8_t dataPin, uint8_t clkPin)
Definition Me7SegmentDisplay.cpp:187
Me7SegmentDisplay::setBrightness
void setBrightness(uint8_t brightness)
Definition Me7SegmentDisplay.cpp:771
Me7SegmentDisplay::clearDisplay
void clearDisplay(void)
Definition Me7SegmentDisplay.cpp:210
Me7SegmentDisplay::display
void display(uint16_t value)
Definition Me7SegmentDisplay.cpp:404
Me7SegmentDisplay::reset
void reset(uint8_t port)
Definition Me7SegmentDisplay.cpp:157
Me7SegmentDisplay::coding
void coding(uint8_t DispData[])
Definition Me7SegmentDisplay.cpp:790
MePort
Port Mapping for RJ25.
Definition MePort.h:128