openpilot v0.9.6 release
date: 2024-01-12T10:13:37 master commit: ba792d576a49a0899b88a753fa1c52956bedf9e6
This commit is contained in:
46
panda/board/stm32h7/board.h
Normal file
46
panda/board/stm32h7/board.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// ///////////////////////////////////////////////////////////// //
|
||||
// Hardware abstraction layer for all different supported boards //
|
||||
// ///////////////////////////////////////////////////////////// //
|
||||
#include "boards/board_declarations.h"
|
||||
#include "boards/unused_funcs.h"
|
||||
|
||||
// ///// Board definition and detection ///// //
|
||||
#include "stm32h7/lladc.h"
|
||||
#include "drivers/harness.h"
|
||||
#include "drivers/fan.h"
|
||||
#include "stm32h7/llfan.h"
|
||||
#include "stm32h7/llrtc.h"
|
||||
#include "stm32h7/lldac.h"
|
||||
#include "drivers/fake_siren.h"
|
||||
#include "drivers/rtc.h"
|
||||
#include "drivers/clock_source.h"
|
||||
#include "boards/red.h"
|
||||
#include "boards/red_chiplet.h"
|
||||
#include "boards/red_v2.h"
|
||||
#include "boards/tres.h"
|
||||
|
||||
|
||||
uint8_t get_board_id(void) {
|
||||
return detect_with_pull(GPIOF, 7, PULL_UP) |
|
||||
(detect_with_pull(GPIOF, 8, PULL_UP) << 1U) |
|
||||
(detect_with_pull(GPIOF, 9, PULL_UP) << 2U) |
|
||||
(detect_with_pull(GPIOF, 10, PULL_UP) << 3U);
|
||||
}
|
||||
|
||||
void detect_board_type(void) {
|
||||
const uint8_t board_id = get_board_id();
|
||||
|
||||
if (board_id == 0U) {
|
||||
hw_type = HW_TYPE_RED_PANDA;
|
||||
current_board = &board_red;
|
||||
} else if (board_id == 1U) {
|
||||
hw_type = HW_TYPE_RED_PANDA_V2;
|
||||
current_board = &board_red_v2;
|
||||
} else if (board_id == 2U) {
|
||||
hw_type = HW_TYPE_TRES;
|
||||
current_board = &board_tres;
|
||||
} else {
|
||||
hw_type = HW_TYPE_UNKNOWN;
|
||||
print("Hardware type is UNKNOWN!\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user