Merge branch 'master' of sh.matthewgong.com:matt/slhal into 1-EF3Lite
# Conflicts: # hal_api.h
This commit is contained in:
@@ -119,6 +119,7 @@ extern "C"
|
||||
{
|
||||
uint16_t channels[18];
|
||||
uint8_t seq;
|
||||
uint8_t id;
|
||||
uint8_t valid;
|
||||
} HAL_sbus_in_t;
|
||||
|
||||
@@ -232,5 +233,4 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _HAL_H_
|
||||
|
||||
#endif // _HAL_H_
|
||||
Binary file not shown.
@@ -140,6 +140,7 @@ cellInfo = { ...
|
||||
'-1', {...
|
||||
{'channels', 18, 'uint16', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('us'), ''}; ...
|
||||
{'seq', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', ''}; ...
|
||||
{'id', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', ''}; ...
|
||||
{'valid', 1, 'boolean', -1, 'real', 'Sample', 'Fixed', [], [], '', ''}; ...
|
||||
} ...
|
||||
} ...
|
||||
|
||||
Binary file not shown.
+8
-4
@@ -26,7 +26,7 @@
|
||||
* | See matlabroot/simulink/src/sfuntmpl_doc.c for a more detailed template |
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Created: Tue Mar 24 14:55:05 2020
|
||||
* Created: Wed Jun 03 15:45:18 2020
|
||||
*/
|
||||
|
||||
#define S_FUNCTION_LEVEL 2
|
||||
@@ -320,7 +320,7 @@ static void mdlStart(SimStruct *S)
|
||||
const char *bpath = ssGetPath(S);
|
||||
DTypeId HAL_sbus_in_tId = ssGetDataTypeId(S, "HAL_sbus_in_t");
|
||||
|
||||
busInfoStruct *busInfo = (busInfoStruct *)malloc(6*sizeof(busInfoStruct));
|
||||
busInfoStruct *busInfo = (busInfoStruct *)malloc(8*sizeof(busInfoStruct));
|
||||
if(busInfo==NULL) {
|
||||
ssSetErrorStatus(S, "Memory allocation failure");
|
||||
return;
|
||||
@@ -335,8 +335,11 @@ static void mdlStart(SimStruct *S)
|
||||
busInfo[1].elemSize = dtaGetDataTypeSize(dta, bpath, ssGetDataTypeId(S, "uint8"));
|
||||
busInfo[1].numElems = 1;
|
||||
busInfo[2].offset = dtaGetDataTypeElementOffset(dta, bpath, HAL_sbus_in_tId, 2);
|
||||
busInfo[2].elemSize = dtaGetDataTypeSize(dta, bpath, ssGetDataTypeId(S, "boolean"));
|
||||
busInfo[2].elemSize = dtaGetDataTypeSize(dta, bpath, ssGetDataTypeId(S, "uint8"));
|
||||
busInfo[2].numElems = 1;
|
||||
busInfo[3].offset = dtaGetDataTypeElementOffset(dta, bpath, HAL_sbus_in_tId, 3);
|
||||
busInfo[3].elemSize = dtaGetDataTypeSize(dta, bpath, ssGetDataTypeId(S, "boolean"));
|
||||
busInfo[3].numElems = 1;
|
||||
ssSetUserData(S, busInfo);
|
||||
const int_T p_width0 = mxGetNumberOfElements(PARAM_DEF0(S));
|
||||
const uint8_T *id = (const uint8_T *) mxGetData(PARAM_DEF0(S));
|
||||
@@ -367,7 +370,8 @@ static void mdlOutputs(SimStruct *S, int_T tid)
|
||||
/* Copy temporary structure into output bus */
|
||||
(void) memcpy(sbus + busInfo[0].offset, _sbusBUS.channels, busInfo[0].elemSize * busInfo[0].numElems);
|
||||
(void) memcpy(sbus + busInfo[1].offset, &_sbusBUS.seq, busInfo[1].elemSize * busInfo[1].numElems);
|
||||
(void) memcpy(sbus + busInfo[2].offset, &_sbusBUS.valid, busInfo[2].elemSize * busInfo[2].numElems);
|
||||
(void) memcpy(sbus + busInfo[2].offset, &_sbusBUS.id, busInfo[2].elemSize * busInfo[2].numElems);
|
||||
(void) memcpy(sbus + busInfo[3].offset, &_sbusBUS.valid, busInfo[3].elemSize * busInfo[3].numElems);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
||||
%% File : hal_sbus_in.tlc
|
||||
%% Created : Tue Mar 24 14:55:05 2020
|
||||
%% Created : Wed Jun 03 15:45:18 2020
|
||||
%%
|
||||
%% Description:
|
||||
%% Simulink Coder wrapper functions interface generated for
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "hal_api.h"
|
||||
|
||||
|
||||
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
#ifdef HAL_IMPL
|
||||
//#include "param_mgr.h"
|
||||
@@ -49,20 +50,20 @@ void sbus_input_init(uint8_t id)
|
||||
*/
|
||||
void hal_sbus_in_Start_wrapper(const uint8_T *id, const int_T p_width0)
|
||||
{
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
sbus_input_init(id[0]);
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
sbus_input_init(id[0]);
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
}
|
||||
/*
|
||||
* Output function
|
||||
*
|
||||
*/
|
||||
void hal_sbus_in_Outputs_wrapper(HAL_sbus_in_t *sbus,
|
||||
int32_T *ErrorCode,
|
||||
const uint8_T *id, const int_T p_width0)
|
||||
int32_T *ErrorCode,
|
||||
const uint8_T *id, const int_T p_width0)
|
||||
{
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
ErrorCode[0] = -1;
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
ErrorCode[0] = -1;
|
||||
/*
|
||||
* input *AI* from ADC channels from *start_idx* to *start_idx*+y_width-1.
|
||||
*
|
||||
@@ -74,11 +75,14 @@ void hal_sbus_in_Outputs_wrapper(HAL_sbus_in_t *sbus,
|
||||
if (is_sbus_in_init[0])
|
||||
{
|
||||
#ifdef HAL_IMPL
|
||||
|
||||
// TODO set sbus outputs
|
||||
ErrorCode[0] = 0;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user