include/basics.h File Reference

Basic functions. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Defines

#define FRONT   0x01
#define FORWARD   FRONT
#define LEFT   0x02
#define RIGHT   0x08
#define BACK   0x10
#define BACKWARD   BACK
#define ANYDIR   (FRONT | BACK | LEFT | RIGHT)
#define FRONT_LEFT   (FRONT | LEFT)
#define FRONT_RIGHT   (FRONT | RIGHT)
#define FRONT_BACK   (FRONT | BACK)
#define LEFT_RIGHT   (LEFT | RIGHT)
#define LEFT_BACK   (LEFT | BACK)
#define FRONT_LEFT_RIGHT   (FRONT | LEFT | RIGHT)
#define LEFT_RIGHT_BACK   (LEFT | RIGHT | BACK)
#define RIGHT_BACK_FRONT   (RIGHT | BACK | FRONT)
#define OFF   0x00
#define NODIR   OFF
#define TURN   0x20
#define LEFT_TURN   0x22
#define RIGHT_TURN   0x28
#define SLOW   1
#define MEDIUM   2
#define FAST   3
#define BROADCAST   0
#define ANY_SOURCE   BROADCAST
#define ANY_DEST   BROADCAST
#define RC_SOURCE   16
#define abs(x)
#define GET_BIT(arr, bit)
#define SET_BIT_COND(arr, bit, val)
#define SET_BIT(arr, bit)
#define CLEAR_BIT_COND(arr, bit, val)
#define CLEAR_BIT(arr, bit)
#define CHANGE_BIT(arr, bit, val)

Typedefs

typedef signed char int8
typedef uint8_t uint8
typedef uint16_t uint16
typedef uint32_t uint32

Functions

uint8_t opposite_dir (uint8_t)
uint8_t turn_dir (uint8_t)
uint8_t id (void)
uint8_t get_user_switches (void)
uint8_t get_user_switch1 (void)
uint8_t get_user_switch2 (void)
void init_all (void)

Variables

uint8_t dirs [4]

Detailed Description

Basic functions.

Definition in file basics.h.


Function Documentation

uint8_t get_user_switch1 ( void  )

get the state of the user switch 1 (Bit 1 of the dip switch)

uint8_t get_user_switch2 ( void  )

get the state of the user switch 2 (Bit 2 of the dip switch)

uint8_t get_user_switches ( void  )

get the state of the user switches (Bit 1 and 2 of the dip switch)

uint8_t id ( void  )

get the id of the current robot (Bit 3 to 6 of the dip switch)

Returns:
id of the current robot
void init_all ( void  )

initialize all devices