Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
f7ba146a
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f7ba146a
编写于
1月 14, 2022
作者:
W
Wayne Lin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add sdk_dist.py and ADC touching calibration function.
上级
0b99eee4
变更
26
展开全部
显示空白变更内容
内联
并排
Showing
26 changed file
with
2446 addition
and
394 deletion
+2446
-394
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.c
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.c
+104
-91
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.h
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.h
+26
-6
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
+457
-66
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c
+2
-1
bsp/nuvoton/libraries/nu_packages/Kconfig
bsp/nuvoton/libraries/nu_packages/Kconfig
+15
-3
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h
+106
-15
bsp/nuvoton/libraries/nuc980/Driver/Include/nuc980.h
bsp/nuvoton/libraries/nuc980/Driver/Include/nuc980.h
+32
-19
bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig
bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig
+7
-0
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.c
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.c
+469
-14
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.h
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.h
+84
-0
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc_touch.c
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc_touch.c
+681
-0
bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c
bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c
+1
-1
bsp/nuvoton/nk-980iot/.config
bsp/nuvoton/nk-980iot/.config
+24
-33
bsp/nuvoton/nk-980iot/board/Kconfig
bsp/nuvoton/nk-980iot/board/Kconfig
+1
-0
bsp/nuvoton/nk-980iot/board/nu_pin_init.c
bsp/nuvoton/nk-980iot/board/nu_pin_init.c
+2
-0
bsp/nuvoton/nk-980iot/rtconfig.py
bsp/nuvoton/nk-980iot/rtconfig.py
+7
-1
bsp/nuvoton/nk-980iot/spinor.config
bsp/nuvoton/nk-980iot/spinor.config
+299
-106
bsp/nuvoton/nk-n9h30/rtconfig.py
bsp/nuvoton/nk-n9h30/rtconfig.py
+7
-1
bsp/nuvoton/nk-rtu980/rtconfig.py
bsp/nuvoton/nk-rtu980/rtconfig.py
+7
-1
bsp/nuvoton/numaker-iot-m487/rtconfig.py
bsp/nuvoton/numaker-iot-m487/rtconfig.py
+8
-0
bsp/nuvoton/numaker-m032ki/rtconfig.py
bsp/nuvoton/numaker-m032ki/rtconfig.py
+8
-0
bsp/nuvoton/numaker-m2354/.config
bsp/nuvoton/numaker-m2354/.config
+22
-18
bsp/nuvoton/numaker-m2354/rtconfig.py
bsp/nuvoton/numaker-m2354/rtconfig.py
+8
-0
bsp/nuvoton/numaker-pfm-m487/.config
bsp/nuvoton/numaker-pfm-m487/.config
+22
-18
bsp/nuvoton/numaker-pfm-m487/rtconfig.py
bsp/nuvoton/numaker-pfm-m487/rtconfig.py
+8
-0
bsp/nuvoton/tools/sdk_dist.py
bsp/nuvoton/tools/sdk_dist.py
+39
-0
未找到文件。
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.c
浏览文件 @
f7ba146a
...
...
@@ -35,24 +35,27 @@ struct nu_adc
uint32_t
chn_mask
;
rt_sem_t
m_psSem
;
#if defined(BSP_USING_ADC_TOUCH)
rt_touch_t
psRtTouch
;
rt_timer_t
psRtTouchMenuTimer
;
rt_mq_t
m_pmqTouchXYZ
;
#endif
nu_adc_cb
m_isr
[
eAdc_ISR_CNT
];
nu_adc_cb
m_wkisr
[
eAdc_WKISR_CNT
];
rt_mq_t
m_pmqTouchXYZ
;
};
typedef
struct
nu_adc
*
nu_adc_t
;
#if defined(BSP_USING_ADC_TOUCH)
struct
nu_adc_touch_data
{
uint
16_t
u16
X
;
uint
16_t
u16
Y
;
uint
16_t
u16
Z0
;
uint
16_t
u16
Z1
;
uint
32_t
u32
X
;
uint
32_t
u32
Y
;
uint
32_t
u32
Z0
;
uint
32_t
u32
Z1
;
};
typedef
struct
nu_adc_touch_data
*
nu_adc_touch_data_t
;
#endif
/* Private functions ------------------------------------------------------------*/
static
rt_err_t
nu_adc_enabled
(
struct
rt_adc_device
*
device
,
rt_uint32_t
channel
,
rt_bool_t
enabled
);
...
...
@@ -134,44 +137,30 @@ static rt_err_t _nu_adc_init(rt_device_t dev)
return
RT_EOK
;
}
void
nu_adc_touch_detect
(
rt_bool_t
bStartDetect
)
static
int32_t
AdcMenuStartCallback
(
uint32_t
status
,
uint32_t
userData
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
userData
;
if
(
bStartDetect
)
{
/* Start detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_ON
,
RT_NULL
);
}
else
{
/* Stop detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_OFF
,
RT_NULL
);
}
}
#if defined(BSP_USING_ADC_TOUCH)
static
int32_t
AdcMenuStartCallback
(
uint32_t
status
,
uint32_t
userData
)
{
static
struct
nu_adc_touch_data
point
;
static
rt_bool_t
bDrop
=
RT_FALSE
;
static
uint16_t
u16LastZ0
=
0xfffful
;
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
userData
;
static
uint32_t
u32LastZ0
=
0xffffu
;
if
(
psNuAdc
->
psRtTouch
!=
RT_NULL
)
{
uint32_t
value
;
value
=
inpw
(
REG_ADC_XYDATA
);
point
.
u
16X
=
(
uint16_t
)
(
value
&
0x0ffful
);
point
.
u
16Y
=
(
uint16_t
)
((
value
>>
16
)
&
0x0ffful
);
point
.
u
32X
=
(
value
&
0x0ffful
);
point
.
u
32Y
=
((
value
>>
16
)
&
0x0ffful
);
value
=
inpw
(
REG_ADC_ZDATA
);
point
.
u
16Z0
=
(
uint16_t
)
(
value
&
0x0ffful
);
point
.
u
16Z1
=
(
uint16_t
)
((
value
>>
16
)
&
0x0ffful
);
point
.
u
32Z0
=
(
value
&
0x0ffful
);
point
.
u
32Z1
=
((
value
>>
16
)
&
0x0ffful
);
/* Trigger next or not. */
if
(
point
.
u
16
Z0
==
0
)
if
(
point
.
u
32
Z0
==
0
)
{
/* Stop sampling procedure. */
rt_timer_stop
(
g_sNuADC
.
psRtTouchMenuTimer
);
...
...
@@ -187,14 +176,15 @@ static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
}
/* Notify upper layer. */
if
((
!
bDrop
||
(
u
16
LastZ0
!=
0
))
&&
rt_mq_send
(
psNuAdc
->
m_pmqTouchXYZ
,
(
const
void
*
)
&
point
,
sizeof
(
struct
nu_adc_touch_data
))
==
RT_EOK
)
if
((
!
bDrop
||
(
u
32
LastZ0
!=
0
))
&&
rt_mq_send
(
psNuAdc
->
m_pmqTouchXYZ
,
(
const
void
*
)
&
point
,
sizeof
(
struct
nu_adc_touch_data
))
==
RT_EOK
)
{
rt_hw_touch_isr
(
psNuAdc
->
psRtTouch
);
}
u
16LastZ0
=
point
.
u16
Z0
;
u
32LastZ0
=
point
.
u32
Z0
;
}
else
#endif
{
rt_err_t
result
=
rt_sem_release
(
psNuAdc
->
m_psSem
);
RT_ASSERT
(
result
==
RT_EOK
);
...
...
@@ -203,6 +193,23 @@ static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
return
0
;
}
#if defined(BSP_USING_ADC_TOUCH)
void
nu_adc_touch_detect
(
rt_bool_t
bStartDetect
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
if
(
bStartDetect
)
{
/* Start detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_ON
,
RT_NULL
);
}
else
{
/* Stop detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_OFF
,
RT_NULL
);
}
}
static
int32_t
PenDownCallback
(
uint32_t
status
,
uint32_t
userData
)
{
...
...
@@ -213,7 +220,7 @@ static int32_t PenDownCallback(uint32_t status, uint32_t userData)
return
0
;
}
int32_t
nu_adc_
read_touch_xyz
(
uint16_t
*
bufX
,
uint16_t
*
bufY
,
uint16_t
*
bufZ0
,
uint16
_t
*
bufZ1
,
int32_t
dataCnt
)
int32_t
nu_adc_
touch_read_xyz
(
uint32_t
*
bufX
,
uint32_t
*
bufY
,
uint32_t
*
bufZ0
,
uint32
_t
*
bufZ1
,
int32_t
dataCnt
)
{
int
i
;
struct
nu_adc_touch_data
value
;
...
...
@@ -223,14 +230,71 @@ int32_t nu_adc_read_touch_xyz(uint16_t *bufX, uint16_t *bufY, uint16_t *bufZ0, u
if
(
rt_mq_recv
(
g_sNuADC
.
m_pmqTouchXYZ
,
(
void
*
)
&
value
,
sizeof
(
struct
nu_adc_touch_data
),
0
)
==
-
RT_ETIMEOUT
)
break
;
bufX
[
i
]
=
value
.
u
16
X
;
bufY
[
i
]
=
value
.
u
16
Y
;
bufZ0
[
i
]
=
value
.
u
16
Z0
;
bufZ1
[
i
]
=
value
.
u
16
Z1
;
bufX
[
i
]
=
value
.
u
32
X
;
bufY
[
i
]
=
value
.
u
32
Y
;
bufZ0
[
i
]
=
value
.
u
32
Z0
;
bufZ1
[
i
]
=
value
.
u
32
Z1
;
}
return
i
;
}
void
nu_adc_touch_start_conv
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
START_MST
,
RT_NULL
);
}
rt_err_t
nu_adc_touch_enable
(
rt_touch_t
psRtTouch
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_cb
sNuAdcCb
;
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
7
);
outpw
(
REG_ADC_CONF
,
(
inpw
(
REG_ADC_CONF
)
&
~
(
0xfful
<<
24
))
|
0xfful
<<
24
);
/* Register touch device. */
psNuAdc
->
psRtTouch
=
psRtTouch
;
/* Enable TouchXY. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_ON
,
RT_NULL
);
/* Enable TouchZZ. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_ON
,
RT_NULL
);
/* Register PenDown callback. */
sNuAdcCb
.
cbfunc
=
PenDownCallback
;
sNuAdcCb
.
private_data
=
(
rt_uint32_t
)
psRtTouch
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_ON
,
(
void
*
)
&
sNuAdcCb
);
nu_adc_touch_detect
(
RT_TRUE
);
return
RT_EOK
;
}
rt_err_t
nu_adc_touch_disable
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_touch_detect
(
RT_FALSE
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_OFF
,
RT_NULL
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
7
);
return
RT_EOK
;
}
#endif
static
rt_err_t
_nu_adc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
rt_err_t
ret
=
RT_EINVAL
;
...
...
@@ -443,7 +507,9 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
case
Z_OFF
:
/* Disable Press measure function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_ZEN
);
#if defined(BSP_USING_ADC_TOUCH)
rt_mq_control
(
psNuAdc
->
m_pmqTouchXYZ
,
RT_IPC_CMD_RESET
,
RT_NULL
);
#endif
}
break
;
...
...
@@ -522,61 +588,6 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
return
RT_EOK
;
}
void
nu_adc_touch_start_conv
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
START_MST
,
RT_NULL
);
}
rt_err_t
nu_adc_touch_enable
(
rt_touch_t
psRtTouch
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_cb
sNuAdcCb
;
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
7
);
outpw
(
REG_ADC_CONF
,
(
inpw
(
REG_ADC_CONF
)
&
~
(
0xfful
<<
24
))
|
0xfful
<<
24
);
/* Register touch device. */
psNuAdc
->
psRtTouch
=
psRtTouch
;
/* Enable TouchXY. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_ON
,
RT_NULL
);
/* Enable TouchZZ. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_ON
,
RT_NULL
);
/* Register PenDown callback. */
sNuAdcCb
.
cbfunc
=
PenDownCallback
;
sNuAdcCb
.
private_data
=
(
rt_uint32_t
)
psRtTouch
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_ON
,
(
void
*
)
&
sNuAdcCb
);
nu_adc_touch_detect
(
RT_TRUE
);
return
RT_EOK
;
}
rt_err_t
nu_adc_touch_disable
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_touch_detect
(
RT_FALSE
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_OFF
,
RT_NULL
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
7
);
return
RT_EOK
;
}
static
rt_err_t
_nu_adc_open
(
rt_device_t
dev
,
rt_uint16_t
oflag
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
dev
;
...
...
@@ -709,11 +720,13 @@ int rt_hw_adc_init(void)
g_sNuADC
.
m_psSem
=
rt_sem_create
(
"adc_mst_sem"
,
0
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
g_sNuADC
.
m_psSem
!=
RT_NULL
);
#if defined(BSP_USING_ADC_TOUCH)
g_sNuADC
.
m_pmqTouchXYZ
=
rt_mq_create
(
"ADC_TOUCH_XYZ"
,
sizeof
(
struct
nu_adc_touch_data
),
TOUCH_MQ_LENGTH
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
g_sNuADC
.
m_pmqTouchXYZ
!=
RT_NULL
);
g_sNuADC
.
psRtTouchMenuTimer
=
rt_timer_create
(
"TOUCH_SMPL_TIMER"
,
nu_adc_touch_smpl
,
(
void
*
)
&
g_sNuADC
,
DEF_ADC_TOUCH_SMPL_TICK
,
RT_TIMER_FLAG_PERIODIC
);
RT_ASSERT
(
g_sNuADC
.
psRtTouchMenuTimer
!=
RT_NULL
);
#endif
rt_memset
(
&
g_sNuADC
.
m_isr
,
0
,
sizeof
(
g_sNuADC
.
m_isr
));
rt_memset
(
&
g_sNuADC
.
m_wkisr
,
0
,
sizeof
(
g_sNuADC
.
m_wkisr
));
...
...
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.h
浏览文件 @
f7ba146a
...
...
@@ -15,9 +15,13 @@
#include <rtthread.h>
#include "nu_adc.h"
#include "touch.h"
#if defined(BSP_USING_ADC_TOUCH)
#include "touch.h"
#endif
#define TOUCH_MQ_LENGTH 128
#define TOUCH_MQ_LENGTH 64
#define DEF_CAL_POINT_NUM 5
typedef
enum
{
...
...
@@ -52,13 +56,29 @@ typedef struct
typedef
nu_adc_cb
*
nu_adc_cb_t
;
int32_t
nu_adc_read_touch_xyz
(
uint16_t
*
bufX
,
uint16_t
*
bufY
,
uint16_t
*
bufZ0
,
uint16_t
*
bufZ1
,
int32_t
dataCnt
);
#if defined(BSP_USING_ADC_TOUCH)
typedef
struct
{
int32_t
x
;
int32_t
y
;
}
S_COORDINATE_POINT
;
typedef
struct
{
int32_t
a
;
int32_t
b
;
int32_t
c
;
int32_t
d
;
int32_t
e
;
int32_t
f
;
int32_t
div
;
}
S_CALIBRATION_MATRIX
;
int32_t
nu_adc_touch_read_xyz
(
uint32_t
*
bufX
,
uint32_t
*
bufY
,
uint32_t
*
bufZ0
,
uint32_t
*
bufZ1
,
int32_t
dataCnt
);
rt_err_t
nu_adc_touch_enable
(
rt_touch_t
psRtTouch
);
rt_err_t
nu_adc_touch_disable
(
void
);
void
nu_adc_touch_detect
(
rt_bool_t
bStartDetect
);
void
nu_adc_touch_start_conv
(
void
);
void
nu_adc_touch_update_caldata
(
int
*
psi32NewValue
);
void
nu_adc_touch_reset_caldata
(
int
*
psi32NewValue
);
#endif
#endif
/* __DRV_ADC_H__ */
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
浏览文件 @
f7ba146a
此差异已折叠。
点击以展开。
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c
浏览文件 @
f7ba146a
...
...
@@ -27,6 +27,7 @@ static struct rt_device_graphic_info g_Ili9341Info =
.
pixel_format
=
RTGRAPHIC_PIXEL_FORMAT_RGB565
,
.
framebuffer
=
RT_NULL
,
.
width
=
XSIZE_PHYS
,
.
pitch
=
XSIZE_PHYS
*
2
,
.
height
=
YSIZE_PHYS
};
...
...
@@ -324,7 +325,7 @@ int rt_hw_lcd_ili9341_init(void)
lcd_device
.
user_data
=
&
ili9341_ops
;
#if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
g_Ili9341Info
.
framebuffer
=
rt_malloc_align
((
DEF_VRAM_BUFFER_NUMBER
*
g_Ili9341Info
.
width
*
g_Ili9341Info
.
height
*
(
g_Ili9341Info
.
bits_per_pixel
/
8
)
)
+
32
,
32
);
g_Ili9341Info
.
framebuffer
=
rt_malloc_align
((
DEF_VRAM_BUFFER_NUMBER
*
g_Ili9341Info
.
pitch
*
g_Ili9341Info
.
height
)
+
32
,
32
);
RT_ASSERT
(
g_Ili9341Info
.
framebuffer
!=
RT_NULL
);
#endif
...
...
bsp/nuvoton/libraries/nu_packages/Kconfig
浏览文件 @
f7ba146a
...
...
@@ -62,8 +62,20 @@ menu "Nuvoton Packages Config"
default n
config NU_PKG_ILI9341_HORIZONTAL
bool "Set horizontal view. (320x240)"
default n
bool
default y
config BSP_LCD_BPP
int
default 16 if NU_PKG_USING_ILI9341
config BSP_LCD_WIDTH
int
default 320 if NU_PKG_ILI9341_HORIZONTAL
config BSP_LCD_HEIGHT
int
default 240 if NU_PKG_ILI9341_HORIZONTAL
endif
...
...
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h
浏览文件 @
f7ba146a
...
...
@@ -35,49 +35,140 @@ extern "C"
#define ADC_ERR_CMD 2
/*!< The command is wrong */
/// @cond HIDDEN_SYMBOLS
typedef
INT32
(
*
ADC_CALLBACK
)(
UINT32
status
,
UINT32
userData
);
typedef
int32_t
(
*
ADC_CALLBACK
)(
uint32_t
status
,
uint32_t
userData
);
/// @endcond HIDDEN_SYMBOLS
/*---------------------------------------------------------------------------------------------------------*/
/* ADC_CTL constant definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define ADC_CTL_ADEN 0x00000001
/*!< ADC Power Control */
#define ADC_CTL_VBGEN 0x00000002
/*!< ADC Internal Bandgap Power Control */
#define ADC_CTL_PWKPEN 0x00000004
/*!< ADC Keypad Power Enable Control */
#define ADC_CTL_MST 0x00000100
/*!< Menu Start Conversion */
#define ADC_CTL_PEDEEN 0x00000200
/*!< Pen Down Event Enable */
#define ADC_CTL_WKPEN 0x00000400
/*!< Keypad Press Wake Up Enable */
#define ADC_CTL_WKTEN 0x00000800
/*!< Touch Wake Up Enable */
#define ADC_CTL_WMSWCH 0x00010000
/*!< Wire Mode Switch For 5-Wire/4-Wire Configuration */
/*---------------------------------------------------------------------------------------------------------*/
/* ADC_CONF constant definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define ADC_CONF_TEN 0x00000001
/*!< Touch Enable */
#define ADC_CONF_ZEN 0x00000002
/*!< Press Enable */
#define ADC_CONF_NACEN 0x00000004
/*!< Normal AD Conversion Enable */
#define ADC_CONF_VBATEN 0x00000100
/*!< Voltage Battery Enable */
#define ADC_CONF_KPCEN 0x00000200
/*!< Keypad Press Conversion Enable */
#define ADC_CONF_SELFTEN 0x00000400
/*!< Selft Test Enable */
#define ADC_CONF_DISTMAVEN (1<<20)
/*!< Display T Mean Average Enable */
#define ADC_CONF_DISZMAVEN (1<<21)
/*!< Display Z Mean Average Enable */
#define ADC_CONF_HSPEED (1<<22)
/*!< High Speed Enable */
#define ADC_CONF_CHSEL_Pos 12
/*!< Channel Selection Position */
#define ADC_CONF_CHSEL_Msk (0xF<<ADC_CONF_CHSEL_Pos)
/*!< Channel Selection Mask */
#define ADC_CONF_CHSEL_Pos 3
/*!< Channel Selection Position */
#define ADC_CONF_CHSEL_Msk (7<<3)
/*!< Channel Selection Mask */
#define ADC_CONF_CHSEL_VBT (0<<3)
/*!< ADC input channel select VBT */
#define ADC_CONF_CHSEL_VHS (1<<3)
/*!< ADC input channel select VHS */
#define ADC_CONF_CHSEL_A2 (2<<3)
/*!< ADC input channel select A2 */
#define ADC_CONF_CHSEL_A3 (3<<3)
/*!< ADC input channel select A3 */
#define ADC_CONF_CHSEL_YM (4<<3)
/*!< ADC input channel select YM */
#define ADC_CONF_CHSEL_YP (5<<3)
/*!< ADC input channel select YP */
#define ADC_CONF_CHSEL_XM (6<<3)
/*!< ADC input channel select XM */
#define ADC_CONF_CHSEL_XP (7<<3)
/*!< ADC input channel select XP */
#define ADC_CONF_REFSEL_Pos 6
/*!< Reference Selection Position */
#define ADC_CONF_REFSEL_Msk (3<<6)
/*!< Reference Selection Mask */
#define ADC_CONF_REFSEL_VREF (0<<6)
/*!< ADC reference select VREF input */
#define ADC_CONF_REFSEL_VREF (0<<6)
/*!< ADC reference select VREF input or 2.5v buffer output */
#define ADC_CONF_REFSEL_YMYP (1<<6)
/*!< ADC reference select YM vs YP */
#define ADC_CONF_REFSEL_XMXP (2<<6)
/*!< ADC reference select XM vs XP */
#define ADC_CONF_REFSEL_AVDD33 (3<<6)
/*!< ADC reference select AGND33 vs AVDD33 */
/*---------------------------------------------------------------------------------------------------------*/
/* ADC_IER constant definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define ADC_IER_MIEN 0x00000001
/*!< Menu Interrupt Enable */
#define ADC_IER_KPEIEN 0x00000002
/*!< Keypad Press Event Interrupt Enable */
#define ADC_IER_PEDEIEN 0x00000004
/*!< Pen Down Even Interrupt Enable */
#define ADC_IER_WKTIEN 0x00000008
/*!< Wake Up Touch Interrupt Enable */
#define ADC_IER_WKPIEN 0x00000010
/*!< Wake Up Keypad Press Interrupt Enable */
#define ADC_IER_KPUEIEN 0x00000020
/*!< Keypad Press Up Event Interrupt Enable */
#define ADC_IER_PEUEIEN 0x00000040
/*!< Pen Up Event Interrupt Enable */
/*---------------------------------------------------------------------------------------------------------*/
/* ADC_ISR constant definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define ADC_ISR_MF 0x00000001
/*!< Menu Complete Flag */
#define ADC_ISR_KPEF 0x00000002
/*!< Keypad Press Event Flag */
#define ADC_ISR_PEDEF 0x00000004
/*!< Pen Down Event Flag */
#define ADC_ISR_KPUEF 0x00000008
/*!< Keypad Press Up Event Flag */
#define ADC_ISR_PEUEF 0x00000010
/*!< Pen Up Event Flag */
#define ADC_ISR_TF 0x00000100
/*!< Touch Conversion Finish */
#define ADC_ISR_ZF 0x00000200
/*!< Press Conversion Finish */
#define ADC_ISR_NACF 0x00000400
/*!< Normal AD Conversion Finish */
#define ADC_ISR_VBF 0x00000800
/*!< Voltage Battery Conversion Finish */
#define ADC_ISR_KPCF 0x00001000
/*!< Keypad Press Conversion Finish */
#define ADC_ISR_SELFTF 0x00002000
/*!< Self-Test Conversion Finish */
#define ADC_ISR_INTKP 0x00010000
/*!< Interrupt Signal For Keypad Detection */
#define ADC_ISR_INTTC 0x00020000
/*!< Interrupt Signal For Touch Screen Touching Detection */
/*---------------------------------------------------------------------------------------------------------*/
/* ADC_WKISR constant definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define ADC_WKISR_WKPEF 0x00000001
/*!< Wake Up Pen Down Event Flag */
#define ADC_WKISR_WPEDEF 0x00000002
/*!< Wake Up Keypad Press Event Flage */
/** \brief Structure type of ADC_CHAN
*/
typedef
enum
{
AIN0
=
ADC_CONF_CHSEL_VBT
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_VBT */
AIN1
=
ADC_CONF_CHSEL_VHS
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_VHS */
AIN2
=
ADC_CONF_CHSEL_A2
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_A2 */
AIN3
=
ADC_CONF_CHSEL_A3
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_A3 */
AIN4
=
ADC_CONF_CHSEL_YM
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_YM */
AIN5
=
ADC_CONF_CHSEL_XP
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_XP */
AIN6
=
ADC_CONF_CHSEL_XM
,
/*!< ADC input channel select \ref ADC_CONF_CHSEL_XM */
AIN7
=
ADC_CONF_CHSEL_XP
/*!< ADC input channel select \ref ADC_CONF_CHSEL_XP */
}
ADC_CHAN
;
/** \brief Structure type of ADC_CMD
*/
typedef
enum
{
START_MST
,
/*!<Menu Start Conversion */
START_MST
,
/*!<Menu Start Conversion with interrupt */
START_MST_POLLING
,
/*!<Menu Start Conversion with polling */
VBPOWER_ON
,
/*!<Enable ADC Internal Bandgap Power */
VBPOWER_OFF
,
/*!<Disable ADC Internal Bandgap Power */
VBAT_ON
,
/*!<Enable Voltage Battery conversion function */
VBAT_OFF
,
/*!<Disable Voltage Battery conversion function */
KPPOWER_ON
,
/*!<Enable ADC Keypad power */
KPPOWER_OFF
,
/*!<Disable ADC Keypad power */
KPCONV_ON
,
/*!<Enable Keypad conversion function */
KPCONV_OFF
,
/*!<Disable Keypad conversion function */
KPPRESS_ON
,
/*!<Enable Keypad press event */
KPPRESS_OFF
,
/*!<Disable Keypad press event */
KPUP_ON
,
/*!<Enable Keypad up event */
KPUP_OFF
,
/*!<Disable Keypad up event */
PEPOWER_ON
,
/*!<Enable Pen Down Power ,It can control pen down event */
PEPOWER_OFF
,
/*!<Disable Pen Power */
PEDEF_ON
,
/*!<Enable Pen Down Event Flag */
PEDEF_OFF
,
/*!<Disable Pen Down Event Flag */
WKP_ON
,
/*!<Enable Keypad Press Wake Up */
WKP_OFF
,
/*!<Disable Keypad Press Wake Up */
WKT_ON
,
/*!<Enable Pen Down Wake Up */
WKT_OFF
,
/*!<Disable Pen Down Wake Up */
SWITCH_5WIRE_ON
,
/*!<Wire Mode Switch to 5-Wire Configuration */
SWITCH_5WIRE_OFF
,
/*!<Wire Mode Switch to 4-Wire Configuration */
T_ON
,
/*!<Enable Touch detection function */
T_OFF
,
/*!<Disable Touch detection function */
TAVG_ON
,
/*!<Enable Touch Mean average for X and Y function */
TAVG_OFF
,
/*!<Disable Touch Mean average for X and Y function */
Z_ON
,
/*!<Enable Press measure function */
Z_OFF
,
/*!<Disable Press measure function */
TZAVG_ON
,
/*!<Enable Pressure Mean average for Z1 and Z2 function */
TZAVG_OFF
,
/*!<Disable Pressure Mean average for Z1 and Z2 function */
NAC_ON
,
/*!<Enable Normal AD Conversion */
NAC_OFF
,
/*!<Disable Normal AD Conversion */
SWITCH_CH
,
/*!<Switch Channel */
...
...
bsp/nuvoton/libraries/nuc980/Driver/Include/nuc980.h
浏览文件 @
f7ba146a
...
...
@@ -1295,25 +1295,38 @@
#define REG_PWM0_PIER (PWM0_BA+0x3C)
/*!< PWM Timer Interrupt Enable Register */
#define REG_PWM0_PIIR (PWM0_BA+0x40)
/*!< PWM Timer Interrupt Identification Register */
#define REG_PWM1_PPR (PWM1_BA+0x00)
/*!< PWM Pre-scale Register 0 */
#define REG_PWM1_CSR (PWM1_BA+0x04)
/*!< PWM Clock Select Register */
#define REG_PWM1_PCR (PWM1_BA+0x08)
/*!< PWM Control Register */
#define REG_PWM1_CNR0 (PWM1_BA+0x0C)
/*!< PWM Counter Register 0 */
#define REG_PWM1_CMR0 (PWM1_BA+0x10)
/*!< PWM Comparator Register 0 */
#define REG_PWM1_PDR0 (PWM1_BA+0x14)
/*!< PWM Data Register 0 */
#define REG_PWM1_CNR1 (PWM1_BA+0x18)
/*!< PWM Counter Register 1 */
#define REG_PWM1_CMR1 (PWM1_BA+0x1C)
/*!< PWM Comparator Register 1 */
#define REG_PWM1_PDR1 (PWM1_BA+0x20)
/*!< PWM Data Register 1 */
#define REG_PWM1_CNR2 (PWM1_BA+0x24)
/*!< PWM Counter Register 2 */
#define REG_PWM1_CMR2 (PWM1_BA+0x28)
/*!< PWM Comparator Register 2 */
#define REG_PWM1_PDR2 (PWM1_BA+0x2C)
/*!< PWM Data Register 2 */
#define REG_PWM1_CNR3 (PWM1_BA+0x30)
/*!< PWM Counter Register 3 */
#define REG_PWM1_CMR3 (PWM1_BA+0x34)
/*!< PWM Comparator Register 3 */
#define REG_PWM1_PDR3 (PWM1_BA+0x38)
/*!< PWM Data Register 3 */
#define REG_PWM1_PIER (PWM1_BA+0x3C)
/*!< PWM Timer Interrupt Enable Register */
#define REG_PWM1_PIIR (PWM1_BA+0x40)
/*!< PWM Timer Interrupt Identification Register */
/**@}*/
/* end of PWM register group */
/*---------------------- Analog to Digital Converter -------------------------*/
/**
@addtogroup ADC Analog to Digital Converter(ADC)
Memory Mapped Structure for ADC Controller
@{ */
#define REG_ADC_CTL (ADC_BA+0x000)
/*!< ADC Contrl */
#define REG_ADC_CONF (ADC_BA+0x004)
/*!< ADC Configure */
#define REG_ADC_IER (ADC_BA+0x008)
/*!< ADC Interrupt Enable Register */
#define REG_ADC_ISR (ADC_BA+0x00C)
/*!< ADC Interrupt Status Register */
#define REG_ADC_WKISR (ADC_BA+0x010)
/*!< ADC Wake Up Interrupt Status Register */
#define REG_ADC_XYDATA (ADC_BA+0x020)
/*!< ADC Touch XY Pressure Data */
#define REG_ADC_ZDATA (ADC_BA+0x024)
/*!< ADC Touch Z Pressure Data */
#define REG_ADC_DATA (ADC_BA+0x028)
/*!< ADC Normal Conversion Data */
#define REG_ADC_VBADATA (ADC_BA+0x02C)
/*!< ADC Battery Detection Data */
#define REG_ADC_KPDATA (ADC_BA+0x030)
/*!< ADC Key Pad Data */
#define REG_ADC_SELFDATA (ADC_BA+0x034)
/*!< ADC Self-Test Data */
#define REG_ADC_XYSORT0 (ADC_BA+0x1F4)
/*!< ADC Touch XY Position Mean Value Sort 0 */
#define REG_ADC_XYSORT1 (ADC_BA+0x1F8)
/*!< ADC Touch XY Position Mean Value Sort 1 */
#define REG_ADC_XYSORT2 (ADC_BA+0x1FC)
/*!< ADC Touch XY Position Mean Value Sort 2 */
#define REG_ADC_XYSORT3 (ADC_BA+0x200)
/*!< ADC Touch XY Position Mean Value Sort 3 */
#define REG_ADC_ZSORT0 (ADC_BA+0x204)
/*!< ADC Touch Z Pressure Mean Value Sort 0 */
#define REG_ADC_ZSORT1 (ADC_BA+0x208)
/*!< ADC Touch Z Pressure Mean Value Sort 1 */
#define REG_ADC_ZSORT2 (ADC_BA+0x20C)
/*!< ADC Touch Z Pressure Mean Value Sort 2 */
#define REG_ADC_ZSORT3 (ADC_BA+0x210)
/*!< ADC Touch Z Pressure Mean Value Sort 3 */
#define REG_ADC_MTMULCK (ADC_BA+0x220)
/*!< ADC Manual Test Mode Unlock */
#define REG_ADC_MTCONF (ADC_BA+0x224)
/*!< ADC Manual Test Mode Configure */
#define REG_ADC_MTCON (ADC_BA+0x228)
/*!< ADC Manual Test Mode Control */
#define REG_ADC_ADCAII (ADC_BA+0x22C)
/*!< ADC Analog Interface Information */
#define REG_ADC_ADCAIIRLT (ADC_BA+0x230)
/*!< ADC Analog Interface Information Result */
/**@}*/
/* end of ADC register group */
/*------------------ Capture Sensor Interface Controller ---------------------*/
...
...
bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig
浏览文件 @
f7ba146a
...
...
@@ -70,6 +70,13 @@ config SOC_SERIES_NUC980
bool "Enable Analog-to-Digital Converter(ADC)"
select RT_USING_ADC
if BSP_USING_ADC
config BSP_USING_ADC_TOUCH
bool "Enable ADC Touching function"
select RT_USING_TOUCH
default n
endif
menuconfig BSP_USING_TMR
bool "Enable Timer Controller(TIMER)"
...
...
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.c
浏览文件 @
f7ba146a
...
...
@@ -15,9 +15,12 @@
#include <rtdevice.h>
#include "NuMicro.h"
#include <drv_sys.h>
#include "drv_sys.h"
#include "nu_bitutil.h"
#include "drv_adc.h"
/* Private define ---------------------------------------------------------------*/
#define DEF_ADC_TOUCH_SMPL_TICK 40
/* Private Typedef --------------------------------------------------------------*/
struct
nu_adc
...
...
@@ -31,12 +34,33 @@ struct nu_adc
int
chn_num
;
uint32_t
chn_mask
;
rt_sem_t
m_psSem
;
#if defined(BSP_USING_ADC_TOUCH)
rt_touch_t
psRtTouch
;
rt_timer_t
psRtTouchMenuTimer
;
rt_mq_t
m_pmqTouchXYZ
;
#endif
nu_adc_cb
m_isr
[
eAdc_ISR_CNT
];
nu_adc_cb
m_wkisr
[
eAdc_WKISR_CNT
];
};
typedef
struct
nu_adc
*
nu_adc_t
;
#if defined(BSP_USING_ADC_TOUCH)
struct
nu_adc_touch_data
{
uint32_t
u32X
;
uint32_t
u32Y
;
uint32_t
u32Z0
;
uint32_t
u32Z1
;
};
typedef
struct
nu_adc_touch_data
*
nu_adc_touch_data_t
;
#endif
/* Private functions ------------------------------------------------------------*/
static
rt_err_t
nu_adc_enabled
(
struct
rt_adc_device
*
device
,
rt_uint32_t
channel
,
rt_bool_t
enabled
);
static
rt_err_t
nu_adc_convert
(
struct
rt_adc_device
*
device
,
rt_uint32_t
channel
,
rt_uint32_t
*
value
);
static
rt_err_t
_nu_adc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
);
/* Public functions ------------------------------------------------------------*/
int
rt_hw_adc_init
(
void
);
...
...
@@ -56,24 +80,41 @@ static struct nu_adc g_sNuADC =
static
void
nu_adc_isr
(
int
vector
,
void
*
param
)
{
uint32_t
isr
,
conf
;
rt_int32_t
isr
,
wkisr
;
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
param
;
rt_int32_t
irqidx
;
conf
=
inpw
(
REG_ADC_CONF
);
isr
=
inpw
(
REG_ADC_ISR
);
wkisr
=
inpw
(
REG_ADC_WKISR
);
while
((
irqidx
=
nu_ctz
(
isr
))
<
eAdc_ISR_CNT
)
{
uint32_t
u32IsrBitMask
=
1
<<
irqidx
;
if
((
isr
&
ADC_ISR_NACF
)
&&
(
conf
&
ADC_CONF_NACEN
)
)
if
(
psNuAdc
->
m_isr
[
irqidx
].
cbfunc
!=
RT_NULL
)
{
outpw
(
REG_ADC_ISR
,
ADC_ISR_NACF
);
//rt_kprintf("[%s] %d %x\n", __func__, irqidx, psNuAdc->m_isr[irqidx].cbfunc);
psNuAdc
->
m_isr
[
irqidx
].
cbfunc
(
isr
,
psNuAdc
->
m_isr
[
irqidx
].
private_data
);
}
if
(
isr
&
ADC_ISR_MF
)
/* Clear sent bit */
outpw
(
REG_ADC_ISR
,
u32IsrBitMask
);
isr
&=
~
(
u32IsrBitMask
);
}
//while
while
((
irqidx
=
nu_ctz
(
wkisr
))
<
eAdc_WKISR_CNT
)
{
rt_err_t
result
;
outpw
(
REG_ADC_ISR
,
ADC_ISR_MF
);
result
=
rt_sem_release
(
psNuAdc
->
m_psSem
);
RT_ASSERT
(
result
==
RT_EOK
);
uint32_t
u32IsrBitMask
=
1
<<
irqidx
;
if
(
psNuAdc
->
m_wkisr
[
irqidx
].
cbfunc
!=
RT_NULL
)
{
psNuAdc
->
m_wkisr
[
irqidx
].
cbfunc
(
wkisr
,
psNuAdc
->
m_wkisr
[
irqidx
].
private_data
);
}
/* Clear sent bit */
outpw
(
REG_ADC_WKISR
,
u32IsrBitMask
);
wkisr
&=
~
(
u32IsrBitMask
);
}
//while
}
static
rt_err_t
_nu_adc_init
(
rt_device_t
dev
)
...
...
@@ -96,11 +137,171 @@ static rt_err_t _nu_adc_init(rt_device_t dev)
return
RT_EOK
;
}
static
int32_t
AdcMenuStartCallback
(
uint32_t
status
,
uint32_t
userData
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
userData
;
#if defined(BSP_USING_ADC_TOUCH)
static
struct
nu_adc_touch_data
point
;
static
rt_bool_t
bDrop
=
RT_FALSE
;
static
uint32_t
u32LastZ0
=
0xffffu
;
if
(
psNuAdc
->
psRtTouch
!=
RT_NULL
)
{
uint32_t
value
;
value
=
inpw
(
REG_ADC_XYDATA
);
point
.
u32X
=
(
value
&
0x0ffful
);
point
.
u32Y
=
((
value
>>
16
)
&
0x0ffful
);
value
=
inpw
(
REG_ADC_ZDATA
);
point
.
u32Z0
=
(
value
&
0x0ffful
);
point
.
u32Z1
=
((
value
>>
16
)
&
0x0ffful
);
/* Trigger next or not. */
if
(
point
.
u32Z0
==
0
)
{
/* Stop sampling procedure. */
rt_timer_stop
(
g_sNuADC
.
psRtTouchMenuTimer
);
/* Re-start pendown detection */
nu_adc_touch_detect
(
RT_TRUE
);
bDrop
=
RT_TRUE
;
}
else
{
bDrop
=
RT_FALSE
;
}
/* Notify upper layer. */
if
((
!
bDrop
||
(
u32LastZ0
!=
0
))
&&
rt_mq_send
(
psNuAdc
->
m_pmqTouchXYZ
,
(
const
void
*
)
&
point
,
sizeof
(
struct
nu_adc_touch_data
))
==
RT_EOK
)
{
rt_hw_touch_isr
(
psNuAdc
->
psRtTouch
);
}
u32LastZ0
=
point
.
u32Z0
;
}
else
#endif
{
rt_err_t
result
=
rt_sem_release
(
psNuAdc
->
m_psSem
);
RT_ASSERT
(
result
==
RT_EOK
);
}
return
0
;
}
#if defined(BSP_USING_ADC_TOUCH)
void
nu_adc_touch_detect
(
rt_bool_t
bStartDetect
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
if
(
bStartDetect
)
{
/* Start detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_ON
,
RT_NULL
);
}
else
{
/* Stop detect PenDown */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEPOWER_OFF
,
RT_NULL
);
}
}
static
int32_t
PenDownCallback
(
uint32_t
status
,
uint32_t
userData
)
{
nu_adc_touch_detect
(
RT_FALSE
);
rt_timer_start
(
g_sNuADC
.
psRtTouchMenuTimer
);
return
0
;
}
int32_t
nu_adc_touch_read_xyz
(
uint32_t
*
bufX
,
uint32_t
*
bufY
,
uint32_t
*
bufZ0
,
uint32_t
*
bufZ1
,
int32_t
dataCnt
)
{
int
i
;
struct
nu_adc_touch_data
value
;
for
(
i
=
0
;
i
<
dataCnt
;
i
++
)
{
if
(
rt_mq_recv
(
g_sNuADC
.
m_pmqTouchXYZ
,
(
void
*
)
&
value
,
sizeof
(
struct
nu_adc_touch_data
),
0
)
==
-
RT_ETIMEOUT
)
break
;
bufX
[
i
]
=
value
.
u32X
;
bufY
[
i
]
=
value
.
u32Y
;
bufZ0
[
i
]
=
value
.
u32Z0
;
bufZ1
[
i
]
=
value
.
u32Z1
;
}
return
i
;
}
void
nu_adc_touch_start_conv
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
START_MST
,
RT_NULL
);
}
rt_err_t
nu_adc_touch_enable
(
rt_touch_t
psRtTouch
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_cb
sNuAdcCb
;
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_enable
((
rt_adc_device_t
)
psNuAdc
,
7
);
outpw
(
REG_ADC_CONF
,
(
inpw
(
REG_ADC_CONF
)
&
~
(
0xfful
<<
24
))
|
0xfful
<<
24
);
/* Register touch device. */
psNuAdc
->
psRtTouch
=
psRtTouch
;
/* Enable TouchXY. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_ON
,
RT_NULL
);
/* Enable TouchZZ. */
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_ON
,
RT_NULL
);
/* Register PenDown callback. */
sNuAdcCb
.
cbfunc
=
PenDownCallback
;
sNuAdcCb
.
private_data
=
(
rt_uint32_t
)
psRtTouch
;
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_ON
,
(
void
*
)
&
sNuAdcCb
);
nu_adc_touch_detect
(
RT_TRUE
);
return
RT_EOK
;
}
rt_err_t
nu_adc_touch_disable
(
void
)
{
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
&
g_sNuADC
;
nu_adc_touch_detect
(
RT_FALSE
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
T_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
Z_OFF
,
RT_NULL
);
_nu_adc_control
((
rt_device_t
)
psNuAdc
,
PEDEF_OFF
,
RT_NULL
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
4
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
5
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
6
);
rt_adc_disable
((
rt_adc_device_t
)
psNuAdc
,
7
);
return
RT_EOK
;
}
#endif
static
rt_err_t
_nu_adc_control
(
rt_device_t
dev
,
int
cmd
,
void
*
args
)
{
rt_err_t
ret
=
RT_EINVAL
;
nu_adc_t
psNuAdc
=
(
nu_adc_t
)
dev
;
nu_adc_cb_t
psAdcCb
=
(
nu_adc_cb_t
)
args
;
switch
(
cmd
)
{
case
START_MST
:
/* Menu Start Conversion */
...
...
@@ -116,29 +317,259 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
RT_ASSERT
(
ret
==
RT_EOK
);
/* Get data: valid data is 12-bit */
if
(
args
!=
RT_NULL
)
*
((
uint32_t
*
)
args
)
=
inpw
(
REG_ADC_DATA
)
&
0x00000FFF
;
}
break
;
/* case START_MST_POLLING: Not supported. */
case
VBPOWER_ON
:
/* Enable ADC Internal Bandgap Power */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_VBGEN
);
}
break
;
case
VBPOWER_OFF
:
/* Disable ADC Internal Bandgap Power */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_VBGEN
);
}
break
;
case
KPPOWER_ON
:
/* Enable ADC Keypad Power */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_PWKPEN
);
}
break
;
case
KPPOWER_OFF
:
/* Disable ADC Keypad Power */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_PWKPEN
);
}
break
;
case
PEPOWER_ON
:
/* Enable Pen Power */
{
int
retry
=
100
;
uint32_t
treg
=
inpw
(
REG_ADC_IER
);
outpw
(
REG_ADC_IER
,
treg
&
~
(
ADC_IER_PEDEIEN
|
ADC_IER_PEUEIEN
));
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_PEDEEN
);
do
{
outpw
(
REG_ADC_ISR
,
ADC_ISR_PEDEF
|
ADC_ISR_PEUEF
);
rt_thread_mdelay
(
1
);
if
(
retry
--
==
0
)
break
;
}
while
(
inpw
(
REG_ADC_ISR
)
&
(
ADC_ISR_PEDEF
|
ADC_ISR_PEUEF
));
outpw
(
REG_ADC_IER
,
treg
);
}
break
;
case
PEPOWER_OFF
:
/* Disable Pen Power */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_PEDEEN
);
}
break
;
case
KPPRESS_ON
:
/* Enable Keypad press event */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_isr
[
eAdc_KPEF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_KPEIEN
);
}
break
;
case
KPPRESS_OFF
:
/* Disable Keypad press event */
{
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
&
~
ADC_IER_KPEIEN
));
}
break
;
case
KPUP_ON
:
/* Enable Keypad up event */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_isr
[
eAdc_KPUEF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_KPUEIEN
);
}
break
;
case
KPUP_OFF
:
/* Disable Keypad up event */
{
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
&
~
ADC_IER_KPUEIEN
);
}
break
;
case
PEDEF_ON
:
/* Enable Pen Down Event */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_isr
[
eAdc_PEDEF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_PEDEIEN
);
}
break
;
case
PEDEF_OFF
:
/* Disable Pen Down Event */
{
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
&
~
ADC_IER_PEDEIEN
);
}
break
;
case
WKP_ON
:
/* Enable Keypad Press Wake Up */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_wkisr
[
eAdc_WKPEF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_WKPEN
);
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_WKPIEN
);
//outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) | (1 << 26));
}
break
;
case
WKP_OFF
:
/* Disable Keypad Press Wake Up */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_WKPEN
);
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
&
~
ADC_IER_WKPIEN
);
//outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) & ~(1 << 26));
}
break
;
case
WKT_ON
:
/* Enable Touch Wake Up */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_wkisr
[
eAdc_WPEDEF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_WKTEN
);
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_WKTIEN
);
//outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) | (1 << 26));
}
break
;
case
WKT_OFF
:
/* Disable Touch Wake Up */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_WKTEN
);
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
&
~
ADC_IER_WKTIEN
);
//outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) & ~(1 << 26));
}
break
;
case
SWITCH_5WIRE_ON
:
/* Wire Mode Switch to 5-Wire */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_WMSWCH
);
}
break
;
case
SWITCH_5WIRE_OFF
:
/* Wire Mode Switch to 4-Wire */
{
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
&
~
ADC_CTL_WMSWCH
);
}
break
;
case
T_ON
:
/* Enable Touch detection function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_TEN
);
}
break
;
case
T_OFF
:
/* Disable Touch detection function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_TEN
);
}
break
;
case
TAVG_ON
:
/* Enable Touch Mean average for X and Y function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_DISTMAVEN
);
}
break
;
case
TAVG_OFF
:
/* Disable Touch Mean average for X and Y function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_DISTMAVEN
);
}
break
;
case
Z_ON
:
/* Enable Press measure function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_ZEN
);
}
break
;
case
Z_OFF
:
/* Disable Press measure function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_ZEN
);
#if defined(BSP_USING_ADC_TOUCH)
rt_mq_control
(
psNuAdc
->
m_pmqTouchXYZ
,
RT_IPC_CMD_RESET
,
RT_NULL
);
#endif
}
break
;
case
TZAVG_ON
:
/* Enable Pressure Mean average for Z1 and Z2 function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_DISZMAVEN
);
}
break
;
case
TZAVG_OFF
:
/* Disable Pressure Mean average for Z1 and Z2 function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_DISZMAVEN
);
}
break
;
case
NAC_ON
:
/* Enable Normal AD Conversion */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_NACEN
|
ADC_CONF_REFSEL_AVDD33
);
}
break
;
case
NAC_OFF
:
/* Disable Normal AD Conversion */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_NACEN
);
}
break
;
case
VBAT_ON
:
/* Enable Voltage Battery Conversion */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_isr
[
eAdc_VBF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_VBATEN
);
}
break
;
case
VBAT_OFF
:
/* Disable Voltage Battery */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_VBATEN
);
}
break
;
case
KPCONV_ON
:
/* Enable Keypad conversion function */
{
if
(
psAdcCb
)
{
rt_memcpy
(
&
psNuAdc
->
m_isr
[
eAdc_KPCF
],
psAdcCb
,
sizeof
(
nu_adc_cb
));
}
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
|
ADC_CONF_KPCEN
);
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_KPEIEN
);
}
break
;
case
KPCONV_OFF
:
/* Disable Keypad conversion function */
{
outpw
(
REG_ADC_CONF
,
inpw
(
REG_ADC_CONF
)
&
~
ADC_CONF_KPCEN
);
}
break
;
case
SWITCH_CH
:
{
int
chn
=
(
int
)
args
;
...
...
@@ -265,6 +696,16 @@ exit_nu_adc_convert:
return
(
-
ret
)
;
}
static
void
nu_adc_touch_smpl
(
void
*
p
)
{
/* Enable interrupt */
outpw
(
REG_ADC_IER
,
inpw
(
REG_ADC_IER
)
|
ADC_IER_MIEN
);
/* Start conversion */
outpw
(
REG_ADC_CTL
,
inpw
(
REG_ADC_CTL
)
|
ADC_CTL_MST
);
}
int
rt_hw_adc_init
(
void
)
{
rt_err_t
result
=
RT_ERROR
;
...
...
@@ -279,8 +720,22 @@ int rt_hw_adc_init(void)
g_sNuADC
.
m_psSem
=
rt_sem_create
(
"adc_mst_sem"
,
0
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
g_sNuADC
.
m_psSem
!=
RT_NULL
);
#if defined(BSP_USING_ADC_TOUCH)
g_sNuADC
.
m_pmqTouchXYZ
=
rt_mq_create
(
"ADC_TOUCH_XYZ"
,
sizeof
(
struct
nu_adc_touch_data
),
TOUCH_MQ_LENGTH
,
RT_IPC_FLAG_FIFO
);
RT_ASSERT
(
g_sNuADC
.
m_pmqTouchXYZ
!=
RT_NULL
);
g_sNuADC
.
psRtTouchMenuTimer
=
rt_timer_create
(
"TOUCH_SMPL_TIMER"
,
nu_adc_touch_smpl
,
(
void
*
)
&
g_sNuADC
,
DEF_ADC_TOUCH_SMPL_TICK
,
RT_TIMER_FLAG_PERIODIC
);
RT_ASSERT
(
g_sNuADC
.
psRtTouchMenuTimer
!=
RT_NULL
);
#endif
rt_memset
(
&
g_sNuADC
.
m_isr
,
0
,
sizeof
(
g_sNuADC
.
m_isr
));
rt_memset
(
&
g_sNuADC
.
m_wkisr
,
0
,
sizeof
(
g_sNuADC
.
m_wkisr
));
g_sNuADC
.
m_isr
[
eAdc_MF
].
cbfunc
=
AdcMenuStartCallback
;
g_sNuADC
.
m_isr
[
eAdc_MF
].
private_data
=
(
UINT32
)
&
g_sNuADC
;
return
(
int
)
result
;
}
INIT_BOARD_EXPORT
(
rt_hw_adc_init
);
#endif //#if defined(BSP_USING_
E
ADC)
#endif //#if defined(BSP_USING_ADC)
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.h
0 → 100644
浏览文件 @
f7ba146a
/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-4-7 Wayne First version
*
******************************************************************************/
#ifndef __DRV_ADC_H__
#define __DRV_ADC_H__
#include <rtthread.h>
#include "nu_adc.h"
#if defined(BSP_USING_ADC_TOUCH)
#include "touch.h"
#endif
#define TOUCH_MQ_LENGTH 64
#define DEF_CAL_POINT_NUM 5
typedef
enum
{
eAdc_MF
,
//0
eAdc_KPEF
,
//1
eAdc_PEDEF
,
//2
eAdc_KPUEF
,
//3
eAdc_PEUEF
,
//4
eAdc_TF
=
8
,
//8
eAdc_ZF
,
//9
eAdc_NACF
,
//10
eAdc_VBF
,
//11
eAdc_KPCF
,
//12
eAdc_SELFTF
,
//13
eAdc_INTKP
=
16
,
//16
eAdc_INTTC
,
//17
eAdc_ISR_CNT
//18
}
E_ADC_ISR_EVENT
;
typedef
enum
{
eAdc_WKPEF
,
eAdc_WPEDEF
,
eAdc_WKISR_CNT
}
E_ADC_WKISR_EVENT
;
typedef
struct
{
ADC_CALLBACK
cbfunc
;
uint32_t
private_data
;
}
nu_adc_cb
;
typedef
nu_adc_cb
*
nu_adc_cb_t
;
#if defined(BSP_USING_ADC_TOUCH)
typedef
struct
{
int32_t
x
;
int32_t
y
;
}
S_COORDINATE_POINT
;
typedef
struct
{
int32_t
a
;
int32_t
b
;
int32_t
c
;
int32_t
d
;
int32_t
e
;
int32_t
f
;
int32_t
div
;
}
S_CALIBRATION_MATRIX
;
int32_t
nu_adc_touch_read_xyz
(
uint32_t
*
bufX
,
uint32_t
*
bufY
,
uint32_t
*
bufZ0
,
uint32_t
*
bufZ1
,
int32_t
dataCnt
);
rt_err_t
nu_adc_touch_enable
(
rt_touch_t
psRtTouch
);
rt_err_t
nu_adc_touch_disable
(
void
);
void
nu_adc_touch_detect
(
rt_bool_t
bStartDetect
);
void
nu_adc_touch_start_conv
(
void
);
#endif
#endif
/* __DRV_ADC_H__ */
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc_touch.c
0 → 100644
浏览文件 @
f7ba146a
此差异已折叠。
点击以展开。
bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c
浏览文件 @
f7ba146a
...
...
@@ -682,7 +682,7 @@ lwiperf_report(void *arg, enum lwiperf_report_type report_type,
(int)report_type, ipaddr_ntoa(remote_addr), (int)remote_port, bytes_transferred, ms_duration, bandwidth_kbitpsec);
}
void lwiperf_example_init(
void
)
void lwiperf_example_init(
int argc, char **argv
)
{
lwiperf_start_tcp_server_default(lwiperf_report, NULL);
}
...
...
bsp/nuvoton/nk-980iot/.config
浏览文件 @
f7ba146a
...
...
@@ -203,8 +203,7 @@ CONFIG_RT_AUDIO_REPLAY_MP_BLOCK_SIZE=4096
CONFIG_RT_AUDIO_REPLAY_MP_BLOCK_COUNT
=
2
CONFIG_RT_AUDIO_RECORD_PIPE_SIZE
=
2048
# CONFIG_RT_USING_SENSOR is not set
CONFIG_RT_USING_TOUCH
=
y
# CONFIG_RT_TOUCH_PIN_IRQ is not set
# CONFIG_RT_USING_TOUCH is not set
CONFIG_RT_USING_HWCRYPTO
=
y
CONFIG_RT_HWCRYPTO_DEFAULT_NAME
=
"hwcryto"
CONFIG_RT_HWCRYPTO_IV_MAX_SIZE
=
16
...
...
@@ -550,17 +549,11 @@ CONFIG_PKG_NETUTILS_VER_NUM=0x10301
#
# LVGL: powerful and easy-to-use embedded GUI library
#
CONFIG_PKG_USING_LVGL
=
y
CONFIG_PKG_LVGL_PATH
=
"/packages/multimedia/LVGL/LVGL"
# CONFIG_PKG_USING_LVGL_EXAMPLES is not set
CONFIG_PKG_USING_LVGL_V810
=
y
# CONFIG_PKG_USING_LVGL is not set
# CONFIG_PKG_USING_LVGL_V810 is not set
# CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
CONFIG_PKG_LVGL_VER
=
"v8.1.0"
CONFIG_PKG_LVGL_VER_NUM
=
0
x08010
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
CONFIG_PKG_USING_LV_MUSIC_DEMO
=
y
CONFIG_PKG_LV_MUSIC_DEMO_PATH
=
"/packages/multimedia/LVGL/lv_music_demo"
CONFIG_PKG_LV_MUSIC_DEMO_VER
=
"v0.1.1"
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
#
# u8g2: a monochrome graphic library
...
...
@@ -597,6 +590,7 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
# CONFIG_PKG_USING_MCURSES is not set
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
#
# tools packages
...
...
@@ -607,7 +601,6 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_SEGGER_RTT is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
...
...
@@ -658,6 +651,7 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
...
...
@@ -783,6 +777,7 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_RS232 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
...
...
@@ -874,23 +869,8 @@ CONFIG_PKG_OPTPARSE_VER="latest"
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
CONFIG_NU_PKG_USING_NAU8822
=
y
# CONFIG_NU_PKG_USING_DA9062 is not set
CONFIG_NU_PKG_USING_ILI9341
=
y
CONFIG_NU_PKG_USING_ILI9341_SPI
=
y
# CONFIG_NU_PKG_USING_ILI9341_EBI is not set
CONFIG_NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
=
y
CONFIG_NU_PKG_ILI9341_HORIZONTAL
=
y
CONFIG_NU_PKG_USING_SPINAND
=
y
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
#
# Hardware Drivers Config
...
...
@@ -913,6 +893,7 @@ CONFIG_BSP_USING_RTC=y
CONFIG_NU_RTC_SUPPORT_IO_RW
=
y
CONFIG_NU_RTC_SUPPORT_MSH_CMD
=
y
CONFIG_BSP_USING_ADC
=
y
# CONFIG_BSP_USING_ADC_TOUCH is not set
CONFIG_BSP_USING_TMR
=
y
CONFIG_BSP_USING_TIMER
=
y
CONFIG_BSP_USING_TMR0
=
y
...
...
@@ -998,10 +979,20 @@ CONFIG_BOARD_USING_USB1_HOST=y
# Board extended module drivers
#
# CONFIG_BOARD_USING_MAX31875 is not set
CONFIG_BOARD_USING_LCD_ILI9341
=
y
CONFIG_BOARD_USING_ILI9341_PIN_BACKLIGHT
=
103
CONFIG_BOARD_USING_ILI9341_PIN_RESET
=
90
CONFIG_BOARD_USING_ILI9341_PIN_DC
=
89
# CONFIG_BOARD_USING_LCD_ILI9341 is not set
# CONFIG_BOARD_USING_ESP8266 is not set
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
CONFIG_NU_PKG_USING_NAU8822
=
y
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
CONFIG_NU_PKG_USING_SPINAND
=
y
CONFIG_BOARD_USE_UTEST
=
y
CONFIG_UTEST_CMD_PREFIX
=
"bsp.nuvoton.nk980-iot.test.utest."
bsp/nuvoton/nk-980iot/board/Kconfig
浏览文件 @
f7ba146a
...
...
@@ -72,6 +72,7 @@ menu "Hardware Drivers Config"
config BOARD_USING_LCD_ILI9341
bool "LCD ILI9341 (over spi0)"
select RT_USING_TOUCH
select BSP_USING_ADC_TOUCH
select NU_PKG_USING_ILI9341
select NU_PKG_USING_ILI9341_SPI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
...
...
bsp/nuvoton/nk-980iot/board/nu_pin_init.c
浏览文件 @
f7ba146a
...
...
@@ -57,8 +57,10 @@ static void nu_pin_i2c_init(void)
/* I2C0: PA[0, 1] */
outpw
(
REG_SYS_GPA_MFPL
,
(
inpw
(
REG_SYS_GPA_MFPL
)
&
~
0x000000FF
)
|
0x00000033
);
#if !defined(BSP_USING_ADC_TOUCH)
/* I2C2: PB5, PB7 */
outpw
(
REG_SYS_GPB_MFPL
,
(
inpw
(
REG_SYS_GPB_MFPL
)
&
~
0xF0F00000
)
|
0x20200000
);
#endif
}
...
...
bsp/nuvoton/nk-980iot/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -86,3 +86,9 @@ elif PLATFORM == 'armcc':
POST_ACTION
=
'fromelf --bin $TARGET --output '
+
TARGET_NAME
+
'
\n
'
POST_ACTION
+=
'fromelf -z $TARGET
\n
'
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/nk-980iot/spinor.config
浏览文件 @
f7ba146a
此差异已折叠。
点击以展开。
bsp/nuvoton/nk-n9h30/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -86,3 +86,9 @@ elif PLATFORM == 'armcc':
POST_ACTION
=
'fromelf --bin $TARGET --output '
+
TARGET_NAME
+
'
\n
'
POST_ACTION
+=
'fromelf -z $TARGET
\n
'
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/nk-rtu980/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -86,3 +86,9 @@ elif PLATFORM == 'armcc':
POST_ACTION
=
'fromelf --bin $TARGET --output '
+
TARGET_NAME
+
'
\n
'
POST_ACTION
+=
'fromelf -z $TARGET
\n
'
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/numaker-iot-m487/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -130,3 +130,11 @@ elif PLATFORM == 'iar':
EXEC_PATH
=
EXEC_PATH
+
'/arm/bin/'
POST_ACTION
=
''
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/numaker-m032ki/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -122,3 +122,11 @@ elif PLATFORM == 'iar':
EXEC_PATH
+=
'/arm/bin/'
POST_ACTION
=
''
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/numaker-m2354/.config
浏览文件 @
f7ba146a
...
...
@@ -557,6 +557,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_MCURSES is not set
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
#
# tools packages
...
...
@@ -567,7 +568,6 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_SEGGER_RTT is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
...
...
@@ -618,6 +618,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
...
...
@@ -652,14 +653,14 @@ CONFIG_FAL_DEBUG_CONFIG=y
CONFIG_FAL_DEBUG
=
1
CONFIG_FAL_PART_HAS_TABLE_CFG
=
y
# CONFIG_FAL_USING_SFUD_PORT is not set
CONFIG_PKG_USING_FAL_V00500
=
y
# CONFIG_PKG_USING_FAL_V00500 is not set
# CONFIG_PKG_USING_FAL_V00400 is not set
# CONFIG_PKG_USING_FAL_V00300 is not set
# CONFIG_PKG_USING_FAL_V00200 is not set
# CONFIG_PKG_USING_FAL_V00100 is not set
# CONFIG_PKG_USING_FAL_LATEST_VERSION is not set
CONFIG_PKG_FAL_VER
=
"
v0.5.0
"
CONFIG_PKG_FAL_VER_NUM
=
0
x
00500
CONFIG_PKG_USING_FAL_LATEST_VERSION
=
y
CONFIG_PKG_FAL_VER
=
"
latest
"
CONFIG_PKG_FAL_VER_NUM
=
0
x
99999
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
...
...
@@ -742,6 +743,7 @@ CONFIG_PKG_FAL_VER_NUM=0x00500
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_RS232 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
...
...
@@ -829,19 +831,8 @@ CONFIG_PKG_FAL_VER_NUM=0x00500
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
#
# Hardware Drivers Config
...
...
@@ -947,5 +938,18 @@ CONFIG_BOARD_USING_OTG=y
# Board extended module drivers
#
CONFIG_BOARD_USING_SEGMENT_LCD
=
y
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
CONFIG_BOARD_USE_UTEST
=
y
CONFIG_UTEST_CMD_PREFIX
=
"bsp.nuvoton.numaker-m2354.test.utest."
bsp/nuvoton/numaker-m2354/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -122,3 +122,11 @@ elif PLATFORM == 'iar':
EXEC_PATH
+=
'/arm/bin/'
POST_ACTION
=
''
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/numaker-pfm-m487/.config
浏览文件 @
f7ba146a
...
...
@@ -578,6 +578,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_MCURSES is not set
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
#
# tools packages
...
...
@@ -588,7 +589,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_SYSTEMVIEW is not set
# CONFIG_PKG_USING_SEGGER_RTT is not set
# CONFIG_PKG_USING_RDB is not set
# CONFIG_PKG_USING_QRCODE is not set
# CONFIG_PKG_USING_ULOG_EASYFLASH is not set
# CONFIG_PKG_USING_ULOG_FILE is not set
# CONFIG_PKG_USING_LOGMGR is not set
...
...
@@ -639,6 +639,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
...
...
@@ -675,13 +676,13 @@ CONFIG_FAL_DEBUG=1
CONFIG_FAL_PART_HAS_TABLE_CFG
=
y
# CONFIG_FAL_USING_SFUD_PORT is not set
# CONFIG_PKG_USING_FAL_V00500 is not set
CONFIG_PKG_USING_FAL_V00400
=
y
# CONFIG_PKG_USING_FAL_V00400 is not set
# CONFIG_PKG_USING_FAL_V00300 is not set
# CONFIG_PKG_USING_FAL_V00200 is not set
# CONFIG_PKG_USING_FAL_V00100 is not set
# CONFIG_PKG_USING_FAL_LATEST_VERSION is not set
CONFIG_PKG_FAL_VER
=
"
v0.4.0
"
CONFIG_PKG_FAL_VER_NUM
=
0
x
00400
CONFIG_PKG_USING_FAL_LATEST_VERSION
=
y
CONFIG_PKG_FAL_VER
=
"
latest
"
CONFIG_PKG_FAL_VER_NUM
=
0
x
99999
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
...
...
@@ -764,6 +765,7 @@ CONFIG_PKG_FAL_VER_NUM=0x00400
# CONFIG_PKG_USING_SSD1306 is not set
# CONFIG_PKG_USING_QKEY is not set
# CONFIG_PKG_USING_RS485 is not set
# CONFIG_PKG_USING_RS232 is not set
# CONFIG_PKG_USING_NES is not set
# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
# CONFIG_PKG_USING_VDEVICE is not set
...
...
@@ -851,19 +853,8 @@ CONFIG_PKG_FAL_VER_NUM=0x00400
# CONFIG_PKG_USING_LWGPS is not set
# CONFIG_PKG_USING_STATE_MACHINE is not set
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
CONFIG_NU_PKG_USING_NAU88L25
=
y
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
#
# Hardware Drivers Config
...
...
@@ -975,5 +966,18 @@ CONFIG_BOARD_USING_HSUSBH_USBD=y
# Board extended module drivers
#
# CONFIG_BOARD_USING_ADVANCE_V4 is not set
#
# Nuvoton Packages Config
#
CONFIG_NU_PKG_USING_UTILS
=
y
CONFIG_NU_PKG_USING_DEMO
=
y
# CONFIG_NU_PKG_USING_BMX055 is not set
# CONFIG_NU_PKG_USING_MAX31875 is not set
CONFIG_NU_PKG_USING_NAU88L25
=
y
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
CONFIG_BOARD_USE_UTEST
=
y
CONFIG_UTEST_CMD_PREFIX
=
"bsp.nuvoton.numaker-pfm-m487.test.utest."
bsp/nuvoton/numaker-pfm-m487/rtconfig.py
浏览文件 @
f7ba146a
...
...
@@ -130,3 +130,11 @@ elif PLATFORM == 'iar':
EXEC_PATH
=
EXEC_PATH
+
'/arm/bin/'
POST_ACTION
=
''
def
dist_handle
(
BSP_ROOT
,
dist_dir
):
import
sys
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'tools'
))
from
sdk_dist
import
dist_do_building
dist_do_building
(
BSP_ROOT
,
dist_dir
)
bsp/nuvoton/tools/sdk_dist.py
0 → 100644
浏览文件 @
f7ba146a
import
os
import
sys
import
shutil
cwd_path
=
os
.
getcwd
()
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
cwd_path
),
'rt-thread'
,
'tools'
))
def
dist_modify_relative_path
(
board_kconfig_path
):
# Read in the file
with
open
(
board_kconfig_path
,
'r'
)
as
file
:
filedata
=
file
.
read
()
# Replace the target string
filedata
=
filedata
.
replace
(
'$BSP_DIR/../libraries'
,
'./libraries'
)
# Write the file out again
with
open
(
board_kconfig_path
,
'w'
)
as
file
:
file
.
write
(
filedata
)
# BSP dist function
def
dist_do_building
(
BSP_ROOT
,
dist_dir
):
from
mkdist
import
bsp_copy_files
import
rtconfig
library_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
BSP_ROOT
),
'libraries'
)
library_dir
=
os
.
path
.
join
(
dist_dir
,
'libraries'
)
print
(
'=> copy nuvoton bsp drivers'
)
bsp_copy_files
(
os
.
path
.
join
(
library_path
,
rtconfig
.
BSP_LIBRARY_TYPE
),
os
.
path
.
join
(
library_dir
,
rtconfig
.
BSP_LIBRARY_TYPE
))
print
(
'=> copy nu_packages'
)
bsp_copy_files
(
os
.
path
.
join
(
library_path
,
'nu_packages'
),
os
.
path
.
join
(
library_dir
,
'nu_packages'
))
print
(
'=> copy Kconfig'
)
shutil
.
copyfile
(
os
.
path
.
join
(
library_path
,
'Kconfig'
),
os
.
path
.
join
(
library_dir
,
'Kconfig'
))
print
(
'=> Modify libraries relative path in board/Kconfig '
)
dist_modify_relative_path
(
os
.
path
.
join
(
dist_dir
,
'board'
,
'Kconfig'
))
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录