... | ... | @@ -13,12 +13,14 @@ The library is based around a core connecting different modules, that can also b |
|
|
|
|
|
It's the task of the library core to include all modules and set the up with proper values for the NXP Cup car models.
|
|
|
|
|
|
## Methods
|
|
|
### HDU_init()
|
|
|
## Documentation
|
|
|
### void HDU_init()
|
|
|
sets up configured pinout and initializes all submodules. This method also gives messages of the init proces via Debugger UART and Bluetooth.
|
|
|
This function may only be calles once.
|
|
|
|
|
|
### HDU_startup()
|
|
|
### void HDU_startup()
|
|
|
starts all peripherial aspects configured in the MCU Config .mex file. It only needs to be called, when just single modules are in use as it is already included in the HDU_init().
|
|
|
This function may only be called once.
|
|
|
|
|
|
## Initialization Examples
|
|
|
### Init complete HDU library
|
... | ... | @@ -36,11 +38,54 @@ HDU_HMI_init(); |
|
|
# Modules
|
|
|
|
|
|
## ADC0 evaluation (HDU_ADC0.h)
|
|
|
This module allows reading 16 bit values from the ADC0.
|
|
|
|
|
|
### Module documentation
|
|
|
|
|
|
#### typedef struct HDU_ADC0_Data
|
|
|
Every ADC0 single ended channel is define via its number and mux. These information are stored in the struct.
|
|
|
If the mux is not specified for a channel it is don't care. There is also a 16-bit integer for the measurement value included.
|
|
|
|
|
|
#### void HDU_ADC0_init()
|
|
|
initializes HDU_ADC0 module (ADC0 in 16 bit mode for single measurements).
|
|
|
This function may only be called once.
|
|
|
|
|
|
#### uint16_t HDU_ADC0_read(HDU_ADC0_Data *data)
|
|
|
is used to read the ADC values. It takes an ADC0 data struct with a channel number and mux and will fill the value. The value is also returned by the method itself.
|
|
|
|
|
|
### Example
|
|
|
Read from ADC0, channel 4, mux b:
|
|
|
|
|
|
<code>
|
|
|
HDU_ADC0_init();
|
|
|
|
|
|
HDU_ADC0_Data adc_config;
|
|
|
adc_config.channel = 4;
|
|
|
adc_config.mux = kADC16_ChannelMuxB;
|
|
|
|
|
|
uint16_t adcvalue = HDU_ADC0_read(&adc config);
|
|
|
</code>
|
|
|
|
|
|
## Battery voltage reading (HDU_BATSENSE.h)
|
|
|
This module can be used to read the battery voltage by evaluating the onboard voltage divider via ADC0, SE4b.
|
|
|
|
|
|
### Module documentation
|
|
|
#### void HDU_BATSENSE_init(int r1, int r2)
|
|
|
initializes the HDU_BATSENSE module. r1 is the value of the upper resistor of the voltage divider, r2 the value of the lower resistor. Both values need to be in a similar decade of ohms.
|
|
|
This function may only be called once.
|
|
|
|
|
|
#### float HDU_BATSENSE_read()
|
|
|
returns the battery voltage in volts.
|
|
|
|
|
|
### Example
|
|
|
<code>
|
|
|
HDU_BATSENSE_init(100, 56);
|
|
|
float voltage = HDU_BATSENSE_read();
|
|
|
</code>
|
|
|
|
|
|
## Bluetooth debugging (HDU_BLUETOOTH.h)
|
|
|
|
|
|
|
|
|
## HMI interaction (HDU_HMI.h)
|
|
|
|
|
|
## Camera reading (HDU_LINESCAN.h)
|
... | ... | |