4894838edf
This reverts commit 811bcae588.
55 lines
908 B
C
55 lines
908 B
C
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "app_config.h"
|
|
#include "apply_old_config.h"
|
|
#include "sdk_config.h"
|
|
|
|
#include "nrf_log.h"
|
|
#include "nrf_log_ctrl.h"
|
|
#include "nrf_log_default_backends.h"
|
|
|
|
#include "nrf_sdh.h"
|
|
#include "nrf_sdh_ble.h"
|
|
#include "nrf_sdh_freertos.h"
|
|
|
|
#include "ble_srv_common.h"
|
|
|
|
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
static uint16_t volt = 3100;
|
|
|
|
uint16_t bas_volt_read(void)
|
|
{
|
|
return volt;
|
|
}
|
|
|
|
void battery_task(void *pArg)
|
|
{
|
|
for (;;)
|
|
{
|
|
// battery psuedo code
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
volt = volt ? volt - 1 : 3100;
|
|
|
|
// update battery volt
|
|
extern void le_eis_bat_volt_update(uint16_t bat_volt);
|
|
le_eis_bat_volt_update(volt);
|
|
}
|
|
}
|
|
|
|
void bas_volt_init(void)
|
|
{
|
|
xTaskCreate(battery_task, "bat_task", 160, NULL, 2, NULL);
|
|
}
|