Minor fixes

Updated platforms.txt
Added a few consumer definitions
This commit is contained in:
NicoHood 2015-05-25 18:17:01 +02:00
parent 19c61d732a
commit 09c2229608
3 changed files with 35 additions and 20 deletions

View file

@ -36,12 +36,18 @@ THE SOFTWARE.
#define MEDIA_REWIND 0xB4
#define MEDIA_NEXT 0xB5
#define MEDIA_PREVIOUS 0xB6
#define MEDIA_PREV MEDIA_PREVIOUS
#define MEDIA_STOP 0xB7
#define MEDIA_PLAY_PAUSE 0xCD
#define MEDIA_VOLUME_MUTE 0xE2
#define MEDIA_VOLUME_UP 0xE9
#define MEDIA_VOLUME_DOWN 0xEA
#define MEDIA_VOL_MUTE MEDIA_VOLUME_MUTE
#define MEDIA_VOL_UP MEDIA_VOLUME_UP
#define MEDIA_VOL_DOWN MEDIA_VOLUME_DOWN
#define CONSUMER_SCREENSAVER 0x19e
#define CONSUMER_EMAIL_READER 0x18A
#define CONSUMER_CALCULATOR 0x192
@ -53,12 +59,12 @@ THE SOFTWARE.
#define CONSUMER_BROWSER_REFRESH 0x227
#define CONSUMER_BROWSER_BOOKMARKS 0x22A
typedef union{
typedef union {
// every usable Consumer key possible, up to 4 keys presses possible
uint8_t whole8[];
uint16_t whole16[];
uint32_t whole32[];
struct{
struct {
uint16_t key1;
uint16_t key2;
uint16_t key3;
@ -66,24 +72,24 @@ typedef union{
};
} HID_ConsumerControlReport_Data_t;
class Consumer_{
class Consumer_ {
public:
inline Consumer_(void){
inline Consumer_(void) {
// empty
}
inline void begin(void){
inline void begin(void) {
// release all buttons
end();
}
inline void end(void){
inline void end(void) {
memset(&_report, 0, sizeof(_report));
HID_SendReport(HID_REPORTID_CONSUMERCONTROL, &_report, sizeof(_report));
}
inline void write(uint16_t m){
inline void write(uint16_t m) {
press(m);
release(m);
}
inline void press(uint16_t m){
inline void press(uint16_t m) {
// search for a free spot
for (int i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) {
if (_report.whole16[i] == 0x00) {
@ -93,7 +99,7 @@ public:
}
HID_SendReport(HID_REPORTID_CONSUMERCONTROL, &_report, sizeof(_report));
}
inline void release(uint16_t m){
inline void release(uint16_t m) {
// search and release the keypress
for (int i = 0; i < sizeof(HID_ConsumerControlReport_Data_t) / 2; i++) {
if (_report.whole16[i] == m) {
@ -103,7 +109,7 @@ public:
}
HID_SendReport(HID_REPORTID_CONSUMERCONTROL, &_report, sizeof(_report));
}
inline void releaseAll(void){
inline void releaseAll(void) {
end();
}
private:

View file

@ -15,17 +15,23 @@ version=2.2
# AVR compile variables
# ---------------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -MMD
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
@ -65,12 +71,14 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
## Create eeprom
## Create output files (.eep and .hex)
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
## Create hex
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Save hex
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
@ -81,8 +89,9 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
# AVR Uploader/Programmers tools
# ------------------------------
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd.path={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q
@ -104,5 +113,5 @@ tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verb
# USB Default Flags
# Default blank usb manufacturer will be filled it at compile time
# - from numeric vendor ID, set to Unknown otherwise
build.usb_manufacturer=
build.usb_manufacturer="Unknown"
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2014 NicoHood
Copyright (c) 2014-2015 NicoHood
See the readme for credit to other people.
Keyboard example