/** \file * * This file contains special DoxyGen information for the generation of the main page and other special * documentation pages. It is not a project source file. */ /** \mainpage Temperature Datalogger Project * * \section Sec_Compat Demo Compatibility: * * The following list indicates what microcontrollers are compatible with this demo. * * \li Series 7 USB AVRs (AT90USBxxx7) * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) - those with >16KB of FLASH memory only * * \section Sec_Info USB Information: * * The following table gives a rundown of the USB utilization of this demo. * * * * * * * * * * * * * * * * * * * * * * *
USB Mode:Device
USB Classes:Mass Storage Device \n * Human Interface Device
USB Subclasses:Bulk-Only Transport \n * Keyboard Subclass
Relevant Standards:USBIF Mass Storage Standard \n * USB Bulk-Only Transport Standard \n * SCSI Primary Commands Specification \n * SCSI Block Commands Specification \n * USBIF HID Specification, USBIF HID Usage Tables
Supported USB Speeds:Full Speed Mode
* * \section Sec_Description Project Description: * * Temperature Data Logger project. This project is a very basic USB data logger for the current temperature as reported by * the board's temperature sensor, writing the temperature to a file stored on the board's Dataflash in a FAT filesystem * each time a specified interval elapses. When inserted into a PC, the datalogger will appear as a standard USB Mass Storage * device with a single text file, which contains the logged data. Files are named according to the current date when the * logging commences. * * A DS1307 or compatible RTC IC is designed to be attached to the AVR's TWI bus, for the management of timestamps on the * sampled data. This project will not function correctly if the RTC chip is omitted unless the DUMMY_RTC compile time token * is specified - see \ref Sec_Options. * * Due to the host's need for exclusive access to the file system, the device will not log samples while connected to a host. * For the logger to store data, the Dataflash must first be formatted by the host so that it contains a valid FAT file system. * * This project uses the FatFS library from ELM Chan (http://elm-chan.org/fsw/ff/00index_e.html) and the .NET HID device library * LibHIDNet (http://sourceforge.net/projects/libhidnet/). * * \section Sec_Options Project Options * * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value. * * * * * * * * * * * * *
Define Name:Location:Description:
DUMMY_RTCAppConfig.hWhen a DS1307 RTC chip is not fitted, this token can be defined to make the demo use a dummy software RTC using the system * clock. This is less accurate and does not store the set time and date into non-volatile memory.
*/ ' href='#n17'>17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
/* Copyright 2016 Jack Humbert
 *
 * 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 2 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/>.
 */

#ifndef _API_H_
#define _API_H_

#ifdef __AVR__
#include "lufa.h"
#endif

enum MESSAGE_TYPE {
    MT_GET_DATA =      0x10, // Get data from keyboard
    MT_GET_DATA_ACK =  0x11, // returned data to process (ACK)
    MT_SET_DATA =      0x20, // Set data on keyboard
    MT_SET_DATA_ACK =  0x21, // returned data to confirm (ACK)
    MT_SEND_DATA =     0x30, // Sending data/action from keyboard
    MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
    MT_EXE_ACTION =    0x40, // executing actions on keyboard
    MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK)
    MT_TYPE_ERROR =    0x80 // type not recognised (ACK)
};

enum DATA_TYPE {
    DT_NONE = 0x00,
    DT_HANDSHAKE,
    DT_DEFAULT_LAYER,
    DT_CURRENT_LAYER,
    DT_KEYMAP_OPTIONS,
    DT_BACKLIGHT,
    DT_RGBLIGHT,
    DT_UNICODE,
    DT_DEBUG,
    DT_AUDIO,
    DT_QUANTUM_ACTION,
    DT_KEYBOARD_ACTION,
    DT_USER_ACTION,
    DT_KEYMAP_SIZE,
    DT_KEYMAP
};

void dword_to_bytes(uint32_t dword, uint8_t * bytes);
uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);

#define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length)
#define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length)
#define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length)
#define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length)
#define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length)
#define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length)
#define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length)
#define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length)

void process_api(uint16_t length, uint8_t * data);

__attribute__ ((weak))
bool process_api_quantum(uint8_t length, uint8_t * data);

__attribute__ ((weak))
bool process_api_keyboard(uint8_t length, uint8_t * data);

__attribute__ ((weak))
bool process_api_user(uint8_t length, uint8_t * data);

#endif