change adc/dac value from single to uint16
Signed-off-by: Matthew GONG <matt@matthewgong.com>
This commit is contained in:
@@ -9,4 +9,5 @@ rtwmakecfg.m
|
||||
*.zip
|
||||
*.exe
|
||||
log.txt
|
||||
.vscode/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Created: Fri Mar 20 10:39:08 2020
|
||||
* Created: Mon Mar 23 08:07:36 2020
|
||||
*/
|
||||
|
||||
#define S_FUNCTION_LEVEL 2
|
||||
@@ -57,7 +57,7 @@
|
||||
#define OUT_PORT_0_NAME AI
|
||||
#define OUTPUT_0_WIDTH DYNAMICALLY_SIZED
|
||||
#define OUTPUT_DIMS_0_COL 1
|
||||
#define OUTPUT_0_DTYPE real32_T
|
||||
#define OUTPUT_0_DTYPE uint16_T
|
||||
#define OUTPUT_0_COMPLEX COMPLEX_NO
|
||||
#define OUT_0_FRAME_BASED FRAME_NO
|
||||
#define OUT_0_BUS_BASED 0
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
extern void hal_ai_Start_wrapper(void);
|
||||
extern void hal_ai_Outputs_wrapper(const uint16_T *start_idx,
|
||||
real32_T *AI,
|
||||
uint16_T *AI,
|
||||
int32_T *ErrorCode,
|
||||
const int_T y_width);
|
||||
/*====================*
|
||||
@@ -147,7 +147,7 @@ static void mdlInitializeSizes(SimStruct *S)
|
||||
if (!ssSetNumOutputPorts(S, NUM_OUTPUTS)) return;
|
||||
/* Output Port 0 */
|
||||
ssSetOutputPortWidth(S, 0, OUTPUT_0_WIDTH);
|
||||
ssSetOutputPortDataType(S, 0, SS_SINGLE);
|
||||
ssSetOutputPortDataType(S, 0, SS_UINT16);
|
||||
ssSetOutputPortComplexSignal(S, 0, OUTPUT_0_COMPLEX);
|
||||
/* Output Port 1 */
|
||||
ssSetOutputPortWidth(S, 1, OUTPUT_1_WIDTH);
|
||||
@@ -220,7 +220,7 @@ static void mdlStart(SimStruct *S)
|
||||
static void mdlOutputs(SimStruct *S, int_T tid)
|
||||
{
|
||||
const uint16_T *start_idx = (uint16_T *) ssGetInputPortRealSignal(S, 0);
|
||||
real32_T *AI = (real32_T *) ssGetOutputPortRealSignal(S, 0);
|
||||
uint16_T *AI = (uint16_T *) ssGetOutputPortRealSignal(S, 0);
|
||||
int32_T *ErrorCode = (int32_T *) ssGetOutputPortRealSignal(S, 1);
|
||||
const int_T y_width = ssGetOutputPortWidth(S, 0);
|
||||
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,5 +1,5 @@
|
||||
%% File : hal_ai.tlc
|
||||
%% Created : Fri Mar 20 10:39:08 2020
|
||||
%% Created : Mon Mar 23 08:07:36 2020
|
||||
%%
|
||||
%% Description:
|
||||
%% Simulink Coder wrapper functions interface generated for
|
||||
@@ -31,7 +31,7 @@
|
||||
extern void hal_ai_Start_wrapper(void);
|
||||
|
||||
extern void hal_ai_Outputs_wrapper(const uint16_T *start_idx,
|
||||
real32_T *AI,
|
||||
uint16_T *AI,
|
||||
int32_T *ErrorCode,
|
||||
const int_T y_width);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Created: Fri Mar 20 10:34:32 2020
|
||||
* Created: Mon Mar 23 08:06:46 2020
|
||||
*/
|
||||
|
||||
#define S_FUNCTION_LEVEL 2
|
||||
@@ -38,7 +38,7 @@
|
||||
#define IN_PORT_0_NAME AO
|
||||
#define INPUT_0_WIDTH DYNAMICALLY_SIZED
|
||||
#define INPUT_DIMS_0_COL 1
|
||||
#define INPUT_0_DTYPE real32_T
|
||||
#define INPUT_0_DTYPE uint16_T
|
||||
#define INPUT_0_COMPLEX COMPLEX_NO
|
||||
#define IN_0_FRAME_BASED FRAME_NO
|
||||
#define IN_0_BUS_BASED 0
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
|
||||
extern void hal_ao_Start_wrapper(void);
|
||||
extern void hal_ao_Outputs_wrapper(const real32_T *AO,
|
||||
extern void hal_ao_Outputs_wrapper(const uint16_T *AO,
|
||||
const uint16_T *start_idx,
|
||||
int32_T *ErrorCode,
|
||||
const int_T u_width);
|
||||
@@ -141,7 +141,7 @@ static void mdlInitializeSizes(SimStruct *S)
|
||||
if (!ssSetNumInputPorts(S, NUM_INPUTS)) return;
|
||||
/* Input Port 0 */
|
||||
ssSetInputPortWidth(S, 0, INPUT_0_WIDTH);
|
||||
ssSetInputPortDataType(S, 0, SS_SINGLE);
|
||||
ssSetInputPortDataType(S, 0, SS_UINT16);
|
||||
ssSetInputPortComplexSignal(S, 0, INPUT_0_COMPLEX);
|
||||
ssSetInputPortDirectFeedThrough(S, 0, INPUT_0_FEEDTHROUGH);
|
||||
ssSetInputPortRequiredContiguous(S, 0, 1); /*direct input signal access*/
|
||||
@@ -297,7 +297,7 @@ static void mdlStart(SimStruct *S)
|
||||
*/
|
||||
static void mdlOutputs(SimStruct *S, int_T tid)
|
||||
{
|
||||
const real32_T *AO = (real32_T *) ssGetInputPortRealSignal(S, 0);
|
||||
const uint16_T *AO = (uint16_T *) ssGetInputPortRealSignal(S, 0);
|
||||
const uint16_T *start_idx = (uint16_T *) ssGetInputPortRealSignal(S, 1);
|
||||
int32_T *ErrorCode = (int32_T *) ssGetOutputPortRealSignal(S, 0);
|
||||
const int_T u_width = ssGetInputPortWidth(S, 0);
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -1,5 +1,5 @@
|
||||
%% File : hal_ao.tlc
|
||||
%% Created : Fri Mar 20 10:34:32 2020
|
||||
%% Created : Mon Mar 23 08:06:46 2020
|
||||
%%
|
||||
%% Description:
|
||||
%% Simulink Coder wrapper functions interface generated for
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
extern void hal_ao_Start_wrapper(void);
|
||||
|
||||
extern void hal_ao_Outputs_wrapper(const real32_T *AO,
|
||||
extern void hal_ao_Outputs_wrapper(const uint16_T *AO,
|
||||
const uint16_T *start_idx,
|
||||
int32_T *ErrorCode,
|
||||
const int_T u_width);
|
||||
|
||||
Binary file not shown.
@@ -32,7 +32,7 @@ void analog_input_init()
|
||||
{
|
||||
if (!is_analog_input_init)
|
||||
{
|
||||
//TODO config channels, update rate, etc. and bind properties
|
||||
//TODO
|
||||
is_analog_input_init = 1;
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ analog_input_init();
|
||||
*
|
||||
*/
|
||||
void hal_ai_Outputs_wrapper(const uint16_T *start_idx,
|
||||
real32_T *AI,
|
||||
uint16_T *AI,
|
||||
int32_T *ErrorCode,
|
||||
const int_T y_width)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ void analog_output_init()
|
||||
{
|
||||
if (!is_analog_output_init)
|
||||
{
|
||||
//TODO config channels, update rate, etc. and bind properties
|
||||
//TODO
|
||||
is_analog_output_init = 1;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ analog_output_init();
|
||||
* Output function
|
||||
*
|
||||
*/
|
||||
void hal_ao_Outputs_wrapper(const real32_T *AO,
|
||||
void hal_ao_Outputs_wrapper(const uint16_T *AO,
|
||||
const uint16_T *start_idx,
|
||||
int32_T *ErrorCode,
|
||||
const int_T u_width)
|
||||
@@ -63,7 +63,7 @@ void hal_ao_Outputs_wrapper(const real32_T *AO,
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
#ifdef HAL_IMPL
|
||||
/*
|
||||
* output *AO* to DAC channels from *start_idx* to *start_idx*+u_width-1.
|
||||
* output *AO* to analog output devices from *start_idx* to *start_idx*+u_width-1.
|
||||
*
|
||||
* ErrorCode - return zero on success, otherwise nonzero on failures.
|
||||
*/
|
||||
@@ -77,7 +77,6 @@ ErrorCode[0] = -1;
|
||||
#else
|
||||
ErrorCode[0] = 0;
|
||||
#endif
|
||||
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user