chibios.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #pragma once
  2. #include <hwdef.h>
  3. #include <hal.h>
  4. #define HAL_BOARD_NAME "ChibiOS"
  5. #if HAL_MEMORY_TOTAL_KB >= 1000
  6. #define HAL_MEM_CLASS HAL_MEM_CLASS_1000
  7. #elif HAL_MEMORY_TOTAL_KB >= 500
  8. #define HAL_MEM_CLASS HAL_MEM_CLASS_500
  9. #elif HAL_MEMORY_TOTAL_KB >= 300
  10. #define HAL_MEM_CLASS HAL_MEM_CLASS_300
  11. #elif HAL_MEMORY_TOTAL_KB >= 192
  12. #define HAL_MEM_CLASS HAL_MEM_CLASS_192
  13. #elif HAL_MEMORY_TOTAL_KB >= 64
  14. #define HAL_MEM_CLASS HAL_MEM_CLASS_64
  15. #else
  16. #define HAL_MEM_CLASS HAL_MEM_CLASS_20
  17. #endif
  18. #ifndef HAL_GPIO_LED_ON
  19. #define HAL_GPIO_LED_ON 0
  20. #endif
  21. #ifndef HAL_GPIO_LED_OFF
  22. #define HAL_GPIO_LED_OFF 1
  23. #endif
  24. #ifndef HAL_WITH_UAVCAN
  25. #define HAL_WITH_UAVCAN 0
  26. #endif
  27. #ifndef HAL_HAVE_BOARD_VOLTAGE
  28. #define HAL_HAVE_BOARD_VOLTAGE 0
  29. #endif
  30. #ifndef HAL_HAVE_SERVO_VOLTAGE
  31. #define HAL_HAVE_SERVO_VOLTAGE 0
  32. #endif
  33. #ifdef HAL_GPIO_PIN_SAFETY_IN
  34. #define HAL_HAVE_SAFETY_SWITCH 1
  35. #endif
  36. #ifndef HAL_HAVE_SAFETY_SWITCH
  37. #define HAL_HAVE_SAFETY_SWITCH 0
  38. #endif
  39. #define HAL_STORAGE_SIZE_AVAILABLE HAL_STORAGE_SIZE
  40. #ifndef HAL_WITH_IO_MCU
  41. #define HAL_WITH_IO_MCU 0
  42. #endif
  43. #ifndef HAL_WITH_RAMTRON
  44. #define HAL_WITH_RAMTRON 0
  45. #endif
  46. // allow for static semaphores
  47. #include <AP_HAL_ChibiOS/Semaphores.h>
  48. #define HAL_Semaphore ChibiOS::Semaphore
  49. #define HAL_Semaphore_Recursive ChibiOS::Semaphore_Recursive
  50. /* string names for well known SPI devices */
  51. #define HAL_BARO_MS5611_NAME "ms5611"
  52. #ifndef HAL_BARO_MS5611_SPI_INT_NAME
  53. #define HAL_BARO_MS5611_SPI_INT_NAME "ms5611_int"
  54. #endif
  55. #define HAL_BARO_MS5611_SPI_EXT_NAME "ms5611_ext"
  56. #define HAL_BARO_LPS22H_NAME "lps22h"
  57. #define HAL_BARO_BMP280_NAME "bmp280"
  58. #define HAL_INS_MPU60x0_NAME "mpu6000"
  59. #define HAL_INS_MPU60x0_EXT_NAME "mpu6000_ext"
  60. #define HAL_INS_LSM9DS0_G_NAME "lsm9ds0_g"
  61. #define HAL_INS_LSM9DS0_A_NAME "lsm9ds0_am"
  62. #define HAL_INS_LSM9DS0_EXT_G_NAME "lsm9ds0_ext_g"
  63. #define HAL_INS_LSM9DS0_EXT_A_NAME "lsm9ds0_ext_am"
  64. #define HAL_INS_MPU9250_NAME "mpu9250"
  65. #define HAL_INS_MPU9250_EXT_NAME "mpu9250_ext"
  66. #define HAL_INS_MPU6500_NAME "mpu6500"
  67. #define HAL_INS_ICM20608_NAME "icm20608"
  68. #define HAL_INS_ICM20608_AM_NAME "icm20608-am"
  69. #define HAL_INS_ICM20608_EXT_NAME "icm20608_ext"
  70. #define HAL_COMPASS_HMC5843_NAME "hmc5843"
  71. #define HAL_COMPASS_LIS3MDL_NAME "lis3mdl"
  72. // allow for short names overridden in hwdef.dat
  73. #ifndef CHIBIOS_SHORT_BOARD_NAME
  74. #define CHIBIOS_SHORT_BOARD_NAME CHIBIOS_BOARD_NAME
  75. #endif
  76. #ifndef CONFIG_HAL_BOARD_SUBTYPE
  77. // allow for generic boards
  78. #define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_GENERIC
  79. #endif
  80. // we support RC serial for BLHeli pass-thru
  81. #define HAL_SUPPORT_RCOUT_SERIAL 1
  82. // by default assume first I2C bus is internal
  83. #ifndef HAL_I2C_INTERNAL_MASK
  84. #define HAL_I2C_INTERNAL_MASK 1
  85. #endif
  86. // put all storage of files under /APM directory
  87. #ifndef HAL_BOARD_STORAGE_DIRECTORY
  88. #define HAL_BOARD_STORAGE_DIRECTORY "/APM"
  89. #endif