You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.5 KiB
C
88 lines
2.5 KiB
C
4 weeks ago
|
/*
|
||
|
* PWMSingleInterace.h
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include "PERIPHERY/PWMInterface.h"
|
||
|
|
||
|
|
||
|
#ifndef CELLQAUNTITYINPHASE
|
||
|
#define CELLQAUNTITYINPHASE 5
|
||
|
#endif
|
||
|
|
||
|
|
||
|
|
||
|
#ifndef PERIPHERY_PWMSINGLEINTERFACE_H_
|
||
|
#define PERIPHERY_PWMSINGLEINTERFACE_H_
|
||
|
|
||
|
namespace PERIPHERY
|
||
|
{
|
||
|
|
||
|
|
||
|
struct PWMSInterfaceConfiguration: public PWMInterfaceConfiguration
|
||
|
{
|
||
|
uint16_t cascade_quantity;
|
||
|
uint16_t cell_quantity;
|
||
|
uint16_t cell_quantity_in_cascade[18];
|
||
|
PWMSInterfaceConfiguration():
|
||
|
PWMInterfaceConfiguration(),
|
||
|
cascade_quantity(),
|
||
|
cell_quantity(0),
|
||
|
cell_quantity_in_cascade()
|
||
|
{}
|
||
|
};//PWMSingleStructureConfiguration
|
||
|
|
||
|
|
||
|
|
||
|
class PWMSInterace: public PWMInterface
|
||
|
{
|
||
|
private:
|
||
|
PWMPhaseStructure m_phase;
|
||
|
PWMHardFaultRegister m_hard_fault;
|
||
|
public:
|
||
|
PWMSInterace();
|
||
|
public:
|
||
|
void setup(uint16_t *memzone);
|
||
|
void setup(const PWMStructureSetup& setup);
|
||
|
void setup(uint16_t *memzone, const PWMStructureSetup& setup);
|
||
|
private:
|
||
|
void _setup_phase(PWMPhaseStructure& phase, uint16_t *base);
|
||
|
public:
|
||
|
void set_frequency(uint16_t freq);
|
||
|
//void set_cascade_quantity(uint16_t quant);
|
||
|
void set_cell_quantity_phase(uint16_t quant);
|
||
|
void set_cmp(uint16_t cmpr);
|
||
|
void set_order(uint16_t order);
|
||
|
void get_board_state(uint16_t& statebard);
|
||
|
void get_sw_version(uint16_t& version);
|
||
|
void get_breakdown_cell_state(uint16_t& cellstate);
|
||
|
void get_breakdown_cell_index(uint16_t& cellindex);
|
||
|
void set_cell_quantity_cascade(uint16_t cascadenum, uint16_t quant);
|
||
|
//
|
||
|
void broadcast_order(uint16_t order);
|
||
|
void broadcast_cell_quantity_phase(uint16_t quant);
|
||
|
void broadcast_freq(uint16_t freq);
|
||
|
//
|
||
|
void get_hard_fault(uint16_t& hard_fault);
|
||
|
//
|
||
|
void get_indirect_access(uint16_t cascade, uint16_t cell, uint16_t offset, uint16_t& telemetry);
|
||
|
//
|
||
|
void telemetry_execute(PWMSInterfaceConfiguration& config, PWMPhaseTelemetryValue& telemetry_phase);
|
||
|
void reset_telemetry();
|
||
|
void set_telemetry_sequence_one();
|
||
|
void set_telemetry_sequence_two();
|
||
|
//
|
||
|
private:
|
||
|
void (PWMSInterace::*_telemetry_execute)(PWMSInterfaceConfiguration& config, PWMPhaseTelemetryValue& telemetry_phase);
|
||
|
void _telemetry_sequence_one(PWMSInterfaceConfiguration& config, PWMPhaseTelemetryValue& telemetry_phase);
|
||
|
void _telemetry_sequence_two(PWMSInterfaceConfiguration& config, PWMPhaseTelemetryValue& telemetry_phase);
|
||
|
//
|
||
|
};//class
|
||
|
|
||
|
} /* namespace PERIPHERY */
|
||
|
|
||
|
#endif /* PERIPHERY_PWMSINGLEINTERFACE_H_ */
|
||
|
|