Unfinished v0.7, added bearing detection
Fork of Pi_Swarm_Library_v06_alpha by
Diff: piswarm.h
- Revision:
- 11:5ebcb52726cf
- Parent:
- 10:5c111c07a2ed
--- a/piswarm.h Tue Feb 18 21:05:32 2014 +0000 +++ b/piswarm.h Mon Jun 30 07:58:31 2014 +0000 @@ -27,6 +27,9 @@ #endif // The following defines are user parameters and may be edited +// USE_BEACON - if Pi Swarm table with IR beacon is used, set to 1 to allow sync on boot. +// DISPLAY_BEACON_READING - if value is 1, display shows beacon reading on each update +// CALIBRATE_MEMS - set to 1 to calibrate MEMS sensors on boot // SWARM_SIZE - size of swarm (+1). Max 32. // USE_COMMUNICATION_STACK - 1 to enable, 0 to bypass // CALIBRATE_COLOURS - 1 to increase blue intensity, 0 to not @@ -44,8 +47,17 @@ // RF_FREQUENCY - Frequency of RF chip. See datasheet for details (default 435000000) // RF_DATARATE - Baud rate of the RF chip. Max 115200, default 57600. +#define USE_BEACON 1 +#define DISPLAY_BEACON_READING 1 +#define CALIBRATE_MEMS 0 +#define SLOW_TURN_LEFT_MULTIPLIER 5200 +#define SLOW_TURN_RIGHT_MULTIPLIER 5450 +#define SLOW_TURN_LEFT_OFFSET 1 +#define SLOW_TURN_RIGHT_OFFSET 4 +#define FAST_TURN_LEFT_MULTIPLIER 1450 +#define FAST_TURN_RIGHT_MULTIPLIER 1450 #define SWARM_SIZE 32 -#define USE_COMMUNICATION_STACK 1 +#define USE_COMMUNICATION_STACK 0 #define CALIBRATE_COLOURS 1 #define CENTER_LED_BRIGHTNESS 30 #define OUTER_LED_BRIGHTNESS 50 @@ -55,7 +67,7 @@ #define RF_USE_TDMA 1 #define RF_TDMA_TIME_PERIOD_US 15625 #define PISWARM_DEBUG 1 -#define RF_DEBUG 1 +#define RF_DEBUG 0 #define RF_VERBOSE 0 #define START_RADIO_ON_BOOT 1 #define RF_FREQUENCY 435000000 @@ -115,6 +127,12 @@ // Disable all the LEDs and the dedicated power supply void turn_off_all_oleds(void); + + // Save the current colour and state of OLEDs [introduced in API 0.7] + void save_oled_state(void); + + // Restore the saved colour and state of OLEDs [introduced in API 0.7] + void restore_oled_state(void); // Set brightness of outer LEDs (works by increasing total period for PWM) void set_oled_brightness ( char brightness ); @@ -267,6 +285,14 @@ // Play a tune on the 3-pi buzzer (see notes at end of file for more details) void play_tune (char * tune, int length); + // Turn at slow speed (0.15) to the set amount of degrees (clockwise) + void slow_turn (float degrees); + + // Turn at fast speed (0.5) to the set amount of degrees (clockwise) + void fast_turn (float degrees); + + void test_turn_calibration(void); + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // EEPROM Functions ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -398,6 +424,10 @@ }; +void display_bearing_info(void); +void resync_with_beacon(void); +void update_bearing(void); +void highlight_bearing(void); void display_system_time(void); void init(void); extern Serial pc;