linux.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. #pragma once
  2. #define HAL_BOARD_NAME "Linux"
  3. #define HAL_CPU_CLASS HAL_CPU_CLASS_1000
  4. #define HAL_MEM_CLASS HAL_MEM_CLASS_1000
  5. #define HAL_OS_POSIX_IO 1
  6. #define HAL_OS_SOCKETS 1
  7. #define HAL_STORAGE_SIZE 16384
  8. #define HAL_STORAGE_SIZE_AVAILABLE HAL_STORAGE_SIZE
  9. // make sensor selection clearer
  10. #define PROBE_IMU_I2C(driver, bus, addr, args ...) ADD_BACKEND(AP_InertialSensor_ ## driver::probe(*this,GET_I2C_DEVICE(bus, addr),##args))
  11. #define PROBE_IMU_SPI(driver, devname, args ...) ADD_BACKEND(AP_InertialSensor_ ## driver::probe(*this,hal.spi->get_device(devname),##args))
  12. #define PROBE_IMU_SPI2(driver, devname1, devname2, args ...) ADD_BACKEND(AP_InertialSensor_ ## driver::probe(*this,hal.spi->get_device(devname1),hal.spi->get_device(devname2),##args))
  13. #define PROBE_BARO_I2C(driver, bus, addr, args ...) ADD_BACKEND(AP_Baro_ ## driver::probe(*this,std::move(GET_I2C_DEVICE(bus, addr)),##args))
  14. #define PROBE_BARO_SPI(driver, devname, args ...) ADD_BACKEND(AP_Baro_ ## driver::probe(*this,std::move(hal.spi->get_device(devname)),##args))
  15. #define PROBE_MAG_I2C(driver, bus, addr, args ...) ADD_BACKEND(DRIVER_ ##driver, AP_Compass_ ## driver::probe(GET_I2C_DEVICE(bus, addr),##args))
  16. #define PROBE_MAG_SPI(driver, devname, args ...) ADD_BACKEND(DRIVER_ ##driver, AP_Compass_ ## driver::probe(hal.spi->get_device(devname),##args))
  17. #define PROBE_MAG_IMU(driver, imudev, imu_instance, args ...) ADD_BACKEND(DRIVER_ ##driver, AP_Compass_ ## driver::probe_ ## imudev(imu_instance,##args))
  18. #define PROBE_MAG_IMU_I2C(driver, imudev, bus, addr, args ...) ADD_BACKEND(DRIVER_ ##driver, AP_Compass_ ## driver::probe_ ## imudev(GET_I2C_DEVICE(bus,addr),##args))
  19. #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NONE
  20. #define HAL_BOARD_LOG_DIRECTORY "logs"
  21. #define HAL_BOARD_TERRAIN_DIRECTORY "terrain"
  22. #define HAL_BOARD_STORAGE_DIRECTORY "."
  23. #define HAL_INS_DEFAULT HAL_INS_HIL
  24. #define HAL_BARO_DEFAULT HAL_BARO_HIL
  25. #define HAL_COMPASS_DEFAULT HAL_COMPASS_HIL
  26. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXF || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD
  27. #if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXF
  28. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_ROLL_180_YAW_270)
  29. #else
  30. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_ROLL_180_YAW_90)
  31. #endif
  32. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  33. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  34. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  35. #define HAL_GPIO_A_LED_PIN 61
  36. #define HAL_GPIO_B_LED_PIN 48
  37. #define HAL_GPIO_C_LED_PIN 117
  38. #define HAL_GPIO_LED_ON LOW
  39. #define HAL_GPIO_LED_OFF HIGH
  40. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
  41. #define HAL_BOARD_LOG_DIRECTORY "/data/ftp/internal_000/ardupilot/logs"
  42. #define HAL_BOARD_TERRAIN_DIRECTORY "/data/ftp/internal_000/ardupilot/terrain"
  43. #define HAL_BOARD_STORAGE_DIRECTORY "/data/ftp/internal_000/ardupilot"
  44. #define HAL_INS_PROBE_LIST PROBE_IMU_I2C(Invensense, 2, 0x68, ROTATION_YAW_270)
  45. #define HAL_MAG_PROBE_LIST PROBE_MAG_I2C(AK8963, 1, 0x0d, ROTATION_NONE)
  46. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77, AP_Baro_MS56XX::BARO_MS5607)
  47. #define HAL_HAVE_IMU_HEATER 1
  48. #define HAL_IMU_TEMP_DEFAULT 55
  49. #define HAL_UTILS_HEAT HAL_LINUX_HEAT_PWM
  50. #define HAL_LINUX_HEAT_PWM_NUM 6
  51. #define HAL_LINUX_HEAT_KP 20000
  52. #define HAL_LINUX_HEAT_KI 6
  53. #define HAL_LINUX_HEAT_PERIOD_NS 125000
  54. #define HAL_LINUX_HEAT_TARGET_TEMP 50
  55. #define BEBOP_CAMV_PWM 9
  56. #define BEBOP_CAMV_PWM_FREQ 43333333
  57. #define HAL_OPTFLOW_ONBOARD_VDEV_PATH "/dev/video0"
  58. #define HAL_OPTFLOW_ONBOARD_SUBDEV_PATH "/dev/v4l-subdev0"
  59. #define HAL_OPTFLOW_ONBOARD_SENSOR_WIDTH 320
  60. #define HAL_OPTFLOW_ONBOARD_SENSOR_HEIGHT 240
  61. #define HAL_OPTFLOW_ONBOARD_OUTPUT_WIDTH 64
  62. #define HAL_OPTFLOW_ONBOARD_OUTPUT_HEIGHT 64
  63. #define HAL_OPTFLOW_ONBOARD_CROP_WIDTH 240
  64. #define HAL_OPTFLOW_ONBOARD_CROP_HEIGHT 240
  65. #define HAL_OPTFLOW_ONBOARD_NBUFS 8
  66. #define HAL_FLOW_PX4_MAX_FLOW_PIXEL 4
  67. #define HAL_FLOW_PX4_BOTTOM_FLOW_FEATURE_THRESHOLD 30
  68. #define HAL_FLOW_PX4_BOTTOM_FLOW_VALUE_THRESHOLD 5000
  69. #define HAL_PARAM_DEFAULTS_PATH "/data/ftp/internal_000/ardupilot/bebop.parm"
  70. #define HAL_RCOUT_BEBOP_BLDC_I2C_BUS 1
  71. #define HAL_RCOUT_BEBOP_BLDC_I2C_ADDR 0x08
  72. /* focal length 2.21mm pixel size 3.6 um, 2x binning in each direction
  73. * 240x240 crop rescaled to 64x64 */
  74. #define HAL_FLOW_PX4_FOCAL_LENGTH_MILLIPX (2.21 / (3.6 * 2.0 * 240 / 64))
  75. #define HAL_RANGEFINDER_LIGHTWARE_I2C_BUS 0
  76. #define HAL_BATT_MONITOR_DEFAULT AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP
  77. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO
  78. #define HAL_BOARD_LOG_DIRECTORY "/data/ftp/internal_000/ardupilot/logs"
  79. #define HAL_BOARD_TERRAIN_DIRECTORY "/data/ftp/internal_000/ardupilot/terrain"
  80. #define HAL_BOARD_STORAGE_DIRECTORY "/data/ftp/internal_000/ardupilot"
  81. #define HAL_INS_PROBE_LIST PROBE_IMU_I2C(Invensense, 2, 0x68, ROTATION_PITCH_180_YAW_90)
  82. #define HAL_MAG_PROBE_LIST PROBE_MAG_I2C(AK8963, 1, 0x0d, ROTATION_NONE)
  83. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77, AP_Baro_MS56XX::BARO_MS5607)
  84. #define HAL_UTILS_HEAT HAL_LINUX_HEAT_PWM
  85. #define HAL_LINUX_HEAT_PWM_NUM 10
  86. #define HAL_LINUX_HEAT_KP 20000
  87. #define HAL_LINUX_HEAT_KI 6
  88. #define HAL_LINUX_HEAT_PERIOD_NS 125000
  89. #define HAL_LINUX_HEAT_TARGET_TEMP 50
  90. #define BEBOP_CAMV_PWM 9
  91. #define BEBOP_CAMV_PWM_FREQ 43333333
  92. #define HAL_OPTFLOW_ONBOARD_VDEV_PATH "/dev/video0"
  93. #define HAL_OPTFLOW_ONBOARD_SUBDEV_PATH "/dev/v4l-subdev0"
  94. #define HAL_OPTFLOW_ONBOARD_SENSOR_WIDTH 320
  95. #define HAL_OPTFLOW_ONBOARD_SENSOR_HEIGHT 240
  96. #define HAL_OPTFLOW_ONBOARD_OUTPUT_WIDTH 64
  97. #define HAL_OPTFLOW_ONBOARD_OUTPUT_HEIGHT 64
  98. #define HAL_OPTFLOW_ONBOARD_CROP_WIDTH 240
  99. #define HAL_OPTFLOW_ONBOARD_CROP_HEIGHT 240
  100. #define HAL_OPTFLOW_ONBOARD_NBUFS 8
  101. #define HAL_FLOW_PX4_MAX_FLOW_PIXEL 4
  102. #define HAL_FLOW_PX4_BOTTOM_FLOW_FEATURE_THRESHOLD 30
  103. #define HAL_FLOW_PX4_BOTTOM_FLOW_VALUE_THRESHOLD 5000
  104. #define HAL_RCOUT_DISCO_BLDC_I2C_BUS 1
  105. #define HAL_RCOUT_DISCO_BLDC_I2C_ADDR 0x08
  106. #define HAL_PARAM_DEFAULTS_PATH "/data/ftp/internal_000/ardupilot/disco.parm"
  107. /* focal length 2.21mm pixel size 3.6 um, 2x binning in each direction
  108. * 240x240 crop rescaled to 64x64 */
  109. #define HAL_FLOW_PX4_FOCAL_LENGTH_MILLIPX (2.21 / (3.6 * 2.0 * 240 / 64))
  110. #define HAL_RANGEFINDER_LIGHTWARE_I2C_BUS 0
  111. // the disco has challenges with its magnetic setup
  112. #define AP_COMPASS_OFFSETS_MAX_DEFAULT 2200
  113. #define HAL_BATT_MONITOR_DEFAULT AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP
  114. #define HAL_GPIO_SCRIPT "/data/ftp/internal_000/ardupilot/gpio.sh"
  115. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIO
  116. #define HAL_GPIO_A_LED_PIN 0
  117. #define HAL_GPIO_B_LED_PIN 1
  118. #define HAL_GPIO_C_LED_PIN 2
  119. #define HAL_GPIO_LED_ON HIGH
  120. #define HAL_GPIO_LED_OFF LOW
  121. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  122. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77)
  123. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  124. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  125. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIO2
  126. #define HAL_HAVE_SERVO_VOLTAGE 1
  127. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  128. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77)
  129. #define HAL_MAG_PROBE1 PROBE_MAG_SPI(LSM9DS1, "lsm9ds1_m", ROTATION_ROLL_180)
  130. #define HAL_MAG_PROBE2 PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  131. #define HAL_MAG_PROBE_LIST HAL_MAG_PROBE1; HAL_MAG_PROBE2
  132. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  133. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ERLEBRAIN2
  134. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_YAW_270)
  135. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  136. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  137. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  138. #define HAL_GPIO_A_LED_PIN 24
  139. #define HAL_GPIO_B_LED_PIN 25
  140. #define HAL_GPIO_C_LED_PIN 16
  141. #define HAL_GPIO_LED_ON LOW
  142. #define HAL_GPIO_LED_OFF HIGH
  143. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ
  144. // Stub the sensors out for now, at least we can build and run
  145. #define HAL_INS_DEFAULT HAL_INS_HIL
  146. #define HAL_BARO_DEFAULT HAL_BARO_HIL
  147. #define HAL_COMPASS_DEFAULT HAL_COMPASS_HIL
  148. // only external compasses
  149. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  150. #define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  151. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
  152. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  153. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  154. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  155. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  156. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI
  157. #define HAL_GPIO_A_LED_PIN 69
  158. #define HAL_GPIO_B_LED_PIN 68
  159. #define HAL_GPIO_C_LED_PIN 45
  160. #define HAL_GPIO_LED_ON LOW
  161. #define HAL_GPIO_LED_OFF HIGH
  162. #define HAL_BUZZER_PIN 11
  163. #define HAL_INS_PROBE1 PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  164. #define HAL_INS_PROBE2 PROBE_IMU_SPI(Invensense, "mpu9250ext", ROTATION_NONE)
  165. #define HAL_INS_PROBE_LIST HAL_INS_PROBE1; HAL_INS_PROBE2
  166. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  167. #define HAL_MAG_PROBE1 PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  168. #define HAL_MAG_PROBE2 PROBE_MAG_IMU(AK8963, mpu9250, 1, ROTATION_NONE)
  169. #define HAL_MAG_PROBE_LIST HAL_MAG_PROBE1; HAL_MAG_PROBE2
  170. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  171. #define HAL_OPTFLOW_PX4FLOW_I2C_BUS 2
  172. #define HAL_RANGEFINDER_LIGHTWARE_I2C_BUS 2
  173. #define HAL_WITH_UAVCAN 1
  174. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR
  175. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(LSM9DS1, "lsm9ds1_ag", ROTATION_PITCH_180)
  176. #define HAL_MAG_PROBE_LIST PROBE_MAG_SPI(LSM9DS1, "lsm9ds1_m", ROTATION_NONE)
  177. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(BMP280, "bmp280")
  178. #define HAL_BATT_CURR_PIN 0
  179. #define HAL_BATT_CURR_SCALE 1
  180. #define HAL_BATT_VOLT_PIN 1
  181. #define HAL_BATT_VOLT_SCALE 1
  182. #define HAL_RGBLED_RED 24
  183. #define HAL_RGBLED_GREEN 25
  184. #define HAL_RGBLED_BLUE 26
  185. #define HAL_RGBLED_NORMAL_POLARITY false
  186. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BLUE
  187. #define HAL_GPIO_A_LED_PIN 66
  188. #define HAL_GPIO_B_LED_PIN 67
  189. #define HAL_GPIO_LED_ON HIGH
  190. #define HAL_GPIO_LED_OFF LOW
  191. #define HAL_INS_PROBE_LIST PROBE_IMU_I2C(Invensense, 2, 0x68, ROTATION_NONE)
  192. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(BMP280, 2, 0x76)
  193. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU_I2C(AK8963, mpu9250, 2, 0x0c, ROTATION_NONE)
  194. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  195. #define HAL_OPTFLOW_PX4FLOW_I2C_BUS 1
  196. #define HAL_RANGEFINDER_LIGHTWARE_I2C_BUS 1
  197. #define HAL_WITH_UAVCAN 1
  198. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_POCKET
  199. #define HAL_GPIO_A_LED_PIN 59
  200. #define HAL_GPIO_B_LED_PIN 58
  201. #define HAL_GPIO_C_LED_PIN 57
  202. #define HAL_GPIO_LED_ON HIGH
  203. #define HAL_GPIO_LED_OFF LOW
  204. #define HAL_BUZZER_PIN 28
  205. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  206. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(BMP280, "bmp280")
  207. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  208. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  209. #define HAL_OPTFLOW_PX4FLOW_I2C_BUS 2
  210. #define HAL_RANGEFINDER_LIGHTWARE_I2C_BUS 2
  211. #define HAL_WITH_UAVCAN 1
  212. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BH
  213. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77)
  214. #define HAL_INS_PROBE1 PROBE_IMU_I2C(Invensense, 1, 0x69, ROTATION_NONE)
  215. #define HAL_INS_PROBE2 PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  216. #define HAL_INS_PROBE_LIST HAL_INS_PROBE1; HAL_INS_PROBE2
  217. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  218. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  219. #define HAL_GPIO_A_LED_PIN 17
  220. #define HAL_GPIO_B_LED_PIN 18
  221. #define HAL_GPIO_C_LED_PIN 22
  222. #define HAL_GPIO_LED_ON LOW
  223. #define HAL_GPIO_LED_OFF HIGH
  224. #define HAL_RCOUT_RGBLED_RED 13
  225. #define HAL_RCOUT_RGBLED_GREEN 14
  226. #define HAL_RCOUT_RGBLED_BLUE 15
  227. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXFMINI
  228. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_YAW_270)
  229. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  230. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  231. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  232. #define HAL_GPIO_A_LED_PIN 24
  233. #define HAL_GPIO_B_LED_PIN 25
  234. #define HAL_GPIO_C_LED_PIN 16
  235. #define HAL_GPIO_LED_ON LOW
  236. #define HAL_GPIO_LED_OFF HIGH
  237. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_AERO
  238. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(BMI160, "bmi160")
  239. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 2, 0x76)
  240. #define HAL_MAG_PROBE1 PROBE_MAG_I2C(BMM150, 2, 0x12, ROTATION_NONE)
  241. #define HAL_MAG_PROBE2 PROBE_MAG_I2C(HMC5843, 4, 0x1e, true, ROTATION_NONE)
  242. #define HAL_MAG_PROBE3 PROBE_MAG_I2C(IST8310, 4, 0x0e, true, ROTATION_PITCH_180_YAW_90)
  243. #define HAL_MAG_PROBE_LIST HAL_MAG_PROBE1; HAL_MAG_PROBE2; HAL_MAG_PROBE3
  244. #define HAL_RCOUTPUT_TAP_DEVICE "/dev/ttyS1"
  245. #define HAL_WITH_UAVCAN 1
  246. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DARK
  247. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI(Invensense, "mpu9250", ROTATION_NONE)
  248. #define HAL_MAG_PROBE_LIST PROBE_MAG_IMU(AK8963, mpu9250, 0, ROTATION_NONE)
  249. #define HAL_BARO_PROBE_LIST PROBE_BARO_I2C(MS56XX, 1, 0x77)
  250. #define HAL_GPIO_A_LED_PIN 24
  251. #define HAL_GPIO_B_LED_PIN 25
  252. #define HAL_GPIO_C_LED_PIN 16
  253. #define HAL_GPIO_LED_ON LOW
  254. #define HAL_GPIO_LED_OFF HIGH
  255. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_EDGE
  256. #define HAL_BOARD_LOG_DIRECTORY "/edge/ardupilot/logs"
  257. #define HAL_BOARD_TERRAIN_DIRECTORY "/edge/ardupilot/terrain"
  258. #define HAL_BOARD_STORAGE_DIRECTORY "/edge/ardupilot"
  259. #define HAL_INS_PROBE1 PROBE_IMU_SPI(Invensense, "mpu60x0", ROTATION_YAW_90)
  260. #define HAL_INS_PROBE2 PROBE_IMU_SPI(Invensense, "mpu60x0ext", ROTATION_YAW_90)
  261. #define HAL_INS_PROBE_LIST HAL_INS_PROBE1; HAL_INS_PROBE2
  262. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  263. // only external compasses
  264. #define HAL_PROBE_EXTERNAL_I2C_COMPASSES
  265. #define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  266. #define HAL_WITH_UAVCAN 1
  267. #define HAL_IMU_TEMP_DEFAULT 55
  268. #define HAL_HAVE_IMU_HEATER 1
  269. #define HAL_UTILS_HEAT HAL_LINUX_HEAT_PWM
  270. #define HAL_LINUX_HEAT_PWM_NUM 15
  271. #define HAL_LINUX_HEAT_KP 20000
  272. #define HAL_LINUX_HEAT_KI 6
  273. #define HAL_LINUX_HEAT_PERIOD_NS 2040816
  274. #define HAL_GPS_TYPE_DEFAULT 9
  275. #define HAL_CAN_DRIVER_DEFAULT 1
  276. #elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ
  277. #define HAL_INS_PROBE_LIST PROBE_IMU_SPI2(Invensense, "rst_g", "rst_a", ROTATION_ROLL_180_YAW_90, ROTATION_ROLL_180_YAW_90)
  278. #define HAL_BARO_PROBE_LIST PROBE_BARO_SPI(MS56XX, "ms5611")
  279. #define HAL_MAG_PROBE_LIST PROBE_MAG_SPI(LIS3MDL, lis3mdl, false, ROTATION_ROLL_180_YAW_90)
  280. #define HAL_OPTFLOW_PX4FLOW_I2C_BUS 0
  281. #define HAL_HAVE_GETTIME_SETTIME 1
  282. #else
  283. #error "no Linux board subtype set"
  284. #endif
  285. #ifndef HAL_COMPASS_DEFAULT
  286. #define HAL_COMPASS_DEFAULT -1
  287. #endif
  288. #ifndef HAL_OPTFLOW_PX4FLOW_I2C_ADDRESS
  289. #define HAL_OPTFLOW_PX4FLOW_I2C_ADDRESS 0x42
  290. #endif
  291. #ifndef HAL_OPTFLOW_PX4FLOW_I2C_BUS
  292. #define HAL_OPTFLOW_PX4FLOW_I2C_BUS 1
  293. #endif
  294. #define HAL_HAVE_BOARD_VOLTAGE 1
  295. #define HAL_HAVE_SAFETY_SWITCH 0
  296. #ifndef HAL_HAVE_SERVO_VOLTAGE
  297. #define HAL_HAVE_SERVO_VOLTAGE 0
  298. #endif
  299. #ifndef AP_STATEDIR
  300. #define HAL_BOARD_STATE_DIRECTORY "/var/lib/ardupilot"
  301. #else
  302. #define HAL_BOARD_STATE_DIRECTORY AP_STATEDIR
  303. #endif
  304. #ifndef HAL_BOARD_LOG_DIRECTORY
  305. #define HAL_BOARD_LOG_DIRECTORY HAL_BOARD_STATE_DIRECTORY "/logs"
  306. #endif
  307. #ifndef HAL_BOARD_TERRAIN_DIRECTORY
  308. #define HAL_BOARD_TERRAIN_DIRECTORY HAL_BOARD_STATE_DIRECTORY "/terrain"
  309. #endif
  310. #ifndef HAL_BOARD_STORAGE_DIRECTORY
  311. #define HAL_BOARD_STORAGE_DIRECTORY HAL_BOARD_STATE_DIRECTORY
  312. #endif
  313. #ifndef HAL_BOARD_CAN_IFACE_NAME
  314. #define HAL_BOARD_CAN_IFACE_NAME "can0"
  315. #endif
  316. // if bus masks are not setup above then use these defaults
  317. #ifndef HAL_LINUX_I2C_BUS_MASK
  318. #define HAL_LINUX_I2C_BUS_MASK 0xFFFF
  319. #endif
  320. #ifndef HAL_LINUX_I2C_INTERNAL_BUS_MASK
  321. #define HAL_LINUX_I2C_INTERNAL_BUS_MASK 0xFFFF
  322. #endif
  323. #ifndef HAL_LINUX_I2C_EXTERNAL_BUS_MASK
  324. #define HAL_LINUX_I2C_EXTERNAL_BUS_MASK 0xFFFF
  325. #endif
  326. #include <AP_HAL_Linux/Semaphores.h>
  327. #define HAL_Semaphore Linux::Semaphore
  328. #define HAL_Semaphore_Recursive Linux::Semaphore_Recursive