mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 03:50:58 +00:00
WIP - optiga
This commit is contained in:
parent
67c00b4c9b
commit
0223078e91
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CORE_OPTIGA_HAL_H
|
||||
#define CORE_OPTIGA_HAL_H
|
||||
@ -6,6 +24,8 @@
|
||||
|
||||
void optiga_hal_init(void);
|
||||
|
||||
void optiga_hal_deinit(void);
|
||||
|
||||
void optiga_reset(void);
|
||||
|
||||
#endif // CORE_OPTIGA_HAL_H
|
||||
|
@ -38,6 +38,24 @@ void optiga_hal_init(void) {
|
||||
hal_delay(20);
|
||||
}
|
||||
|
||||
void optiga_hal_deinit(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = OPTIGA_RST_PIN;
|
||||
HAL_GPIO_Init(OPTIGA_RST_PORT, &GPIO_InitStructure);
|
||||
|
||||
#ifdef OPTIGA_PWR_PIN
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = OPTIGA_PWR_PIN;
|
||||
HAL_GPIO_Init(OPTIGA_PWR_PORT, &GPIO_InitStructure);
|
||||
#endif
|
||||
}
|
||||
|
||||
void optiga_reset(void) {
|
||||
HAL_GPIO_WritePin(OPTIGA_RST_PORT, OPTIGA_RST_PIN, GPIO_PIN_RESET);
|
||||
hal_delay(10);
|
||||
|
@ -21,6 +21,10 @@ void optiga_hal_init(void) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
void optiga_hal_deinit(void) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
void optiga_reset(void) {
|
||||
// nothing to do
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user