This repository has been archived on 2026-06-17. You can view files and clone it, but cannot push or open issues or pull requests.
FireWatchTower_2axis/firmware/lib/tmc/helpers/Config.h

42 lines
1.2 KiB
C
Executable File

/*******************************************************************************
* Copyright © 2018 TRINAMIC Motion Control GmbH & Co. KG
* (now owned by Analog Devices Inc.),
*
* Copyright © 2023 Analog Devices Inc. All Rights Reserved.
* This software is proprietary to Analog Devices, Inc. and its licensors.
*******************************************************************************/
#ifndef TMC_HELPERS_CONFIG_H_
#define TMC_HELPERS_CONFIG_H_
#include "Constants.h"
#include "Types.h"
// Callback functions have IC-dependent parameters
// To store the function pointers we use this dummy type, which is never
// called without casting it to the IC-specific type first.
// (Casting between function pointers is allowed by the C standard)
typedef void (*tmc_callback_config)(void);
// States of a configuration
typedef enum {
CONFIG_READY,
CONFIG_RESET,
CONFIG_RESTORE
} ConfigState;
// structure for configuration mechanism
typedef struct
{
ConfigState state;
uint8_t configIndex;
int32_t shadowRegister[TMC_REGISTER_COUNT];
uint8_t (*reset) (void);
uint8_t (*restore) (void);
tmc_callback_config callback;
uint8_t channel;
} ConfigurationTypeDef;
#endif /* TMC_HELPERS_CONFIG_H_ */