board.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __BOARD_H
  2. #define __BOARD_H
  3. /* Public macros ------------------------------------------------------------*/
  4. /* MACROs for SET, RESET or TOGGLE Output port */
  5. #define GPIO_HIGH(a,b) a->ODR |= b
  6. #define GPIO_LOW(a,b) a->ODR &= ~b
  7. #define GPIO_TOGGLE(a,b) a->ODR ^= b
  8. /* Public define ------------------------------------------------------------*/
  9. #define TDA7448_I2C_WRADDR 0x88
  10. #define TDA7448_SUB_ADDR 0x10
  11. #define TDA7448_MIN_VOL 79
  12. #define TDA7448_MUTE 0xC0
  13. #define I2C_PORT GPIOB
  14. #define I2C_SCL GPIO_PIN_4
  15. #define I2C_SDA GPIO_PIN_5
  16. #define ENC_PORT GPIOC
  17. #define ENC_PIN_BTN GPIO_PIN_4
  18. #define ENC_PINA GPIO_PIN_6
  19. #define ENC_PINB GPIO_PIN_7
  20. #define ENC_PIN_ALL (GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7)
  21. #define TIM1_PERIOD 0xFFFF
  22. // 320
  23. #define TIM1_ENC_FILTR 0x30
  24. // ^^^ RM0016 p.201
  25. #define TIM1_ENC_MODE 0x03
  26. // ^^^ TIM1_ENCODERMODE_TI12
  27. #define BTN_SCAN_PERIOD 50
  28. #define BTN_NOSCAN_MS 200
  29. #define IR_BTN_POWER 7
  30. #define IR_BTN_MUTE 8
  31. #define IR_BTN_VOLP 1
  32. #define IR_BTN_VOLM 2
  33. #define IR_THRESHOLD 4
  34. #endif /* __BOARD_H */
  35. /* Public typedef ------------------------------------------------------------*/
  36. typedef struct {
  37. uint8_t code; // pult code
  38. uint8_t key; // key number
  39. uint8_t seq; // sequence
  40. } ir_btn_t;