Radio Datalogger Project  Version 2.0
Data Structures | Macros | Functions
TempDataLogger.h File Reference
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <util/delay.h>
#include "Descriptors.h"
#include "Lib/SCSI.h"
#include "Lib/DataflashManager.h"
#include "Lib/FATFs/ff.h"
#include "Lib/DS1307.h"
#include "Lib/HYT321.h"
#include "Lib/lcd.h"
#include "Lib/Funkmodul.h"
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Temperature.h>
#include <LUFA/Drivers/Peripheral/ADC.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/USB/USB.h>

Data Structures

struct  Device_Report_t
 

Macros

#define LEDMASK_USB_NOTREADY   LEDS_LED1
 
#define LEDMASK_USB_ENUMERATING   (LEDS_LED2 | LEDS_LED3)
 
#define LEDMASK_USB_READY   (LEDS_LED2 | LEDS_LED4)
 
#define LEDMASK_USB_ERROR   (LEDS_LED1 | LEDS_LED3)
 
#define LEDMASK_USB_BUSY   LEDS_LED2
 
#define LOG_FILENAME   "TEMPLOG.txt"
 
#define DEFAULT_LOG_INTERVAL   20
 
#define DEFAULT_SENSOR1_NAME   "Sensor 1"
 
#define DEFAULT_SENSOR2_NAME   "Sensor 2"
 
#define DEFAULT_SENSOR3_NAME   "Sensor 3"
 
#define MAX_Port_DDR   DDRB
 
#define MAX_Port_Read   PINB
 
#define MAX_Port_Write   PORTB
 
#define MAX_DataInput   0xDF
 
#define MAXSWITCH   5
 
#define LOCAL_Port_DDR   DDRC
 
#define LOCAL_Port_Read   PINC
 
#define LOCAL_DataInput   0x7F
 
#define LOCAL   7
 
#define LCD_MODUL   4
 
#define writeAPIKey   "ABCDEFDG"
 
#define USER_AGENT   "Datalogger_One"
 
#define POWER_ENABLE_Port_DDR   DDRB
 
#define POWER_ENABLE_Port_Write   PORTB
 
#define POWER_ENABLE_DataOutput   0x10
 
#define POWER_ENABLE   4
 
#define WEB_LOGGING_INTERVAL   1170
 

Functions

void SetupHardware (void)
 
void OpenLogFile (void)
 
void CloseLogFile (void)
 
void EVENT_USB_Device_Connect (void)
 
void EVENT_USB_Device_Disconnect (void)
 
void EVENT_USB_Device_ConfigurationChanged (void)
 
void EVENT_USB_Device_ControlRequest (void)
 
bool CALLBACK_MS_Device_SCSICommandReceived (USB_ClassInfo_MS_Device_t *const MSInterfaceInfo)
 
bool CALLBACK_HID_Device_CreateHIDReport (USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize)
 
void CALLBACK_HID_Device_ProcessHIDReport (USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void *ReportData, const uint16_t ReportSize)
 
void RadioReceive (void)
 
void GetCorrectionValues (void)
 

Detailed Description

Header file for TempDataLogger.c.

Macro Definition Documentation

#define DEFAULT_LOG_INTERVAL   20

Default log interval when the EEPROM is blank, in 500ms ticks.

#define DEFAULT_SENSOR1_NAME   "Sensor 1"

Default sensor1 name when the EEPROM is blank.

#define DEFAULT_SENSOR2_NAME   "Sensor 2"

Default sensor2 name when the EEPROM is blank.

#define DEFAULT_SENSOR3_NAME   "Sensor 3"

Default sensor3 name when the EEPROM is blank.

#define LCD_MODUL   4

Define LCD Modul: 2 -> 2*16 Char, 4 -> 4*20 Char

#define LEDMASK_USB_BUSY   LEDS_LED2

LED mask for the library LED driver, to indicate that the USB interface is busy.

#define LEDMASK_USB_ENUMERATING   (LEDS_LED2 | LEDS_LED3)

LED mask for the library LED driver, to indicate that the USB interface is enumerating.

#define LEDMASK_USB_ERROR   (LEDS_LED1 | LEDS_LED3)

LED mask for the library LED driver, to indicate that an error has occurred in the USB interface.

#define LEDMASK_USB_NOTREADY   LEDS_LED1

LED mask for the library LED driver, to indicate that the USB interface is not ready.

#define LEDMASK_USB_READY   (LEDS_LED2 | LEDS_LED4)

LED mask for the library LED driver, to indicate that the USB interface is ready.

#define LOCAL   7
#define LOCAL_DataInput   0x7F
#define LOCAL_Port_DDR   DDRC

Define Port for local connection or usb

#define LOCAL_Port_Read   PINC
#define LOG_FILENAME   "TEMPLOG.txt"

Filename for the log data when written to the dataflash FAT filesystem.

#define MAX_DataInput   0xDF
#define MAX_Port_DDR   DDRB

Define Port for max/min display switch -> PB5

#define MAX_Port_Read   PINB
#define MAX_Port_Write   PORTB
#define MAXSWITCH   5
#define POWER_ENABLE   4
#define POWER_ENABLE_DataOutput   0x10
#define POWER_ENABLE_Port_DDR   DDRB

Define Power Enable for Wiznet module WIZ107SR -> PB4

#define POWER_ENABLE_Port_Write   PORTB
#define USER_AGENT   "Datalogger_One"
#define WEB_LOGGING_INTERVAL   1170

Define Web logging interval = (time in seconds-10 * 2)

#define writeAPIKey   "ABCDEFDG"

Define parameters for cosm datalogging

Function Documentation

bool CALLBACK_HID_Device_CreateHIDReport ( USB_ClassInfo_HID_Device_t *const  HIDInterfaceInfo,
uint8_t *const  ReportID,
const uint8_t  ReportType,
void *  ReportData,
uint16_t *const  ReportSize 
)

HID class driver callback function for the creation of HID reports to the host.

Parameters
[in]HIDInterfaceInfoPointer to the HID class interface configuration structure being referenced
[in,out]ReportIDReport ID requested by the host if non-zero, otherwise callback should set to the generated report ID
[in]ReportTypeType of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
[out]ReportDataPointer to a buffer where the created report should be stored
[out]ReportSizeNumber of bytes written in the report (or zero if no report is to be sent
Returns
Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
void CALLBACK_HID_Device_ProcessHIDReport ( USB_ClassInfo_HID_Device_t *const  HIDInterfaceInfo,
const uint8_t  ReportID,
const uint8_t  ReportType,
const void *  ReportData,
const uint16_t  ReportSize 
)

HID class driver callback function for the processing of HID reports from the host.

Parameters
[in]HIDInterfaceInfoPointer to the HID class interface configuration structure being referenced
[in]ReportIDReport ID of the received report from the host
[in]ReportTypeThe type of report that the host has sent, either HID_REPORT_ITEM_Out or HID_REPORT_ITEM_Feature
[in]ReportDataPointer to a buffer where the created report has been stored
[in]ReportSizeSize in bytes of the received HID report
bool CALLBACK_MS_Device_SCSICommandReceived ( USB_ClassInfo_MS_Device_t *const  MSInterfaceInfo)

Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.

Parameters
[in]MSInterfaceInfoPointer to the Mass Storage class interface configuration structure being referenced
void CloseLogFile ( void  )

Closes the open data log file on the Dataflash's FAT formatted partition

void EVENT_USB_Device_ConfigurationChanged ( void  )

Event handler for the library USB Configuration Changed event.

void EVENT_USB_Device_Connect ( void  )

Event handler for the library USB Connection event.

void EVENT_USB_Device_ControlRequest ( void  )

Event handler for the library USB Control Request reception event.

void EVENT_USB_Device_Disconnect ( void  )

Event handler for the library USB Disconnection event.

void GetCorrectionValues ( void  )
void OpenLogFile ( void  )

Opens the log file on the Dataflash's FAT formatted partition according to the current date

void RadioReceive ( void  )

Receive telegram from radio modul

void SetupHardware ( void  )

Configures the board hardware and chip peripherals for the demo's functionality.