This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:<<BATCH | |
@echo off | |
@cd ..\src | |
@copy /b version.c +,, >NUL | |
exit /b | |
BATCH | |
touch src/version.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build.c | |
// | |
// Build timestamp and time derived build number strings | |
#define MONTH_CH0 (\ | |
__DATE__ [2] == 't' ? '1' \ | |
: __DATE__ [2] == 'v' ? '1' \ | |
: __DATE__ [2] == 'c' ? '1' \ | |
: '0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DST dates | |
// EU, from year 2000, start day in March, end day in October, at 01:00. | |
uint8_t eu_dst_dates[] = { | |
26, 29, // 2000 | |
25, 28, | |
31, 27, | |
30, 26, | |
28, 31, | |
27, 30, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MONTH0 ( __DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? '0' : '0') \ | |
: __DATE__ [2] == 'b' ? 2 \ | |
: __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? '0' : '0') \ | |
: __DATE__ [2] == 'y' ? '0' \ | |
: __DATE__ [2] == 'l' ? '0' \ | |
: __DATE__ [2] == 'g' ? '0' \ | |
: __DATE__ [2] == 'p' ? '0' \ | |
: __DATE__ [2] == 't' ? '1' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HID descriptor locations: | |
src\ASF\common\services\usb\class\hid\device\generic\udi_hid_generic.c - contains 'udi_hid_generic_report_desc' | |
src\ASF\common\services\usb\class\hid\device\generic\udi_hid_generic.h - contains 'udi_hid_generic_report_desc_t' | |
To handle feature requests, add this to conf_usb.h: | |
#define UDI_HID_GENERIC_GET_FEATURE(payload, size) HID_get_feature_report_out(payload, size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To add MS USB extended descriptors to an ASF project: | |
0. Optionally disable disabling peripheral clocks in common/services/clock/xmega/sysclk.c -> sysclk_init() | |
1. Configure clocks and oscillators in config/conf_board.h: | |
// required for the ASF clock module | |
#define BOARD_XOSC_HZ F_CPU | |
#define BOARD_XOSC_STARTUP_US 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************************************** | |
* XMEGA NVM compatible CRC32 | |
*/ | |
#define XMEGA_CRC32_POLY 0x0080001B // Polynomial for use with Xmega devices | |
uint32_t xmega_nvm_crc32(uint8_t *buffer, uint32_t buffer_length) | |
{ | |
uint32_t address; | |
uint32_t data_reg, help_a, help_b; | |
uint32_t crc_reg = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// crc.cpp | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include "crc.h" | |
/************************************************************************************************** | |
* Reverse bits in a uint32 | |
*/ |