#include "asuro.h"
#include "asuro_irrc5.h"
Go to the source code of this file.
Interrupt handlers | |
SIGNAL (SIG_OVERFLOW2) | |
ISR for timer2 overflow. | |
SIGNAL (SIG_INTERRUPT1) | |
ISR for switches. | |
Functions | |
void | AS_Avr_Sleep (unsigned char ticks) |
Halt execution for a given time of 36kHz ticks. | |
void | AS_Init () |
Do some initialization stuff. | |
unsigned long | AS_GetClockTicks () |
Return the number of system clock ticks elapsed since system start. | |
unsigned long | AS_GetSysTime () |
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. | |
Variables | |
volatile AS_UserIsr | AS_UserIsrInterrupt1 = 0 |
User defined ISR for INT1 (switches). | |
volatile unsigned char | AS_count36kHz = 0 |
Intermediate counter for system clock ticks. | |
volatile unsigned long | AS_clockTicks = 0 |
Counter for system clock ticks. | |
volatile unsigned char | AS_irrc5DecodeEnabled = 1 |
Enable/disable IR-RC5 decoding in ISR. | |
volatile char | AS_sensSwitchesOn = 0 |
Set to true if the interrupt for switches is enabled. | |
volatile char | AS_sensSwitched = 0 |
Set to true, when one or more of the switches are pressed. |
Definition in file asuro_avr.c.
|
Halt execution for a given time of 36kHz ticks.
Definition at line 102 of file asuro_avr.c. References AS_count36kHz. Referenced by AS_SensSwitchesRead(). |
|
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. |
|
Set front LED on or off. Note that you can also call AS_LED_FRONT_ON and AS_LED_FRONT_OFF directly.
Definition at line 209 of file asuro_avr.c. References AS_LED_FRONT_OFF, and AS_LED_FRONT_ON. |
|
Return the number of system clock ticks elapsed since system start. Remember that it might overflow.
Definition at line 158 of file asuro_avr.c. References AS_clockTicks, and AS_count36kHz. |
|
Return the time in milliseconds elapsed since system start. Remember that it might overflow.
Definition at line 169 of file asuro_avr.c. References AS_clockTicks, and AS_count36kHz. |
|
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).
Definition at line 255 of file asuro_avr.c. References AS_DIR_LEFT, and AS_DIR_RIGHT. Referenced by AS_Init(). |
|
Set speed of left and right motor. Use AS_MotorDir() before to specifiy the direction.
Definition at line 241 of file asuro_avr.c. Referenced by AS_Init(). |
|
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. |
|
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
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. |
|
Send data via IR serial interface. IR-RC5 decoding will be disabled during write.
Definition at line 268 of file asuro_avr.c. References AS_irrc5DecodeEnabled, UCSRA, UCSRB, and UDR. |
|
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!
Definition at line 181 of file asuro_avr.c. References AS_count36kHz. |
|
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. |
|
ISR for switches. The interrupt is disabled here, so you have to reactivate it manually using AS_SensSwitchesInterruptOn(). Definition at line 83 of file asuro_avr.c. References AS_sensSwitched, AS_SensSwitchesInterruptOff(), and AS_UserIsrInterrupt1. |
|
ISR for timer2 overflow. timer2 is used as a 72kHz counter for IR communication. While the signal SIG_OUTPUT_COMPARE2 would be triggered every 1/72k seconds, this ISR is called only every 1/36k seconds. Definition at line 65 of file asuro_avr.c. References AS_clockTicks, AS_count36kHz, AS_irrc5DecodeEnabled, AS_isr_irrc5(), and TCNT2. |
|
Counter for system clock ticks. Don't read it directly, but use AS_GetClockTicks() or AS_GetSysTime() instead. Definition at line 37 of file asuro_avr.c. Referenced by AS_GetClockTicks(), AS_GetSysTime(), and SIGNAL(). |
|
Intermediate counter for system clock ticks. Don't read it directly, but use AS_GetClockTicks() or AS_GetSysTime() instead. Definition at line 31 of file asuro_avr.c. Referenced by AS_Avr_Sleep(), AS_GetClockTicks(), AS_GetSysTime(), AS_Sleep(), and SIGNAL(). |
|
Enable/disable IR-RC5 decoding in ISR. Will be disabled during read/write on IR serial interface. Definition at line 43 of file asuro_avr.c. Referenced by AS_SerWrite(), and SIGNAL(). |
|
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(). |
|
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. |
|
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(). |