mirror of
https://github.com/openharmony/vendor_lockzhiner.git
synced 2026-07-01 21:34:03 -04:00
@@ -32,7 +32,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_one(void *arg)
|
||||
void task_one(void)
|
||||
{
|
||||
while (1) {
|
||||
printf("This is %s\n", __func__);
|
||||
@@ -46,7 +46,7 @@ void task_one(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void task_two(void *arg)
|
||||
void task_two(void)
|
||||
{
|
||||
while (1) {
|
||||
printf("This is %s\n", __func__);
|
||||
|
||||
@@ -163,12 +163,12 @@ void timer_example()
|
||||
}
|
||||
}
|
||||
|
||||
void timer1_timeout(void *arg)
|
||||
void timer1_timeout(void)
|
||||
{
|
||||
printf("This is Timer1 Timeout function\n");
|
||||
}
|
||||
|
||||
void timer2_timeout(void *arg)
|
||||
void timer2_timeout(void)
|
||||
{
|
||||
printf("This is Timer2 Timeout function\n");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void timer1_timeout(void *arg)
|
||||
void timer1_timeout(void)
|
||||
{
|
||||
printf("This is Timer1 Timeout function\n");
|
||||
}
|
||||
@@ -37,7 +37,7 @@ void timer1_timeout(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void timer2_timeout(void *arg)
|
||||
void timer2_timeout(void)
|
||||
{
|
||||
printf("This is Timer2 Timeout function\n");
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void queue_example()
|
||||
msg_write_thread函数每隔1s,通过LOS_QueueWrite函数向队列中发送消息。
|
||||
|
||||
```c
|
||||
void msg_write_thread(void *arg)
|
||||
void msg_write_thread(void)
|
||||
{
|
||||
unsigned int data = 0;
|
||||
unsigned int ret = LOS_OK;
|
||||
@@ -175,7 +175,7 @@ void msg_write_thread(void *arg)
|
||||
msg_read_thread函数通过LOS_QueueRead函数读取队列中的消息,当队列中没有消息的时候,msg_read_thread函数阻塞等待消息。
|
||||
|
||||
```c
|
||||
void msg_read_thread(void *arg)
|
||||
void msg_read_thread(void)
|
||||
{
|
||||
unsigned int addr;
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
@@ -37,7 +37,7 @@ static unsigned int m_msg_queue;
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void msg_write_thread(void *arg)
|
||||
void msg_write_thread(void)
|
||||
{
|
||||
unsigned int data = 0;
|
||||
unsigned int ret = LOS_OK;
|
||||
@@ -62,7 +62,7 @@ void msg_write_thread(void *arg)
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void msg_read_thread(void *arg)
|
||||
void msg_read_thread(void)
|
||||
{
|
||||
unsigned int addr;
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lz_hardware.h"
|
||||
#include "NT3H.h"
|
||||
#include "ndef.h"
|
||||
#include "nfcForum.h"
|
||||
#include "NT3H.h"
|
||||
|
||||
/* NFC使用i2c的总线ID */
|
||||
static unsigned int NFC_I2C_PORT = 2;
|
||||
@@ -227,11 +227,11 @@ bool NT3HWriteUserData(uint8_t page, const uint8_t* data)
|
||||
uint8_t dataSend[NFC_PAGE_SIZE + 1]; // data plus register
|
||||
uint8_t reg = USER_START_REG + page;
|
||||
|
||||
// if the requested page is out of the register exit with error
|
||||
/* if the requested page is out of the register exit with error */
|
||||
if (reg > USER_END_REG) {
|
||||
errNo = NT3HERROR_INVALID_USER_MEMORY_PAGE;
|
||||
ret = false;
|
||||
goto end;
|
||||
return ret;
|
||||
}
|
||||
|
||||
dataSend[0] = reg; // store the register
|
||||
@@ -239,10 +239,9 @@ bool NT3HWriteUserData(uint8_t page, const uint8_t* data)
|
||||
ret = writeTimeout(dataSend, sizeof(dataSend));
|
||||
if (ret == false) {
|
||||
errNo = NT3HERROR_WRITE_USER_MEMORY_PAGE;
|
||||
goto end;
|
||||
return ret;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#ifndef NT3H_H_
|
||||
#define NT3H_H_
|
||||
|
||||
#include "stdbool.h"
|
||||
#include <stdint.h>
|
||||
#include "stdbool.h"
|
||||
#include "nfc.h"
|
||||
#include "lz_hardware.h"
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ static bool writeUserPayload(int16_t payloadPtr, const NDEFDataStr *data, Uncomp
|
||||
if (ret == false) {
|
||||
errNo = NT3HERROR_WRITE_NDEF_TEXT;
|
||||
}
|
||||
goto end;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (addedPayload < data->rtdPayloadlength) {
|
||||
@@ -188,14 +188,13 @@ static bool writeUserPayload(int16_t payloadPtr, const NDEFDataStr *data, Uncomp
|
||||
ret = NT3HWriteUserData(addPage->page, nfcPageBuffer);
|
||||
if (ret == false) {
|
||||
errNo = NT3HERROR_WRITE_NDEF_TEXT;
|
||||
goto end;
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
endRecord = true;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "rtdText.h"
|
||||
#include "rtdTypes.h"
|
||||
#include <string.h>
|
||||
#include "rtdTypes.h"
|
||||
#include "rtdText.h"
|
||||
|
||||
uint8_t addRtdText(RtdTextTypeStr *typeStr)
|
||||
{
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "NT3H.h"
|
||||
|
||||
#ifndef RTDURI_H_
|
||||
#define RTDURI_H_
|
||||
|
||||
#include "NT3H.h"
|
||||
|
||||
typedef enum {
|
||||
freeForm, // 0x00 No prepending is done ... the entire URI is contained in the URI Field
|
||||
httpWWW, // 0x01 http://www.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
/* 循环等待时间 */
|
||||
#define WAIT_MSEC 5000
|
||||
|
||||
void eeprom_proress(void *arg)
|
||||
void eeprom_proress(void)
|
||||
{
|
||||
#define FOR_CHAR 30
|
||||
#define FOR_ADDRESS 32
|
||||
|
||||
@@ -22,8 +22,22 @@
|
||||
#define EEPROM_PAGE 8
|
||||
|
||||
static I2cBusIo m_i2cBus = {
|
||||
.scl = {.gpio = GPIO0_PA1, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.sda = {.gpio = GPIO0_PA0, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.scl = {
|
||||
.gpio = GPIO0_PA1,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.sda = {
|
||||
.gpio = GPIO0_PA0,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_I2C0,
|
||||
.mode = FUNC_MODE_M2,
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ extern const unsigned char gImage_lingzhi[IMAGE_MAXSIZE_LINGZHI];
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void lcd_process(void *arg)
|
||||
void lcd_process(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
float t = 0;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#define OLED_STRING4_Y 6
|
||||
#define OLED_STRING4_SIZE 16
|
||||
|
||||
void oled_process(void *arg)
|
||||
void oled_process(void)
|
||||
{
|
||||
unsigned char buffer[STRING_MAXSIZE];
|
||||
int i = 0;
|
||||
|
||||
@@ -245,7 +245,7 @@ int lwip_close(int sockfd);
|
||||
创建客户端任务 socket-->connect-->send-->recv-->lwip_close
|
||||
|
||||
```c
|
||||
int wifi_client(void* arg)
|
||||
int wifi_client(void)
|
||||
{
|
||||
int client_fd, ret;
|
||||
struct sockaddr_in serv_addr;
|
||||
@@ -321,7 +321,7 @@ void tcp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
创建服务端任务 socket-->bind-->listen-->accept-->recv-->send-->close
|
||||
|
||||
```c
|
||||
int wifi_server(void* arg)
|
||||
int wifi_server(void)
|
||||
{
|
||||
int server_fd, ret;
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ int get_wifi_info(WifiLinkedInfo *info)
|
||||
LZ_HARDWARE_LOGD(LOG_TAG, "network NETMASK (%s)", inet_ntoa(addr));
|
||||
}
|
||||
ret = 0;
|
||||
goto connect_done;
|
||||
retry = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,6 @@ int get_wifi_info(WifiLinkedInfo *info)
|
||||
retry--;
|
||||
}
|
||||
|
||||
connect_done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void tcp_server_msg_handle(int fd)
|
||||
lwip_close(fd);
|
||||
}
|
||||
|
||||
int wifi_server(void* arg)
|
||||
int wifi_server(void)
|
||||
{
|
||||
int server_fd, ret;
|
||||
|
||||
@@ -175,8 +175,9 @@ int wifi_server(void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
void tcp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
void tcp_client_msg_handle(int fd_src, struct sockaddr* dst)
|
||||
{
|
||||
int fd = fd_src;
|
||||
socklen_t len = sizeof(*dst);
|
||||
|
||||
int cnt = 0, count = 0;
|
||||
@@ -207,7 +208,7 @@ void tcp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
lwip_close(fd);
|
||||
}
|
||||
|
||||
int wifi_client(void* arg)
|
||||
int wifi_client(void)
|
||||
{
|
||||
int client_fd, ret;
|
||||
struct sockaddr_in serv_addr;
|
||||
@@ -245,7 +246,7 @@ int wifi_client(void* arg)
|
||||
}
|
||||
|
||||
|
||||
void wifi_process(void *args)
|
||||
void wifi_process(void)
|
||||
{
|
||||
unsigned int threadID_client, threadID_server;
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
@@ -210,7 +210,7 @@ int lwip_close(int sockfd);
|
||||
创建客户端任务 socket-->connect-->send-->recv-->lwip_close
|
||||
|
||||
```c
|
||||
int wifi_udp_client(void* arg)
|
||||
int wifi_udp_client(void)
|
||||
{
|
||||
int client_fd, ret;
|
||||
struct sockaddr_in serv_addr, local_addr;
|
||||
@@ -299,7 +299,7 @@ void udp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
创建服务端任务 socket-->bind-->listen-->accept-->recv-->send-->close
|
||||
|
||||
```c
|
||||
int wifi_udp_server(void* arg)
|
||||
int wifi_udp_server(void)
|
||||
{
|
||||
int server_fd, ret;
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ int udp_get_wifi_info(WifiLinkedInfo *info)
|
||||
LZ_HARDWARE_LOGD(LOG_TAG, "network NETMASK (%s)", inet_ntoa(addr));
|
||||
}
|
||||
ret = 0;
|
||||
goto connect_done;
|
||||
retry = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +91,6 @@ int udp_get_wifi_info(WifiLinkedInfo *info)
|
||||
retry--;
|
||||
}
|
||||
|
||||
connect_done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ void udp_server_msg_handle(int fd)
|
||||
lwip_close(fd);
|
||||
}
|
||||
|
||||
int wifi_udp_server(void* arg)
|
||||
int wifi_udp_server(void)
|
||||
{
|
||||
int server_fd, ret;
|
||||
struct in_addr addr;
|
||||
@@ -216,7 +216,7 @@ void udp_client_msg_handle(int fd, struct sockaddr* dst)
|
||||
}
|
||||
|
||||
|
||||
int wifi_udp_client(void* arg)
|
||||
int wifi_udp_client(void)
|
||||
{
|
||||
int client_fd, ret;
|
||||
struct sockaddr_in serv_addr, local_addr;
|
||||
@@ -266,7 +266,7 @@ int wifi_udp_client(void* arg)
|
||||
}
|
||||
|
||||
|
||||
void wifi_udp_process(void *args)
|
||||
void wifi_udp_process(void)
|
||||
{
|
||||
unsigned int threadID_client, threadID_server;
|
||||
unsigned int ret = LOS_OK;
|
||||
|
||||
@@ -26,8 +26,22 @@
|
||||
#define SHT30_ADDR 0x44
|
||||
|
||||
static I2cBusIo m_ia_i2c0m2 = {
|
||||
.scl = {.gpio = GPIO0_PA1, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.sda = {.gpio = GPIO0_PA0, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.scl = {
|
||||
.gpio = GPIO0_PA1,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.sda = {
|
||||
.gpio = GPIO0_PA0,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_I2C0,
|
||||
.mode = FUNC_MODE_M2,
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_isl_thread(void *args)
|
||||
void e53_isl_thread(void)
|
||||
{
|
||||
float lum = 0;
|
||||
|
||||
|
||||
@@ -24,8 +24,22 @@
|
||||
#define BH1750_ADDR 0x23
|
||||
|
||||
static I2cBusIo m_isl_i2c0m2 = {
|
||||
.scl = {.gpio = GPIO0_PA1, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.sda = {.gpio = GPIO0_PA0, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.scl = {
|
||||
.gpio = GPIO0_PA1,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.sda = {
|
||||
.gpio = GPIO0_PA0,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_I2C0,
|
||||
.mode = FUNC_MODE_M2,
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
* 参 数: 无
|
||||
* 返 回 值: 无
|
||||
***************************************************************/
|
||||
void e53_iv01_process(void *arg)
|
||||
void e53_iv01_process(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
/* 每个周期为200usec,占空比为100usec */
|
||||
|
||||
@@ -19,14 +19,35 @@
|
||||
#define BI_PWM7 7
|
||||
|
||||
static I2cBusIo m_bi_i2c0m2 = {
|
||||
.scl = {.gpio = GPIO0_PA1, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.sda = {.gpio = GPIO0_PA0, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.scl = {
|
||||
.gpio = GPIO0_PA1,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.sda = {
|
||||
.gpio = GPIO0_PA0,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_I2C0,
|
||||
.mode = FUNC_MODE_M2,
|
||||
};
|
||||
|
||||
static PwmBusIo m_buzzer = {
|
||||
.pwm = {.gpio = GPIO1_PD0, .func = MUX_FUNC1, .type = PULL_DOWN, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.pwm = {
|
||||
.gpio = GPIO1_PD0,
|
||||
.func = MUX_FUNC1,
|
||||
.type = PULL_DOWN,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_PWM7,
|
||||
.mode = FUNC_MODE_NONE,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/* 定义任务的优先级 */
|
||||
#define TASK_PRIO 24
|
||||
|
||||
void e53_gs_process(void *arg)
|
||||
void e53_gs_process(void)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
unsigned short flag = 0;
|
||||
|
||||
@@ -36,8 +36,22 @@
|
||||
|
||||
#define E53_I2C_BUS 0
|
||||
static I2cBusIo m_i2cBus = {
|
||||
.scl = {.gpio = GPIO0_PA1, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.sda = {.gpio = GPIO0_PA0, .func = MUX_FUNC3, .type = PULL_NONE, .drv = DRIVE_KEEP, .dir = LZGPIO_DIR_KEEP, .val = LZGPIO_LEVEL_KEEP},
|
||||
.scl = {
|
||||
.gpio = GPIO0_PA1,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.sda = {
|
||||
.gpio = GPIO0_PA0,
|
||||
.func = MUX_FUNC3,
|
||||
.type = PULL_NONE,
|
||||
.drv = DRIVE_KEEP,
|
||||
.dir = LZGPIO_DIR_KEEP,
|
||||
.val = LZGPIO_LEVEL_KEEP
|
||||
},
|
||||
.id = FUNC_ID_I2C0,
|
||||
.mode = FUNC_MODE_M2,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user