📄 dcdc_example.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 + -