diff options
Diffstat (limited to 'floppyMusic')
-rw-r--r-- | floppyMusic/floppy.c | 14 | ||||
-rw-r--r-- | floppyMusic/floppy.h | 2 | ||||
-rw-r--r-- | floppyMusic/floppyMusic.componentinfo.xml | 2 | ||||
-rw-r--r-- | floppyMusic/floppyMusic.cproj | 139 | ||||
-rw-r--r-- | floppyMusic/main.c | 18 |
5 files changed, 95 insertions, 80 deletions
diff --git a/floppyMusic/floppy.c b/floppyMusic/floppy.c index e4eff05..440508b 100644 --- a/floppyMusic/floppy.c +++ b/floppyMusic/floppy.c @@ -17,7 +17,7 @@ ISR(TIMER0_OVF_vect) for(uint8_t i = 0; i < 8; i++) { - if(floppy_nextrun[i] == (timer_overflow_counter + 1)) + if(floppy_nextrun[i] == timer_overflow_counter ) { floppy_nextrun[i] += floppy_frequencies[i]; floppy_pulse(i); @@ -34,7 +34,7 @@ void floppy_setup(char *_pulse_port, char *_pulse_ddr, char *_direction_port, ch fDDR = _pulse_ddr; dPORT = _direction_port; dDDR = _direction_ddr; - + *fDDR = 0xff; *fPORT = 0xff; *dDDR = 0xff; @@ -58,17 +58,20 @@ void floppy_setup(char *_pulse_port, char *_pulse_ddr, char *_direction_port, ch *fPORT ^= 0xff; } + *dPORT = 0x00; *fPORT = 0xff; //Setup Timer TCCR0 |= (1 << CS01); // Prescaler 8 To leave enough time for ISR to complete TIMSK |= (1 << TOIE0); //Activate Interrupt + sei(); } void floppy_set_frequency(uint8_t _floppy_id, uint8_t _freq) { - floppy_frequencies[_floppy_id] = floppy_nextrun[_floppy_id] = _freq; + floppy_frequencies[_floppy_id] = _freq; + floppy_nextrun[_floppy_id] = _freq + timer_overflow_counter; } void floppy_pulse(uint8_t _floppy_id) @@ -82,4 +85,9 @@ void floppy_setup(char *_pulse_port, char *_pulse_ddr, char *_direction_port, ch *dPORT ^= (1<<_floppy_id); floppy_head_return_counter[_floppy_id] = 0; } + } + + int floppy_calc_freq(uint32_t _f_hz) + { + }
\ No newline at end of file diff --git a/floppyMusic/floppy.h b/floppyMusic/floppy.h index 76ad123..f8b1c26 100644 --- a/floppyMusic/floppy.h +++ b/floppyMusic/floppy.h @@ -30,5 +30,7 @@ void floppy_set_frequency(uint8_t _floppy_id, uint8_t _freq); void floppy_pulse(uint8_t _floppy_id); +int floppy_calc_freq(uint32_t _f_hz); + #endif /* FLOPPY_H_ */
\ No newline at end of file diff --git a/floppyMusic/floppyMusic.componentinfo.xml b/floppyMusic/floppyMusic.componentinfo.xml index 7c3c717..ebbfd74 100644 --- a/floppyMusic/floppyMusic.componentinfo.xml +++ b/floppyMusic/floppyMusic.componentinfo.xml @@ -41,7 +41,7 @@ <Attribute>template</Attribute> <Category>source</Category> <Condition>C Exe</Condition> - <FileContentHash>6uB4FLeVljduSJojLjAg+A==</FileContentHash> + <FileContentHash>GD1k8YYhulqRs6FD1B2Hog==</FileContentHash> <FileVersion></FileVersion> <Name>templates/main.c</Name> <SelectString>Main file (.c)</SelectString> diff --git a/floppyMusic/floppyMusic.cproj b/floppyMusic/floppyMusic.cproj index 9910c79..9c197cc 100644 --- a/floppyMusic/floppyMusic.cproj +++ b/floppyMusic/floppyMusic.cproj @@ -45,8 +45,7 @@ <ToolOptions> <InterfaceProperties> </InterfaceProperties> - <InterfaceName> - </InterfaceName> + <InterfaceName>ISP</InterfaceName> </ToolOptions> <ToolType>custom</ToolType> <ToolNumber> @@ -83,79 +82,79 @@ <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>NDEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.directories.IncludePaths> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> - </ListValues> - </avrgcc.compiler.directories.IncludePaths> - <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - <avrgcc.assembler.general.IncludePaths> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> - </ListValues> - </avrgcc.assembler.general.IncludePaths> - </AvrGcc> + <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>NDEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.general.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.assembler.general.IncludePaths> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <ToolchainSettings> <AvrGcc> - <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> - <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> - <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> - <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> - <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> - <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> - <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> - <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> - <avrgcc.compiler.symbols.DefSymbols> - <ListValues> - <Value>DEBUG</Value> - </ListValues> - </avrgcc.compiler.symbols.DefSymbols> - <avrgcc.compiler.directories.IncludePaths> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> - </ListValues> - </avrgcc.compiler.directories.IncludePaths> - <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> - <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> - <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> - <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> - <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> - <avrgcc.linker.libraries.Libraries> - <ListValues> - <Value>libm</Value> - </ListValues> - </avrgcc.linker.libraries.Libraries> - <avrgcc.assembler.general.IncludePaths> - <ListValues> - <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> - </ListValues> - </avrgcc.assembler.general.IncludePaths> - <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> - </AvrGcc> + <avrgcc.common.Device>-mmcu=atmega8 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega8"</avrgcc.common.Device> + <avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex> + <avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss> + <avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep> + <avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec> + <avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures> + <avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned> + <avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned> + <avrgcc.compiler.symbols.DefSymbols> + <ListValues> + <Value>DEBUG</Value> + </ListValues> + </avrgcc.compiler.symbols.DefSymbols> + <avrgcc.compiler.directories.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.compiler.directories.IncludePaths> + <avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level> + <avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers> + <avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum> + <avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel> + <avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings> + <avrgcc.linker.libraries.Libraries> + <ListValues> + <Value>libm</Value> + </ListValues> + </avrgcc.linker.libraries.Libraries> + <avrgcc.assembler.general.IncludePaths> + <ListValues> + <Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include</Value> + </ListValues> + </avrgcc.assembler.general.IncludePaths> + <avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel> +</AvrGcc> </ToolchainSettings> </PropertyGroup> <ItemGroup> diff --git a/floppyMusic/main.c b/floppyMusic/main.c index c0db582..09ca8d0 100644 --- a/floppyMusic/main.c +++ b/floppyMusic/main.c @@ -12,19 +12,25 @@ #include <avr/io.h> #include "floppy.h" -#include "uart.h" +//#include "uart.h" int main(void) { - uart_init(9600); + //uart_init(9600); + //DDRC = 0xff; + floppy_setup(&PORTC, &DDRC, &PORTB, &DDRB); + floppy_set_frequency(0, 70); - floppy_setup(&PORTC, &DDRC, &PORTD, &DDRD); - floppy_set_frequency(0, 4); + DDRD = 0xff; - uart_send_string("Floppy Music\n"); + PORTD = 0xff; //DEBUG + //uart_send_string("Floppy Music\n"); while (1) { - floppy_set_frequency(0, uart_recieve()); + //floppy_set_frequency(0, uart_recieve()); + //uart_send_string("Floppy Music\n"); + //_delay_ms(500); + //PORTD ^= 0xff; } }
\ No newline at end of file |