commit
9fc272c510
|
@ -717,12 +717,73 @@ void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber,
|
|||
}
|
||||
|
||||
//Converts a number to a string
|
||||
while (Nummber) {
|
||||
do {
|
||||
Num_Array[Num_Bit] = Nummber % 10 + '0';
|
||||
Num_Bit++;
|
||||
Nummber /= 10;
|
||||
} while(Nummber);
|
||||
|
||||
|
||||
//The string is inverted
|
||||
while (Num_Bit > 0) {
|
||||
Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
|
||||
Str_Bit ++;
|
||||
Num_Bit --;
|
||||
}
|
||||
|
||||
//show
|
||||
Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Background, Color_Foreground);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display nummber (Able to display decimals)
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
Nummber : The number displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Digit : Fractional width
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawNumDecimals(UWORD Xpoint, UWORD Ypoint, double Nummber,
|
||||
sFONT* Font, UWORD Digit, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
int16_t Num_Bit = 0, Str_Bit = 0;
|
||||
uint8_t Str_Array[ARRAY_LEN] = {0}, Num_Array[ARRAY_LEN] = {0};
|
||||
uint8_t *pStr = Str_Array;
|
||||
int temp = Nummber;
|
||||
float decimals;
|
||||
uint8_t i;
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DisNum Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(Digit > 0) {
|
||||
decimals = Nummber - temp;
|
||||
for(i=Digit; i > 0; i--) {
|
||||
decimals*=10;
|
||||
}
|
||||
temp = decimals;
|
||||
//Converts a number to a string
|
||||
for(i=Digit; i>0; i--) {
|
||||
Num_Array[Num_Bit] = temp % 10 + '0';
|
||||
Num_Bit++;
|
||||
temp /= 10;
|
||||
}
|
||||
Num_Array[Num_Bit] = '.';
|
||||
Num_Bit++;
|
||||
}
|
||||
|
||||
temp = Nummber;
|
||||
//Converts a number to a string
|
||||
do {
|
||||
Num_Array[Num_Bit] = temp % 10 + '0';
|
||||
Num_Bit++;
|
||||
temp /= 10;
|
||||
} while(temp);
|
||||
|
||||
//The string is inverted
|
||||
while (Num_Bit > 0) {
|
||||
Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
|
||||
|
|
|
@ -202,6 +202,7 @@ void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Fo
|
|||
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawNumDecimals(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Font, UWORD Digit, UWORD Color_Foreground, UWORD Color_Background); // Able to display decimals
|
||||
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
|
||||
//pic
|
||||
|
|
|
@ -15,7 +15,8 @@ EPD model EPD define (EPD=)
|
|||
2.9inch e-Paper (B)/(C) epd2in9bc
|
||||
2.9inch e-Paper (B) (V3) epd2in9bV3
|
||||
2.9inch e-Paper (D) epd2in9d
|
||||
2.9inch e-Paper (V3) epd2in13V3
|
||||
2.13inch e-Paper (V2) epd2in13V2
|
||||
2.13inch e-Paper (V3) epd2in13V3
|
||||
2.13inch e-Paper (B)/(C) epd2in13bc
|
||||
2.13inch e-Paper (B) (V3) epd2in13bV3
|
||||
2.13inch e-Paper (B) (V4) epd2in13bV4
|
||||
|
|
|
@ -124,7 +124,7 @@ class EPD:
|
|||
def send_data2(self, data):
|
||||
epdconfig.digital_write(self.dc_pin, 1)
|
||||
epdconfig.digital_write(self.cs_pin, 0)
|
||||
epdconfig.SPI.writebytes2(data)
|
||||
epdconfig.spi_writebyte2(data)
|
||||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
|
|
|
@ -70,7 +70,7 @@ class EPD:
|
|||
def send_data2(self, data): #faster
|
||||
epdconfig.digital_write(self.dc_pin, 1)
|
||||
epdconfig.digital_write(self.cs_pin, 0)
|
||||
epdconfig.SPI.writebytes2(data)
|
||||
epdconfig.spi_writebyte2(data)
|
||||
epdconfig.digital_write(self.cs_pin, 1)
|
||||
|
||||
def ReadBusy(self):
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
import os
|
||||
import logging
|
||||
from ossaudiodev import SOUND_MIXER_SPEAKER
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
|
Loading…
Reference in New Issue