include/asuro.h File Reference

Interface to ASURO's devices. More...

#include "asuro_defs.h"

Go to the source code of this file.

Type definitions

typedef void(* AS_UserIsr )(void)
 User ISRs have to have this signature.

Main functions

void AS_Init (void)
 Do some initialization stuff.
unsigned long AS_GetClockTicks (void)
 Return the number of system clock ticks elapsed since system start.
unsigned long AS_GetSysTime (void)
 Return the time in milliseconds elapsed since system start.
void AS_Sleep (unsigned int time)
 Halt execution for a given time in milliseconds.
void AS_StatusLED (unsigned char color)
 Set status LED to the specified color.
void AS_FrontLED (unsigned char status)
 Set front LED on or off.
void AS_BackLED (unsigned char left, unsigned char right)
 Set back LEDs on or off.
void AS_MotorSpeed (unsigned char left_speed, unsigned char right_speed)
 Set speed of left and right motor.
void AS_MotorDir (unsigned char left_dir, unsigned char right_dir)
 Set rotation direction of left and right motor.
void AS_SerWrite (unsigned char *data, unsigned char length)
 Send data via IR serial interface.
void AS_SensSwitchesInterruptOn (void)
 Turn on interrupt for activity on switches.
void AS_SensSwitchesInterruptOff (void)
 Disable interrupt for activity on switches.
unsigned char AS_SensSwitchesRead (void)
 Read status of switches.

Global variables

volatile char AS_sensSwitched
 Set to true, when one or more of the switches are pressed.
volatile char AS_sensSwitchesOn
 Set to true if the interrupt for switches is enabled.
volatile AS_UserIsr AS_UserIsrInterrupt1
 User defined ISR for INT1 (switches).


Detailed Description

Interface to ASURO's devices.

The implentations of these are target-specific.

Author:
Denis Martin
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Definition in file asuro.h.


Function Documentation

void AS_BackLED unsigned char  left,
unsigned char  right
[inline]
 

Set back LEDs on or off.

Note that you can also call AS_LED_RBACK_ON, AS_LED_RBACK_OFF, AS_LED_LBACK_ON and AS_LED_LBACK_OFF directly, but you have to switch to AS_BACK_LED_MODE before.

left Status for left back LED (AS_ON or AS_OFF) right Status for right back LED (AS_ON or AS_OFF)

Definition at line 222 of file asuro_avr.c.

References AS_BACK_LED_MODE, AS_LED_LBACK_OFF, AS_LED_LBACK_ON, AS_LED_ODO_OFF, AS_LED_RBACK_OFF, and AS_LED_RBACK_ON.

void AS_FrontLED unsigned char  status  )  [inline]
 

Set front LED on or off.

Note that you can also call AS_LED_FRONT_ON and AS_LED_FRONT_OFF directly.

Parameters:
status AS_ON or AS_OFF

Definition at line 209 of file asuro_avr.c.

References AS_LED_FRONT_OFF, and AS_LED_FRONT_ON.

unsigned long AS_GetClockTicks void   )  [inline]
 

Return the number of system clock ticks elapsed since system start.

Remember that it might overflow.

Returns:
Number of system clock ticks

Definition at line 158 of file asuro_avr.c.

References AS_clockTicks, and AS_count36kHz.

unsigned long AS_GetSysTime void   )  [inline]
 

Return the time in milliseconds elapsed since system start.

Remember that it might overflow.

Returns:
System time in milliseconds

Definition at line 169 of file asuro_avr.c.

References AS_clockTicks, and AS_count36kHz.

void AS_MotorDir unsigned char  left_dir,
unsigned char  right_dir
[inline]
 

Set rotation direction of left and right motor.

Possible values are AS_DIR_FWD (forward), AS_DIR_RWD (backward), AS_DIR_BREAK (stop) and AS_DIR_FREE (no change to direction).

Parameters:
left_dir Direction for left motor.
right_dir Direction for right motor.

Definition at line 255 of file asuro_avr.c.

References AS_DIR_LEFT, and AS_DIR_RIGHT.

Referenced by AS_Init().

void AS_MotorSpeed unsigned char  left_speed,
unsigned char  right_speed
[inline]
 

Set speed of left and right motor.

Use AS_MotorDir() before to specifiy the direction.

Parameters:
left_speed Speed of left motor (0..255)
right_speed Speed of right motor (0..255)

Definition at line 241 of file asuro_avr.c.

References OCR1A, and OCR1B.

Referenced by AS_Init().

void AS_SensSwitchesInterruptOn void   ) 
 

Turn on interrupt for activity on switches.

The user ISR assigned to AS_UserIsrInterrupt1 will be called if any of the switches was pushed.

Definition at line 292 of file asuro_avr.c.

References AS_PD_SWITCHES, AS_SENS_SWITCHES_OFF, AS_sensSwitched, DDRD, GICR, INT1, ISC10, ISC11, and MCUCR.

unsigned char AS_SensSwitchesRead void   ) 
 

Read status of switches.

The bits of the returned value represent the switches currently pressed. The mapping is the following:

bit0 = K6, bit1 = K5, bit2 = K4, bit3 = K3, bit4 = K2, bit5 = K1

Returns:
A value whose bits represent the switches currently pressed (see above)

Definition at line 323 of file asuro_avr.c.

References ADMUX, AS_ADC_FINISHED, AS_ADC_START, AS_ADC_STOP, AS_ADC_VALUE, AS_Avr_Sleep(), AS_MUX_SWITCHES, AS_SENS_SWITCHES_MODE, AS_SENS_SWITCHES_OFF, AS_SENS_SWITCHES_ON, and REFS0.

void AS_SerWrite unsigned char *  data,
unsigned char  length
 

Send data via IR serial interface.

IR-RC5 decoding will be disabled during write.

Parameters:
data Pointer to data buffer to send.
length Size of data in bytes.

Definition at line 268 of file asuro_avr.c.

References AS_irrc5DecodeEnabled, UCSRA, UCSRB, and UDR.

void AS_Sleep unsigned int  time  ) 
 

Halt execution for a given time in milliseconds.

Note: a value of zero will not return immediately as you might expect. Instead, the execution is halted for over a minute!

Parameters:
time Time to sleep in milliseconds

Definition at line 181 of file asuro_avr.c.

References AS_count36kHz.

void AS_StatusLED unsigned char  color  )  [inline]
 

Set status LED to the specified color.

Note that you can also call AS_LED_GREEN_ON, AS_LED_GREEN_OFF, AS_LED_RED_ON, AS_LED_RED_OFF, AS_LED_YELLOW_ON and AS_LED_YELLOW_OFF directly.

color Color (possible values: AS_GREEN, AS_RED, AS_YELLOW)

Definition at line 197 of file asuro_avr.c.

References AS_GREEN, AS_LED_GREEN_OFF, AS_LED_GREEN_ON, AS_LED_RED_OFF, AS_LED_RED_ON, and AS_RED.


Variable Documentation

volatile char AS_sensSwitched
 

Set to true, when one or more of the switches are pressed.

Note that you have to turn on the concerned interrupt using AS_SensSwitchesInterruptOn().

Definition at line 55 of file asuro_avr.c.

Referenced by AS_SensSwitchesInterruptOn(), and SIGNAL().

volatile char AS_sensSwitchesOn
 

Set to true if the interrupt for switches is enabled.

If it is not enabled, you may activate it by using AS_SensSwitchesInterruptOn().

Definition at line 49 of file asuro_avr.c.

volatile AS_UserIsr AS_UserIsrInterrupt1
 

User defined ISR for INT1 (switches).

Assign a function to this global variable to get your own ISR called.

Definition at line 25 of file asuro_avr.c.

Referenced by SIGNAL().


Generated on Fri May 12 10:11:15 2006 for simsuro by  doxygen 1.4.6