Uzetherm
Speaking thermometer with video output
Defines | Functions | Variables
uzetherm.c File Reference

UzeTherm for Uzebox - Speaking thermometer with LM75. More...

#include <stdbool.h>
#include <string.h>
#include <avr/io.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
#include "kernel/uzebox.h"
#include "kernel/mmc.h"
#include "i2c_software_master.h"
#include "uzewav.h"
#include "data/UzeThermTiles.pic.inc"
#include "data/fonts.pic.inc"
#include "data/UzeTherm.maps.inc"
#include "data/sprites.pic.inc"
#include "data/sprites.map.inc"
Include dependency graph for uzetherm.c:

Defines

#define PM_Thermometer   1
 program mode: shows the digital thermometer...
#define PM_Demo   2
 program mode: demonstration without sensor...
#define Celsius   0
 unit Celsius
#define Fahrenheit   1
 unit Fahrenheit
#define Max_temp   50
 maximal temperature in Celsius
#define Min_temp   -20
 minimal temperature in Celsius
#define Bar_Start_Y   21
 start position in Y direction (= -20 degree Celsius) for thermometer bar
#define Bar_Start_X   5
 start position in X direction for thermometer bar
#define BUTTON_FLAG_X   17
 position in X direction for language button
#define BUTTON_FLAG_Y   17
 position in Y direction for language button
#define BUTTON_SPK_X   23
 position in X direction for mute button
#define BUTTON_SPK_Y   17
 position in Y direction for mute button
#define GERMAN   0
 definition for german voice output
#define ENGLISH   1
 definition for english voice output
#define PRNG_NEXT()   (prng = ((u8)((prng>>1) | ((prng^(prng>>2)^(prng>>3)^(prng>>4))<<7))))
 8-bit, 255 period LFSR (for generating pseudo-random numbers)

Functions

void init (void)
void set_PM_mode (u8 mode)
void copy_buf (unsigned char *BUFA, unsigned char *BUFB, unsigned char ucANZ)
void fill_buf (char *BUFA, char content, unsigned char ucANZ)
int gettemperature (void)
void convert_temperature (double *dTempOut, int iTempIn, u8 TempFormat)
void draw_thermometer_bar (int iTempRaw)
void draw_Dotmatrix (u8 PosX, u8 PosY, int iTempRaw, u8 TempFormat)
void VsyncCallBack (void)
void convert_temperature_DE (int iTempRaw, u8 TempFormat)
void convert_temperature_EN (int iTempRaw, u8 TempFormat)
void draw_button (u8 PosX, u8 PosY, const char *map, bool Pressed)
void button_handler (u8 PosX, u8 PosY)
int main ()
u8 GetTile (u8 x, u8 y)

Variables

u8 prng
 Pseudo-random number generator.
u8 program_mode = PM_Thermometer
 program mode
u8 language = GERMAN
 choosed language
bool SPK_ON = true
 status for voice output / mute button
bool cardDetected
 SD card detected.
File files [MAX_WAVES]
 array with file entries
unsigned long sectorNo
bool playing
 voice output of a file is running
long bootRecordSector
int reservedSectors
int sectorsPerFat
unsigned char maxRootDirectorySectors
long dirTableSector
char wav_queue [7]
 queue with wave files for playing

Detailed Description

UzeTherm for Uzebox - Speaking thermometer with LM75.

Version:
1.1
Date:
2012
Author:
Hartmut Wendt info@hwhardsoft.de.vu <http://www.hwhardsoft.de.vu>
Note:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Function Documentation

void button_handler ( u8  PosX,
u8  PosY 
)

button handler for mouse cursor

Parameters:
Xposition of cursor
Yposition of cursor
Returns:
none

Here is the call graph for this function:

void convert_temperature ( double *  dTempOut,
int  iTempIn,
u8  TempFormat 
)

converts measured temperature into a value in Celsius or Fahrenheit

Parameters:
pointerto output temperature
measured(input) temperature from sensor
temperatureunit (Fahrenheit or Celsius)
Returns:
none

Here is the caller graph for this function:

void convert_temperature_DE ( int  iTempRaw,
u8  TempFormat 
)

converts measured temperature into a german voice anouncement

Parameters:
measured(input) temperature from sensor
temperatureunit (Fahrenheit or Celsius)
Returns:
none

Here is the call graph for this function:

void convert_temperature_EN ( int  iTempRaw,
u8  TempFormat 
)

converts measured temperature into am english voice anouncement

Parameters:
measured(input) temperature from sensor
temperatureunit (Fahrenheit or Celsius)
Returns:
none

Here is the call graph for this function:

void copy_buf ( unsigned char *  BUFA,
unsigned char *  BUFB,
unsigned char  ucANZ 
)

copy a buffer into another buffer

Parameters:
sourcebuffer
targetbuffer
countof copied bytes
Returns:
none
void draw_button ( u8  PosX,
u8  PosY,
const char *  map,
bool  Pressed 
)

draw a graphic button

Parameters:
Xcoordinate for button (first digit, left corner)
Ycoordinate for button (first digit, upper corner)
mapfor button picture
buttonis pressed or unpressed
Returns:
none

Here is the caller graph for this function:

void draw_Dotmatrix ( u8  PosX,
u8  PosY,
int  iTempRaw,
u8  TempFormat 
)

draws the dotmatrix style display

Parameters:
Xcoordinate for output (first digit, left corner)
Ycoordinate for output (first digit, upper corner)
temperatureunit (Fahrenheit or Celsius)
Returns:
none

Here is the call graph for this function:

void draw_thermometer_bar ( int  iTempRaw)

draws the thermometer bar

Parameters:
measured(input) temperature from sensor
Returns:
none

Here is the call graph for this function:

void fill_buf ( char *  BUFA,
char  content,
unsigned char  ucANZ 
)

fill a buffer

Parameters:
targetbuffer
byteto fill
countof copied bytes
Returns:
none

Here is the caller graph for this function:

int gettemperature ( void  )

read temperature from LM75 sensor via I2C bus

Parameters:
void
Return values:
temperature

Here is the call graph for this function:

u8 GetTile ( u8  x,
u8  y 
)

get background tile from vram

Parameters:
Xcoordinates of tile
Ycoordinates of tile
Return values:
tilenumber
void init ( void  )

init the kernel, graphic, SD card and I2C interface

Parameters:
void
Returns:
non

Here is the call graph for this function:

void set_PM_mode ( u8  mode)

set parameters, tiles, background etc for choosed program mode

Parameters:
mode(program mode)
Returns:
non

Here is the call graph for this function:

Here is the caller graph for this function:

void VsyncCallBack ( void  )

Call process mixer for sound output

Parameters:
void
Returns:
non

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines