Code Monkey home page Code Monkey logo

Comments (8)

tylerYu123 avatar tylerYu123 commented on August 10, 2024

基于AC6311芯片, 通过定时器实现GPIO引脚(PB9)的脉冲宽度检测功能 ,可以设置检测精度 。 需要提供Demo程序 。

from fw-ac63_bt_sdk.

rixin-Tech avatar rixin-Tech commented on August 10, 2024

#define GPCNT_EN(x) SFR(JL_GPCNT->CON, 0, 1, x)
#define GPCNT_CSS(x) SFR(JL_GPCNT->CON, 1, 3, x)

enum {
GPCNT_CSS_LSB = 0,
GPCNT_CSS_OSC,
GPCNT_CSS_CAP_MUX,
GPCNT_CSS_CLK_MUX,
GPCNT_CSS_GPCFD,
GPCNT_CSS_RING,
GPCNT_CSS_PLL480M,
GPCNT_CSS_IRFLT,
};

#define GPCNT_CLR_PEND(x) SFR(JL_GPCNT->CON, 6, 1, x)
#define GPCNT_GTS(x) SFR(JL_GPCNT->CON, 8, 4, x)
#define GPCNT_GSS(x) SFR(JL_GPCNT->CON, 12, 3, x)

enum {
GPCNT_GSS_LSB = 0,
GPCNT_GSS_OSC,
GPCNT_GSS_CAP_MUX,
GPCNT_GSS_CLK_MUX,
GPCNT_GSS_GPCFD,
GPCNT_GSS_RING,
GPCNT_GSS_PLL480M,
GPCNT_GSS_IRFLT,
};
#define MHz_UNIT 1000000L
#define KHz_UNIT 1000L
#define CY 0x2
SET_INTERRUPT
void gpcnt_isr()
{
JL_GPCNT->CON |= BIT(6);
volatile int xosc = 192 * MHz_UNIT / JL_GPCNT->NUM * (32 * (2 << (CY - 1)));

GPCNT_EN(0);
GPCNT_EN(1);

}
void gpcnt_init()
{
JL_PORTB->DIR |= BIT(9);
JL_PORTB->DIE |= BIT(9);
JL_PORTB->PU &= ~BIT(9);
JL_PORTB->PD &= ~BIT(9);
JL_IOMAP->CON2 &= ~(0x3f << 16);
JL_IOMAP->CON2 |= (IO_PORTB_09 << 16); //PB9--->input ch2

GPCNT_CLR_PEND(1);
GPCNT_GSS(0b010);
GPCNT_CSS(0b110);
GPCNT_GTS(CY);

GPCNT_CLR_PEND(1);
GPCNT_EN(1);

HWI_Install(GPCNT_INIT, (int)gpcnt_isr, 1);

}

from fw-ac63_bt_sdk.

rixin-Tech avatar rixin-Tech commented on August 10, 2024

image

from fw-ac63_bt_sdk.

tylerYu123 avatar tylerYu123 commented on August 10, 2024

image

from fw-ac63_bt_sdk.

tylerYu123 avatar tylerYu123 commented on August 10, 2024

请问主时钟与次时钟是如何同步的 ? 我的理解是芯片捕捉到次时钟上升沿后开始计时, 是这样吗 ?

from fw-ac63_bt_sdk.

tylerYu123 avatar tylerYu123 commented on August 10, 2024

请提供SFR(), HWI_Install() 头文件 。

from fw-ac63_bt_sdk.

rixin-Tech avatar rixin-Tech commented on August 10, 2024

1、#define SFR(sfr, start, len, dat)
(sfr = (sfr & (((0xffffffff << (len))) << (start))) |
(((dat) & (~(0xffffffff << (len)))) << (start)))

2、HWI_Install 和 request_irq 功能相同,注册中断函数。

from fw-ac63_bt_sdk.

rixin-Tech avatar rixin-Tech commented on August 10, 2024

请问主时钟与次时钟是如何同步的 ? 我的理解是芯片捕捉到次时钟上升沿后开始计时, 是这样吗 ?

是的。计时结束,产生中断

from fw-ac63_bt_sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.