85 lines
1.6 KiB
C
85 lines
1.6 KiB
C
|
|
|
||
|
|
/*
|
||
|
|
* Include Files
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
#if defined(MATLAB_MEX_FILE)
|
||
|
|
#include "tmwtypes.h"
|
||
|
|
#include "simstruc_types.h"
|
||
|
|
#else
|
||
|
|
#include "rtwtypes.h"
|
||
|
|
#endif
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
|
||
|
|
#ifdef HAL_IMPL
|
||
|
|
#include "tim_devs.h"
|
||
|
|
#endif
|
||
|
|
#include <string.h>
|
||
|
|
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
|
||
|
|
#define y_width 1
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Create external references here.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
|
||
|
|
#ifdef HAL_IMPL
|
||
|
|
#endif
|
||
|
|
|
||
|
|
int is_pwm_out_init = 0;
|
||
|
|
|
||
|
|
void pwm_out_init()
|
||
|
|
{
|
||
|
|
if (!is_pwm_out_init)
|
||
|
|
{
|
||
|
|
#ifdef HAL_IMPL
|
||
|
|
//TODO
|
||
|
|
is_pwm_out_init = 1;
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Start function
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
void hal_pwm_out_Start_wrapper(void)
|
||
|
|
{
|
||
|
|
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
|
||
|
|
pwm_out_init();
|
||
|
|
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
|
||
|
|
}
|
||
|
|
/*
|
||
|
|
* Output function
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
void hal_pwm_out_Outputs_wrapper(const uint16_T *pwm,
|
||
|
|
const uint16_T *start_idx,
|
||
|
|
int32_T *ErrorCode,
|
||
|
|
const int_T u_width)
|
||
|
|
{
|
||
|
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||
|
|
ErrorCode[0] = -1;
|
||
|
|
if (is_pwm_out_init)
|
||
|
|
{
|
||
|
|
#ifdef HAL_IMPL
|
||
|
|
/*
|
||
|
|
* output *pwm* to pwm devices from *start_idx* to *start_idx*+u_width-1.
|
||
|
|
*
|
||
|
|
* ErrorCode - return zero on success, othedrwise nonzero on failures.
|
||
|
|
*/
|
||
|
|
for(uint8_T i = 0; i < u_width; ++i)
|
||
|
|
{
|
||
|
|
set_pwm(start_idx[0]+i, pwm[i]);
|
||
|
|
}
|
||
|
|
ErrorCode[0] = 0;
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||
|
|
}
|
||
|
|
|
||
|
|
|