battery.c
/*******************************************************************************
* examples/battery.c *
* ================== *
* *
* Version: 1.0.6 *
* Date : 01.11.17 *
* Author : Peter Weissig *
* *
* If you are changing this file, you may also consider to update *
* demos/diagnosticTool/diagnosticTool.c *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
//*********************************<Methods>************************************
void testBattery(void);
int main(void);
//*********************************[testBattery]********************************
void testBattery(void) {
lcdclr();
lcdstr_p(PSTR("Battery" ));
lcdxy(0,1);
lcdstr_p(PSTR("Voltage:##### mV"));
while (1) {
if (battery_changed()) {
lcdxy(8,1);
mdelay(250);
}
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testBattery();
return (0);
}
battery_get
uint16_t battery_get(void)
Returns the last stored voltage of the battery.
int16tostr
void int16tostr(void *out, int16_t number, uint8_t digits)
Converts an integer to a string and passes it to an output function.
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
battery_changed
uint8_t battery_changed(void)
Indicates if new data changed the data block sMD_SensBattery.
battery_request
void battery_request(eRequestType request)
Requests new data from the battery.
lcdclr
void lcdclr(void)
Clears the display.
lcdxy
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
lcdstr_p
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
lcdout
void lcdout(uint8_t data)
Writes one byte to the display.
init_tucbot
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
mdelay
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.