fix : fix comment and document

This commit is contained in:
downeyboy
2019-07-05 17:09:37 +08:00
parent 76fc3bab28
commit 55f2bd052b
9 changed files with 39 additions and 42 deletions

View File

@@ -2,13 +2,13 @@
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube1; Seeed_Digital_Tube tube1;
Seeee_Digital_Tube tube2; Seeed_Digital_Tube tube2;
/** /**
* NOTICE:Every tubes display has the same default i2c address. * NOTICE:Every tubes display has the same default i2c address.
* if you want to combine two(or more)display in one project,you should change the i2c * if you want to combine two(or more)display in one project,you should change the
* i2c address,by soldering the pad of display backside. * i2c address,by soldering the pad of device's backside.
* please refer to our wiki to get more details. * please refer to our wiki to get more details.
* */ * */
#define I2C_ADDR_AFTER_CHANGE_FOUR 0x75 #define I2C_ADDR_AFTER_CHANGE_FOUR 0x75

View File

@@ -32,7 +32,7 @@
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube; Seeed_Digital_Tube tube;
void setup() void setup()
{ {

View File

@@ -1,5 +1,5 @@
/* /*
* display_custom_4.ino * display_custom.ino
* Example for digital tube. * Example for digital tube.
* *
* Copyright (c) 2018 Seeed Technology Co., Ltd. * Copyright (c) 2018 Seeed Technology Co., Ltd.
@@ -31,12 +31,9 @@
#include <Wire.h> #include <Wire.h>
/*********************************************************/
/*****NOTICE : This example only for qual_alphanumeric****/
/*********************************************************/
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube; Seeed_Digital_Tube tube;
void setup() void setup()

View File

@@ -32,7 +32,7 @@
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube; Seeed_Digital_Tube tube;

View File

@@ -31,7 +31,7 @@
#include <Wire.h> #include <Wire.h>
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube; Seeed_Digital_Tube tube;

View File

@@ -1,5 +1,5 @@
/* /*
* number_increment_2.ino * number_increment.ino
* Driver for digital tube. * Driver for digital tube.
* *
* Copyright (c) 2018 Seeed Technology Co., Ltd. * Copyright (c) 2018 Seeed Technology Co., Ltd.
@@ -32,7 +32,7 @@
#include "grove_alphanumeric_display.h" #include "grove_alphanumeric_display.h"
Seeee_Digital_Tube tube; Seeed_Digital_Tube tube;
char hex_str[10]; char hex_str[10];

View File

@@ -130,14 +130,14 @@ uint16_t g_display_font2[]={
}; };
Seeee_Digital_Tube::Seeee_Digital_Tube() Seeed_Digital_Tube::Seeed_Digital_Tube()
{ {
_ms = 100; _ms = 100;
} }
void Seeee_Digital_Tube::setTubeType(TubeType_t type,uint8_t addr) void Seeed_Digital_Tube::setTubeType(TubeType_t type,uint8_t addr)
{ {
_type = type; _type = type;
(_type == TYPE_2) ? (_tube_cnt = CNT_2) : (_tube_cnt = CNT_4); (_type == TYPE_2) ? (_tube_cnt = CNT_2) : (_tube_cnt = CNT_4);
@@ -145,7 +145,7 @@ void Seeee_Digital_Tube::setTubeType(TubeType_t type,uint8_t addr)
HT16K33::init(addr); HT16K33::init(addr);
} }
bool Seeee_Digital_Tube::isLegalToDisplay(char byte) bool Seeed_Digital_Tube::isLegalToDisplay(char byte)
{ {
if( !((byte >= '.' && byte <= '9') || (byte >= 'A' && byte <= 'Z') || (byte >= 'a' && byte <= 'z') ) ) if( !((byte >= '.' && byte <= '9') || (byte >= 'A' && byte <= 'Z') || (byte >= 'a' && byte <= 'z') ) )
return false; return false;
@@ -160,7 +160,7 @@ bool Seeee_Digital_Tube::isLegalToDisplay(char byte)
* @param num the number to display. * @param num the number to display.
* @param interval :the interval of scroll number. * @param interval :the interval of scroll number.
* */ * */
void Seeee_Digital_Tube::displayNum(uint32_t num,uint32_t interval) void Seeed_Digital_Tube::displayNum(uint32_t num,uint32_t interval)
{ {
char num_str[15] = {0}; char num_str[15] = {0};
sprintf(num_str,"%ld",(uint32_t)num); sprintf(num_str,"%ld",(uint32_t)num);
@@ -169,7 +169,7 @@ void Seeee_Digital_Tube::displayNum(uint32_t num,uint32_t interval)
void Seeee_Digital_Tube::shiftDisplay(char *origin_disp_buf,char new_item) void Seeed_Digital_Tube::shiftDisplay(char *origin_disp_buf,char new_item)
{ {
char temp[MAX_TUBE_COUNT] = {0}; char temp[MAX_TUBE_COUNT] = {0};
@@ -193,7 +193,7 @@ void Seeee_Digital_Tube::shiftDisplay(char *origin_disp_buf,char new_item)
* @param str the str to display. * @param str the str to display.
* @param interval :the interval of scroll string. * @param interval :the interval of scroll string.
* */ * */
void Seeee_Digital_Tube::displayString(char *str,uint32_t interval) void Seeed_Digital_Tube::displayString(char *str,uint32_t interval)
{ {
int len = 0; int len = 0;
clearBuf(); clearBuf();
@@ -230,7 +230,7 @@ void Seeee_Digital_Tube::displayString(char *str,uint32_t interval)
} }
void Seeee_Digital_Tube::clear() void Seeed_Digital_Tube::clear()
{ {
memset(_buffer, 0, sizeof(_buffer)); memset(_buffer, 0, sizeof(_buffer));
writeBytes(_addr, 0x00, 16, _buffer); writeBytes(_addr, 0x00, 16, _buffer);
@@ -238,7 +238,7 @@ void Seeee_Digital_Tube::clear()
} }
void Seeee_Digital_Tube::fulDisplay() void Seeed_Digital_Tube::fulDisplay()
{ {
uint8_t buf[16] = {0}; uint8_t buf[16] = {0};
memcpy(_buffer,buf,sizeof(buf)); memcpy(_buffer,buf,sizeof(buf));
@@ -247,12 +247,12 @@ void Seeee_Digital_Tube::fulDisplay()
delay(_ms); delay(_ms);
} }
/** Because of the difference of the hardware design of two kinds of display(two & four tubes). /** There are some differences of the hardware design of two kinds of display(two & four tubes).
* two digital tubes use _buffer[2,3,4,5] to control display. * two digital tubes use _buffer[2,3,4,5] to control display.
* four digital tubes use _buffer[2,3,4,5,6,7,8,9,10,11] to control display. * four digital tubes use _buffer[2,3,4,5,6,7,8,9,10,11] to control display.
* *
**/ **/
void Seeee_Digital_Tube::replace_bit12(TubeNum tube_num,bool bit1,bool bit2) void Seeed_Digital_Tube::replace_bit12(TubeNum tube_num,bool bit1,bool bit2)
{ {
switch(tube_num) switch(tube_num)
{ {
@@ -289,7 +289,7 @@ void Seeee_Digital_Tube::replace_bit12(TubeNum tube_num,bool bit1,bool bit2)
} }
} }
void Seeee_Digital_Tube::setPoint(bool first_dot,bool second_dot) void Seeed_Digital_Tube::setPoint(bool first_dot,bool second_dot)
{ {
if( TYPE_4 == _type ) if( TYPE_4 == _type )
{ {
@@ -317,7 +317,7 @@ void Seeee_Digital_Tube::setPoint(bool first_dot,bool second_dot)
} }
void Seeee_Digital_Tube::setTubeBuf(TubeNum tube_num,char byte) void Seeed_Digital_Tube::setTubeBuf(TubeNum tube_num,char byte)
{ {
uint16_t value = disp_font_p[get_char_index(byte)]; uint16_t value = disp_font_p[get_char_index(byte)];
@@ -363,7 +363,7 @@ void Seeee_Digital_Tube::setTubeBuf(TubeNum tube_num,char byte)
* @param tube_num The number of tube ,total 4. * @param tube_num The number of tube ,total 4.
* @param c ,The char to display * @param c ,The char to display
* */ * */
void Seeee_Digital_Tube::setTubeSingleChar(TubeNum tube_num,char c) void Seeed_Digital_Tube::setTubeSingleChar(TubeNum tube_num,char c)
{ {
if(!( ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')) || (c=='.') ) ) if(!( ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')) || (c=='.') ) )
{ {
@@ -389,7 +389,7 @@ void Seeee_Digital_Tube::setTubeSingleChar(TubeNum tube_num,char c)
* @param tube_num The number of tube ,total 4. * @param tube_num The number of tube ,total 4.
* @param num ,The number to display * @param num ,The number to display
* */ * */
void Seeee_Digital_Tube::setTubeSingleNum(TubeNum tube_num,char num) void Seeed_Digital_Tube::setTubeSingleNum(TubeNum tube_num,char num)
{ {
if( !((num >= 0) && (num <= 9)) ) if( !((num >= 0) && (num <= 9)) )
return ; return ;
@@ -411,7 +411,7 @@ void Seeee_Digital_Tube::setTubeSingleNum(TubeNum tube_num,char num)
} }
void Seeee_Digital_Tube::display_one_tube(TubeNum tube_num,uint16_t value) void Seeed_Digital_Tube::display_one_tube(TubeNum tube_num,uint16_t value)
{ {
_buffer[tube_num*2] = value; _buffer[tube_num*2] = value;
_buffer[tube_num*2+1] = value >> 8; _buffer[tube_num*2+1] = value >> 8;
@@ -421,12 +421,12 @@ void Seeee_Digital_Tube::display_one_tube(TubeNum tube_num,uint16_t value)
} }
void Seeee_Digital_Tube::clearBuf() void Seeed_Digital_Tube::clearBuf()
{ {
memset(_buffer,0,sizeof(_buffer)); memset(_buffer,0,sizeof(_buffer));
} }
int Seeee_Digital_Tube::get_char_index(char c) int Seeed_Digital_Tube::get_char_index(char c)
{ {
if((c >= '0') && (c <= '9')) if((c >= '0') && (c <= '9'))
{ {
@@ -447,7 +447,7 @@ int Seeee_Digital_Tube::get_char_index(char c)
} }
void Seeee_Digital_Tube::display() void Seeed_Digital_Tube::display()
{ {
writeBytes(_addr, 0x00, 16, _buffer); writeBytes(_addr, 0x00, 16, _buffer);
delay(_ms); delay(_ms);

View File

@@ -72,22 +72,22 @@ typedef enum{
CNT_4 = 4, CNT_4 = 4,
}TubeCnt_t; }TubeCnt_t;
class Seeee_Digital_Tube : public HT16K33 { class Seeed_Digital_Tube : public HT16K33 {
public: public:
Seeee_Digital_Tube(); Seeed_Digital_Tube();
void setTubeType(TubeType_t type,uint8_t addr = TYPE_2_DEFAULT_I2C_ADDR); void setTubeType(TubeType_t type,uint8_t addr = TYPE_2_DEFAULT_I2C_ADDR);
void clear(); void clear();
/**@brief Display number,If the param-num's len less than 4,The tubes display static number,otherwise,it displays scroll number. /**@brief Display number,If the param-num's len less than count of tubes(2 or 4),The tubes display static number,otherwise,it displays scroll number.
* When it displays scroll number,the param interval is scrolling interval(ms) .. * When it displays scroll number,the param interval is scrolling interval(ms) ..
* @param num the number to display. * @param num the number to display.
* @param interval :the interval of scroll number. * @param interval :the interval of scroll number.
* */ * */
void displayNum(uint32_t num,uint32_t interval = 0); void displayNum(uint32_t num,uint32_t interval = 0);
/**@brief Display string,If the param-str's len less than 4,The tubes display static string,otherwise,it displays scroll string. /**@brief Display string,If the param-str's len less than count of tube(2 or 4),The tubes display static string,otherwise,it displays scroll string.
* When it displays scroll string,the param interval is scrolling interval(ms) .. * When it displays scroll string,the param interval is scrolling interval(ms) ..
* @param str the str to display. * @param str the str to display.
* @param interval :the interval of scroll string. * @param interval :the interval of scroll string.
@@ -111,20 +111,20 @@ public:
void display(); void display();
/**@brief Specify the display char of a digital tube. /**@brief Specify the display char of a digital tube.
* @param tube_num The number of tube ,total 4. * @param tube_num The number of tube ,depend on the device you are using (max : 2 or 4).
* @param num ,The number to display * @param num ,The number to display
* */ * */
void setTubeSingleChar(TubeNum tube_num,char c); void setTubeSingleChar(TubeNum tube_num,char c);
/**@brief Specify the display number of a digital tube. /**@brief Specify the display number of a digital tube.
* @param tube_num The number of tube ,total 4. * @param tube_num The number of tube ,depend on the device you are using ( max : 2 or 4).
* @param num ,The number to display * @param num ,The number to display
* */ * */
void setTubeSingleNum(TubeNum tube_num,char num); void setTubeSingleNum(TubeNum tube_num,char num);
/**@brief Set two points status. /**@brief Set two points status.
* @prarm upper_on if true,the upper point light on ,otherwise turn off; * @prarm upper_on if true,the first point light on ,otherwise turn off;
* @prarm lower_on if true,the upper point light on ,otherwise turn off; * @prarm lower_on if true,the second point light on ,otherwise turn off;
* */ * */
void setPoint(bool first_dot,bool second_dot); void setPoint(bool first_dot,bool second_dot);
private: private:

View File

@@ -5,7 +5,7 @@
####################################### #######################################
# Datatypes (KEYWORD1) # Datatypes (KEYWORD1)
####################################### #######################################
Seeee_Digital_Tube KEYWORD1 Seeed_Digital_Tube KEYWORD1
####################################### #######################################
# Methods and Functions (KEYWORD2) # Methods and Functions (KEYWORD2)