Subversion Repositories idreammicro-avr

Compare Revisions

Ignore whitespace Rev 58 → Rev 59

/trunk/libraries/adc/demo/SConscript
0,0 → 1,16
# Import environment set for target.
Import('env_target')
 
# Set target name.
TARGET = 'adc__demo'
 
# Set source file.
sources = [
'adc__demo.c'
]
 
# Build project and libraries.
env_target.BuildProject(sources, TARGET)
 
# Compute memory usage.
env_target.ComputeMemoryUsage(TARGET)
/trunk/libraries/adc/demo/adc__demo.c
0,0 → 1,60
/**************************************************************************//**
* \brief ADC library - Demonstration program
* \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com
* \version 1.0
* \date 20121104
*
* This file is part of the iDreamMicro library.
*
* This library is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see http://www.gnu.org/licenses/
******************************************************************************/
 
/**************************************************************************//**
* \file adc__demo.c
******************************************************************************/
 
/******************************************************************************
* Header file inclusions.
******************************************************************************/
 
#include "../adc.h"
 
#include <util/delay.h>
 
/******************************************************************************
* Main function.
******************************************************************************/
 
/**************************************************************************//**
* \fn int main(void)
*
* \brief Main function.
******************************************************************************/
int
main
(
void
){
// Initialize ADC.
adc__single_channel_initialize(ADC__CHANNEL_0);
 
for (;;)
{
// Read ADC value.
uint16_t value = adc__single_channel_read();
_delay_ms(100);
}
 
return 0;
}
/trunk/libraries/adc/src/adc.c
70,7 → 70,7
}
 
/**************************************************************************//**
* \fn uint16_t adc__read(void)
* \fn uint16_t adc__single_channel_read(void)
*
* \brief Read ADC.
*
/trunk/libraries/adc/min_env/env_target.py
0,0 → 1,27
# Create and initialize the environment.
env_target = Environment()
 
# Set environment for AVR-GCC.
env_target['CC'] = 'avr-gcc'
env_target['CPPPATH'] = '/usr/lib/avr/include'
env_target['OBJCOPY'] = 'avr-objcopy'
env_target['SIZE'] = 'avr-size'
env_target['AR'] = 'avr-ar'
env_target['RANLIB'] = 'avr-ranlib'
env_target.Append(CCFLAGS = '-Os')
 
# Define environment name.
env_target.Append(NAME = 'env_target')
 
# Microcontroller type.
env_target.Append(MCU = 'atmega328p')
# Microcontroller frequency in Hertz.
env_target.Append(F_CPU = '16000000UL')
 
# Set environment for an Atmel AVR ATmega328p microcontroller.
env_target.Append(CCFLAGS = '-mmcu=' + env_target['MCU'])
env_target.Append(LINKFLAGS = '-mmcu=' + env_target['MCU'])
env_target.Append(CPPDEFINES = 'F_CPU=' + env_target['F_CPU'])
 
# Export environment set for target.
Export('env_target')
/trunk/libraries/adc/min_env/build_tools.py
0,0 → 1,41
"""
Build project.
"""
def BuildProject(env, sources, target_name):
# Build program.
env.Program(target = target_name + '.elf', source = sources)
# Create hex binary file.
env.Command(
target_name + '.hex',
target_name + '.elf',
env['OBJCOPY'] + ' -O ihex $SOURCE $TARGET'
)
AddMethod(Environment, BuildProject)
 
"""
Build library.
"""
def BuildLibrary(env, sources, target_name):
# Build static library.
env.StaticLibrary(target = target_name, source = sources)
# Append LIBPATH and LIBS.
env.Append(LIBPATH = [ '#build/libraries/' + target_name + '/' + env['NAME'] ])
env.Append(LIBS = [ target_name ])
 
AddMethod(Environment, BuildLibrary)
 
"""
Compute memory usage.
"""
def ComputeMemoryUsage(env, target_name):
# Compute memory usage.
env.Command(
None,
target_name + '.elf',
env['SIZE'] + ' -C --mcu=' + env['MCU'] + ' $SOURCE'
)
AddMethod(Environment, ComputeMemoryUsage)
/trunk/libraries/adc/adc.h
42,23 → 42,23
******************************************************************************/
 
/**************************************************************************//**
* \enum
* \brief
* \enum adc__channels
* \brief ADC channels.
*
* \typedef
* \brief
* \typedef adc__channel_t
* \brief ADC channel.
******************************************************************************/
typedef enum adc__channels
{
ADC__CHANNEL_0,
ADC__CHANNEL_1,
ADC__CHANNEL_2,
ADC__CHANNEL_3,
ADC__CHANNEL_4,
ADC__CHANNEL_5,
ADC__CHANNEL_6,
ADC__CHANNEL_7,
ADC__CHANNEL_8
ADC__CHANNEL_0, /*!< Channel 0. */
ADC__CHANNEL_1, /*!< Channel 1. */
ADC__CHANNEL_2, /*!< Channel 2. */
ADC__CHANNEL_3, /*!< Channel 3. */
ADC__CHANNEL_4, /*!< Channel 4. */
ADC__CHANNEL_5, /*!< Channel 5. */
ADC__CHANNEL_6, /*!< Channel 6. */
ADC__CHANNEL_7, /*!< Channel 7. */
ADC__CHANNEL_8 /*!< Channel 8. */
} adc__channel_t;
 
/******************************************************************************
79,7 → 79,7
);
 
/**************************************************************************//**
* \fn uint16_t adc__read(void)
* \fn uint16_t adc__single_channel_read(void)
*
* \brief Read ADC.
*
/trunk/libraries/adc
Modification de propriétés sur adc
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+build