Subversion Repositories idreammicro-avr

Compare Revisions

Regard whitespace Rev 2 → Rev 3

/trunk/helloworld.c
File deleted
/trunk/SConscript
File deleted
/trunk/SConstruct
1,32 → 1,2
# Set environment for AVR-GCC.
SConscript('#build_system/env_avr.py')
 
# Import environment set for AVR-GCC.
Import('env_avr')
 
# Append CPPPATH with the root path of libraries.
env_avr.Append(CPPPATH = [ '#libraries/' ])
 
# Define environments to use (one environment per target).
environments = [
'env_arduino_uno',
'env_arduino_mega2560'
]
 
# Browse environments.
for environment in environments:
# Set environment for target.
SConscript(
'#build_system/' + environment + '.py',
exports = 'env_avr'
)
# Import environment set for target.
Import('env_target')
# Build program.
SConscript(
'SConscript',
variant_dir = '#build/' + environment,
exports = { 'env_target' : env_target, 'env_name' : environment },
duplicate = 0
)
 
# Execute projects SConscript.
SConscript('projects/SConscript')
/trunk/projects/input_to_output/input_to_output.c
0,0 → 1,48
/**************************************************************************//**
* \file input_to_output.c
******************************************************************************/
 
/******************************************************************************
* Header file inclusions.
******************************************************************************/
 
#include <digital_io/digital_io.h>
 
#include <avr/io.h>
#include <util/delay.h>
 
/******************************************************************************
* Public function definitions.
******************************************************************************/
 
/**************************************************************************//**
* \fn int main(void)
*
* \brief Main function.
******************************************************************************/
int
main
(
void
){
// Configure PB4 as input.
digital_io__pin_position_t input = DIGITAL_IO__PORT_B | DIGITAL_IO__PIN_4;
digital_io__configure_pin(input, DIGITAL_IO__DIRECTION__INPUT);
// Configure PB5 as output.
digital_io__pin_position_t output = DIGITAL_IO__PORT_B | DIGITAL_IO__PIN_5;
digital_io__configure_pin(output, DIGITAL_IO__DIRECTION__OUTPUT);
 
while (1)
{
// Get input level on PB4.
digital_io__level_t level = digital_io__get_pin_level(input);
 
// Set output level on PB5.
digital_io__set_pin_level(output, level);
 
_delay_ms(250);
}
 
return 0;
}
/trunk/projects/input_to_output/SConscript
0,0 → 1,39
# Import environment set for target.
Import('env_target', 'env_name', 'DEVICE')
 
# Set target name.
TARGET = 'input_to_output'
 
# Set libraries to use.
libraries = [
'digital_io'
]
 
# Build libraries.
for library in libraries:
SConscript(
'#libraries/' + library + '/SConscript',
exports = { 'env_target' : env_target, 'env_name' : env_name },
duplicate = 0
)
 
# Set source file.
sources = 'input_to_output.c'
 
# Build program.
env_target.Program(target = TARGET + '.elf', source = sources)
 
# Create hex binary file.
env_target.Command(
TARGET + '.hex',
TARGET + '.elf',
env_target['OBJCOPY'] + ' -O ihex $SOURCE $TARGET'
)
 
# Compute memory usage.
env_target.Command(
None,
TARGET + '.elf',
env_target['SIZE'] + ' -C --mcu=' + DEVICE + ' $SOURCE'
)
 
/trunk/projects/input_to_output/SConstruct
0,0 → 1,32
# Set environment for AVR-GCC.
SConscript('#build_system/env_avr.py')
 
# Import environment set for AVR-GCC.
Import('env_avr')
 
# Append CPPPATH with the root path of libraries.
env_avr.Append(CPPPATH = [ '#libraries/' ])
 
# Define environments to use (one environment per target).
environments = [
'env_arduino_uno',
'env_arduino_mega2560'
]
 
# Browse environments.
for environment in environments:
# Set environment for target.
SConscript(
'#build_system/' + environment + '.py',
exports = 'env_avr'
)
# Import environment set for target.
Import('env_target')
# Build program.
SConscript(
'SConscript',
variant_dir = '#build/' + 'projects/input_to_output/' + environment,
exports = { 'env_target' : env_target, 'env_name' : environment },
duplicate = 0
)
 
/trunk/projects/SConscript
0,0 → 1,9
# Define projects to build.
projects = [
'helloworld/',
'input_to_output/'
]
 
# Build each project.
for project in projects:
SConscript(project + 'SConstruct')
/trunk/projects/helloworld/SConscript
0,0 → 1,39
# Import environment set for target.
Import('env_target', 'env_name', 'DEVICE')
 
# Set target name.
TARGET = 'helloworld'
 
# Set libraries to use.
libraries = [
'digital_io'
]
 
# Build libraries.
for library in libraries:
SConscript(
'#libraries/' + library + '/SConscript',
exports = { 'env_target' : env_target, 'env_name' : env_name },
duplicate = 0
)
 
# Set source file.
sources = 'helloworld.c'
 
# Build program.
env_target.Program(target = TARGET + '.elf', source = sources)
 
# Create hex binary file.
env_target.Command(
TARGET + '.hex',
TARGET + '.elf',
env_target['OBJCOPY'] + ' -O ihex $SOURCE $TARGET'
)
 
# Compute memory usage.
env_target.Command(
None,
TARGET + '.elf',
env_target['SIZE'] + ' -C --mcu=' + DEVICE + ' $SOURCE'
)
 
/trunk/projects/helloworld/SConstruct
0,0 → 1,31
# Set environment for AVR-GCC.
SConscript('#build_system/env_avr.py')
 
# Import environment set for AVR-GCC.
Import('env_avr')
 
# Append CPPPATH with the root path of libraries.
env_avr.Append(CPPPATH = [ '#libraries/' ])
 
# Define environments to use (one environment per target).
environments = [
'env_arduino_uno',
'env_arduino_mega2560'
]
 
# Browse environments.
for environment in environments:
# Set environment for target.
SConscript(
'#build_system/' + environment + '.py',
exports = 'env_avr'
)
# Import environment set for target.
Import('env_target')
# Build program.
SConscript(
'SConscript',
variant_dir = '#build/' + 'projects/helloworld/' + environment,
exports = { 'env_target' : env_target, 'env_name' : environment },
duplicate = 0
)
/trunk/projects/helloworld/helloworld.c
0,0 → 1,46
/**************************************************************************//**
* \file helloworld.c
******************************************************************************/
 
/******************************************************************************
* Header file inclusions.
******************************************************************************/
 
#include <digital_io/digital_io.h>
 
#include <avr/io.h>
#include <util/delay.h>
 
/******************************************************************************
* Public function definitions.
******************************************************************************/
 
/**************************************************************************//**
* \fn int main(void)
*
* \brief Main function.
******************************************************************************/
int
main
(
void
){
// Declare pin.
digital_io__pin_position_t pin = DIGITAL_IO__PORT_B | DIGITAL_IO__PIN_5;
// Configure pin as output.
digital_io__configure_pin(pin, DIGITAL_IO__DIRECTION__OUTPUT);
 
while (1)
{
// Set pin level.
digital_io__set_pin_level(pin, DIGITAL_IO__LEVEL__HIGH);
_delay_ms(1000);
 
// Reset pin level.
digital_io__set_pin_level(pin, DIGITAL_IO__LEVEL__LOW);
_delay_ms(1000);
}
 
return 0;
}
/trunk/libraries/digital_io/SConscript
10,7 → 10,7
for directory in directories:
SConscript(
directory + 'SConscript',
variant_dir = '#build/' + env_name + '/libraries/digital_io/' + directory,
variant_dir = '#build/' + '/libraries/digital_io/' + env_name,
exports = { 'env_target' : env_target, 'env_name' : env_name },
duplicate = 0
)
/trunk/libraries/digital_io/src/SConscript
13,6 → 13,5
env_target.StaticLibrary(target = TARGET, source = sources)
 
# Append LIBPATH and LIBS.
env_target.Append(LIBPATH = [ '#build/' + env_name + '/libraries/' + TARGET + '/src'])
env_target.Append(LIBPATH = [ '#build/' + '/libraries/' + TARGET + '/' + env_name])
env_target.Append(LIBS = [ TARGET ])