USER MANUAL RC188x-GPR
2019 Radiocrafts AS
RIIM User Manual (rev.1.2)
Page
12
of
23
8
API Usage
The following sections describes each of the API modules. The functions are presented in a simplified form here as
a quick reference; please see the
RIIM SDK API Reference
document for details.
8.1. RIIM_UAPI
This is basically an include file that includes everything you need to develop in ICI. It includes all User API
definitions and needed standard C header files.
Simply put this include line on top of your source file:
Example : ICI code
#include "RIIM_UAPI.h"
8.2. ADC
The ADC module lets you sample and convert the analog input of the module
RC1882-IPM supports 2 ADC channels, called ADC0 and ADC1.
The following example shows an example usage where the ADC is initialized, read, and the value is converted to
millivolts and printed on the console.
Example : ICI code
static
uint32_t
milliVolts
;
void
ADC_DemoFunc
()
{
milliVolts
=
0
;
// Set up interface
ADC
.
init
(
ADC0
,
ADC_FIXED_REFERENCE
,
ADC_SAMPLING_DURATION_10_6_US
);
ADC
.
convertToMicroVolts
(
ADC0
,
&
milliVolts
);
milliVolts
/=
1000
;
// Print directly to console to show the latest values
Util
.
printf
(
"ADC sensor read: Voltage(mV): %i\n"
,
milliVolts
);
return
;
}
Example 2 - ADC example code
The following functions are part of the ADC module.
Function
Description
init
(Channel, Reference,
SamplingDuration)
Initializes the ADC module input (either ADC0 or ADC1). It specifies
which voltage reference to use and how long a sampling takes
convert
(Channel, Value)
Convert an input voltage to its raw ADC value
convertToMicroVolts
(Channel, Value) Convert an input voltage to a integer representing the input voltage in
microvolts
Table 2 - ADC functions