Commit dbeb0a86 authored by Snorre Nilssen Vestli's avatar Snorre Nilssen Vestli

Working code!

parent b1b08dbb
......@@ -26,64 +26,61 @@
:1001900068414A456A49C84D68524E577E5CFE61C7
:1001A00011241FBECFEFCDBFDFE3DEBF28E2A0E00A
:1001B000B8E201C01D92AE31B207E1F70E94E4003F
:1001C0000C94BB020C94000088ED84BF1092610077
:1001D0000E940B0284E098E20E94280280E098E2EC
:1001E0000E9428020E9464020E94410223C00E94D1
:1001F0001A020E948B010E940802C82F0E94050269
:10020000D82F8C2F0E947602BC0184E098E20E94D5
:100210003D02CD1307C060E070E080E098E20E94EC
:100220003D0208C08D2F0E947602BC0180E098E25A
:100230000E943D020E9422028111D9CF0E946D02CC
:1002400084E098E20E942E02811106C084E098E2C8
:100250000E942E02882371F384E60E944A02EACFAC
:1002600080911D2881113DC09EE0E92FF0E0E25F02
:10027000F74D8081811136C091509031B0F390E0FC
:1002800040E005C04F5F8695E9F701C040E08091EE
:100290000E2881112BC0EFE0F8E221E0819181115D
:1002A00026C02F5F2031D1F720E030E006C08695D0
:1002B0003F5F80FFFCCF01C030E0220F220F220FF2
:1002C000230F61F020930C28990F990F990F940F29
:1002D00090930D2881E080930B28089510920B28AD
:1002E00008959FE0869591F240E0CCCF20E080FD1C
:1002F000E3CF30E0DCCF807782958F70863018F4C2
:10030000843038F004C0863021F080E0089582E027
:10031000089583E00895CF93882354F4982F90771D
:10032000903709F470C080930928109208286BC098
:1003300090910928992309F466C0C82F8091082854
:1003400081110AC0809109280E947B01833009F045
:100350005AC0C093082857C0909108288091092856
:10036000282F2F7009F04FC0807719F08031C9F025
:100370004AC0E92FE695E695E695F0E0E25FF74D95
:10038000977021E030E0A90102C0440F551F9A95F3
:10039000E2F7CA0180959081892380830E94300111
:1003A00032C0CC23C9F0C0930A28E92FE695E69520
:1003B000E695F0E0E25FF74D977021E030E0A901AB
:1003C00002C0440F551F9A95E2F7CA019081892B0C
:1003D00080830E94300117C0E92FE695E695E695E7
:1003E000F0E0E25FF74D977021E030E0A90102C034
:1003F000440F551F9A95E2F7CA0180959081892391
:1004000080830E943001CF91089580910D28089536
:1004100080910C280895E0E0F8E080E09AE0808781
:1004200091878681806886838AE5828388E08093CD
:1004300010040895E0E0F8E084818823ECF78091CF
:100440000008089580910408881F8827881F089550
:10045000FC0110821182128213820895FC014281F4
:10046000538120813181240F351F2083318381E026
:100470002417350708F080E00895FC016283738338
:100480000895E0E9FAE086E1818381E0808380934A
:10049000B50108959091970A90FD15C0A82FB0E07E
:1004A00020E03DE241E351E00E94A10220E432E479
:1004B0004FE050E00E947F0220938C0A30938D0A17
:1004C00081E0809380010895E0E8FAE081E0808394
:1004D00082E692E0848795870895E0E8FAE08681D5
:1004E0008823E9F381E08093860A0895E82FF0E0FD
:1004F000EE0FFF1FE056FF4F859194910895A1E202
:100500001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F8D
:10051000FF1FA217B307E407F50720F0A21BB30BD8
:10052000E40BF50B661F771F881F991F1A9469F754
:1005300060957095809590959B01AC01BD01CF01B0
:1005400008950E94AC02A59F900DB49F900DA49FAA
:10055000800D911D11240895A29FB001B39FC00189
:10056000A39F700D811D1124911DB29F700D811DDF
:0A0570001124911D0895F894FFCFA7
:1001C0000C94A2020C94000088ED84BF1092610090
:1001D0000E94360280E28093A10484E098E20E94AB
:1001E000530280E098E20E9453020E9487020E941C
:1001F0006C0280E1809301046894EE24E7F8FF2408
:10020000F394C12C6894DD24D2F86894AA24A4F84D
:1002100000EA14E06894BB24B5F82CC00E944502A3
:100220000E94B3010E943002C82F0E942D02D82FD5
:100230008C2F0E949902BC0184E098E20E9468021F
:10024000CD1307C060E070E080E098E20E94680291
:1002500008C08D2F0E949902BC0180E098E20E94A4
:1002600068020E943302882319F0F801B68202C0A6
:10027000F801B5820E944D028111D0CF0E949002F8
:1002800084E098E20E945902811106C080E098E261
:100290000E945902882349F00E943302882329F0E2
:1002A00084E60E947502F601A782F7011082E2CF70
:1002B00080911D2881113DC09EE0E92FF0E0E25FB2
:1002C000F74D8081811136C091509031B0F390E0AC
:1002D00040E005C04F5F8695E9F701C040E080919E
:1002E0000E2881112BC0EFE0F8E221E0819181110D
:1002F00026C02F5F2031D1F720E030E006C0869580
:100300003F5F80FFFCCF01C030E0220F220F220FA1
:10031000230F61F020930C28990F990F990F940FD8
:1003200090930D2881E080930B28089510920B285C
:1003300008959FE0869591F240E0CCCF20E080FDCB
:10034000E3CF30E0DCCF807782958F70863018F471
:10035000843038F004C0863021F080E0089582E0D7
:10036000089583E00895CF93882354F4982F9077CD
:10037000903709F470C080930928109208286BC048
:1003800090910928992309F466C0C82F8091082804
:1003900081110AC0809109280E94A301833009F0CD
:1003A0005AC0C093082857C0909108288091092806
:1003B000282F2F7009F04FC0807719F08031C9F0D5
:1003C0004AC0E92FE695E695E695F0E0E25FF74D45
:1003D000977021E030E0A90102C0440F551F9A95A3
:1003E000E2F7CA0180959081892380830E94580199
:1003F00032C0CC23C9F0C0930A28E92FE695E695D0
:10040000E695F0E0E25FF74D977021E030E0A9015A
:1004100002C0440F551F9A95E2F7CA019081892BBB
:1004200080830E94580117C0E92FE695E695E6956E
:10043000F0E0E25FF74D977021E030E0A90102C0E3
:10044000440F551F9A95E2F7CA0180959081892340
:1004500080830E945801CF91089580910D280895BE
:1004600080910C28089580910B280895E0E0F8E031
:1004700080E09AE0808791878681806886838AE51C
:10048000828388E0809311040895E0E0F8E084819D
:100490008823ECF780910008089580910408881F54
:1004A0008827881F0895FC0110821182128213820E
:1004B0000895FC014281538120813181240F351F31
:1004C0002083318381E02417350708F080E0089508
:1004D000FC01628373830895E0E9FAE086E1818399
:1004E00081E080838093B50108959091970A90FDF3
:1004F0000DC0E0E9FAE01286138624E1829FC00174
:1005000011248487958781E0809380010895E0E835
:10051000FAE081E0808382E692E0848795870895FF
:10052000E0E8FAE086818823E9F381E08093860A97
:100530000895E82FF0E0EE0FFF1FE056FF4F859182
:0805400094910895F894FFCF97
:00000001FF
......@@ -2,8 +2,8 @@
#define CONFIG_H_
#include <avr/io.h>
#define F_CPU 20000000
#define US_LENGTH F_CPU/1000000UL
#define F_CPU 20000000UL
#define US_LENGTH (F_CPU/1000000UL)
#define PULSEWIDTH 100
......@@ -15,5 +15,5 @@
#define MIDI_USART USART0
#define MIDI_USART_PORT PORTA
#define MIDI_USART_PINCTRL PORTA.PIN0CTRL
#define MIDI_USART_PINCTRL PORTA.PIN1CTRL
#endif /* CONFIG_H_ */
\ No newline at end of file
......@@ -22,6 +22,7 @@ int main(void)
UART_init();
//PORTB.PIN3CTRL |= PORT_PULLUPEN_bm; //TODO: UPDATE
PORTF.DIRSET = 1 << 5;
osc_init(&dco0);
osc_init(&dco1);
......@@ -31,6 +32,9 @@ int main(void)
timer_init();
pulse_init();
//TEST:
PORTA.DIRSET = 1 << 4;
while (1)
{
......@@ -47,13 +51,26 @@ int main(void)
osc_set_speed(&dco1,0);
} else {
osc_set_speed(&dco1,tone_get_frequency(high_note));
}
}
if (midi_gate()){
PORTF.OUTCLR = 1 << 5; // led blink
} else {
PORTF.OUTSET = 1 << 5;
}
}
timer_sync();
if (osc_update(&dco0) || osc_update(&dco0)){
if ((osc_update(&dco0) || osc_update(&dco1)) && midi_gate()){
pulse_trig(PULSEWIDTH);
PORTA.OUTTGL = 1 << 4; // debug toggle
}
//PORTA.OUTTGL = 1 << 4;
EVSYS.STROBE = 0;
}
}
......@@ -13,7 +13,8 @@ void pulse_init()
void pulse_trig(uint8_t length_us)
{
if (!(PULSE_TIMER.STATUS & TCB_RUN_bm)) {//if not already running:
TIMEBASE_TIMER.CCMP = length_us * US_LENGTH;
PULSE_TIMER.CNT = 0;
PULSE_TIMER.CCMP = length_us * US_LENGTH;
EVSYS.STROBE = PULSE_EVENT_bm;
}
......
......@@ -20,14 +20,30 @@
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress />
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue />
<OverrideVtorValue>exception_table</OverrideVtorValue>
<BootSegment>2</BootSegment>
<ResetRule>0</ResetRule>
<eraseonlaunchrule>0</eraseonlaunchrule>
<EraseKey />
<avrtool>com.atmel.avrdbg.tool.nedbg</avrtool>
<avrtoolserialnumber>ATML3094051800000369</avrtoolserialnumber>
<avrdeviceexpectedsignature>0x1E9651</avrdeviceexpectedsignature>
<avrtoolinterface>UPDI</avrtoolinterface>
<com_atmel_avrdbg_tool_nedbg>
<ToolOptions>
<InterfaceProperties>
<UpdiClock>750000</UpdiClock>
</InterfaceProperties>
<InterfaceName>UPDI</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.nedbg</ToolType>
<ToolNumber>ATML3094051800000369</ToolNumber>
<ToolName>nEDBG</ToolName>
</com_atmel_avrdbg_tool_nedbg>
<avrtoolinterfaceclock>750000</avrtoolinterfaceclock>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment