X7 support serial control
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
extern char cmd[70];
|
||||||
|
extern uint8_t cmd_len;
|
||||||
|
#endif
|
||||||
|
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
|
||||||
|
#define u_width 70
|
||||||
|
#define y_width 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create external references here.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||||
|
|
||||||
|
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Output function
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void hal_serial_cmdline_Outputs_wrapper(const uint8_T *data,
|
||||||
|
const uint8_T *len,
|
||||||
|
uint32_T *ErrorCode)
|
||||||
|
{
|
||||||
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||||
|
ErrorCode[0] = 0;
|
||||||
|
#ifdef HAL_IMPL
|
||||||
|
if (cmd_len == 0)
|
||||||
|
{
|
||||||
|
cmd_len = len[0]-1;
|
||||||
|
if (cmd_len > sizeof(cmd)-1)
|
||||||
|
{
|
||||||
|
cmd_len = sizeof(cmd)-1;
|
||||||
|
}
|
||||||
|
memcpy(cmd, data, cmd_len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* 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 <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
extern char echo[70];
|
||||||
|
extern uint8_t echo_len;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* %%%-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 */
|
||||||
|
|
||||||
|
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Output function
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void hal_serial_echoline_Outputs_wrapper(uint8_T *data,
|
||||||
|
uint8_T *len)
|
||||||
|
{
|
||||||
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||||
|
#ifdef HAL_IMPL
|
||||||
|
if (echo_len)
|
||||||
|
{
|
||||||
|
if (echo_len > 70)
|
||||||
|
echo_len = 70;
|
||||||
|
memcpy(data, echo, echo_len);
|
||||||
|
memset(data+echo_len, 0, 70-echo_len);
|
||||||
|
len[0] = echo_len;
|
||||||
|
echo_len = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
len[0] = 0;
|
||||||
|
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user