#include <tucbot/tucbot.h>
void testLine(void);
int main(void);
void testLine(void) {
uint8_t menu_pos = 0;
uint8_t flag_redraw_menu = 0xFF;
uint8_t value;
uint8_t adc_min;
uint8_t adc_max;
while (1) {
if (flag_redraw_menu) {
flag_redraw_menu = 0x00;
switch (menu_pos) {
case 0:
break;
case 1:
break;
default:
menu_pos = 2;
break;
}
}
menu_pos++;
if (menu_pos > 2) {menu_pos = 0;}
flag_redraw_menu = 0xFF;
} else {
adc_min = 255;
adc_max = 0;
if (value < adc_min) {adc_min = value;}
if (value > adc_max) {adc_max = value;}
if (value < adc_min) {adc_min = value;}
if (value > adc_max) {adc_max = value;}
if (value < adc_min) {adc_min = value;}
if (value > adc_max) {adc_max = value;}
if (value < adc_min) {adc_min = value;}
if (value > adc_max) {adc_max = value;}
if (value < adc_min) {adc_min = value;}
if (value > adc_max) {adc_max = value;}
value = (adc_min >> 1) + (adc_max >> 1);
}
switch (menu_pos) {
case 0 :
}
}
break;
case 1 :
}
break;
default:
}
break;
}
}
}
}
int main (void) {
testLine();
return (0);
}
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
@ kLineSetThreshold
Definition: line.h:171
@ kLineDigitalMiddleLeft
bit mask (0x08): middle left line sensor
Definition: line.h:37
eLineSelectMask line_received(eLineSelectMask bitmask)
Indicates if new data for the selected data blocks were received.
void line_request(eLineSelectMask bitmask, eRequestType request)
Requests new data from the line sensors.
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
@ kLedRight
bit mask (0x04): right led
Definition: leds.h:46
@ kLineSelectMiddle
Definition: line.h:125
@ kLineGetMiddleRight
constant (5): middle right line sensor
Definition: line.h:153
@ kLineGetThreshold
constant (8): theshold value for converting to digital bitfield
Definition: line.h:159
@ kLineGetFrontMiddle
constant (2): front middle line sensor
Definition: line.h:147
@ kLineGetFrontLeft
constant (1): front left line sensor
Definition: line.h:145
@ kLineDigitalMiddleRight
bit mask (0x10): middle right line sensor
Definition: line.h:39
@ kLineSelectDigital
Definition: line.h:128
uint8_t line_get(eLineGet select)
Returns the last stored version of the selected value.
@ kLineEnableAll
bit mask (0x03): enable all line sensors
Definition: line.h:57
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
@ kLineSetEnable
constant (kLineGetEnable): bitfield of enabled line sensor groups
Definition: line.h:169
@ kLineDigitalFrontMiddle
bit mask (0x02): front middle line sensor
Definition: line.h:33
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
void uint16tostr(void *out, uint16_t number, uint8_t digits)
Converts an unsigned integer to a string and passes it to an output function.
void lcdclr(void)
Clears the display.
eLineSelectMask line_changed(eLineSelectMask bitmask)
Indicates if new data changed the selected data blocks.
@ kLineSelectAll
bit mask (0x0F): select all data blocks
Definition: line.h:135
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
@ kRequestSingle
constant (1): request a single update
Definition: update.h:33
@ kLineGetFrontRight
constant (3): front right line sensor
Definition: line.h:149
@ kLineDigitalFrontLeft
bit mask (0x01): front left line sensor
Definition: line.h:31
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
void lcdout(uint8_t data)
Writes one byte to the display.
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
void line_set(eLineSet select, uint8_t value)
Sets the selected values of the line sensors.
@ kLineSelectEnable
Definition: line.h:131
@ kLineDigitalFrontRight
bit mask (0x04): front right line sensor
Definition: line.h:35
@ kLineGetDigital
constant (6): bitfield of all line sensor
Definition: line.h:155
@ kLineSelectFront
Definition: line.h:122
@ kLineGetMiddleLeft
constant (4): middle left line sensor
Definition: line.h:151