board.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #ifndef _BOARD_H_
  14. #define _BOARD_H_
  15. /*
  16. * Setup for STMicroelectronics STM8S-Discovery board.
  17. */
  18. /*
  19. * Board identifiers.
  20. */
  21. #define BOARD_ST_STM8S_DISCOVERY
  22. #define BOARD_NAME "ST STM8S-Discovery"
  23. /*
  24. * Board frequencies.
  25. */
  26. #define HSECLK 16000000
  27. /*
  28. * MCU model used on the board.
  29. */
  30. #define STM8S105
  31. /*
  32. * Pin definitions.
  33. */
  34. #define PA_OSCIN 1
  35. #define PA_OSCOUT 2
  36. #define PC_TS_KEY 1
  37. #define PC_TS_LOADREF 2
  38. #define PC_TS_SHIELD 3
  39. #define PD_LD10 0
  40. #define PD_SWIM 1
  41. #define PD_TX 5
  42. #define PD_RX 6
  43. /*
  44. * Port A initial setup.
  45. */
  46. #define VAL_GPIOAODR 0
  47. #define VAL_GPIOADDR 0 /* All inputs. */
  48. #define VAL_GPIOACR1 0xFF /* All pull-up or push-pull. */
  49. #define VAL_GPIOACR2 0
  50. /*
  51. * Port B initial setup.
  52. */
  53. #define VAL_GPIOBODR 0
  54. #define VAL_GPIOBDDR 0 /* All inputs. */
  55. #define VAL_GPIOBCR1 0xFF /* All push-pull. */
  56. #define VAL_GPIOBCR2 0
  57. /*
  58. * Port C initial setup.
  59. */
  60. #define VAL_GPIOCODR 0
  61. #define VAL_GPIOCDDR 0 /* All inputs. */
  62. #define VAL_GPIOCCR1 0xFF /* All pull-up. */
  63. #define VAL_GPIOCCR2 0
  64. /*
  65. * Port D initial setup.
  66. */
  67. #define VAL_GPIODODR (1 << PD_LD10) | (1 << PD_TX)
  68. #define VAL_GPIODDDR (1 << PD_LD10) | (1 << PD_TX)
  69. #define VAL_GPIODCR1 0xFF /* All pull-up. */
  70. #define VAL_GPIODCR2 0
  71. /*
  72. * Port E initial setup.
  73. */
  74. #define VAL_GPIOEODR 0
  75. #define VAL_GPIOEDDR 0 /* All inputs. */
  76. #define VAL_GPIOECR1 0xFF /* All pull-up. */
  77. #define VAL_GPIOECR2 0
  78. /*
  79. * Port F initial setup.
  80. */
  81. #define VAL_GPIOFODR 0
  82. #define VAL_GPIOFDDR 0 /* All inputs. */
  83. #define VAL_GPIOFCR1 0xFF /* All pull-up. */
  84. #define VAL_GPIOFCR2 0
  85. /*
  86. * Port G initial setup.
  87. */
  88. #define VAL_GPIOGODR 0
  89. #define VAL_GPIOGDDR 0 /* All inputs. */
  90. #define VAL_GPIOGCR1 0xFF /* All pull-up or push-pull. */
  91. #define VAL_GPIOGCR2 0
  92. #if !defined(_FROM_ASM_)
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96. void boardInit(void);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* _FROM_ASM_ */
  101. #endif /* _BOARD_H_ */