⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcdc_example.c

📁 Sharp LH7A400 BSP平台无关部分的代码,有很高的参考价值,尤其是系统架构设计上,设计成移植度很高的BSP.
💻 C
字号:
#include "abl_types.h"
#include "lh7a400_dcdc_driver.h"

/***********************************************************************
 *
 * Function: c_entry
 *
 * Purpose: DCDC modulators driver example
 *
 * Processing:
 *     See function. This example sets up DCDC modulator 1 for a
 *     constant frequency and duty cycle output. (If the DCDC modulator
 *     output is connected to the speaker, a buzzing sound will be
 *     heard.)
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Always returns 1
 *
 * Notes: None
 *
 **********************************************************************/
int c_entry(void)
{
    INT_32 dcdcdev;

    /* Open DCDC modulator */
    if ((dcdcdev = dcdc_open(DCDC, 0)) == 0x00000000)
    {
        return 0;
    }

    /* Set DCDC modulator 2 for 5/8th duty cycle for NEXTPWR = low */
    dcdc_ioctl(dcdcdev, DCDC2_SET_DUTYL, FIVE_EIGTHS);

    /* Set DCDC modulator 2 for 5/8th duty cycle for NEXTPWR = high */
    dcdc_ioctl(dcdcdev, DCDC2_SET_DUTYH, FIVE_EIGTHS);

    /* Set DCDC modulator 2 frequency to 7.2KHz for NEXTPWR = low */
    dcdc_ioctl(dcdcdev, DCDC2_SET_PSCL, SEVEN_POINT_TWO_KHZ);

    /* Set DCDC modulator 2 frequency to 7.2KHz for NEXTPWR = high */
    dcdc_ioctl(dcdcdev, DCDC2_SET_PSCH, SEVEN_POINT_TWO_KHZ);

    /* Close RTC */
    dcdc_close(dcdcdev);

    return 1;
}

#ifndef __GNUC__
/* With ARM and GHS toolsets, the entry point is main() - this will
   allow the linker to generate wrapper code to setup stacks, allocate
   heap area, and initialize and copy code and data segments. For GNU
   toolsets, the entry point is through __start() in the crt0_gnu.asm
   file, and that startup code will setup stacks and data */
int main(void)
{
    return c_entry();
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -