| 1 | #include "Types.h" |
| 2 | #include "UsartModel.h" |
| 3 | #include "ModelConfig.h" |
| 4 | #include "UsartBaudRateRegisterCalculator.h" |
| 5 | #include "TemperatureFilter.h" |
| 6 | #include <stdio.h> |
| 7 | #include <math.h> |
| 8 | |
| 9 | char formattedTemperature[32]; |
| 10 | char* wakeup = "It's Awesome Time!\n"; |
| 11 | |
| 12 | uint8 UsartModel_GetBaudRateRegisterSetting(void) |
| 13 | { |
| 14 | return UsartModel_CalculateBaudRateRegisterSetting(MASTER_CLOCK, USART0_BAUDRATE); |
| 15 | } |
| 16 | |
| 17 | char* UsartModel_GetFormattedTemperature(void) |
| 18 | { |
| 19 | float temperature = TemperatureFilter_GetTemperatureInCelcius(); |
| 20 | if (temperature == -INFINITY) |
| 21 | { |
| 22 | sprintf(formattedTemperature, "%s", "Temperature sensor failure!\n"); |
| 23 | } |
| 24 | else |
| 25 | { |
| 26 | sprintf(formattedTemperature, "%.1f C\n", temperature); |
| 27 | } |
| 28 | return formattedTemperature; |
| 29 | } |
| 30 | |
| 31 | char* UsartModel_GetWakeupMessage(void) |
| 32 | { |
| 33 | return wakeup; |
| 34 | } |