mirror of
https://github.com/openharmony/vendor_lockzhiner.git
synced 2026-06-30 21:47:55 -04:00
@@ -56,7 +56,7 @@ Note:If the text contains special characters, please escape them according to th
|
||||
-->
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile>build/LICENSE|third_party/LICENSE</licensefile>
|
||||
<LICENSE>build/LICENSE|third_party/LICENSE</LICENSE>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="FuZhou Lockzhiner Electronic Co., Ltd." path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc=""/>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_helloworld()
|
||||
void task_helloworld(void)
|
||||
{
|
||||
while (1) {
|
||||
printf("Hello World\n");
|
||||
@@ -46,7 +46,7 @@ void task_helloworld()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_openharmony()
|
||||
void task_openharmony(void)
|
||||
{
|
||||
while (1) {
|
||||
printf("Hello OpenHarmony\n");
|
||||
@@ -61,7 +61,7 @@ void task_openharmony()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void helloworld_example()
|
||||
void helloworld_example(void)
|
||||
{
|
||||
/* 任务id */
|
||||
unsigned int thread_id1;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_one()
|
||||
void task_one(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
printf("This is %s\n", __func__);
|
||||
@@ -46,7 +46,7 @@ void task_one()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_two()
|
||||
void task_two(void *arg)
|
||||
{
|
||||
while (1) {
|
||||
printf("This is %s\n", __func__);
|
||||
@@ -60,7 +60,7 @@ void task_two()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_example()
|
||||
void task_example(void)
|
||||
{
|
||||
unsigned int thread_id1;
|
||||
unsigned int thread_id2;
|
||||
|
||||
@@ -36,7 +36,7 @@ static unsigned int m_sem;
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void control_thread()
|
||||
void control_thread(void)
|
||||
{
|
||||
#define CYCLES 3
|
||||
unsigned int count = 0;
|
||||
@@ -65,10 +65,10 @@ void control_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void sem_one_thread()
|
||||
void sem_one_thread(void)
|
||||
{
|
||||
while (1) {
|
||||
/*申请信号量*/
|
||||
/* 申请信号量 */
|
||||
LOS_SemPend(m_sem, LOS_WAIT_FOREVER);
|
||||
|
||||
printf("sem_one_thread get Semaphore\n");
|
||||
@@ -82,10 +82,10 @@ void sem_one_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void sem_two_thread()
|
||||
void sem_two_thread(void)
|
||||
{
|
||||
while (1) {
|
||||
/*申请信号量*/
|
||||
/* 申请信号量 */
|
||||
LOS_SemPend(m_sem, LOS_WAIT_FOREVER);
|
||||
|
||||
printf("sem_two_thread get Semaphore\n");
|
||||
@@ -99,7 +99,7 @@ void sem_two_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void semaphore_example()
|
||||
void semaphore_example(void)
|
||||
{
|
||||
unsigned int thread_crtl;
|
||||
unsigned int thread_id1;
|
||||
|
||||
@@ -48,7 +48,7 @@ void timer2_timeout(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void timer_example()
|
||||
void timer_example(void)
|
||||
{
|
||||
unsigned int timer_id1, timer_id2;
|
||||
unsigned int ret;
|
||||
|
||||
@@ -35,7 +35,7 @@ static unsigned int m_data = 0;
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void write_thread()
|
||||
void write_thread(void)
|
||||
{
|
||||
while (1) {
|
||||
LOS_MuxPend(m_mutex_id, LOS_WAIT_FOREVER);
|
||||
@@ -54,9 +54,9 @@ void write_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void read_thread()
|
||||
void read_thread(void)
|
||||
{
|
||||
/*delay 1s*/
|
||||
/* delay 1s */
|
||||
LOS_Msleep(READ_WAIT_MSEC);
|
||||
|
||||
while (1) {
|
||||
@@ -74,7 +74,7 @@ void read_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void mutex_example()
|
||||
void mutex_example(void)
|
||||
{
|
||||
unsigned int thread_id1;
|
||||
unsigned int thread_id2;
|
||||
|
||||
@@ -51,7 +51,7 @@ void msg_write_thread(void *arg)
|
||||
printf("%s write Message Queue msg:%u\n", __func__, data);
|
||||
}
|
||||
|
||||
/*delay 1s*/
|
||||
/* delay 1s */
|
||||
LOS_Msleep(MSG_WRITE_WAIT_MSEC);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ void msg_read_thread(void *arg)
|
||||
unsigned int *pData = NULL;
|
||||
|
||||
while (1) {
|
||||
/*wait for message*/
|
||||
/* wait for message */
|
||||
ret = LOS_QueueRead(m_msg_queue, (void *)&addr, BUFFER_LEN, LOS_WAIT_FOREVER);
|
||||
if (ret == LOS_OK) {
|
||||
pData = addr;
|
||||
@@ -86,7 +86,7 @@ void msg_read_thread(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void queue_example()
|
||||
void queue_example(void)
|
||||
{
|
||||
unsigned int thread_id1;
|
||||
unsigned int thread_id2;
|
||||
|
||||
@@ -39,7 +39,7 @@ static EVENT_CB_S m_event;
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void event_master_thread()
|
||||
void event_master_thread(void)
|
||||
{
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
@@ -52,7 +52,7 @@ void event_master_thread()
|
||||
printf("%s write event failed ret:0x%x\n", __func__, ret);
|
||||
}
|
||||
|
||||
/*delay 1s*/
|
||||
/* delay 1s */
|
||||
LOS_Msleep(EVENT_DELAY_MSEC);
|
||||
LOS_EventClear(&m_event, ~m_event.uwEventID);
|
||||
}
|
||||
@@ -64,12 +64,12 @@ void event_master_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void event_slave_thread()
|
||||
void event_slave_thread(void)
|
||||
{
|
||||
unsigned int event;
|
||||
|
||||
while (1) {
|
||||
/* 阻塞方式读事件,等待事件到达*/
|
||||
/* 阻塞方式读事件,等待事件到达 */
|
||||
event = LOS_EventRead(&m_event, EVENT_WAIT, LOS_WAITMODE_AND, LOS_WAIT_FOREVER);
|
||||
printf("%s read event:0x%x\n", __func__, event);
|
||||
LOS_Msleep(SLAVE_EVENT_DELAY_MSEC);
|
||||
@@ -82,7 +82,7 @@ void event_slave_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void event_example()
|
||||
void event_example(void)
|
||||
{
|
||||
unsigned int thread_id1;
|
||||
unsigned int thread_id2;
|
||||
|
||||
@@ -35,7 +35,14 @@
|
||||
static DevIo m_adcKey = {
|
||||
.isr = {.gpio = INVALID_GPIO},
|
||||
.rst = {.gpio = INVALID_GPIO},
|
||||
.ctrl1 = {.gpio = GPIO0_PC5, .func = MUX_FUNC1, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_IN, .val = LZGPIO_LEVEL_KEEP},
|
||||
.ctrl1 = {
|
||||
.gpio = GPIO0_PC5,
|
||||
.func = MUX_FUNC1,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_IN,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.ctrl2 = {.gpio = INVALID_GPIO},
|
||||
};
|
||||
|
||||
@@ -45,17 +52,13 @@ static DevIo m_adcKey = {
|
||||
#define BITS_SELECT_AVDD(value) ((value) & (~(0x1 << 4)))
|
||||
#define BITS_ENABLE_AVDD(value) ((value) | ((0x1 << 4) << 16))
|
||||
|
||||
/* ADC最大电压量程 */
|
||||
#define
|
||||
/* ADC最大档位 */
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: adc_dev_init
|
||||
* 说 明: 初始化ADC
|
||||
* 参 数: 无
|
||||
* 返 回 值: 0为成功,反之为失败
|
||||
***************************************************************/
|
||||
static unsigned int adc_dev_init()
|
||||
static unsigned int adc_dev_init(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
uint32_t *pGrfSocCon29 = (uint32_t *)(GRF_SOC_CON29_REG_ADDRESS);
|
||||
@@ -90,10 +93,12 @@ static unsigned int adc_dev_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 电压值
|
||||
***************************************************************/
|
||||
static float adc_get_voltage()
|
||||
static float adc_get_voltage(void)
|
||||
{
|
||||
unsigned int ret = LZ_HARDWARE_SUCCESS;
|
||||
unsigned int data = 0;
|
||||
float voltage = 3.3;
|
||||
float range = 1024.0;
|
||||
|
||||
ret = LzSaradcReadValue(ADC_CHANNEL, &data);
|
||||
if (ret != LZ_HARDWARE_SUCCESS) {
|
||||
@@ -101,7 +106,7 @@ static float adc_get_voltage()
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return (float)(data * 3.3 / 1024.0);
|
||||
return (float)(data * voltage / range);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
@@ -110,7 +115,7 @@ static float adc_get_voltage()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void adc_process()
|
||||
void adc_process(void)
|
||||
{
|
||||
float voltage;
|
||||
|
||||
@@ -119,7 +124,7 @@ void adc_process()
|
||||
|
||||
while (1) {
|
||||
printf("***************Adc Example*************\r\n");
|
||||
/*获取电压值*/
|
||||
/* 获取电压值 */
|
||||
voltage = adc_get_voltage();
|
||||
printf("vlt:%.3fV\n", voltage);
|
||||
|
||||
@@ -128,14 +133,13 @@ void adc_process()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: adc_example
|
||||
* 说 明: 开机自启动调用函数
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void adc_example()
|
||||
void adc_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
/* 信息标记 */
|
||||
typedef enum {
|
||||
NDEFFirstPos, /* 起始信息标记 */
|
||||
NDEFMiddlePos, /* 中间信息标记 */
|
||||
NDEFLastPos /* 结束信息标记 */
|
||||
NDEFFirstPos, /* 起始信息标记 */
|
||||
NDEFMiddlePos, /* 中间信息标记 */
|
||||
NDEFLastPos /* 结束信息标记 */
|
||||
} RecordPosEnu;
|
||||
|
||||
/***************************************************************
|
||||
|
||||
@@ -66,7 +66,7 @@ void nfc_process(void)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void nfc_example()
|
||||
void nfc_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
@@ -61,6 +61,7 @@ inline const uint8_t* get_last_ncf_page(void)
|
||||
|
||||
static bool writeTimeout( uint8_t *data, uint8_t dataSend)
|
||||
{
|
||||
uint32_t timeout_usec = 300000;
|
||||
uint32_t status = 0;
|
||||
|
||||
status = LzI2cWrite(NFC_I2C_PORT, NT3H1X_SLAVE_ADDRESS, data, dataSend);
|
||||
@@ -68,7 +69,7 @@ static bool writeTimeout( uint8_t *data, uint8_t dataSend)
|
||||
printf("===== Error: I2C write status1 = 0x%x! =====\r\n", status);
|
||||
return 0;
|
||||
}
|
||||
usleep(300000);
|
||||
usleep(timeout_usec);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -93,15 +94,21 @@ static bool readTimeout(uint8_t address, uint8_t *block_data)
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned int NT3HI2cInit()
|
||||
unsigned int NT3HI2cInit(void)
|
||||
{
|
||||
uint32_t *pGrf = (uint32_t *)0x41050000U;
|
||||
uint32_t reg_offset = 7;
|
||||
uint32_t reg_bit_i2c = 0x7;
|
||||
uint32_t regbit_offset_h = 8;
|
||||
uint32_t regbit_offset_l = 4;
|
||||
uint32_t regmask = 0xFFFF;
|
||||
uing32_t regmask_offset = 16;
|
||||
uint32_t ulValue;
|
||||
|
||||
ulValue = pGrf[7];
|
||||
ulValue &= ~((0x7 << 8) | (0x7 << 4));
|
||||
ulValue |= ((0x1 << 8) | (0x1 << 4));
|
||||
pGrf[7] = ulValue | (0xFFFF << 16);
|
||||
ulValue = pGrf[reg_offset];
|
||||
ulValue &= ~((reg_bit_i2c << regbit_offset_h) | (reg_bit_i2c << regbit_offset_l));
|
||||
ulValue |= ((0x1 << regbit_offset_h) | (0x1 << regbit_offset_l));
|
||||
pGrf[reg_offset] = ulValue | (regmask << regmask_offset);
|
||||
|
||||
if (I2cIoInit(m_i2c2m0) != LZ_HARDWARE_SUCCESS) {
|
||||
printf("%s, %s, %d: I2cIoInit failed!\n", __FILE__, __func__, __LINE__);
|
||||
@@ -115,7 +122,7 @@ unsigned int NT3HI2cInit()
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int NT3HI2cDeInit()
|
||||
unsigned int NT3HI2cDeInit(void)
|
||||
{
|
||||
LzI2cDeinit(NFC_I2C_PORT);
|
||||
}
|
||||
@@ -149,13 +156,14 @@ bool NT3HReadHeaderNfc(uint8_t *endRecordsPtr, uint8_t *ndefHeader)
|
||||
|
||||
bool NT3HWriteHeaderNfc(uint8_t endRecordsPtr, uint8_t ndefHeader)
|
||||
{
|
||||
|
||||
// read the first page to see where is the end of the Records.
|
||||
uint32_t offset_record_ptr = 1;
|
||||
uint32_t offset_header = 2;
|
||||
|
||||
/* read the first page to see where is the end of the Records. */
|
||||
bool ret = NT3HReadUserData(0);
|
||||
if (ret == true) {
|
||||
|
||||
nfcPageBuffer[1] = endRecordsPtr;
|
||||
nfcPageBuffer[2] = ndefHeader;
|
||||
nfcPageBuffer[offset_record_ptr] = endRecordsPtr;
|
||||
nfcPageBuffer[offset_header] = ndefHeader;
|
||||
ret = NT3HWriteUserData(0, nfcPageBuffer);
|
||||
if (ret == false) {
|
||||
errNo = NT3HERROR_WRITE_HEADER;
|
||||
@@ -167,8 +175,6 @@ bool NT3HWriteHeaderNfc(uint8_t endRecordsPtr, uint8_t ndefHeader)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool NT3HEraseAllTag(void)
|
||||
{
|
||||
bool ret = true;
|
||||
@@ -196,7 +202,6 @@ bool getSessionReg(void)
|
||||
return readTimeout(SESSION_REG, nfcPageBuffer);
|
||||
}
|
||||
|
||||
|
||||
bool NT3HReadUserData(uint8_t page)
|
||||
{
|
||||
uint8_t reg = USER_START_REG + page;
|
||||
@@ -250,7 +255,6 @@ bool NT3HReadSram(void)
|
||||
if (ret == false) {
|
||||
return ret;
|
||||
}
|
||||
//memcpy(&userData[offset], pageBuffer, sizeof(pageBuffer));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ typedef struct {
|
||||
} NDEFDataStr;
|
||||
|
||||
|
||||
unsigned int NT3HI2cInit();
|
||||
unsigned int NT3HI2cDeInit();
|
||||
unsigned int NT3HI2cInit(void);
|
||||
unsigned int NT3HI2cDeInit(void);
|
||||
|
||||
|
||||
void NT3HGetNxpSerialNumber(char* buffer);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
typedef uint8_t (*composeRtdPtr)(const NDEFDataStr *ndef, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg);
|
||||
static composeRtdPtr composeRtd[] = {composeRtdText, composeRtdUri};
|
||||
|
||||
|
||||
static int16_t firstRecord(UncompletePageStr *page, const NDEFDataStr *data, RecordPosEnu rtdPosition)
|
||||
{
|
||||
NDEFRecordStr record;
|
||||
@@ -125,7 +124,7 @@ static int16_t addRecord(UncompletePageStr *pageToUse, const NDEFDataStr *data,
|
||||
// update the info with the new page
|
||||
pageToUse->page++;
|
||||
pageToUse->usedBytes = recordLength - byteToCopy;
|
||||
//copy the remain part in the pageBuffer because this is what the caller expect
|
||||
// copy the remain part in the pageBuffer because this is what the caller expect
|
||||
memcpy(nfcPageBuffer, &tmpBuffer[byteToCopy], pageToUse->usedBytes);
|
||||
return pageToUse->usedBytes;
|
||||
}
|
||||
@@ -153,8 +152,7 @@ static bool writeUserPayload(int16_t payloadPtr, const NDEFDataStr *data, Uncomp
|
||||
memcpy(&nfcPageBuffer[payloadPtr], data->rtdPayload, copyByte);
|
||||
addedPayload = copyByte;
|
||||
|
||||
|
||||
//if it is sufficient one send add the NDEF_END_BYTE
|
||||
// if it is sufficient one send add the NDEF_END_BYTE
|
||||
if ((addedPayload >= data->rtdPayloadlength) && ((payloadPtr + copyByte) < NFC_PAGE_SIZE)) {
|
||||
nfcPageBuffer[(payloadPtr + copyByte)] = NDEF_END_BYTE;
|
||||
endRecord = true;
|
||||
@@ -166,7 +164,7 @@ static bool writeUserPayload(int16_t payloadPtr, const NDEFDataStr *data, Uncomp
|
||||
addPage->page++; // move to a new register
|
||||
memset(nfcPageBuffer, 0, NFC_PAGE_SIZE);
|
||||
|
||||
//special case just the NDEF_END_BYTE remain out
|
||||
// special case just the NDEF_END_BYTE remain out
|
||||
if (addedPayload == data->rtdPayloadlength) {
|
||||
nfcPageBuffer[0] = NDEF_END_BYTE;
|
||||
ret = NT3HWriteUserData(addPage->page, nfcPageBuffer);
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#define NFC_IS_INIT 1
|
||||
static unsigned char m_nfc_is_init = NFC_NOT_INIT;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: nfc_store_uri_http
|
||||
* 说 明: 向NFC写入URI信息
|
||||
|
||||
@@ -33,44 +33,41 @@ static void rtdHeader(uint8_t type, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg)
|
||||
uint8_t composeRtdText(const NDEFDataStr *ndef, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg)
|
||||
{
|
||||
uint8_t retLen;
|
||||
uint32_t offset_text = 4;
|
||||
uint8_t sizeof_header = 3;
|
||||
uint8_t sizeof_str = 3;
|
||||
uint8_t sizeof_type = 1;
|
||||
uint8_t offset_i2cmsg = 2;
|
||||
|
||||
rtdHeader(RTD_TEXT, ndefRecord, I2CMsg);
|
||||
|
||||
uint8_t payLoadLen = addRtdText(&ndefRecord->type.typePayload.text);
|
||||
memcpy(&I2CMsg[4], &ndefRecord->type.typePayload.text, payLoadLen);
|
||||
memcpy(&I2CMsg[offset_text], &ndefRecord->type.typePayload.text, payLoadLen);
|
||||
|
||||
ndefRecord->payloadLength = ndef->rtdPayloadlength + payLoadLen; // added the typePayload
|
||||
I2CMsg[2] = ndefRecord->payloadLength;
|
||||
I2CMsg[offset_i2cmsg] = ndefRecord->payloadLength;
|
||||
|
||||
retLen = 3 + /*sizeof(ndefRecord->header) +
|
||||
sizeof(ndefRecord->typeLength) +
|
||||
sizeof(ndefRecord->payloadLength) +*/
|
||||
3 + //sizeof(RTDTextTypeStr)-sizeof(TextExtraDataStr)
|
||||
1 /*sizeof(ndefRecord->type.typeCode)*/;
|
||||
|
||||
retLen = sizeof_header + sizeof_str + sizeof_type;
|
||||
|
||||
return retLen;
|
||||
}
|
||||
|
||||
|
||||
uint8_t composeRtdUri(const NDEFDataStr *ndef, NDEFRecordStr *ndefRecord, uint8_t *I2CMsg)
|
||||
{
|
||||
|
||||
uint32_t offset_text = 4;
|
||||
uint32_t offset_length = 2;
|
||||
uint8_t length = 5;
|
||||
|
||||
rtdHeader(RTD_URI, ndefRecord, I2CMsg);
|
||||
|
||||
uint8_t payLoadLen = addRtdUriRecord(ndef, &ndefRecord->type.typePayload.uri);
|
||||
memcpy(&I2CMsg[4], &ndefRecord->type.typePayload.uri, payLoadLen);
|
||||
memcpy(&I2CMsg[offset_text], &ndefRecord->type.typePayload.uri, payLoadLen);
|
||||
|
||||
ndefRecord->payloadLength = ndef->rtdPayloadlength + payLoadLen; // added the typePayload
|
||||
I2CMsg[2] = ndefRecord->payloadLength;
|
||||
|
||||
return 5;
|
||||
/* retLen = sizeof(ndefRecord->header) +
|
||||
sizeof(ndefRecord->typeLength) +
|
||||
sizeof(ndefRecord->payloadLength) +
|
||||
sizeof(1) + //ndefRecord->type.typePayload.uri.type
|
||||
sizeof(ndefRecord->type.typeCode);
|
||||
*/
|
||||
I2CMsg[offset_length] = ndefRecord->payloadLength;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
void composeNDEFMBME(bool isFirstRecord, bool isLastRecord, NDEFRecordStr *ndefRecord)
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
|
||||
uint8_t addRtdText(RtdTextTypeStr *typeStr)
|
||||
{
|
||||
uint8_t retrun_value = 3;
|
||||
typeStr->status = 0x2;
|
||||
typeStr->language[0] = 'e';
|
||||
typeStr->language[1] = 'n';
|
||||
|
||||
return 3;
|
||||
return retrun_value;
|
||||
}
|
||||
|
||||
void prepareText(NDEFDataStr *data, RecordPosEnu position, uint8_t *text)
|
||||
|
||||
@@ -81,7 +81,7 @@ void eeprom_proress(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_example()
|
||||
void eeprom_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 0为成功,反之失败
|
||||
***************************************************************/
|
||||
unsigned int eeprom_init();
|
||||
unsigned int eeprom_init(void);
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: eeprom_deinit
|
||||
@@ -29,7 +29,7 @@ unsigned int eeprom_init();
|
||||
* 参 数: 无
|
||||
* 返 回 值: 0为成功,反之失败
|
||||
***************************************************************/
|
||||
unsigned int eeprom_deinit();
|
||||
unsigned int eeprom_deinit(void);
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: eeprom_get_blocksize
|
||||
@@ -37,7 +37,7 @@ unsigned int eeprom_deinit();
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回页大小
|
||||
***************************************************************/
|
||||
unsigned int eeprom_get_blocksize();
|
||||
unsigned int eeprom_get_blocksize(void);
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: eeprom_readbyte
|
||||
@@ -93,5 +93,4 @@ unsigned int eeprom_read(unsigned int addr, unsigned char *data, unsigned int da
|
||||
unsigned int eeprom_write(unsigned int addr, unsigned char *data, unsigned int data_len);
|
||||
|
||||
|
||||
#endif /* _EEPROM_H_ */
|
||||
/** @} */
|
||||
#endif /* _EEPROM_H_ */
|
||||
@@ -54,7 +54,7 @@ static inline void eeprog_delay_usec(unsigned int usec)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int eeprom_init()
|
||||
unsigned int eeprom_init(void)
|
||||
{
|
||||
if (I2cIoInit(m_i2cBus) != LZ_HARDWARE_SUCCESS) {
|
||||
printf("%s, %d: I2cIoInit failed!\n", __FILE__, __LINE__);
|
||||
@@ -79,7 +79,7 @@ unsigned int eeprom_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 0为成功,反之失败
|
||||
***************************************************************/
|
||||
unsigned int eeprom_deinit()
|
||||
unsigned int eeprom_deinit(void)
|
||||
{
|
||||
LzI2cDeinit(EEPROM_I2C_BUS);
|
||||
LzGpioDeinit(m_i2cBus.scl.gpio);
|
||||
@@ -93,7 +93,7 @@ unsigned int eeprom_deinit()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回页大小
|
||||
***************************************************************/
|
||||
unsigned int eeprom_get_blocksize()
|
||||
unsigned int eeprom_get_blocksize(void)
|
||||
{
|
||||
return EEPROM_PAGE;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ unsigned int eeprom_writebyte(unsigned int addr, unsigned char data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* K24C02芯片需要时间完成写操作,在此之前不响应其他操作*/
|
||||
/* K24C02芯片需要时间完成写操作,在此之前不响应其他操作 */
|
||||
eeprog_delay_usec(1000);
|
||||
|
||||
return 1;
|
||||
@@ -196,22 +196,26 @@ unsigned int eeprom_writepage(unsigned int addr, unsigned char *data, unsigned i
|
||||
|
||||
/* K24C02的存储地址是0~255 */
|
||||
if (addr >= EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((addr % EEPROM_PAGE) != 0) {
|
||||
printf("%s, %s, %d: addr(0x%x) is not page addr(0x%x)\n", __FILE__, __func__, __LINE__, addr, EEPROM_PAGE);
|
||||
printf("%s, %s, %d: addr(0x%x) is not page addr(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr, EEPROM_PAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((addr + data_len) > EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr + data_len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr + data_len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data_len > EEPROM_PAGE) {
|
||||
printf("%s, %s, %d: data_len(%d) > EEPROM_PAGE(%d)\n", __FILE__, __func__, __LINE__, data_len, EEPROM_PAGE);
|
||||
printf("%s, %s, %d: data_len(%d) > EEPROM_PAGE(%d)\n",
|
||||
__FILE__, __func__, __LINE__, data_len, EEPROM_PAGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -229,7 +233,7 @@ unsigned int eeprom_writepage(unsigned int addr, unsigned char *data, unsigned i
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* K24C02芯片需要时间完成写操作,在此之前不响应其他操作*/
|
||||
/* K24C02芯片需要时间完成写操作,在此之前不响应其他操作 */
|
||||
eeprog_delay_usec(K24C02_DELAY_USEC);
|
||||
|
||||
return data_len;
|
||||
@@ -249,12 +253,14 @@ unsigned int eeprom_read(unsigned int addr, unsigned char *data, unsigned int da
|
||||
unsigned int ret = 0;
|
||||
|
||||
if (addr >= EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((addr + data_len) > EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr + len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr + len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -294,12 +300,14 @@ unsigned int eeprom_write(unsigned int addr, unsigned char *data, unsigned int d
|
||||
unsigned int len;
|
||||
|
||||
if (addr >= EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr(0x%x) >= EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((addr + data_len) > EEPROM_ADDRESS_MAX) {
|
||||
printf("%s, %s, %d: addr + len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n", __FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
printf("%s, %s, %d: addr + len(0x%x) > EEPROM_ADDRESS_MAX(0x%x)\n",
|
||||
__FILE__, __func__, __LINE__, addr + data_len, EEPROM_ADDRESS_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,16 +41,16 @@
|
||||
#define LCD_GREEN 0x07E0
|
||||
#define LCD_CYAN 0x7FFF
|
||||
#define LCD_YELLOW 0xFFE0
|
||||
#define LCD_BROWN 0XBC40 //棕色
|
||||
#define LCD_BRRED 0XFC07 //棕红色
|
||||
#define LCD_GRAY 0X8430 //灰色
|
||||
#define LCD_DARKBLUE 0X01CF //深蓝色
|
||||
#define LCD_LIGHTBLUE 0X7D7C //浅蓝色
|
||||
#define LCD_GRAYBLUE 0X5458 //灰蓝色
|
||||
#define LCD_LIGHTGREEN 0X841F //浅绿色
|
||||
#define LCD_LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
|
||||
#define LCD_LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
|
||||
#define LCD_LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
|
||||
#define LCD_BROWN 0XBC40 // 棕色
|
||||
#define LCD_BRRED 0XFC07 // 棕红色
|
||||
#define LCD_GRAY 0X8430 // 灰色
|
||||
#define LCD_DARKBLUE 0X01CF // 深蓝色
|
||||
#define LCD_LIGHTBLUE 0X7D7C // 浅蓝色
|
||||
#define LCD_GRAYBLUE 0X5458 // 灰蓝色
|
||||
#define LCD_LIGHTGREEN 0X841F // 浅绿色
|
||||
#define LCD_LGRAY 0XC618 // 浅灰色(PANNEL),窗体背景色
|
||||
#define LCD_LGRAYBLUE 0XA651 // 浅灰蓝色(中间层颜色)
|
||||
#define LCD_LBBLUE 0X2B12 // 浅棕蓝色(选择条目的反色)
|
||||
|
||||
/* 字体大小 */
|
||||
#define LCD_FONT_SIZE12 12
|
||||
@@ -64,7 +64,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int lcd_init();
|
||||
unsigned int lcd_init(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
@@ -73,7 +73,7 @@ unsigned int lcd_init();
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int lcd_deinit();
|
||||
unsigned int lcd_deinit(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
static inline uint32_t chinese_utf8_to_ascii(uint8_t *src, uint32_t src_len, uint8_t *dst, uint32_t *dst_len)
|
||||
{
|
||||
#define UTF8_TO_ASCII_BYTES 3
|
||||
#define UTF8_OFFSET 2
|
||||
uint32_t i;
|
||||
uint32_t offset = 0;
|
||||
|
||||
for (i = 0; i < src_len; i += UTF8_TO_ASCII_BYTES) {
|
||||
dst[offset] = src[i];
|
||||
dst[offset + 1] = src[i + 1];
|
||||
offset += 2;
|
||||
offset += UTF8_OFFSET;
|
||||
}
|
||||
|
||||
*dst_len = offset;
|
||||
|
||||
@@ -162,7 +162,7 @@ void lcd_process(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void lcd_example()
|
||||
void lcd_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
+113
-83
@@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "lz_hardware.h"
|
||||
#include "lcd.h"
|
||||
#include "lcd_font.h"
|
||||
#include "lcd.h"
|
||||
|
||||
/* 是否启用SPI通信
|
||||
* 0 => 禁用SPI,使用gpio模拟SPI通信
|
||||
@@ -46,18 +46,50 @@
|
||||
|
||||
#if LCD_ENABLE_SPI
|
||||
static SpiBusIo m_spiBus = {
|
||||
.cs = {.gpio = GPIO0_PC0, .func = MUX_FUNC4, .type = PULL_UP, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.clk = {.gpio = GPIO0_PC1, .func = MUX_FUNC4, .type = PULL_UP, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.mosi = {.gpio = GPIO0_PC2, .func = MUX_FUNC4, .type = PULL_UP, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
//.miso = {.gpio = GPIO0_PC3, .func = MUX_FUNC4, .type = PULL_UP, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.miso = {.gpio = INVALID_GPIO, .func = MUX_FUNC4, .type = PULL_UP, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.cs = {
|
||||
.gpio = GPIO0_PC0,
|
||||
.func = MUX_FUNC4,
|
||||
.type = PULL_UP,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.clk = {
|
||||
.gpio = GPIO0_PC1,
|
||||
.func = MUX_FUNC4,
|
||||
.type = PULL_UP,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.mosi = {
|
||||
.gpio = GPIO0_PC2,
|
||||
.func = MUX_FUNC4,
|
||||
.type = PULL_UP,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.miso = {
|
||||
.gpio = INVALID_GPIO,
|
||||
.func = MUX_FUNC4,
|
||||
.type = PULL_UP,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_SPI0,
|
||||
.mode = FUNC_MODE_M1,
|
||||
};
|
||||
|
||||
static LzSpiConfig m_spiConf = {.bitsPerWord = SPI_PERWORD_8BITS, .firstBit = SPI_MSB, .mode = SPI_MODE_3,
|
||||
.csm = SPI_CMS_ONE_CYCLES, .speed = 50000000, .isSlave = false
|
||||
};
|
||||
static LzSpiConfig m_spiConf = {
|
||||
.bitsPerWord = SPI_PERWORD_8BITS,
|
||||
.firstBit = SPI_MSB,
|
||||
.mode = SPI_MODE_3,
|
||||
.csm = SPI_CMS_ONE_CYCLES,
|
||||
.speed = 50000000,
|
||||
.isSlave = false,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* 寄存器定义 */
|
||||
@@ -85,14 +117,13 @@ static LzSpiConfig m_spiConf = {.bitsPerWord = SPI_PERWORD_8BITS, .firstBit = SP
|
||||
/* 中文转化为UTF-8的字节数 */
|
||||
#define CHINESE_TO_BYTES 2
|
||||
|
||||
|
||||
static void lcd_write_bus(uint8_t dat)
|
||||
{
|
||||
#if LCD_ENABLE_SPI
|
||||
LzSpiWrite(LCD_SPI_BUS, 0, &dat, 1);
|
||||
#else
|
||||
uint8_t i;
|
||||
|
||||
|
||||
LCD_CS_Clr();
|
||||
for (i = 0; i < REG_BITS_MAXSIZE; i++) {
|
||||
LCD_CLK_Clr();
|
||||
@@ -143,11 +174,11 @@ static void lcd_address_set(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
||||
static uint32_t mypow(uint8_t m, uint8_t n)
|
||||
{
|
||||
uint32_t result = 1;
|
||||
|
||||
|
||||
while (n--) {
|
||||
result *= m;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -169,15 +200,15 @@ static void lcd_show_chinese_12x12(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
{
|
||||
uint8_t i, j, m = 0;
|
||||
uint16_t k;
|
||||
uint16_t HZnum;//汉字数目
|
||||
uint16_t TypefaceNum;//一个字符所占字节大小
|
||||
uint16_t HZnum; // 汉字数目
|
||||
uint16_t TypefaceNum; // 一个字符所占字节大小
|
||||
uint16_t x0 = x;
|
||||
|
||||
TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
|
||||
|
||||
|
||||
TypefaceNum = (sizey / BYTE_TO_BITS + ((sizey % biBYTE_TO_BITSts) ? 1 : 0)) * sizey;
|
||||
|
||||
/* 统计汉字数目 */
|
||||
HZnum = sizeof(tfont12) / sizeof(typFNT_GB12);
|
||||
|
||||
|
||||
for (k = 0; k < HZnum; k++) {
|
||||
if ((tfont12[k].Index[0] == *(s)) && (tfont12[k].Index[1] == *(s + 1))) {
|
||||
lcd_address_set(x, y, x + sizey - 1, y + sizey - 1);
|
||||
@@ -190,7 +221,7 @@ static void lcd_show_chinese_12x12(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
} else {
|
||||
lcd_wr_data(bc);
|
||||
}
|
||||
|
||||
|
||||
m++;
|
||||
if ((m % sizey) == 0) {
|
||||
m = 0;
|
||||
@@ -202,7 +233,7 @@ static void lcd_show_chinese_12x12(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
/* 画一个点 */
|
||||
lcd_draw_point(x, y, fc);
|
||||
}
|
||||
|
||||
|
||||
x++;
|
||||
if ((x - x0) == sizey) {
|
||||
x = x0;
|
||||
@@ -212,8 +243,8 @@ static void lcd_show_chinese_12x12(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
|
||||
|
||||
break; /* 查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响 */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,14 +266,14 @@ static void lcd_show_chinese_16x16(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
{
|
||||
uint8_t i, j, m = 0;
|
||||
uint16_t k;
|
||||
uint16_t HZnum;//汉字数目
|
||||
uint16_t TypefaceNum;//一个字符所占字节大小
|
||||
uint16_t HZnum; /* 汉字数目 */
|
||||
uint16_t TypefaceNum; /* 一个字符所占字节大小 */
|
||||
uint16_t x0 = x;
|
||||
|
||||
|
||||
TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
|
||||
/* 统计汉字数目 */
|
||||
HZnum = sizeof(tfont16) / sizeof(typFNT_GB16);
|
||||
|
||||
|
||||
for (k = 0; k < HZnum; k++) {
|
||||
if ((tfont16[k].Index[0] == *(s)) && (tfont16[k].Index[1] == *(s + 1))) {
|
||||
lcd_address_set(x, y, x + sizey - 1, y + sizey - 1);
|
||||
@@ -255,7 +286,7 @@ static void lcd_show_chinese_16x16(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
} else {
|
||||
lcd_wr_data(bc);
|
||||
}
|
||||
|
||||
|
||||
m++;
|
||||
if (m % sizey == 0) {
|
||||
m = 0;
|
||||
@@ -267,7 +298,7 @@ static void lcd_show_chinese_16x16(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
/* 画一个点 */
|
||||
lcd_draw_point(x, y, fc);
|
||||
}
|
||||
|
||||
|
||||
x++;
|
||||
if ((x - x0) == sizey) {
|
||||
x = x0;
|
||||
@@ -277,7 +308,7 @@ static void lcd_show_chinese_16x16(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
|
||||
}
|
||||
}
|
||||
@@ -301,14 +332,14 @@ static void lcd_show_chinese_24x24(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
{
|
||||
uint8_t i, j, m = 0;
|
||||
uint16_t k;
|
||||
uint16_t HZnum;//汉字数目
|
||||
uint16_t TypefaceNum;//一个字符所占字节大小
|
||||
uint16_t HZnum; /* 汉字数目 */
|
||||
uint16_t TypefaceNum; /* 一个字符所占字节大小 */
|
||||
uint16_t x0 = x;
|
||||
|
||||
TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
|
||||
|
||||
TypefaceNum = (sizey / BYTE_TO_BITS + ((sizey % BYTE_TO_BITS) ? 1 : 0)) * sizey;
|
||||
/* 统计汉字数目 */
|
||||
HZnum = sizeof(tfont24) / sizeof(typFNT_GB24);
|
||||
|
||||
|
||||
for (k = 0; k < HZnum; k++) {
|
||||
if ((tfont24[k].Index[0] == *(s)) && (tfont24[k].Index[1] == *(s + 1))) {
|
||||
lcd_address_set(x, y, x + sizey - 1, y + sizey - 1);
|
||||
@@ -321,7 +352,7 @@ static void lcd_show_chinese_24x24(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
} else {
|
||||
lcd_wr_data(bc);
|
||||
}
|
||||
|
||||
|
||||
m++;
|
||||
if (m % sizey == 0) {
|
||||
m = 0;
|
||||
@@ -333,7 +364,7 @@ static void lcd_show_chinese_24x24(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
/* 画一个点 */
|
||||
lcd_draw_point(x, y, fc);
|
||||
}
|
||||
|
||||
|
||||
x++;
|
||||
if ((x - x0) == sizey) {
|
||||
x = x0;
|
||||
@@ -343,7 +374,7 @@ static void lcd_show_chinese_24x24(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
|
||||
}
|
||||
}
|
||||
@@ -370,11 +401,11 @@ static void lcd_show_chinese_32x32(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
uint16_t HZnum;//汉字数目
|
||||
uint16_t TypefaceNum;//一个字符所占字节大小
|
||||
uint16_t x0 = x;
|
||||
|
||||
|
||||
TypefaceNum = (sizey / 8 + ((sizey % 8) ? 1 : 0)) * sizey;
|
||||
/* 统计汉字数目 */
|
||||
HZnum = sizeof(tfont32) / sizeof(typFNT_GB32);
|
||||
|
||||
|
||||
for (k = 0; k < HZnum; k++) {
|
||||
if ((tfont32[k].Index[0] == *(s)) && (tfont32[k].Index[1] == *(s + 1))) {
|
||||
lcd_address_set(x, y, x + sizey - 1, y + sizey - 1);
|
||||
@@ -387,7 +418,7 @@ static void lcd_show_chinese_32x32(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
} else {
|
||||
lcd_wr_data(bc);
|
||||
}
|
||||
|
||||
|
||||
m++;
|
||||
if (m % sizey == 0) {
|
||||
m = 0;
|
||||
@@ -396,9 +427,9 @@ static void lcd_show_chinese_32x32(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
} else {
|
||||
/* 叠加方式 */
|
||||
if (tfont32[k].Msk[i] & (0x01 << j)) {
|
||||
lcd_draw_point(x, y, fc);//画一个点
|
||||
lcd_draw_point(x, y, fc); /* 画一个点 */
|
||||
}
|
||||
|
||||
|
||||
x++;
|
||||
if ((x - x0) == sizey) {
|
||||
x = x0;
|
||||
@@ -408,26 +439,25 @@ static void lcd_show_chinese_32x32(uint16_t x, uint16_t y, uint8_t *s, uint16_t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break; //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
|
||||
|
||||
break; /* 查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: lcd_init
|
||||
* 说 明: Lcd初始化
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int lcd_init()
|
||||
unsigned int lcd_init(void)
|
||||
{
|
||||
unsigned int delay_msec = 100;
|
||||
unsigned int long_delay_msec = 500;
|
||||
#if LCD_ENABLE_SPI
|
||||
LzSpiDeinit(LCD_SPI_BUS);
|
||||
|
||||
|
||||
if (SpiIoInit(m_spiBus) != LZ_HARDWARE_SUCCESS) {
|
||||
printf("%s, %d: SpiIoInit failed!\n", __FILE__, __LINE__);
|
||||
return __LINE__;
|
||||
@@ -454,21 +484,21 @@ unsigned int lcd_init()
|
||||
LzGpioInit(LCD_PIN_RES);
|
||||
LzGpioSetDir(LCD_PIN_RES, LZGPIO_DIR_OUT);
|
||||
LzGpioSetVal(LCD_PIN_RES, LZGPIO_LEVEL_HIGH);
|
||||
|
||||
|
||||
/* 初始化GPIO0_C6 */
|
||||
LzGpioInit(LCD_PIN_DC);
|
||||
LzGpioSetDir(LCD_PIN_DC, LZGPIO_DIR_OUT);
|
||||
LzGpioSetVal(LCD_PIN_DC, LZGPIO_LEVEL_LOW);
|
||||
|
||||
|
||||
/* 重启lcd */
|
||||
LCD_RES_Clr();
|
||||
LOS_Msleep(100);
|
||||
LOS_Msleep(delay_msec);
|
||||
LCD_RES_Set();
|
||||
LOS_Msleep(100);
|
||||
LOS_Msleep(500);
|
||||
LOS_Msleep(delay_msec);
|
||||
LOS_Msleep(long_delay_msec);
|
||||
lcd_wr_reg(0x11);
|
||||
/* 等待LCD 100ms */
|
||||
LOS_Msleep(100);
|
||||
LOS_Msleep(delay_msec);
|
||||
/* 启动LCD配置,设置显示和颜色配置 */
|
||||
lcd_wr_reg(0X36);
|
||||
if (USE_HORIZONTAL == 0) {
|
||||
@@ -545,7 +575,7 @@ unsigned int lcd_init()
|
||||
lcd_wr_data8(0x21);
|
||||
lcd_wr_data8(0x20);
|
||||
lcd_wr_reg(0x29);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -556,7 +586,7 @@ unsigned int lcd_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int lcd_deinit()
|
||||
unsigned int lcd_deinit(void)
|
||||
{
|
||||
#if LCD_ENABLE_SPI
|
||||
LzSpiDeinit(LCD_SPI_BUS);
|
||||
@@ -567,7 +597,7 @@ unsigned int lcd_deinit()
|
||||
#endif
|
||||
LzGpioDeinit(LCD_PIN_RES);
|
||||
LzGpioDeinit(LCD_PIN_DC);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -586,7 +616,7 @@ unsigned int lcd_deinit()
|
||||
void lcd_fill(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color)
|
||||
{
|
||||
uint16_t i, j;
|
||||
|
||||
|
||||
/* 设置显示范围 */
|
||||
lcd_address_set(xsta, ysta, xend - 1, yend - 1);
|
||||
/* 填充颜色 */
|
||||
@@ -631,14 +661,14 @@ void lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t
|
||||
uint16_t t;
|
||||
int xerr = 0, yerr = 0, delta_x, delta_y, distance;
|
||||
int incx, incy, uRow, uCol;
|
||||
|
||||
|
||||
/* 计算坐标增量 */
|
||||
delta_x = x2 - x1;
|
||||
delta_y = y2 - y1;
|
||||
/* 画线起点坐标 */
|
||||
uRow = x1;
|
||||
uCol = y1;
|
||||
|
||||
|
||||
if (delta_x > 0) {
|
||||
/* 设置单步方向 */
|
||||
incx = 1;
|
||||
@@ -649,7 +679,7 @@ void lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t
|
||||
incx = -1;
|
||||
delta_x = -delta_x;
|
||||
}
|
||||
|
||||
|
||||
if (delta_y > 0) {
|
||||
incy = 1;
|
||||
} else if (delta_y == 0) {
|
||||
@@ -659,14 +689,14 @@ void lcd_draw_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t
|
||||
incy = -1;
|
||||
delta_y = -delta_y;
|
||||
}
|
||||
|
||||
|
||||
if (delta_x > delta_y) {
|
||||
/* 选取基本增量坐标轴 */
|
||||
distance = delta_x;
|
||||
} else {
|
||||
distance = delta_y;
|
||||
}
|
||||
|
||||
|
||||
for (t = 0; t < distance + 1; t++) {
|
||||
/* 画点 */
|
||||
lcd_draw_point(uRow, uCol, color);
|
||||
@@ -717,10 +747,10 @@ void lcd_draw_rectangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint
|
||||
void lcd_draw_circle(uint16_t x0, uint16_t y0, uint8_t r, uint16_t color)
|
||||
{
|
||||
int a, b;
|
||||
|
||||
|
||||
a = 0;
|
||||
b = r;
|
||||
|
||||
|
||||
while (a <= b) {
|
||||
lcd_draw_point(x0 - b, y0 - a, color);
|
||||
lcd_draw_point(x0 + b, y0 - a, color);
|
||||
@@ -757,11 +787,11 @@ void lcd_show_chinese(uint16_t x, uint16_t y, uint8_t *s, uint16_t fc, uint16_t
|
||||
uint8_t buffer[128];
|
||||
uint32_t buffer_len = 0;
|
||||
uint32_t len = strlen(s);
|
||||
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
/* utf8格式汉字转化为ascii格式 */
|
||||
chinese_utf8_to_ascii(s, strlen(s), buffer, &buffer_len);
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < buffer_len; i += CHINESE_TO_BYTES, x += sizey) {
|
||||
if (sizey == LCD_FONT_SIZE12) {
|
||||
lcd_show_chinese_12x12(x, y, &buffer[i], fc, bc, sizey, mode);
|
||||
@@ -778,7 +808,6 @@ void lcd_show_chinese(uint16_t x, uint16_t y, uint8_t *s, uint16_t fc, uint16_t
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: lcd_show_char
|
||||
* 说 明: 显示一个字符
|
||||
@@ -796,17 +825,17 @@ void lcd_show_char(uint16_t x, uint16_t y, uint8_t num, uint16_t fc, uint16_t bc
|
||||
{
|
||||
uint8_t temp, sizex, t, m = 0;
|
||||
uint16_t i;
|
||||
uint16_t TypefaceNum;//一个字符所占字节大小
|
||||
uint16_t TypefaceNum; /* 一个字符所占字节大小 */
|
||||
uint16_t x0 = x;
|
||||
|
||||
|
||||
sizex = sizey / 2;
|
||||
TypefaceNum = (sizex / 8 + ((sizex % 8) ? 1 : 0)) * sizey;
|
||||
|
||||
TypefaceNum = (sizex / BYTE_TO_BITS + ((sizex % BYTE_TO_BITS) ? 1 : 0)) * sizey;
|
||||
|
||||
/* 得到偏移后的值 */
|
||||
num = num - ' ';
|
||||
/* 设置光标位置 */
|
||||
lcd_address_set(x, y, x + sizex - 1, y + sizey - 1);
|
||||
|
||||
|
||||
for (i = 0; i < TypefaceNum; i++) {
|
||||
if (sizey == LCD_FONT_SIZE12) {
|
||||
/* 调用6x12字体 */
|
||||
@@ -823,7 +852,7 @@ void lcd_show_char(uint16_t x, uint16_t y, uint8_t num, uint16_t fc, uint16_t bc
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (t = 0; t < BYTE_TO_BITS; t++) {
|
||||
if (!mode) {
|
||||
/* 非叠加模式 */
|
||||
@@ -832,7 +861,7 @@ void lcd_show_char(uint16_t x, uint16_t y, uint8_t num, uint16_t fc, uint16_t bc
|
||||
} else {
|
||||
lcd_wr_data(bc);
|
||||
}
|
||||
|
||||
|
||||
m++;
|
||||
if (m % sizex == 0) {
|
||||
m = 0;
|
||||
@@ -844,7 +873,7 @@ void lcd_show_char(uint16_t x, uint16_t y, uint8_t num, uint16_t fc, uint16_t bc
|
||||
/* 画一个点 */
|
||||
lcd_draw_point(x, y, fc);
|
||||
}
|
||||
|
||||
|
||||
x++;
|
||||
if ((x - x0) == sizex) {
|
||||
x = x0;
|
||||
@@ -899,7 +928,7 @@ void lcd_show_int_num(uint16_t x, uint16_t y, uint16_t num, uint8_t len, uint16_
|
||||
uint8_t t, temp;
|
||||
uint8_t enshow = 0;
|
||||
uint8_t sizex = sizey / 2;
|
||||
|
||||
|
||||
for (t = 0; t < len; t++) {
|
||||
temp = (num / mypow(10, len - t - 1)) % 10;
|
||||
if (enshow == 0 && t < (len - 1)) {
|
||||
@@ -935,7 +964,7 @@ void lcd_show_float_num1(uint16_t x, uint16_t y, float num, uint8_t len, uint16_
|
||||
#define CHAR_0 ((uint8_t)('0'))
|
||||
uint8_t t, temp, sizex;
|
||||
uint16_t num1;
|
||||
|
||||
|
||||
sizex = X_OFFSET(sizey);
|
||||
num1 = FLOAT_TO_INT(num);
|
||||
for (t = 0; t < len; t++) {
|
||||
@@ -964,12 +993,13 @@ void lcd_show_picture(uint16_t x, uint16_t y, uint16_t length, uint16_t width, c
|
||||
{
|
||||
uint16_t i, j;
|
||||
uint32_t k = 0;
|
||||
|
||||
uint32_t unit = 2;
|
||||
|
||||
lcd_address_set(x, y, x + length - 1, y + width - 1);
|
||||
for (i = 0; i < length; i++) {
|
||||
for (j = 0; j < width; j++) {
|
||||
lcd_wr_data8(pic[k * 2]);
|
||||
lcd_wr_data8(pic[k * 2 + 1]);
|
||||
lcd_wr_data8(pic[k * unit]);
|
||||
lcd_wr_data8(pic[k * unit + 1]);
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "picture.h"
|
||||
|
||||
const unsigned char gImage_lingzhi[IMAGE_MAXSIZE_LINGZHI] = { /* 0X10,0X10,0X00,0XD2,0X00,0X3E,0X01,0X1B, */
|
||||
const unsigned char gImage_lingzhi[IMAGE_MAXSIZE_LINGZHI] = {
|
||||
0XFF, 0XBF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFD, 0XFF, 0XFC, 0XFF, 0XFC, 0XFF, 0XFD, 0XFF, 0XFD,
|
||||
0XFF, 0XFF, 0XFF, 0XFE, 0XFF, 0XFE, 0XFF, 0XFE, 0XFF, 0XFE, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF, 0XFF,
|
||||
0XFF, 0XFF, 0XFF, 0XFD, 0XFF, 0XFD, 0XFF, 0XFD, 0XFF, 0XFD, 0XFF, 0XFD, 0XFF, 0XFE, 0XFF, 0XFF,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int oled_init();
|
||||
unsigned int oled_init(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
@@ -38,7 +38,7 @@ unsigned int oled_init();
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int oled_deinit();
|
||||
unsigned int oled_deinit(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _OLED_FONT_H_
|
||||
#define _OLED_FONT_H_
|
||||
|
||||
/* */
|
||||
/* F6X8的行长度 */
|
||||
#define F6X8_COLUMNS 6
|
||||
|
||||
// 常用ASCII表
|
||||
|
||||
@@ -76,7 +76,7 @@ void oled_process(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void oled_example()
|
||||
void oled_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
@@ -101,7 +101,7 @@ static uint32_t oled_pow(uint8_t m, uint8_t n)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static inline void iic_start()
|
||||
static inline void iic_start(void)
|
||||
{
|
||||
OLED_SCLK_Set();
|
||||
OLED_SDIN_Set();
|
||||
@@ -116,7 +116,7 @@ static inline void iic_start()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static inline void iic_stop()
|
||||
static inline void iic_stop(void)
|
||||
{
|
||||
OLED_SCLK_Set() ;
|
||||
OLED_SDIN_Clr();
|
||||
@@ -130,7 +130,7 @@ static inline void iic_stop()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static inline void iic_wait_ack()
|
||||
static inline void iic_wait_ack(void)
|
||||
{
|
||||
OLED_SCLK_Set();
|
||||
OLED_SCLK_Clr();
|
||||
@@ -152,7 +152,6 @@ static inline void write_iic_byte(unsigned char iic_byte)
|
||||
OLED_SCLK_Clr();
|
||||
for (i = 0; i < BYTE_TO_BITS; i++) {
|
||||
m = da;
|
||||
//OLED_SCLK_Clr();
|
||||
m = m & 0x80;
|
||||
if (m == 0x80) {
|
||||
OLED_SDIN_Set();
|
||||
@@ -289,15 +288,13 @@ static inline void oled_set_pos(unsigned char x, unsigned char y)
|
||||
oled_wr_byte((x & 0x0f), OLED_CMD);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: oled_init
|
||||
* 说 明: oled初始化
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int oled_init()
|
||||
unsigned int oled_init(void)
|
||||
{
|
||||
#if !OLED_I2C_ENABLE
|
||||
/* GPIO0_C1 => I2C1_SDA_M1 */
|
||||
@@ -364,7 +361,7 @@ unsigned int oled_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int oled_deinit()
|
||||
unsigned int oled_deinit(void)
|
||||
{
|
||||
#if !OLED_I2C_ENABLE
|
||||
LzGpioDeinit(GPIO_I2C_SDA);
|
||||
@@ -382,7 +379,7 @@ unsigned int oled_deinit()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void oled_clear()
|
||||
void oled_clear(void)
|
||||
{
|
||||
uint8_t i, n;
|
||||
|
||||
@@ -494,7 +491,6 @@ void oled_show_num(uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t size
|
||||
} else {
|
||||
enshow = 1;
|
||||
}
|
||||
|
||||
}
|
||||
oled_show_char(x + (size2 / div)*t, y, temp + '0', size2);
|
||||
}
|
||||
@@ -514,13 +510,14 @@ void oled_show_num(uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t size
|
||||
void oled_show_string(uint8_t x, uint8_t y, uint8_t *chr, uint8_t chr_size)
|
||||
{
|
||||
unsigned char j = 0;
|
||||
uint8_t offset = 2;
|
||||
|
||||
while (chr[j] != '\0') {
|
||||
oled_show_char(x, y, chr[j], chr_size);
|
||||
x += 8;
|
||||
if (x > OLED_COLUMN_MAX) {
|
||||
x = 0;
|
||||
y += 2;
|
||||
y += offset;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
/* 循环等待时间 */
|
||||
#define WAIT_MSEC 2000
|
||||
|
||||
|
||||
/* E53模块中
|
||||
* UART0_RX_M0 -> GPIO0_B6
|
||||
* UART0_TX_M0 -> GPIO0_B7
|
||||
@@ -75,7 +74,7 @@ void uart_process(void)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void uart_example()
|
||||
void uart_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
|
||||
@@ -98,7 +98,7 @@ connect_done:
|
||||
|
||||
void tcp_server_msg_handle(int fd)
|
||||
{
|
||||
char buf[BUFF_LEN]; //接收缓冲区
|
||||
char buf[BUFF_LEN]; // 接收缓冲区
|
||||
socklen_t client_addr_len;
|
||||
int cnt = 0, count;
|
||||
int client_fd;
|
||||
@@ -107,14 +107,12 @@ void tcp_server_msg_handle(int fd)
|
||||
printf("waitting for client connect...\n");
|
||||
/* 监听socket 此处会阻塞 */
|
||||
client_fd = accept(fd, (struct sockaddr*)&client_addr, &client_addr_len);
|
||||
// client_fd = lwip_accept(fd, (struct sockaddr*)&client_addr, &client_addr_len);
|
||||
printf("[tcp server] accept <%s:%d>\n", inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
|
||||
while (1) {
|
||||
memset(buf, 0, BUFF_LEN);
|
||||
printf("-------------------------------------------------------\n");
|
||||
printf("[tcp server] waitting client msg\n");
|
||||
count = recv(client_fd, buf, BUFF_LEN, 0); // read是阻塞函数,没有数据就一直阻塞
|
||||
// count = lwip_read(client_fd, buf, BUFF_LEN); // read是阻塞函数,没有数据就一直阻塞
|
||||
if (count == -1) {
|
||||
printf("[tcp server] recieve data fail!\n");
|
||||
LOS_Msleep(SERVER_WAIT_MSEC);
|
||||
@@ -125,7 +123,6 @@ void tcp_server_msg_handle(int fd)
|
||||
sprintf(buf, "I have recieved %d bytes data! recieved cnt:%d", count, ++cnt);
|
||||
printf("[tcp server] send msg:%s\n", buf);
|
||||
send(client_fd, buf, strlen(buf), 0); // 发送信息给client
|
||||
// lwip_write(client_fd, buf, strlen(buf)); // 发送信息给client
|
||||
}
|
||||
lwip_close(client_fd);
|
||||
lwip_close(fd);
|
||||
@@ -137,7 +134,6 @@ int wifi_server(void* arg)
|
||||
|
||||
while (1) {
|
||||
server_fd = socket(AF_INET, SOCK_STREAM, 0); // AF_INET:IPV4;SOCK_STREAM:TCP
|
||||
// server_fd = lwip_socket(AF_INET, SOCK_STREAM, 0); // AF_INET:IPV4;SOCK_STREAM:TCP
|
||||
if (server_fd < 0) {
|
||||
printf("create socket fail!\n");
|
||||
return -1;
|
||||
@@ -156,12 +152,10 @@ int wifi_server(void* arg)
|
||||
serv_addr.sin_family = AF_INET;
|
||||
/* IP地址,需要进行网络序转换,INADDR_ANY:本地地址 */
|
||||
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
// serv_addr.sin_addr.s_addr = inet_addr(OC_SERVER_IP);
|
||||
/* 端口号,需要网络序转换 */
|
||||
serv_addr.sin_port = htons(SERVER_PORT);
|
||||
/* 绑定服务器地址结构 */
|
||||
ret = bind(server_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
|
||||
// ret = lwip_bind(server_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
|
||||
if (ret < 0) {
|
||||
printf("socket bind fail!\n");
|
||||
lwip_close(server_fd);
|
||||
@@ -169,7 +163,6 @@ int wifi_server(void* arg)
|
||||
}
|
||||
/* 监听socket 此处不阻塞 */
|
||||
ret = listen(server_fd, SERVER_LISTEN_MAX);
|
||||
// ret = lwip_listen(server_fd, 64);
|
||||
if (ret != 0) {
|
||||
printf("socket listen fail!\n");
|
||||
lwip_close(server_fd);
|
||||
@@ -204,7 +197,6 @@ void tcp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
printf("[tcp client] client sendto msg to server %d,waitting server respond msg!!!\n", count);
|
||||
memset(buf, 0, BUFF_LEN);
|
||||
count = recv(fd, buf, BUFF_LEN, 0); // 接收来自server的信息
|
||||
// count = lwip_read(fd, buf, BUFF_LEN); // 接收来自server的信息
|
||||
if (count == -1) {
|
||||
printf("[tcp client] recieve data fail!\n");
|
||||
LOS_Msleep(CLIENT_WAIT_MSEC);
|
||||
|
||||
@@ -97,7 +97,7 @@ connect_done:
|
||||
|
||||
void udp_server_msg_handle(int fd)
|
||||
{
|
||||
char buf[BUFF_LEN]; //接收缓冲区
|
||||
char buf[BUFF_LEN]; // 接收缓冲区
|
||||
socklen_t len;
|
||||
int cnt = 0, count;
|
||||
struct sockaddr_in client_addr = {0};
|
||||
@@ -173,8 +173,6 @@ int wifi_udp_server(void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void udp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
{
|
||||
socklen_t len = sizeof(*dst);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_ia_thread()
|
||||
void e53_ia_thread(void)
|
||||
{
|
||||
e53_ia_data_t data;
|
||||
|
||||
@@ -77,7 +77,7 @@ void e53_ia_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_ia_example()
|
||||
void e53_ia_example(void)
|
||||
{
|
||||
unsigned int ret = LOS_OK;
|
||||
unsigned int thread_id;
|
||||
|
||||
@@ -29,7 +29,7 @@ typedef enum {
|
||||
ON
|
||||
} SWITCH_STATUS_ENUM;
|
||||
|
||||
void e53_ia_init();
|
||||
void e53_ia_init(void);
|
||||
void e53_ia_read_data(e53_ia_data_t *p_data);
|
||||
void light_set(SWITCH_STATUS_ENUM status);
|
||||
void motor_status_set(SWITCH_STATUS_ENUM status);
|
||||
|
||||
@@ -49,7 +49,7 @@ enum enum_offset_sht30_reg {
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void init_sht30()
|
||||
void init_sht30(void)
|
||||
{
|
||||
uint8_t send_data[2] = {0x22, 0x36};
|
||||
uint32_t send_len = 2;
|
||||
@@ -63,7 +63,7 @@ void init_sht30()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void init_bh1750()
|
||||
void init_bh1750(void)
|
||||
{
|
||||
uint8_t send_data[1] = {0x01};
|
||||
uint32_t send_len = 1;
|
||||
@@ -77,7 +77,7 @@ void init_bh1750()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void start_bh1750()
|
||||
void start_bh1750(void)
|
||||
{
|
||||
uint8_t send_data[1] = {0x10};
|
||||
uint32_t send_len = 1;
|
||||
@@ -93,13 +93,15 @@ void start_bh1750()
|
||||
***************************************************************/
|
||||
float sht30_calc_RH(uint16_t u16sRH)
|
||||
{
|
||||
float threshold = 100.0;
|
||||
float range = 65535.0;
|
||||
float humidityRH = 0;
|
||||
|
||||
/* clear bits [1..0] (status bits) */
|
||||
u16sRH &= ~0x0003;
|
||||
/* calculate relative humidity [%RH] */
|
||||
/* RH = rawValue / (2^16-1) * 10 */
|
||||
humidityRH = (100 * (float)u16sRH / 65535);
|
||||
humidityRH = (threshold * (float)u16sRH / range);
|
||||
|
||||
return humidityRH;
|
||||
}
|
||||
@@ -112,13 +114,16 @@ float sht30_calc_RH(uint16_t u16sRH)
|
||||
***************************************************************/
|
||||
float sht30_calc_temperature(uint16_t u16sT)
|
||||
{
|
||||
float threshold = 175.0;
|
||||
float range = 65535.0;
|
||||
float adjust = 45.0;
|
||||
float temperature = 0;
|
||||
|
||||
/* clear bits [1..0] (status bits) */
|
||||
u16sT &= ~0x0003;
|
||||
/* calculate temperature [℃] */
|
||||
/* T = -45 + 175 * rawValue / (2^16-1) */
|
||||
temperature = (175 * (float)u16sT / 65535 - 45);
|
||||
temperature = (threshold * (float)u16sT / range - adjust);
|
||||
|
||||
return temperature;
|
||||
}
|
||||
@@ -165,7 +170,7 @@ uint8_t sht30_check_crc(uint8_t *data, uint8_t nbrOfBytes, uint8_t checksum)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_ia_io_init()
|
||||
void e53_ia_io_init(void)
|
||||
{
|
||||
uint32_t ret = LZ_HARDWARE_FAILURE;
|
||||
|
||||
@@ -202,7 +207,7 @@ void e53_ia_io_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_ia_init()
|
||||
void e53_ia_init(void)
|
||||
{
|
||||
e53_ia_io_init();
|
||||
init_bh1750();
|
||||
@@ -217,30 +222,30 @@ void e53_ia_init()
|
||||
***************************************************************/
|
||||
void e53_ia_read_data(e53_ia_data_t *pData)
|
||||
{
|
||||
uint32_t wait_start_hb1750 = 180;
|
||||
float luminance_rate = 1.2;
|
||||
uint16_t high_byte_bit = 8;
|
||||
uint8_t recv_data[2] = {0};
|
||||
uint32_t receive_len = 2;
|
||||
uint8_t rc;
|
||||
|
||||
start_bh1750();
|
||||
LOS_Msleep(180);
|
||||
LOS_Msleep(wait_start_hb1750);
|
||||
|
||||
LzI2cRead(IA_I2C0, BH1750_ADDR, recv_data, receive_len);
|
||||
pData->luminance = (float)(((recv_data[0] << 8) + recv_data[1]) / 1.2);
|
||||
// printf("BH1750 data:0x%x%x", recv_data[0], recv_data[1]);
|
||||
pData->luminance = (float)(((recv_data[0] << high_byte_bit) + recv_data[1]) / luminance_rate);
|
||||
|
||||
/* checksum verification */
|
||||
uint8_t data[3];
|
||||
uint16_t tmp;
|
||||
/* byte 0,1 is temperature byte 4,5 is humidity */
|
||||
uint8_t SHT30_Data_Buffer[EOFFSET_SHT30_REG_MAX];
|
||||
memset(SHT30_Data_Buffer, 0, 6);
|
||||
memset(SHT30_Data_Buffer, 0, EOFFSET_SHT30_REG_MAX);
|
||||
uint8_t send_data[2] = {0xE0, 0x00};
|
||||
uint32_t send_len = 2;
|
||||
LzI2cWrite(IA_I2C0, SHT30_ADDR, send_data, send_len);
|
||||
receive_len = 6;
|
||||
receive_len = EOFFSET_SHT30_REG_MAX;
|
||||
LzI2cRead(IA_I2C0, SHT30_ADDR, SHT30_Data_Buffer, receive_len);
|
||||
// printf("SHT30 data:0x%x%x%x)", SHT30_Data_Buffer[0], SHT30_Data_Buffer[1], SHT30_Data_Buffer[2]);
|
||||
|
||||
/* check temperature */
|
||||
data[0] = SHT30_Data_Buffer[EOFFSET_SHT30_REG_TEMP_H];
|
||||
@@ -302,4 +307,3 @@ void motor_set_status(SWITCH_STATUS_ENUM status)
|
||||
LzGpioSetVal(GPIO1_PD0, LZGPIO_LEVEL_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,14 +25,13 @@
|
||||
/* 循环等待时间 */
|
||||
#define WAIT_MSEC 2000
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_sc_thread
|
||||
* 说 明: E53智慧井盖线程
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_sc_thread()
|
||||
void e53_sc_thread(void)
|
||||
{
|
||||
e53_sc_data_t data;
|
||||
int x = 0, y = 0, z = 0;
|
||||
@@ -59,7 +58,7 @@ void e53_sc_thread()
|
||||
|| (y - DELTA) > data.accel[EACCEL_Y]
|
||||
|| (z + DELTA) < data.accel[EACCEL_Z]
|
||||
|| (z - DELTA) > data.accel[EACCEL_Z]) {
|
||||
/*倾斜告警*/
|
||||
/* 倾斜告警 */
|
||||
led_d1_set(OFF);
|
||||
led_d2_set(ON);
|
||||
data.tilt_status = 1;
|
||||
@@ -81,7 +80,7 @@ void e53_sc_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_sc_example()
|
||||
void e53_sc_example(void)
|
||||
{
|
||||
unsigned int ret = LOS_OK;
|
||||
unsigned int thread_id;
|
||||
|
||||
@@ -57,10 +57,9 @@ typedef enum {
|
||||
#define MPU6050_RA_PWR_MGMT_1 0x6B
|
||||
#define MPU6050_RA_WHO_AM_I 0x75
|
||||
|
||||
void e53_sc_init();
|
||||
void e53_sc_init(void);
|
||||
void e53_sc_read_data(e53_sc_data_t *p_data);
|
||||
void led_d1_set(SWITCH_STATUS_ENUM status);
|
||||
void led_d2_set(SWITCH_STATUS_ENUM status);
|
||||
|
||||
#endif/*__E53_SMART_CITY_H__*/
|
||||
|
||||
#endif /* __E53_SMART_CITY_H__ */
|
||||
@@ -46,13 +46,13 @@ static I2cBusIo m_sc_i2c0m2 = {
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_sc_io_init()
|
||||
void e53_sc_io_init(void)
|
||||
{
|
||||
unsigned int ret = LZ_HARDWARE_SUCCESS;
|
||||
|
||||
/* led1 gpio init */
|
||||
LzGpioInit(GPIO0_PA5);
|
||||
/*led2 gpio init*/
|
||||
/* led2 gpio init */
|
||||
LzGpioInit(GPIO1_PD0);
|
||||
|
||||
/* 设置GPIO0_PA5为输出模式 */
|
||||
@@ -90,7 +90,6 @@ void e53_sc_io_init()
|
||||
***************************************************************/
|
||||
uint8_t MPU6050_Read_Buffer(uint8_t reg, uint8_t *p_buffer, uint16_t length)
|
||||
{
|
||||
|
||||
uint32_t status = 0;
|
||||
uint8_t buffer[1] = {reg};
|
||||
|
||||
@@ -162,7 +161,7 @@ void mpu6050_read_acc(short *acc_data)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void action_interrupt()
|
||||
void action_interrupt(void)
|
||||
{
|
||||
mpu6050_write_reg(MPU6050_RA_MOT_THR, 0x03); // 运动阈值
|
||||
mpu6050_write_reg(MPU6050_RA_MOT_DUR, 0x14); // 检测时间20ms 单位1ms
|
||||
@@ -174,7 +173,7 @@ void action_interrupt()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void mpu6050_init()
|
||||
void mpu6050_init(void)
|
||||
{
|
||||
#define DELAY_COUNT 1000000
|
||||
#define RESET_DELAY_MSEC 20 /* 复位等待设备重启完毕 */
|
||||
@@ -191,10 +190,10 @@ void mpu6050_init()
|
||||
mpu6050_write_reg(MPU6050_RA_INT_ENABLE, 0X00); // 关闭所有中断
|
||||
mpu6050_write_reg(MPU6050_RA_USER_CTRL, 0X00); // I2C主模式关闭
|
||||
mpu6050_write_reg(MPU6050_RA_FIFO_EN, 0X00); // 关闭FIFO
|
||||
mpu6050_write_reg(MPU6050_RA_INT_PIN_CFG, 0X80); // 中断的逻辑电平模式,设置为0,中断信号为高电;设置为1,中断信号为低电平时。
|
||||
mpu6050_write_reg(MPU6050_RA_INT_PIN_CFG, 0X80); // 中断的逻辑电平模式
|
||||
action_interrupt(); // 运动中断
|
||||
mpu6050_write_reg(MPU6050_RA_CONFIG, 0x04); // 配置外部引脚采样和DLPF数字低通滤波器
|
||||
mpu6050_write_reg(MPU6050_RA_ACCEL_CONFIG, 0x1C);// 加速度传感器量程和高通滤波器配置
|
||||
mpu6050_write_reg(MPU6050_RA_ACCEL_CONFIG, 0x1C); // 加速度传感器量程和高通滤波器配置
|
||||
mpu6050_write_reg(MPU6050_RA_INT_PIN_CFG, 0X1C); // INT引脚低电平平时
|
||||
mpu6050_write_reg(MPU6050_RA_INT_ENABLE, 0x40); // 中断使能寄存器
|
||||
}
|
||||
@@ -205,7 +204,7 @@ void mpu6050_init()
|
||||
* 返 回 值: 无
|
||||
* 说 明: 无
|
||||
***************************************************************/
|
||||
uint8_t mpu6050_read_id()
|
||||
uint8_t mpu6050_read_id(void)
|
||||
{
|
||||
unsigned char buff = 0;
|
||||
|
||||
@@ -224,7 +223,7 @@ uint8_t mpu6050_read_id()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_sc_init()
|
||||
void e53_sc_init(void)
|
||||
{
|
||||
#define WAIT_MPU6050_INIT_MSEC 1000
|
||||
e53_sc_io_init();
|
||||
@@ -247,7 +246,9 @@ void e53_sc_read_data(e53_sc_data_t *p_data)
|
||||
|
||||
/* 等待读取设备地址正常 */
|
||||
if (mpu6050_read_id() == 0) {
|
||||
while (1);
|
||||
while (1) {
|
||||
/* 什么都不做,等待 */
|
||||
}
|
||||
}
|
||||
|
||||
mpu6050_read_acc(accel);
|
||||
@@ -291,5 +292,4 @@ void led_d2_set(SWITCH_STATUS_ENUM status)
|
||||
/* 设置GPIO1_PD0输出高电平关闭灯 */
|
||||
LzGpioSetVal(GPIO1_PD0, LZGPIO_LEVEL_HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_isl_thread()
|
||||
void e53_isl_thread(void *args)
|
||||
{
|
||||
float lum = 0;
|
||||
|
||||
@@ -63,7 +63,7 @@ void e53_isl_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_isl_example()
|
||||
void e53_isl_example(void)
|
||||
{
|
||||
unsigned int ret = LOS_OK;
|
||||
unsigned int thread_id;
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef enum {
|
||||
} SWITCH_STATUS_ENUM;
|
||||
|
||||
void e53_isl_init(void);
|
||||
float e53_isl_read_data();
|
||||
float e53_isl_read_data(void);
|
||||
void isl_light_set_status(SWITCH_STATUS_ENUM status);
|
||||
|
||||
#endif/*__E53_INTELLIGENT_STREET_LAMP_H__*/
|
||||
#endif /* __E53_INTELLIGENT_STREET_LAMP_H__ */
|
||||
@@ -56,7 +56,7 @@ void e53_isl_io_init(void)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void init_bh1750()
|
||||
void init_bh1750(void)
|
||||
{
|
||||
uint8_t send_data[1] = {0x01};
|
||||
uint32_t send_len = 1;
|
||||
@@ -70,7 +70,7 @@ void init_bh1750()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void start_bh1750()
|
||||
void start_bh1750(void)
|
||||
{
|
||||
uint8_t send_data[1] = {0x10};
|
||||
uint32_t send_len = 1;
|
||||
@@ -96,7 +96,7 @@ void e53_isl_init(void)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
float e53_isl_read_data()
|
||||
float e53_isl_read_data(void)
|
||||
{
|
||||
/* 等待从设备准备完毕 */
|
||||
#define WAIT_SLAVE_DEVICE_START_MSEC 180
|
||||
@@ -125,12 +125,11 @@ float e53_isl_read_data()
|
||||
void isl_light_set_status(SWITCH_STATUS_ENUM status)
|
||||
{
|
||||
if (status == ON) {
|
||||
/*设置GPIO0_PA5输出高电平点亮灯*/
|
||||
/* 设置GPIO0_PA5输出高电平点亮灯 */
|
||||
LzGpioSetVal(GPIO0_PA5, LZGPIO_LEVEL_HIGH);
|
||||
}
|
||||
if (status == OFF) {
|
||||
/*设置GPIO0_PA5输出低电平关闭灯*/
|
||||
/* 设置GPIO0_PA5输出低电平关闭灯 */
|
||||
LzGpioSetVal(GPIO0_PA5, LZGPIO_LEVEL_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void e53_iv01_process(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_iv01_example()
|
||||
void e53_iv01_example(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
unsigned int thread_id;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int e53_iv01_init();
|
||||
unsigned int e53_iv01_init(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
@@ -30,7 +30,7 @@ unsigned int e53_iv01_init();
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_iv01_deinit();
|
||||
void e53_iv01_deinit(void);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
|
||||
@@ -50,6 +50,10 @@ static e53_iv01_echo_info_s m_echo_info = {
|
||||
static UINT32 m_task_sem;
|
||||
/* 定义轮询任务id */
|
||||
static UINT32 m_task_id = 0;
|
||||
/* 定义轮训任务的堆栈大小 */
|
||||
#define ECHO_TASK_STACK_SIZE 0x400
|
||||
/* 定义轮训任务的优先级 */
|
||||
#define ECHO_TASK_PRIO 30
|
||||
/* 定时器5的CURRENT_VALUE_LOW的基地址 */
|
||||
#define TIMER5_ADDRESS (0x400000A0U + 0x8U)
|
||||
static uint32_t *m_ptimer5_current_value_low = (uint32_t *)(TIMER5_ADDRESS);
|
||||
@@ -70,8 +74,6 @@ static PwmBusIo m_buzzer_config = {
|
||||
.mode = FUNC_MODE_NONE,
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_iv01_delay_usec
|
||||
* 说 明: 延时函数
|
||||
@@ -147,7 +149,7 @@ static VOID e53_iv01_task_echo_func(VOID *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_task_create_echo()
|
||||
static void e53_iv01_task_create_echo(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
TSK_INIT_PARAM_S task;
|
||||
@@ -158,9 +160,9 @@ static void e53_iv01_task_create_echo()
|
||||
(VOID)memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)e53_iv01_task_echo_func;
|
||||
task.pcName = "Cs100aTaskEcho";
|
||||
task.uwStackSize = 0x400;
|
||||
task.uwStackSize = ECHO_TASK_STACK_SIZE;
|
||||
/* 优先级比当前线程低 */
|
||||
task.usTaskPrio = 30;
|
||||
task.usTaskPrio = ECHO_TASK_PRIO;
|
||||
ret = LOS_TaskCreate(&m_task_id, &task);
|
||||
if (ret != LOS_OK) {
|
||||
printf("%s, %d: LOS_TaskCreate failed(%d)\n", __func__, __LINE__, ret);
|
||||
@@ -180,7 +182,7 @@ static void e53_iv01_task_create_echo()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_task_delete_echo()
|
||||
static void e53_iv01_task_delete_echo(void)
|
||||
{
|
||||
/* 锁任务调度 */
|
||||
LOS_TaskLock();
|
||||
@@ -197,11 +199,13 @@ static void e53_iv01_task_delete_echo()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_send_trig()
|
||||
static void e53_iv01_send_trig(void)
|
||||
{
|
||||
uint32_t delay_usec = 20;
|
||||
|
||||
/* 发送至少10usec的高电平给智慧车载,触发其工作 */
|
||||
E53_IV01_TRIG_Set();
|
||||
e53_iv01_delay_usec(20);
|
||||
e53_iv01_delay_usec(delay_usec);
|
||||
E53_IV01_TRIG_Clr();
|
||||
}
|
||||
|
||||
@@ -211,7 +215,7 @@ static void e53_iv01_send_trig()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_init_gpio()
|
||||
static void e53_iv01_init_gpio(void)
|
||||
{
|
||||
/* Trig引脚设置为GPIO输出模式 */
|
||||
PinctrlSet(E53_IV01_TRIG_GPIO, MUX_FUNC0, PULL_KEEP, DRIVE_KEEP);
|
||||
@@ -232,7 +236,7 @@ static void e53_iv01_init_gpio()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_deinit_gpio()
|
||||
static void e53_iv01_deinit_gpio(void)
|
||||
{
|
||||
LzGpioDeinit(E53_IV01_TRIG_GPIO);
|
||||
}
|
||||
@@ -243,7 +247,7 @@ static void e53_iv01_deinit_gpio()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static unsigned int e53_iv01_init_pwm()
|
||||
static unsigned int e53_iv01_init_pwm(void)
|
||||
{
|
||||
/* 初始化pwm */
|
||||
PinctrlSet(E53_IV01_BUZZER_GPIO, MUX_FUNC2, PULL_DOWN, DRIVE_KEEP);
|
||||
@@ -259,7 +263,7 @@ static unsigned int e53_iv01_init_pwm()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_deinit_pwm()
|
||||
static void e53_iv01_deinit_pwm(void)
|
||||
{
|
||||
LzPwmDeinit(E53_IV01_PWM_IO);
|
||||
}
|
||||
@@ -270,10 +274,8 @@ static void e53_iv01_deinit_pwm()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_init_interrupt()
|
||||
static void e53_iv01_init_interrupt(void)
|
||||
{
|
||||
//LzI2cInit(0, 400000);
|
||||
|
||||
/* 创建信号量 */
|
||||
LOS_SemCreate(0, &m_task_sem);
|
||||
|
||||
@@ -290,11 +292,11 @@ static void e53_iv01_init_interrupt()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_iv01_deinit_interrupt()
|
||||
static void e53_iv01_deinit_interrupt(void)
|
||||
{
|
||||
LzGpioDeinit(E53_IV01_ECHO0_GPIO);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_iv01_init
|
||||
@@ -302,7 +304,7 @@ static void e53_iv01_deinit_interrupt()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int e53_iv01_init()
|
||||
unsigned int e53_iv01_init(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
|
||||
@@ -325,7 +327,7 @@ unsigned int e53_iv01_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_iv01_deinit()
|
||||
void e53_iv01_deinit(void)
|
||||
{
|
||||
e53_iv01_deinit_interrupt();
|
||||
e53_iv01_deinit_pwm();
|
||||
|
||||
@@ -25,14 +25,13 @@
|
||||
/* 循环等待时间 */
|
||||
#define WAIT_MSEC 1000
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_bi_thread
|
||||
* 说 明: 人体感应模块线程
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_bi_thread()
|
||||
void e53_bi_thread(void)
|
||||
{
|
||||
unsigned int ret;
|
||||
LzGpioValue val = LZGPIO_LEVEL_LOW, val_last = LZGPIO_LEVEL_LOW;
|
||||
@@ -66,7 +65,7 @@ void e53_bi_thread()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_bi_example()
|
||||
void e53_bi_example(void)
|
||||
{
|
||||
unsigned int ret = LOS_OK;
|
||||
unsigned int thread_id;
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef enum {
|
||||
ON
|
||||
} SWITCH_STATUS_ENUM;
|
||||
|
||||
void e53_bi_init();
|
||||
void e53_bi_init(void);
|
||||
void buzzer_set_status(SWITCH_STATUS_ENUM status);
|
||||
|
||||
#endif/*__E53_BODY_INDUCTION_H__*/
|
||||
#endif /* __E53_BODY_INDUCTION_H__ */
|
||||
@@ -37,7 +37,7 @@ static PwmBusIo m_buzzer = {
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_bi_init()
|
||||
void e53_bi_init(void)
|
||||
{
|
||||
uint32_t ret = LZ_HARDWARE_SUCCESS;
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ static void paj7620u2_poll_task_init()
|
||||
(VOID)memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)paj7620u2_poll_task;
|
||||
task.pcName = "InterruptSemTask";
|
||||
task.uwStackSize = 0x400;
|
||||
task.uwStackSize = TASK_STACK_SIZE;
|
||||
task.usTaskPrio = 10;
|
||||
ret = LOS_TaskCreate(&m_pollTaskId, &task);
|
||||
if (ret != LOS_OK)
|
||||
|
||||
@@ -17,10 +17,16 @@
|
||||
#include "ohos_init.h"
|
||||
#include "e53_gesture_sensor.h"
|
||||
|
||||
/* 定义任务的堆栈大小 */
|
||||
#define TASK_STACK_SIZE 2048
|
||||
/* 定义任务的优先级 */
|
||||
#define TASK_PRIO 24
|
||||
|
||||
void e53_gs_process(void *arg)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
unsigned short flag = 0;
|
||||
unsigned int sleep_msec = 100;
|
||||
|
||||
e53_gs_init();
|
||||
|
||||
@@ -67,21 +73,21 @@ void e53_gs_process(void *arg)
|
||||
e53_gs_led_wave_set((flag & GES_WAVE) ? (1) : (0));
|
||||
} else {
|
||||
/* 如果没有数据,则多等待 */
|
||||
LOS_Msleep(100);
|
||||
LOS_Msleep(sleep_msec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void e53_gs_example()
|
||||
void e53_gs_example(void)
|
||||
{
|
||||
unsigned int thread_id;
|
||||
TSK_INIT_PARAM_S task = {0};
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)e53_gs_process;
|
||||
task.uwStackSize = 2048;
|
||||
task.uwStackSize = TASK_STACK_SIZE;
|
||||
task.pcName = "e53 getsture sensor process";
|
||||
task.usTaskPrio = 24;
|
||||
task.usTaskPrio = TASK_PRIO;
|
||||
ret = LOS_TaskCreate(&thread_id, &task);
|
||||
if (ret != LOS_OK) {
|
||||
printf("Falied to create Task_One ret:0x%x\n", ret);
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
#define _E53_GESTURE_SENSOR_H_
|
||||
|
||||
/* 手势识别效果 */
|
||||
#define GES_UP (0x1 << 0) //向上
|
||||
#define GES_DOWM (0x1 << 1) //向下
|
||||
#define GES_LEFT (0x1 << 2) //向左
|
||||
#define GES_RIGHT (0x1 << 3) //向右
|
||||
#define GES_FORWARD (0x1 << 4) //向前
|
||||
#define GES_BACKWARD (0x1 << 5) //向后
|
||||
#define GES_CLOCKWISE (0x1 << 6) //顺时针
|
||||
#define GES_COUNT_CLOCKWISE (0x1 << 7) //逆时针
|
||||
#define GES_WAVE (0x1 << 8) //挥动
|
||||
#define GES_UP (0x1 << 0) /* 向上 */
|
||||
#define GES_DOWM (0x1 << 1) /* 向下 */
|
||||
#define GES_LEFT (0x1 << 2) /* 向左 */
|
||||
#define GES_RIGHT (0x1 << 3) /* 向右 */
|
||||
#define GES_FORWARD (0x1 << 4) /* 向前 */
|
||||
#define GES_BACKWARD (0x1 << 5) /* 向后 */
|
||||
#define GES_CLOCKWISE (0x1 << 6) /* 顺时针 */
|
||||
#define GES_COUNT_CLOCKWISE (0x1 << 7) /* 逆时针 */
|
||||
#define GES_WAVE (0x1 << 8) /* 挥动 */
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_gs_init
|
||||
@@ -32,7 +32,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int e53_gs_init();
|
||||
unsigned int e53_gs_init(void);
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: gs_led_up_set
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
#include "los_sem.h"
|
||||
#include "lz_hardware.h"
|
||||
|
||||
/* 定义任务的堆栈大小 */
|
||||
#define TASK_STACK_SIZE 0x400
|
||||
/* 定义任务的优先级 */
|
||||
#define TASK_PRIO 10
|
||||
|
||||
/* LED对应RK2206芯片的GPIO引脚 */
|
||||
#define GPIO_LED_UP GPIO0_PB1
|
||||
#define GPIO_LED_DOWN GPIO0_PB0
|
||||
@@ -47,40 +52,40 @@ typedef enum {
|
||||
} BankId;
|
||||
|
||||
/* BANK的寄存器地址和BANK0~1 */
|
||||
#define PAJ_REG_BANK_SEL 0xEF //BANK选择寄存器
|
||||
#define PAJ_REB_BANK_SEL_BANK0 0x00 //BANK0
|
||||
#define PAJ_REB_BANK_SEL_BANK1 0x01 //BANK1
|
||||
#define PAJ_REG_BANK_SEL 0xEF // BANK选择寄存器
|
||||
#define PAJ_REB_BANK_SEL_BANK0 0x00 // BANK0
|
||||
#define PAJ_REB_BANK_SEL_BANK1 0x01 // BANK1
|
||||
|
||||
/* BANK0 寄存器组 */
|
||||
#define PAJ_REG_SUSPEND_CMD 0x03 //设置设备挂起
|
||||
#define PAJ_REG_SET_INT_FLAG1 0x41 //设置手势检测中断寄存器1
|
||||
#define PAJ_REG_SET_INT_FLAG2 0x42 //设置手势检测中断寄存器2
|
||||
#define PAJ_REG_GET_INT_FLAG1 0x43 //获取手势检测中断标志寄存器1(获取手势结果)
|
||||
#define PAJ_REG_GET_INT_FLAG2 0x44 //获取手势检测中断标志寄存器2(获取手势结果)
|
||||
#define PAJ_REG_GET_STATE 0x45 //获取手势检测工作状态
|
||||
#define PAJ_REG_SET_HIGH_THRESHOLD 0x69 //设置滞后高阀值(仅在接近检测模式下)
|
||||
#define PAJ_REG_SET_LOW_THRESEHOLD 0x6A //设置滞后低阀值
|
||||
#define PAJ_REG_GET_APPROACH_STATE 0x6B //获取接近状态 (1:PS data>= PS threshold ,0:PS data<= Low threshold)
|
||||
#define PAJ_REG_GET_GESTURE_DATA 0x6C //获取接近数据
|
||||
#define PAJ_REG_GET_OBJECT_BRIGHTNESS 0xB0 //获取被照物体亮度(最大255)
|
||||
#define PAJ_REG_GET_OBJECT_SIZE_1 0xB1 //获取被照物体大小低八位(bit7:0)(最大900)
|
||||
#define PAJ_REG_GET_OBJECT_SIZE_2 0xB2 //获取被照物体大小高四位(bit3:0)
|
||||
#define PAJ_REG_SUSPEND_CMD 0x03 // 设置设备挂起
|
||||
#define PAJ_REG_SET_INT_FLAG1 0x41 // 设置手势检测中断寄存器1
|
||||
#define PAJ_REG_SET_INT_FLAG2 0x42 // 设置手势检测中断寄存器2
|
||||
#define PAJ_REG_GET_INT_FLAG1 0x43 // 获取手势检测中断标志寄存器1(获取手势结果)
|
||||
#define PAJ_REG_GET_INT_FLAG2 0x44 // 获取手势检测中断标志寄存器2(获取手势结果)
|
||||
#define PAJ_REG_GET_STATE 0x45 // 获取手势检测工作状态
|
||||
#define PAJ_REG_SET_HIGH_THRESHOLD 0x69 // 设置滞后高阀值(仅在接近检测模式下)
|
||||
#define PAJ_REG_SET_LOW_THRESEHOLD 0x6A // 设置滞后低阀值
|
||||
#define PAJ_REG_GET_APPROACH_STATE 0x6B // 获取接近状态 (1:PS data>= PS threshold ,0:PS data<= Low threshold)
|
||||
#define PAJ_REG_GET_GESTURE_DATA 0x6C // 获取接近数据
|
||||
#define PAJ_REG_GET_OBJECT_BRIGHTNESS 0xB0 // 获取被照物体亮度(最大255)
|
||||
#define PAJ_REG_GET_OBJECT_SIZE_1 0xB1 // 获取被照物体大小低八位(bit7:0)(最大900)
|
||||
#define PAJ_REG_GET_OBJECT_SIZE_2 0xB2 // 获取被照物体大小高四位(bit3:0)
|
||||
|
||||
/* BANK1 寄存器组 */
|
||||
#define PAJ_REG_SET_PS_GAIN 0x44 //设置检测增益大小 (0:1x gain 1:2x gain)
|
||||
#define PAJ_REG_SET_IDLE_S1_STEP_0 0x67 //设置S1的响应因子
|
||||
#define PAJ_REG_SET_PS_GAIN 0x44 // 设置检测增益大小 (0:1x gain 1:2x gain)
|
||||
#define PAJ_REG_SET_IDLE_S1_STEP_0 0x67 // 设置S1的响应因子
|
||||
#define PAJ_REG_SET_IDLE_S1_STEP_1 0x68
|
||||
#define PAJ_REG_SET_IDLE_S2_STEP_0 0x69 //设置S2的响应因子
|
||||
#define PAJ_REG_SET_IDLE_S2_STEP_0 0x69 // 设置S2的响应因子
|
||||
#define PAJ_REG_SET_IDLE_S2_STEP_1 0x6A
|
||||
#define PAJ_REG_SET_OP_TO_S1_STEP_0 0x6B //设置OP到S1的过度时间
|
||||
#define PAJ_REG_SET_OP_TO_S1_STEP_0 0x6B // 设置OP到S1的过度时间
|
||||
#define PAJ_REG_SET_OP_TO_S1_STEP_1 0x6C
|
||||
#define PAJ_REG_SET_S1_TO_S2_STEP_0 0x6D //设置S1到S2的过度时间
|
||||
#define PAJ_REG_SET_S1_TO_S2_STEP_0 0x6D // 设置S1到S2的过度时间
|
||||
#define PAJ_REG_SET_S1_TO_S2_STEP_1 0x6E
|
||||
#define PAJ_REG_OPERATION_ENABLE 0x72 //设置PAJ7620U2使能寄存器
|
||||
#define PAJ_REG_OPERATION_ENABLE 0x72 // 设置PAJ7620U2使能寄存器
|
||||
|
||||
static uint8_t m_Paj7620u2_InitRegisterConfig[][2] = {
|
||||
{0xEF, 0x00}, //切换bank0
|
||||
{0x37, 0x07}, //
|
||||
{0xEF, 0x00}, // 切换bank0
|
||||
{0x37, 0x07},
|
||||
{0x38, 0x17},
|
||||
{0x39, 0x06},
|
||||
{0x41, 0x00},
|
||||
@@ -208,8 +213,6 @@ static fifo_s m_fifo_intflags;
|
||||
/* 轮询方式访问 */
|
||||
static UINT32 m_pollTaskId;
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
static inline void FifoInit(fifo_s *fifo)
|
||||
{
|
||||
fifo->offset_read = fifo->offset_write = 0;
|
||||
@@ -238,7 +241,7 @@ static inline uint16_t FifoGet(fifo_s *fifo, uint16_t *flag)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void e53_gs_led_init()
|
||||
static void e53_gs_led_init(void)
|
||||
{
|
||||
PinctrlSet(GPIO_LED_UP, MUX_FUNC0, PULL_KEEP, DRIVE_KEEP);
|
||||
LzGpioInit(GPIO_LED_UP);
|
||||
@@ -306,7 +309,7 @@ static inline void paj7620u2_delay_usec(uint32_t usec)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回1为成功
|
||||
***************************************************************/
|
||||
static uint8_t paj7620U2_write_null()
|
||||
static uint8_t paj7620U2_write_null(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
|
||||
@@ -402,7 +405,7 @@ static void paj7620u2_select_bank(BankId bank)
|
||||
* 参 数: 无
|
||||
* 返 回 值: BankId
|
||||
***************************************************************/
|
||||
static uint8_t paj7620u2_get_bank_id()
|
||||
static uint8_t paj7620u2_get_bank_id(void)
|
||||
{
|
||||
uint8_t bankId = 0;
|
||||
|
||||
@@ -416,7 +419,7 @@ static uint8_t paj7620u2_get_bank_id()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功
|
||||
***************************************************************/
|
||||
static uint32_t paj7620u2_wake_up()
|
||||
static uint32_t paj7620u2_wake_up(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint8_t data = 0;
|
||||
@@ -449,7 +452,7 @@ static uint32_t paj7620u2_wake_up()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void paj7620u2_suspend()
|
||||
static void paj7620u2_suspend(void)
|
||||
{
|
||||
/* 禁用PAJ7620U2,往bank1 addr 0x72寄存器写0x00 */
|
||||
paj7620u2_select_bank(BANK1);
|
||||
@@ -500,7 +503,7 @@ static VOID paj7620u2_poll_task(VOID *args)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void paj7620u2_i2c_init()
|
||||
static void paj7620u2_i2c_init(void)
|
||||
{
|
||||
if (I2cIoInit(m_i2cBus) != LZ_HARDWARE_SUCCESS) {
|
||||
printf("%s, %d: I2cIoInit failed!\n", __FILE__, __LINE__);
|
||||
@@ -521,7 +524,7 @@ static void paj7620u2_i2c_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void paj7620u2_poll_task_init()
|
||||
static void paj7620u2_poll_task_init(void)
|
||||
{
|
||||
TSK_INIT_PARAM_S task;
|
||||
uint8_t int_flag1, int_flag2;
|
||||
@@ -538,8 +541,8 @@ static void paj7620u2_poll_task_init()
|
||||
(VOID)memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
task.pfnTaskEntry = (TSK_ENTRY_FUNC)paj7620u2_poll_task;
|
||||
task.pcName = "InterruptSemTask";
|
||||
task.uwStackSize = 0x400;
|
||||
task.usTaskPrio = 10;
|
||||
task.uwStackSize = TASK_STACK_SIZE;
|
||||
task.usTaskPrio = TASK_PRIO;
|
||||
ret = LOS_TaskCreate(&m_pollTaskId, &task);
|
||||
if (ret != LOS_OK) {
|
||||
printf("%s, %d: LOS_TaskCreate failed(%d)\n", __func__, __LINE__, ret);
|
||||
@@ -563,7 +566,7 @@ static void paj7620u2_poll_task_init()
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
static void paj7620u2_init_config()
|
||||
static void paj7620u2_init_config(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
uint32_t size;
|
||||
@@ -589,15 +592,13 @@ static void paj7620u2_init_config()
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
/***************************************************************
|
||||
* 函数名称: e53_gs_init
|
||||
* 说 明: 手势感应模块初始化
|
||||
* 参 数: 无
|
||||
* 返 回 值: 返回0为成功,反之为失败
|
||||
***************************************************************/
|
||||
unsigned int e53_gs_init()
|
||||
unsigned int e53_gs_init(void)
|
||||
{
|
||||
/* 初始化LED */
|
||||
e53_gs_led_init();
|
||||
@@ -772,4 +773,3 @@ unsigned int e53_gs_get_gesture_state(unsigned short *flag)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user