/* ADC, Display results using LEDs */
#include
#include “LEDs.h”
/* ADC initialisation */
void Init_ADC(void) {
// Enable ADC clock
ADC0->CFG1 |= ADC_CFG1_ADLPC_MASK | ADC_CFG1_ADIV(0) | ADC_CFG1_ADLSMP_MASK | ADC_CFG1_MODE(3) ; // comment this line, explain how ADC is configured
ADC0->SC2 = 0; // comment this line, explain how ADC is configured
}
/* write a subroutine to store ADC result in a variable and return this variable, specify the type of this subroutine */
Measure_VBat(void) { // your code here
}
/*————————————————————————————————————
Complete the main function to change LED colour according to measured voltage
*———————————————————————————————————–*/
int main (void) {
Init_RGB_LEDs();
Init_ADC();
// your code here
}