/*
* File: LED_Exploration_main.c
* Author: COSMOS
*
* Created on July 17, 2018, 10:52 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include "serial.h"
#include "BOARD.h"
#include "roach.h"
#include "timers.h"
#define THIRD_BIT 0b001000
#define FOURTH_BIT 0b010000
/*
*
*/
int main(int argc, char** argv) {
SERIAL_Init();
BOARD_Init();
Roach_Init();
TIMERS_Init();
int Readout = 0b000000000001;
while (1) {
//update LED bar:
while (!(Readout == 0x800)) { //checks that readout is not 0b1000 0000 0000
//wait one second:
TIMERS_InitTimer(0, 250);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet(Readout);
Readout = (Readout << 1);
}
while (!(Readout == 0x001)) { //checks that readout is not 0b1000 0000 0000
//wait one second:
TIMERS_InitTimer(0, 250);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet(Readout);
Readout = (Readout >> 1);
}
}
/* char BumperReading = 12;
if ((THIRD_BIT & BumperReading) || (FOURTH_BIT & BumperReading)) {
printf("Either third or fourth bit high!");
} else {
printf("Third bit and fourth bit are low");
}
*/
/*while (1) {
Roach_LEDSSet(0b110110110110);
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet(~0b110110110110);
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
}
*/
/*
Roach_LEDSSet(0b101010101010);
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet(0xBEEF);
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet(6);
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
Roach_LEDSSet('c');
TIMERS_InitTimer(0, 1000);
while (TIMERS_IsTimerActive(0));
*/
while (1);
return (EXIT_SUCCESS);
}