Added ulong2uchar (version 3.5).
This commit is contained in:
parent
87a6ed0795
commit
c85b090306
@ -13,6 +13,9 @@ uint32_t uchar2ulong(uint8_t Highbyte, uint8_t MHbyte, uint8_t MLbyte, uint8_t L
|
||||
|
||||
uint8_t uint2uchar(uint16_t uival, bool getHighB);
|
||||
|
||||
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr);
|
||||
// getBytNr: 0=LSB 3=MSB
|
||||
|
||||
|
||||
void delay(uint16_t MilliSec);
|
||||
|
||||
|
@ -76,6 +76,23 @@ uint8_t uint2uchar(uint16_t uival, bool getHighB)
|
||||
}
|
||||
|
||||
|
||||
uint8_t ulong2uchar(uint32_t ulval, uint8_t getBytNr)
|
||||
{
|
||||
// getBytNr: 0=LSB 3=MSB
|
||||
uint32_t ultmp=ulval;
|
||||
if (getBytNr==0)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
if (getBytNr==1)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
if (getBytNr==2)
|
||||
return uint8_t(ultmp);
|
||||
ultmp>>=8;
|
||||
return uint8_t(ultmp);
|
||||
|
||||
}
|
||||
|
||||
void delay(uint16_t MilliSec)
|
||||
{
|
||||
QThread::msleep(uint32_t(MilliSec));
|
||||
|
Loading…
Reference in New Issue
Block a user