More refactoring
Lots of things removed but compiles again
This commit is contained in:
70
source/driver.h
Normal file
70
source/driver.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef _DRIVER_H
|
||||
#define _DRIVER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "fgen.h"
|
||||
|
||||
#define MAIN_PSU_ENBL 0b00000100 // Active Low U13 D2
|
||||
#define V_18V 0
|
||||
#define V_21V 88
|
||||
|
||||
#define V_24V 118
|
||||
#define V_27V 148
|
||||
#define V_30V 171
|
||||
#define V_36V 218
|
||||
#define V_42V 250
|
||||
#define V_55V 255
|
||||
#define MAX_AB_PSU V_24V //TODO
|
||||
|
||||
#define MAX_D_PSU V_36V
|
||||
#define MAX_CLAMP_PSU 255
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POWER_LEVEL_0 = 0,
|
||||
POWER_LEVEL_1,
|
||||
POWER_LEVEL_2,
|
||||
POWER_LEVEL_3,
|
||||
POWER_LEVEL_4,
|
||||
} PowerLevel_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DRIVER_STATE_INIT = 0,
|
||||
DRIVER_STATE_WAIT_PSU,
|
||||
DRIVER_STATE_SWITCH_FREQUENCY,
|
||||
} DriverState_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DriverState_t state;
|
||||
bool initState;
|
||||
|
||||
uint32_t stateTimer;
|
||||
|
||||
uint8_t psuValue;
|
||||
uint8_t psuValueMax;
|
||||
|
||||
FREQUENCY_t *frequency;
|
||||
PowerLevel_t powerLevel;
|
||||
|
||||
} TxDriver_t;
|
||||
|
||||
TxDriver_t * driver_getDriver(void);
|
||||
void driver_setPSUVoltage(uint8_t value);
|
||||
void driver_setAmplitude(uint8_t value);
|
||||
void driver_isolateOutput(bool isolate);
|
||||
void driver_enablePower(bool enable);
|
||||
void driver_init(void);
|
||||
void driver_monitor(void);
|
||||
void driver_service(void);
|
||||
void driver_setDuty(uint32_t duty);
|
||||
void driver_broadcastOn(bool on);
|
||||
void driver_setFrequency(FREQUENCY_t *freq);
|
||||
void driver_setPower(PowerLevel_t powerLevel);
|
||||
FREQUENCY_t *driver_getFrequency(void);
|
||||
void driver_setSafe(bool safe);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user