Copyright (c) 2015-2018 Microchip Technology Inc.
and its subsidiaries.
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "contiki.h"
#include "battery-sensor.h"
#include "sys/timer.h"
#include "asf.h"
#include "extint.h"
#include "trx_access.h"
Macros | |
#define | BATMON_HR_HIGH (1) |
Constant BATMON_HR_HIGH for sub-register SR_BATMON_HR in register BATMON. More... | |
#define | BATMON_HR_LOW (0) |
Constant BATMON_HR_LOW for sub-register SR_BATMON_HR in register BATMON. More... | |
#define | BATMON_NOT_VALID (0) |
Constant BATMON_NOT_VALID for sub-register SR_BATMON_OK in register BATMON. More... | |
#define | BATMON_VALID (1) |
Constant BATMON_VALID for sub-register SR_BATMON_OK in register BATMON. More... | |
#define | SR_BATMON_HR 0x11, 0x10, 4 |
Access parameters for sub-register BATMON_HR in register RG_BATMON. More... | |
#define | SR_BATMON_OK 0x11, 0x20, 5 |
Access parameters for sub-register BATMON_OK in register RG_BATMON. More... | |
#define | SR_BATMON_VTH 0x11, 0x0F, 0 |
Access parameters for sub-register BATMON_VTH in register RG_BATMON. More... | |
#define | SUPPLY_VOLTAGE_ABOVE_UPPER_LIMIT (0xFFFF) |
Supply voltage above upper limit. More... | |
#define | SUPPLY_VOLTAGE_BELOW_LOWER_LIMIT (0) |
Supply voltage below lower limit. More... | |
Functions | |
static int | battery_sensor_configure (int type, int value) |
void | battery_sensor_init (void) |
static int | battery_sensor_status (int type) |
static int | battery_sensor_value (int type) |
static uint16_t | get_batmon_voltage (void) |
SENSORS_SENSOR (battery_sensor,"Battery sensor", battery_sensor_value, battery_sensor_configure, battery_sensor_status) | |
Variables | |
static int | enabled = 0 |
#define BATMON_HR_HIGH (1) |
Constant BATMON_HR_HIGH for sub-register SR_BATMON_HR in register BATMON.
Referenced by get_batmon_voltage().
#define BATMON_HR_LOW (0) |
Constant BATMON_HR_LOW for sub-register SR_BATMON_HR in register BATMON.
Referenced by get_batmon_voltage().
#define BATMON_NOT_VALID (0) |
Constant BATMON_NOT_VALID for sub-register SR_BATMON_OK in register BATMON.
Referenced by get_batmon_voltage().
#define BATMON_VALID (1) |
Constant BATMON_VALID for sub-register SR_BATMON_OK in register BATMON.
Referenced by get_batmon_voltage().
#define SR_BATMON_HR 0x11, 0x10, 4 |
Access parameters for sub-register BATMON_HR in register RG_BATMON.
Referenced by get_batmon_voltage().
#define SR_BATMON_OK 0x11, 0x20, 5 |
Access parameters for sub-register BATMON_OK in register RG_BATMON.
Referenced by get_batmon_voltage().
#define SR_BATMON_VTH 0x11, 0x0F, 0 |
Access parameters for sub-register BATMON_VTH in register RG_BATMON.
Referenced by get_batmon_voltage().
#define SUPPLY_VOLTAGE_ABOVE_UPPER_LIMIT (0xFFFF) |
Supply voltage above upper limit.
Referenced by get_batmon_voltage().
#define SUPPLY_VOLTAGE_BELOW_LOWER_LIMIT (0) |
Supply voltage below lower limit.
Referenced by get_batmon_voltage().
|
static |
References enabled.
Referenced by battery_sensor_init().
void battery_sensor_init | ( | void | ) |
References battery_sensor_configure().
Referenced by PROCESS_THREAD().
|
static |
References enabled.
|
static |
References enabled, and get_batmon_voltage().
|
static |
References BATMON_HR_HIGH, BATMON_HR_LOW, BATMON_NOT_VALID, BATMON_VALID, delay_us, HIGH, i, LOW, SR_BATMON_HR, SR_BATMON_OK, SR_BATMON_VTH, SUPPLY_VOLTAGE_ABOVE_UPPER_LIMIT, SUPPLY_VOLTAGE_BELOW_LOWER_LIMIT, trx_bit_read(), trx_bit_write(), and trx_reg_read().
Referenced by battery_sensor_value().
SENSORS_SENSOR | ( | battery_sensor | , |
"Battery sensor" | , | ||
battery_sensor_value | , | ||
battery_sensor_configure | , | ||
battery_sensor_status | |||
) |
|
static |