Skip to content

Commit 7195028

Browse files
authored
Merge pull request #6 from AaronPerl/master
Various fixes, unique serial numbers
2 parents 4d54d8c + 84f0be4 commit 7195028

19 files changed

+1648
-367
lines changed

.cproject

Lines changed: 37 additions & 14 deletions
Large diffs are not rendered by default.

.project

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@
4848
<type>1</type>
4949
<locationURI>STUDIO_SDK_LOC/Lib/efm8_usb/src/efm8_usbd.c</locationURI>
5050
</link>
51-
<link>
52-
<name>lib/efm8_usb/src/efm8_usbdch9.c</name>
53-
<type>1</type>
54-
<locationURI>STUDIO_SDK_LOC/Lib/efm8_usb/src/efm8_usbdch9.c</locationURI>
55-
</link>
5651
<link>
5752
<name>lib/efm8_usb/src/efm8_usbdep.c</name>
5853
<type>1</type>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
copiedFilesOriginState={}
1+
copiedFilesOriginState={"C\:\\\\SiliconLabs\\\\SimplicityStudio\\\\v4\\\\developer\\\\sdks\\\\8051\\\\v4.1.1\\\\Lib\\\\efm8_usb\\\\src\\\\efm8_usbdch9.c"\:"-715631228"}
22
eclipse.preferences.version=1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
fileModificationValidator.projectStoredChoice=true
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
3+
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
4+
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
5+
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
6+
org.eclipse.cdt.codan.checkers.nocommentinside=-Error
7+
org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
8+
org.eclipse.cdt.codan.checkers.nolinecomment=-Error
9+
org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
10+
org.eclipse.cdt.codan.checkers.noreturn=Error
11+
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
12+
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
13+
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
14+
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
15+
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
16+
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
17+
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
18+
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
19+
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
20+
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
21+
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
22+
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
23+
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
24+
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
25+
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
26+
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
27+
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
28+
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
29+
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
30+
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
31+
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
32+
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
33+
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
34+
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
35+
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
36+
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
37+
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
38+
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
39+
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
40+
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
41+
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
42+
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
43+
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
44+
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
45+
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
46+
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
47+
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
48+
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
49+
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
50+
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
51+
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
52+
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
53+
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
54+
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
55+
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
56+
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
57+
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
58+
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
59+
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
60+
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
61+
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
62+
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
63+
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
64+
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
65+
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
66+
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
67+
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
68+
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
69+
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
70+
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}

AstroKey.hwconf

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="ASCII"?>
2-
<device:XMLDevice xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:device="http://www.silabs.com/ss/hwconfig/document/device.ecore" name="EFM8UB10F8G-C-QFN20" partId="mcu.8051.efm8.ub1.efm8ub10f8g-c-qfn20" version="4.0.1" contextId="%DEFAULT%">
2+
<device:XMLDevice xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:device="http://www.silabs.com/ss/hwconfig/document/device.ecore" name="EFM8UB10F16G-C-QFN20" partId="mcu.8051.efm8.ub1.efm8ub10f16g-c-qfn20" version="4.0.1" contextId="%DEFAULT%">
33
<mode name="DefaultMode">
44
<property object="ADC_0" propertyId="adc.configuration.sarclockdivider" value="6"/>
55
<property object="CIP51_0" propertyId="ABPeripheral.included" value="true"/>
@@ -11,6 +11,7 @@
1111
<property object="DefaultMode" propertyId="mode.diagramLocation" value="100, 100"/>
1212
<property object="INTERRUPT_0" propertyId="ABPeripheral.included" value="true"/>
1313
<property object="INTERRUPT_0" propertyId="interrupt.interruptenable.enableallinterrupts" value="Enabled"/>
14+
<property object="INTERRUPT_0" propertyId="interrupt.interruptenable.enabletimer2interrupt" value="Enabled"/>
1415
<property object="INTERRUPT_0" propertyId="interruptenables.codegenerationoptions.generateinterruptfunctions" value="Disabled"/>
1516
<property object="P0.0" propertyId="ports.settings.label" value="S0"/>
1617
<property object="P0.0" propertyId="ports.settings.skip" value="Skipped"/>
@@ -28,6 +29,20 @@
2829
<property object="SPI_0" propertyId="spi.clockrate.sysclk" value="24.500 MHz"/>
2930
<property object="SPI_0" propertyId="spi.clockrate.sysclkdividercoefficientspi0ckr" value="7"/>
3031
<property object="SPI_0" propertyId="spi.control.slaveselectmode" value="Slave or master 3-wire mode"/>
32+
<property object="TIMER01_0" propertyId="ABPeripheral.included" value="true"/>
33+
<property object="TIMER16_2" propertyId="ABPeripheral.included" value="true"/>
34+
<property object="TIMER16_2" propertyId="timer16.control.runcontrol" value="Start"/>
35+
<property object="TIMER16_2" propertyId="timer16.control.timerrunningstate" value="Timer is Running"/>
36+
<property object="TIMER16_2" propertyId="timer16.highbyte.highbyte" value="240"/>
37+
<property object="TIMER16_2" propertyId="timer16.initandreloadvalue.targetoverflowfrequency" value="1000"/>
38+
<property object="TIMER16_2" propertyId="timer16.initandreloadvalue.timerinitvalue" value="61536"/>
39+
<property object="TIMER16_2" propertyId="timer16.initandreloadvalue.timerreloadvalue" value="61536"/>
40+
<property object="TIMER16_2" propertyId="timer16.lowbyte.lowbyte" value="96"/>
41+
<property object="TIMER16_2" propertyId="timer16.reloadhighbyte.reloadhighbyte" value="240"/>
42+
<property object="TIMER16_2" propertyId="timer16.reloadlowbyte.reloadlowbyte" value="96"/>
43+
<property object="TIMER16_3" propertyId="ABPeripheral.included" value="true"/>
44+
<property object="TIMER16_4" propertyId="ABPeripheral.included" value="true"/>
45+
<property object="TIMER_SETUP_0" propertyId="ABPeripheral.included" value="true"/>
3146
<property object="USBLIB_0" propertyId="ABPeripheral.included" value="true"/>
3247
<property object="USBLIB_0" propertyId="configuration.configurationparameters.configurationstring" value=""/>
3348
<property object="USBLIB_0" propertyId="configuration.configurationparameters.devicepower" value="Bus-Powered"/>

inc/InitDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern void PORTS_0_enter_DefaultMode_from_RESET(void);
2222
extern void PBCFG_0_enter_DefaultMode_from_RESET(void);
2323
extern void CIP51_0_enter_DefaultMode_from_RESET(void);
2424
extern void CLOCK_0_enter_DefaultMode_from_RESET(void);
25+
extern void TIMER16_2_enter_DefaultMode_from_RESET(void);
2526
extern void INTERRUPT_0_enter_DefaultMode_from_RESET(void);
2627
extern void USBLIB_0_enter_DefaultMode_from_RESET(void);
2728
// [Config(Per-Module Mode)Transition Prototypes]$

inc/astrokey.h

Lines changed: 98 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,59 @@
1-
/*
2-
* astrokey.h
3-
*
4-
* Created on: Nov 3, 2017
5-
* Author: Aaron
6-
*/
1+
//-----------------------------------------------------------------------------
2+
// astrokey.h
3+
//-----------------------------------------------------------------------------
4+
// Copyright 2018 AstroKey
5+
// https://github.com/AstroKey/astrokey_firmware/blob/master/LICENSE
6+
//
7+
// File Description:
8+
//
9+
// AstroKey-specific definitions and function declarations.
10+
//
711

812
#ifndef INC_ASTROKEY_H_
913
#define INC_ASTROKEY_H_
1014

1115
#include <SI_EFM8UB1_Defs.h>
1216
#include <stdint.h>
17+
#include <efm8_usb.h>
1318

14-
// Astrokey USB protocol
19+
//////////////////////////
20+
// Device Serial Number //
21+
//////////////////////////
22+
23+
// Converts a nibble to a hex character
24+
#define NIBBLE_TO_ASCII(x) ((x) >= 10? (x) - 10 + 'A' : (x) + '0')
25+
26+
// Struct for non-const string descriptors
27+
#define UTF16LE_PACKED_STRING_DESC(__name, __size) \
28+
SI_SEGMENT_VARIABLE(__name, USB_StringDescriptor_TypeDef, SI_SEG_XDATA) = \
29+
{ USB_STRING_DESCRIPTOR_UTF16LE_PACKED, __size * 2, USB_STRING_DESCRIPTOR }
30+
31+
// Serial number string descriptor
32+
extern SI_SEGMENT_VARIABLE(serDesc[], USB_StringDescriptor_TypeDef, SI_SEG_XDATA);
33+
34+
// MCU UUID Flash Address
35+
#define UUID_ADDR 0xFFC0
36+
37+
// MCU UUID Length in Bytes
38+
#define UUID_LEN 16
39+
40+
// Length of serial number string (2 characters per byte)
41+
#define SER_STR_LEN (UUID_LEN * 2)
42+
43+
// MCU UUID
44+
SI_VARIABLE_SEGMENT_POINTER(UUID, static const uint8_t, SI_SEG_CODE) = UUID_ADDR;
45+
46+
///////////////////////////
47+
// Astrokey USB protocol //
48+
///////////////////////////
1549

1650
// wIndex values
17-
#define ASTROKEY_SET_MACRO 0x01
18-
#define ASTROKEY_GET_MACRO 0x02
51+
#define ASTROKEY_SET_WORKFLOW 0x01
52+
#define ASTROKEY_GET_WORKFLOW 0x02
53+
54+
///////////////////////
55+
// Device Parameters //
56+
///////////////////////
1957

2058
// Switch configuration
2159
#define NUM_SWITCHES 5
@@ -28,41 +66,74 @@
2866
// Switch pressed
2967
#define PRESSED(x) (!x)
3068

31-
// No macro running
32-
#define NO_MACRO 0xFF
69+
////////////////////////
70+
// Workflow Constants //
71+
////////////////////////
72+
73+
// No workflow running
74+
#define NO_WORKFLOW 0xFF
75+
76+
// Workflow action types
77+
#define WORKFLOW_ACTION_DOWN 1
78+
#define WORKFLOW_ACTION_UP 2
79+
#define WORKFLOW_ACTION_PRESS 3
80+
#define WORKFLOW_ACTION_DELAY 16
81+
#define WORKFLOW_ACTION_PAUSE 128 // Pauses a macro until key release
82+
#define WORKFLOW_ACTION_UNPROGRAMMED 255 // Unprogrammed flash memory
83+
84+
#define USAGE_LEFTCTRL 224
85+
#define USAGE_LEFTSHIFT 225
86+
#define USAGE_LEFTALT 226
87+
#define USAGE_LEFTGUI 227
3388

34-
// Macro action types
35-
#define MACRO_ACTION_DOWN 1
36-
#define MACRO_ACTION_UP 2
89+
#define MODIFIER_LEFTCTRL 0x01
90+
#define MODIFIER_LEFTSHIFT 0x02
91+
#define MODIFIER_LEFTALT 0x04
92+
#define MODIFIER_LEFTGUI 0x08
3793

38-
// Macro action struct
94+
// Workflow action struct
3995
typedef struct {
4096
uint8_t actionType;
4197
uint8_t value;
42-
} Macro_TypeDef;
98+
} Action_TypeDef;
4399

44100
// User data flash
45101
#define USER_PAGE_SIZE 64
46102
#define USER_START_ADDR 0xF800
47103

48104
// Number of pages per macro
49-
#define MACRO_PAGES 2
105+
#define WORKFLOW_PAGES 2
50106
// Number of bytes per macro
51-
#define MACRO_BYTES (MACRO_PAGES * USER_PAGE_SIZE)
107+
#define WORKFLOW_BYTES (WORKFLOW_PAGES * USER_PAGE_SIZE)
52108
// Maximum number of actions in a macro
53-
#define MACRO_MAX_SIZE ((MACRO_BYTES) / sizeof(Macro_TypeDef))
109+
#define WORKFLOW_MAX_SIZE ((WORKFLOW_BYTES) / sizeof(Action_TypeDef))
54110
// Max number of keys simultaenously held by macro
55-
#define MACRO_MAX_KEYS 6
111+
#define WORKFLOW_MAX_KEYS 6
112+
113+
#define WORKFLOW_FLASH_ADDR USER_START_ADDR
114+
115+
////////////////////////
116+
// Workflow Functions //
117+
////////////////////////
118+
119+
void saveWorkflow(Action_TypeDef* workflowData, uint8_t saveIndex);
120+
void loadWorkflow(Action_TypeDef* workflowData, uint8_t loadIndex);
121+
122+
////////////////////////
123+
// Workflow Variables //
124+
////////////////////////
56125

57-
#define MACRO_FLASH_ADDR USER_START_ADDR
126+
extern Action_TypeDef SI_SEG_XDATA workflow[WORKFLOW_MAX_SIZE];
127+
extern uint8_t workflowNumActions;
58128

59-
void saveMacro(Macro_TypeDef* macroData, uint8_t saveIndex);
60-
void loadMacro(Macro_TypeDef* macroData, uint8_t loadIndex);
129+
extern Action_TypeDef SI_SEG_XDATA tmpWorkflow[WORKFLOW_MAX_SIZE];
130+
extern volatile int8_t workflowUpdated;
61131

62-
extern Macro_TypeDef SI_SEG_XDATA macro[MACRO_MAX_SIZE];
63-
extern uint8_t macroNumActions;
132+
////////////////////////
133+
// Astrokey Functions //
134+
////////////////////////
64135

65-
extern Macro_TypeDef SI_SEG_XDATA tmpMacro[MACRO_MAX_SIZE];
66-
extern volatile int8_t macroUpdated;
136+
void astrokeyInit();
137+
void astrokeyPoll();
67138

68139
#endif /* INC_ASTROKEY_H_ */

inc/config/usbconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
// settings
4646
// -----------------------------------------------------------------------------
4747
// $[Number of Interfaces]
48-
#define SLAB_USB_NUM_INTERFACES 2
48+
#define SLAB_USB_NUM_INTERFACES 1
4949
#define SLAB_USB_SUPPORT_ALT_INTERFACES 0
5050
// [Number of Interfaces]$
5151

0 commit comments

Comments
 (0)