예제 #1
0
Student::Student(char * name, char * second_name, char * surname, GENDER gender, Date birth, char * ofStudent, int * Exams, int * Courses, int * Moduls)
{
	SetName(name);
	SetSecond(second_name);
	SetSurname(surname);
	SetGender(gender);
	this->birth = birth;
	SetAdress(ofStudent);
	SetExams(Exams);
	SetCourses(Courses);
	SetModuls(Moduls);
}
예제 #2
0
void Student::operator=(const Student& other)
{
	SetName(other.name);
	SetSecond(other.second_name);
	SetSurname(other.surname);
	SetGender(other.gender);
	this->birth = other.birth;
	SetAdress(other.ofStudent);
	SetExams(other.Exams);
	SetCourses(other.Courses);
	SetModuls(other.Moduls);
}
예제 #3
0
int main(void)
{
  /* MCU Configuration----------------------------------------------------------*/

  HAL_Init();	  													/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  SystemClock_Config(); 									/* Configure the system clock */
	ADC1_Config(); 													/* configure ADC1 */
	Display_GPIO_Config(); 									/* Configure 7-Segment Displays */
	Alarm_GPIO_Config(); 										/* Configure alarm pins */	
	initLCD(); 															/* configure LCD */

	/* print temperature on the first line of the LCD */
	returnHome(); 													/* just makes sure that start writing at the right place */
	LCD_WriteString("  Temperature"); 			/* The 2 initial space are for centering */
	

	
	adcState = malloc(sizeof(kalmanState)); /* Init Kalman Filter */
	kalmanInit(adcState, INIT_q, INIT_r, INIT_x, INIT_p, INIT_k);

	/* main program to run in this infinite loop */
	while (1)	{

		
		if (adcTimer >= ADC_PERIOD) { 								/* 100Hz */
			adcTimer = 0;
			HAL_ADC_Start(&ADC1_Handle); 								/* start ADC conversion */
			
			/* wait for the conversion to be done and get data */
			if (HAL_ADC_PollForConversion(&ADC1_Handle, 1000000) == HAL_OK) { 
				adc_val = HAL_ADC_GetValue(&ADC1_Handle); /* get the value */
				
				kalmanUpdate(adcState, adc_val); 					/* filter the data and update the filter parameters */
				/* DON'T DELETE printf for matlab script */
				//printf("%f,%f,%f,%f,%f,%f\n",adc_val, adcState->q,adcState->r, adcState->x, adcState->p, adcState->k);
				
				temp = convertTemp(adcState->x); 					/* convert the filterd value of the ADC into temperature */
				
				/* Alarm triggering  */
				if (temp > THRESHHOLD_TEMP) {
					if ( filterAlarmCounter > 5 ){ 					/* 5 consecutive to avoid false positive */
						trigger_alarm();
					}
					else {
					filterAlarmCounter++;
					}
				} 
				else {
					shutoff_alarm();
					filterAlarmCounter = 0;
				}
		
				/* Update Measurement to Display at 2Hz */
				if (updateMeasureForDisplayTimer >= UPDATE_MEASURE_PERIOD) {
					updateMeasureForDisplayTimer = 0; 						/* reset the displayTimer tick */
					displayTemp = temp;
					displayTemp = floor(10 * displayTemp) / 10; 	/* truncate to 1 decimal without rounding */
								
					/* LCD DISPLAY */	
					SetAdress(64); 																/* go to line 2 of LCD */
					sprintf(tempToLCD, "     %.1f", displayTemp); /* convert the float to a string and formats it */
					LCD_WriteString(tempToLCD);										/* print value to the LCD display */
					/* LCD DISPLAY END */
				}
			}
		}
		
		/* here display runs at DISPLAY_7_SEGMENT_PERIOD speed, but displayTemp gets updated at 2Hz */
		if(display7segTimer >= DISPLAY_7_SEGMENT_PERIOD) {
			display7segTimer = 0;
			display(displayTemp); 														/* display on 7-segment display */
		}
	
	}
}