|
@@ -38,6 +38,8 @@ static uint16_t Humidity;
|
|
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
|
static void boardInit(void);
|
|
|
+static void showT(void);
|
|
|
+static void showH(void);
|
|
|
|
|
|
void main(void)
|
|
|
{
|
|
@@ -50,14 +52,41 @@ void main(void)
|
|
|
/* Infinite loop */
|
|
|
while (1) {
|
|
|
htu_GetTemperature(&Temperature);
|
|
|
+ showT();
|
|
|
Delay(410);
|
|
|
htu_GetHumidity(&Humidity);
|
|
|
+ showH();
|
|
|
Delay(440);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/* Private functions ---------------------------------------------------------*/
|
|
|
+static void showT(void) {
|
|
|
+ int16_t t;
|
|
|
+ uint8_t a;
|
|
|
+ if (Temperature > 0) {
|
|
|
+ LedDigits[0] = LED_OUT_PL;
|
|
|
+ t = (Temperature + 5) / 10;
|
|
|
+ } else {
|
|
|
+ LedDigits[0] = LED_OUT_MM;
|
|
|
+ t = ((Temperature + 5) / 10) * -1;
|
|
|
+ }
|
|
|
+ LedDigits[1] = t / 100;
|
|
|
+ a = t % 100;
|
|
|
+ LedDigits[2] = a / 10;
|
|
|
+ LedDigits[3] = a % 10;
|
|
|
+}
|
|
|
+
|
|
|
+static void showH(void) {
|
|
|
+ uint8_t a;
|
|
|
+ LedDigits[4] = LED_OUT_H;
|
|
|
+ LedDigits[5] = Humidity / 100;
|
|
|
+ a = Humidity % 100;
|
|
|
+ LedDigits[6] = a / 10;
|
|
|
+ LedDigits[7] = a % 10;
|
|
|
+}
|
|
|
+
|
|
|
static void boardInit(void) {
|
|
|
/* Насколько я понял, для частот выше 16МГц нужно вводить задержку при работе с FLASH:
|
|
|
- Before using the HSE clock make sure that the "Flash_Wait_States" is set to 1.
|