From 95cc51ba7be82d3b6591800c36aeace4771674d8 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Mon, 16 Jul 2018 13:56:43 +0200 Subject: [PATCH] added AtmelStudio Project --- .vs/AtTiny_alarm_clock/v14/.atsuo | Bin 0 -> 18944 bytes AtTiny_alarm_clock.atsln | 22 +++++ AtTiny_alarm_clock.componentinfo.xml | 86 ++++++++++++++++++ AtTiny_alarm_clock.cproj | 128 +++++++++++++++++++++++++++ main.c | 94 ++------------------ main_old.c | 100 +++++++++++++++++++++ 6 files changed, 342 insertions(+), 88 deletions(-) create mode 100644 .vs/AtTiny_alarm_clock/v14/.atsuo create mode 100644 AtTiny_alarm_clock.atsln create mode 100644 AtTiny_alarm_clock.componentinfo.xml create mode 100644 AtTiny_alarm_clock.cproj create mode 100644 main_old.c diff --git a/.vs/AtTiny_alarm_clock/v14/.atsuo b/.vs/AtTiny_alarm_clock/v14/.atsuo new file mode 100644 index 0000000000000000000000000000000000000000..135d58c19c2b15c84a84bcb26af4f8b2553fca3a GIT binary patch literal 18944 zcmeHO-ESjT6`yRo+q9I@QYfV@ZQ3rS)Jgmqe{8#@w#Ogw_h%ftDO-CycE%om#51;I zw-tyNo_It^AVGQM4T(R12P7VND2O6a2_y;U3eVje*W2U z;RGnQxEi+(>J_AX-0lgrOul{u9H|}d$+y#=LdXXDj$o5(a59(Rik!gJajkM97w6g- z2??!fa>`!0qi$EZOA90;tPMw%)8+^9klV{({ilAn(UKO%LjU#|MdEg^J$|HJ@0-peW3HT)NDc}lz;8IH|o?0mvff?1(GGEgH9kl zdaadz#%Y)FhV%fFVY<&Mi(2`o`iUO3?AIXpYIIBOWGuj`)D)isoVw z$oPQn_wPN^I{z6U$q;)_;>^6$RUnl$;Jyr8 z0j>g#Koigmv;eI@8*mM12ReXGpbK~n_#*Hn;C0~3z^?&c0lI-6pcly6q`j~2<%e;P zXv$pN4BcKzajpw1Lx#1}9AQ;sdGN^TpwGtv*&k#>JOrec9#@vV3m`!}M&N3Y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F8uuC)LF literal 0 HcmV?d00001 diff --git a/AtTiny_alarm_clock.atsln b/AtTiny_alarm_clock.atsln new file mode 100644 index 0000000..0631184 --- /dev/null +++ b/AtTiny_alarm_clock.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "AtTiny_alarm_clock", "AtTiny_alarm_clock.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/AtTiny_alarm_clock.componentinfo.xml b/AtTiny_alarm_clock.componentinfo.xml new file mode 100644 index 0000000..1295b29 --- /dev/null +++ b/AtTiny_alarm_clock.componentinfo.xml @@ -0,0 +1,86 @@ + + + + + + + Device + Startup + + + Atmel + 1.3.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.172\include + + include + C + + + include + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.172\include\avr\iotn2313a.h + + header + C + S5kp0bTA63lv+OH62wjqfA== + + include/avr/iotn2313a.h + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.172\templates\main.c + template + source + C Exe + 2YdP1NP06ldLfwWqlY0byw== + + templates/main.c + Main file (.c) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.172\templates\main.cpp + template + source + C Exe + YXFphlh0CtZJU+ebktABgQ== + + templates/main.cpp + Main file (.cpp) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.3.172\gcc\dev\attiny2313a + + libraryPrefix + GCC + + + gcc/dev/attiny2313a + + + + + ATtiny_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATtiny_DFP/1.3.172/Atmel.ATtiny_DFP.pdsc + 1.3.172 + true + ATtiny2313A + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/AtTiny_alarm_clock.cproj b/AtTiny_alarm_clock.cproj new file mode 100644 index 0000000..f60c36d --- /dev/null +++ b/AtTiny_alarm_clock.cproj @@ -0,0 +1,128 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + dce6c7e3-ee26-4d79-826b-08594b9ad897 + ATtiny2313A + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + AtTiny_alarm_clock + AtTiny_alarm_clock + AtTiny_alarm_clock + Native + true + false + true + true + + + true + + 2 + 0 + 0 + + + + + + + + + + + + + + + + + + -mmcu=attiny2313a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\gcc\dev\attiny2313a" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\include + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\include + + + + + + + + + -mmcu=attiny2313a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\gcc\dev\attiny2313a" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.3.172\include + + + Default (-Wa,-g) + + + + + + compile + + + + \ No newline at end of file diff --git a/main.c b/main.c index 7803561..5b8686e 100644 --- a/main.c +++ b/main.c @@ -1,100 +1,18 @@ /* - * GccApplication1.c + * AtTiny_alarm_clock.c * - * Created: 10.07.2018 19:39:28 + * Created: 16.07.2018 13:55:13 * Author : dozed */ -#define button1 1234 -#define button2 5678 -#define button3 whatever +#include -typedef enum {CLOCK_INIT = 0, CLOCK_IDLE, CLOCK_ALARM, CLOCK_STOPWATCH_RUNNING, CLOCK_STOPWATCH_STOPPED, CLOCK_STOPWATCH_NOT_SET, CLOCK_USER_INPUT, CLOCK_SET_TIME} clock_state_e; -clock_state_e clock_old_state = NULL; -clock_state_e clock_state = CLOCK_INIT; -clock_state_e clock_new_state = CLOCK_INIT; - -int counter = 0; //the counter variable that is being set by the interrupt -//variables for the alarm -bool alarm_active = false; -bool alarm_triggered = false; -int alarm_time = 0; - -//variables for the stopwatch -bool stopwatch_running = false; -bool stopwatch_set = false -int stopwatch_started = 0; -int stopwatch_stopped = 0; - -//other variables -int user_input = 0; //variable to store user input -int current_time = 0; int main(void) { - //-----------INIT---------------- - //SETUP PINS (needs to be done) - - //attach interrupt (needs to be done) - - //-----------END INIT------------ - while (1) - { - timer_state = timer_new_state; - - switch(clock_state){ - case CLOCK_INIT: - //do some init stuff... - lcd.init(); //I know, it's just c but I don't care - - //INIT done -> change to IDLE - clock_new_state = CLOCK_IDLE; - - break; - - case CLOCK_IDLE: - //IDLE MODE - - //print the IDLE Screen - lcd.goto(0,0); - lcd.print(counter /*do some claculations*/); - lcd.goto(0,1); - lcd.print("< current time >"); - - //check buttons - if(button_pressed(1)){ - timer_new_state = CLOCK_ALARM; - } - else if(button_pressed(2){ - //do something - } - else if(button_pressed(3)){ - //do something - } - - case CLOCK_ALARM: - //CLOCK ALARM - //check if the alarm time was set - if(user_input == 0){ - alarm_time = user_input; - user_input = 0; - } - if(alarm_active){ - lcd.goto(0,0); - lcd.print(current_time); - lcd.goto(0,1); - lcd.print("alarm >"); - - } + /* Replace with your application code */ + while (1) + { } - //do some other stuff (like checking if an alarm has been triggered) - - } -} - -bool button_pressed(int button_number) -{ - bool button_state = /*check the state of the button here*/; - return(button_state); } diff --git a/main_old.c b/main_old.c new file mode 100644 index 0000000..7803561 --- /dev/null +++ b/main_old.c @@ -0,0 +1,100 @@ +/* + * GccApplication1.c + * + * Created: 10.07.2018 19:39:28 + * Author : dozed + */ + +#define button1 1234 +#define button2 5678 +#define button3 whatever + +typedef enum {CLOCK_INIT = 0, CLOCK_IDLE, CLOCK_ALARM, CLOCK_STOPWATCH_RUNNING, CLOCK_STOPWATCH_STOPPED, CLOCK_STOPWATCH_NOT_SET, CLOCK_USER_INPUT, CLOCK_SET_TIME} clock_state_e; + +clock_state_e clock_old_state = NULL; +clock_state_e clock_state = CLOCK_INIT; +clock_state_e clock_new_state = CLOCK_INIT; + +int counter = 0; //the counter variable that is being set by the interrupt +//variables for the alarm +bool alarm_active = false; +bool alarm_triggered = false; +int alarm_time = 0; + +//variables for the stopwatch +bool stopwatch_running = false; +bool stopwatch_set = false +int stopwatch_started = 0; +int stopwatch_stopped = 0; + +//other variables +int user_input = 0; //variable to store user input +int current_time = 0; +int main(void) +{ + //-----------INIT---------------- + //SETUP PINS (needs to be done) + + //attach interrupt (needs to be done) + + //-----------END INIT------------ + while (1) + { + timer_state = timer_new_state; + + switch(clock_state){ + case CLOCK_INIT: + //do some init stuff... + lcd.init(); //I know, it's just c but I don't care + + //INIT done -> change to IDLE + clock_new_state = CLOCK_IDLE; + + break; + + case CLOCK_IDLE: + //IDLE MODE + + //print the IDLE Screen + lcd.goto(0,0); + lcd.print(counter /*do some claculations*/); + lcd.goto(0,1); + lcd.print("< current time >"); + + //check buttons + if(button_pressed(1)){ + timer_new_state = CLOCK_ALARM; + } + else if(button_pressed(2){ + //do something + } + else if(button_pressed(3)){ + //do something + } + + case CLOCK_ALARM: + //CLOCK ALARM + //check if the alarm time was set + if(user_input == 0){ + alarm_time = user_input; + user_input = 0; + } + if(alarm_active){ + lcd.goto(0,0); + lcd.print(current_time); + lcd.goto(0,1); + lcd.print("alarm >"); + + } + } + //do some other stuff (like checking if an alarm has been triggered) + + } +} + +bool button_pressed(int button_number) +{ + bool button_state = /*check the state of the button here*/; + return(button_state); +} +