26 lines
479 B
C
26 lines
479 B
C
#include "battery.h"
|
|
#include "adc.h"
|
|
#include "remote.h"
|
|
|
|
extern MyUART_Struct_Typedef uartCool;
|
|
|
|
void battery(uint32_t data)
|
|
{
|
|
if(data >= 0x420) //0x429 -> approx. 12V
|
|
{
|
|
MyUART_Send(&uartCool,'h');
|
|
}
|
|
else {
|
|
MyUART_Send(&uartCool,'l');
|
|
}
|
|
|
|
}
|
|
|
|
void initBattery(void)
|
|
{
|
|
MyADC_Init_Periph(battery);
|
|
MyADC_Struct_TypeDef adcBattery = {ADC1,10,cycles41d5};
|
|
MyADC_Init(&adcBattery);
|
|
MyGPIO_Struct_TypeDef gpioBattery = {GPIOC,0,In_Analog};;
|
|
MyGPIO_Init(&gpioBattery);
|
|
}
|