]> mj.ucw.cz Git - home-hw.git/blobdiff - test-sinclair/main.c
Auto: Meditation mode turned off
[home-hw.git] / test-sinclair / main.c
index fc8a3705e276e5d4a650ee9d21948d595efe0e99..d0194cc28838de19f6eb8b8ef3fcd520fa9a3f2f 100644 (file)
@@ -57,10 +57,11 @@ static void gpio_init(void)
        gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
        gpio_clear(GPIOC, GPIO13);
 
-       // PB13 = SCK2
-       // PB15 = MOSI2
-       gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO13);
-       gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO15);
+       // PB13 = SCK2 (pulled up)
+       // PB15 = MOSI2 (pulled up)
+       gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO13);
+       gpio_set_mode(GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO15);
+       gpio_set(GPIOB, GPIO13 | GPIO15);
 
        // PA8 = IR remote control
        gpio_clear(GPIOA, GPIO8);
@@ -306,6 +307,8 @@ static void tm_show(void)
  *  The AC unit expects demodulated IR signal. The RC sends 52-bit messages
  *  (plus leader and trailer). The last 4 bits are a complement of checksum
  *  of 4-bit nibbles.
+ *
+ *  We represent the messages as two 32-bit words, the upper word containing
  */
 
 #define RC_POWER_OFF_HI                0b00000000000000000000
@@ -313,26 +316,26 @@ static void tm_show(void)
 
 #define RC_DEFAULT_HI          0b00000011000000000000
 
-// Combines with a temperature setting (17-30)
+// Cooling with different fan settings. Combines with a temperature setting (17-30).
 #define RC_COOL_AUTO           0b00000000000000010000000000000000
-#define RC_COOL_HI             0b00000000000000010000100000000000
+#define RC_COOL_HIGH           0b00000000000000010000100000000000
 #define RC_COOL_MED            0b00000000000000010001000100000000
-#define RC_COOL_LO             0b00000000000000010010001000000000
+#define RC_COOL_LOW            0b00000000000000010010001000000000
 
 static const u32 rc_cool_fan[4] = {
        RC_COOL_AUTO,
-       RC_COOL_LO,
+       RC_COOL_LOW,
        RC_COOL_MED,
-       RC_COOL_HI,
+       RC_COOL_HIGH,
 };
 
-// Combines with a temperature setting (15-25)
+// Heating with fixed fan setting. Combines with a temperature setting (15-25).
 #define RC_WARM                        0b00000000000000010000001100000000
 
-// This is sent with temperature=17
+// Dehumidifying with fixed fan setting. This is always sent with temperature=17.
 #define RC_DEHUMIDIFY          0b00000000000000010010010000000000
 
-// This can be added to any command to enable sleep mode, but we do not issue these yet
+// This can be added to any command to enable sleep mode, but we do not issue it yet.
 #define RC_SLEEP               0b00000000000010000000000000000000
 
 enum rc_mode {