|
|
@@ -1,10 +1,5 @@
|
|
1
|
1
|
package utils
|
|
2
|
2
|
|
|
3
|
|
-import (
|
|
4
|
|
- "fmt"
|
|
5
|
|
- "strings"
|
|
6
|
|
-)
|
|
7
|
|
-
|
|
8
|
3
|
type Uint24 [3]byte
|
|
9
|
4
|
|
|
10
|
5
|
func ToUint24(number uint32) Uint24 {
|
|
|
@@ -14,17 +9,3 @@ func ToUint24(number uint32) Uint24 {
|
|
14
|
9
|
func FromUint24(number Uint24) uint32 {
|
|
15
|
10
|
return uint32(number[0]) + (uint32(number[1]) << 8) + (uint32(number[2]) << 16)
|
|
16
|
11
|
}
|
|
17
|
|
-
|
|
18
|
|
-func Hexify(data []byte) string {
|
|
19
|
|
- s := []string{}
|
|
20
|
|
-
|
|
21
|
|
- for _, v := range data {
|
|
22
|
|
- if v < 0x10 {
|
|
23
|
|
- s = append(s, fmt.Sprintf("0x0%x", v))
|
|
24
|
|
- } else {
|
|
25
|
|
- s = append(s, fmt.Sprintf("0x%x", v))
|
|
26
|
|
- }
|
|
27
|
|
- }
|
|
28
|
|
-
|
|
29
|
|
- return strings.Join(s, " ")
|
|
30
|
|
-}
|