#include #include #include #include #include "i2c.h" #include "ssd1306_display_driver.h" #include "debug.h" //TODO move to timer #include "br24t_eeprom_driver.h" /** * TODO * make sure desired functions are static (it's just good practice) * crashing, stack tracing, if that ever matters * see if stdio is ever needed in non debug builds * Battery factors to test: * OLED clock (command 0xd5) * OLED stay on/off * organize i2c eeprom/timer code */ #if defined(DEBUG_BUILD) || defined(EEPROM_INSTALL) #include "uart.h" //TODO remove if needed #endif int main() { //initlizes i2c, right now only speed //TODO don't delegate a whole function if desired i2c_init(); screen_init(); #if defined(DEBUG_BUILD) || defined(EEPROM_INSTALL) //initlizes usart registers uart_init(); FILE stdout_replacement = FDEV_SETUP_STREAM((void *)uart_sendbyte, NULL, _FDEV_SETUP_WRITE); FILE stdin_replacement = FDEV_SETUP_STREAM(NULL, (void *)uart_recvbyte, _FDEV_SETUP_READ); stdout = &stdout_replacement; stdin = &stdin_replacement; screen_testdraw(); #endif //initilize timer timer_init(); #ifdef EEPROM_INSTALL flash_eeprom(); #endif //initlizes screen registers with good values since we dont have control over reset functionallity screen_init(); return 0; }