Files
beyon-motion/TMC2209/lib/tmc/helpers/Config.h
2026-03-31 13:10:37 +02:00

42 lines
1.3 KiB
C

/*******************************************************************************
* 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 & confidential 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_ */