%if !SLibCodeGenForSim()
%% Declare temporal variables
- %if EXISTS("_RPP_AIN_TMP_VARS_") == 0
- %assign ::_RPP_AIN_TMP_VARS_ = 1
- int16_t ain_tmp;
+ %if EXISTS("_RPP_ADC_TMP_VARS_") == 0
+ %assign ::_RPP_ADC_TMP_VARS_ = 1
+ int16_t adc_tmp;
%endif
%% Error flag
%assign err_flag = LibBlockOutputSignal(1, "", "", 0)
%% First executed block must update cached values
- %if EXISTS("_RPP_AIN_UPDATE_") == 0
- %assign _RPP_AIN_UPDATE_ = 1
- if(rpp_ain_update() != SUCCESS) {
+ %if EXISTS("_RPP_ADC_UPDATE_") == 0
+ %assign _RPP_ADC_UPDATE_ = 1
+ if(rpp_adc_update() != SUCCESS) {
%<err_flag> = TRUE;
}
%endif
%assign pin_num = LibBlockParameterValue(p1, 0)
%% Get pin value
- ain_tmp = rpp_ain_get(%<pin_num>);
+ adc_tmp = rpp_adc_get(%<pin_num>);
/* <0 for error code, and =0 for broken ADC */
- if(ain_tmp <= 0) {
+ if(adc_tmp <= 0) {
%<err_flag> = TRUE;
- ain_tmp = 0;
+ adc_tmp = 0;
}
%% Return input
%assign analog_in = LibBlockOutputSignal(0, "", "", 0)
- %<analog_in> = ain_tmp;
+ %<analog_in> = adc_tmp;
%endif
%if !SLibCodeGenForSim()
%assign pin_num = LibBlockParameterValue(p1, 0)
- rpp_aout_setup(%<pin_num>, TRUE);
- rpp_aout_set(%<pin_num>, 0);
+ rpp_dac_setup(%<pin_num>, TRUE);
+ rpp_dac_set(%<pin_num>, 0);
/*
- * Warning! This should be the correct way to initialize AOUT.
- * Nevertheless rpp_aout_update() has a known bug that if it is called
+ * Warning! This should be the correct way to initialize DAC.
+ * Nevertheless rpp_dac_update() has a known bug that if it is called
* before starting the FreeRTOS Scheduler the application will freeze.
* Check the RPP API documentation for more information.
* Not updating now is harmless though.
*/
- /* rpp_aout_update(); */
+ /* rpp_dac_update(); */
%endif
%endfunction
%assign err_flag = LibBlockOutputSignal(0, "", "", 0)
%if use_voltage
- if(rpp_aout_set_voltage(%<pin_num>, %<analog_out>) != SUCCESS) {
+ if(rpp_dac_set_voltage(%<pin_num>, %<analog_out>) != SUCCESS) {
%else
- if(rpp_aout_set(%<pin_num>, %<analog_out>) != SUCCESS) {
+ if(rpp_dac_set(%<pin_num>, %<analog_out>) != SUCCESS) {
%endif
%<err_flag> = TRUE;
} else {
%% The call is smart enought to commit only the changed outputs
%% so it is efficient to call this at the end of each block.
- if(rpp_aout_update() != SUCCESS) {
+ if(rpp_dac_update() != SUCCESS) {
%<err_flag> = TRUE;
}
}