1 /*
2  * Copyright (c) 2022 OpenLuat & AirM2M
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy of
5  * this software and associated documentation files (the "Software"), to deal in
6  * the Software without restriction, including without limitation the rights to
7  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8  * the Software, and to permit persons to whom the Software is furnished to do so,
9  * subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all
12  * copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20  */
21 
22 #ifndef __CORE_SERVICE_H__
23 #define __CORE_SERVICE_H__
24 #include "bsp_common.h"
25 
26 typedef struct
27 {
28     uint32_t Speed;
29     uint32_t x1;
30     uint32_t y1;
31     uint32_t x2;
32     uint32_t y2;
33     uint32_t xoffset;
34     uint32_t yoffset;
35     uint32_t Size;
36     uint32_t DCDelay;
37     uint8_t *Data;
38     uint8_t SpiID;
39     uint8_t Mode;
40     uint8_t CSPin;
41     uint8_t DCPin;
42     uint8_t ColorMode;
43 }LCD_DrawStruct;
44 
45 void Core_ServiceInit(void);
46 void Core_LCDDraw(LCD_DrawStruct *Draw);
47 void Core_CameraDraw(LCD_DrawStruct *Draw);
48 void Core_DecodeQR(uint8_t *ImageData, uint16_t ImageW, uint16_t ImageH,  CBDataFun_t CB);
49 uint32_t Core_LCDDrawCacheLen(void);
50 void Core_USBDefaultDeviceStart(uint8_t USB_ID);
51 void Core_USBAction(uint8_t USB_ID, uint8_t Action, void *pParam);
52 void Core_PrintMemInfo(void);
53 void Core_PrintServiceStack(void);
54 void Core_DebugMem(uint8_t HeapID, const char *FuncName, uint32_t Line);
55 
56 uint8_t Core_GetSleepFlag(void);
57 void Core_SetSleepEnable(uint8_t OnOff);
58 
59 void Core_VUartInit(uint8_t UartID, uint32_t BaudRate, uint8_t IsRxCacheEnable, uint8_t DataBits, uint8_t Parity, uint8_t StopBits, CBFuncEx_t CB);
60 void Core_VUartDeInit(uint8_t UartID);
61 void Core_VUartSetRxTimeout(uint8_t UartID, uint32_t TimeoutUS);
62 void Core_VUartSetCb(uint8_t UartID, CBFuncEx_t CB);
63 uint32_t Core_VUartRxBufferRead(uint8_t UartID, uint8_t *Data, uint32_t Len);
64 int32_t Core_VUartBufferTx(uint8_t UartID, const uint8_t *Data, uint32_t Len);
65 void Core_VUartBufferTxStop(uint8_t UartID);
66 
67 void Core_VHIDInit(uint8_t USB_ID, CBFuncEx_t CB);
68 void Core_VHIDUploadData(uint8_t USB_ID, uint8_t *Data, uint16_t Len);
69 void Core_VHIDUploadStop(uint8_t USB_ID);
70 #endif
71