no-OS
Functions | Variables
pilot.c File Reference

Pilot phase implementation file. More...

#include "no_os_print_log.h"
#include "interface.h"
#include "adc_reva.h"
#include "ade9113.h"
#include "pilot.h"
#include "gpio.h"
#include "tmr.h"
#include "adc.h"
Include dependency graph for pilot.c:

Functions

void TMR0_IRQHandler_CP ()
 TMR0 ISR. More...
 
void TMR1_IRQHandler_CP ()
 TMR1 ISR. More...
 
int get_pwm_low_flag_state (void)
 Get PWM low flag value. More...
 
uint32_t get_pwm_low_val (void)
 Get PWM LOW value. More...
 
uint32_t get_pwm_high_val (void)
 Get PWM HIGH value. More...
 
void reset_pwm_low_flag_state (void)
 Reset PWM low flag value. More...
 
int pilot_init (struct stout *stout)
 Initialize pilot phase. More...
 
void pilot_pwm_timer_setup (unsigned int duty_cycle)
 Set PMW parameters. More...
 
int pilot_interrupts_setup (struct no_os_irq_ctrl_desc *desc, struct stout *stout)
 Set pilot CP analog read interrupts. More...
 
void pilot_pwm_timer_set_duty_cycle (struct stout *stout, unsigned int duty_cycle)
 Set PMW duty cycle. More...
 
int pilot_setup_adc (void)
 Set PMW duty cycle. More...
 
unsigned int pilot_read_val (void)
 Read PWM voltage value. More...
 
uint32_t pilot_convert_to_mv (uint32_t value)
 Compute ADC voltage value. More...
 
uint32_t pilot_compute_average (uint8_t high)
 Compute PWM value average. More...
 
int pilot_write_new_values (struct stout *stout)
 Update PWM values in the state machine structure. More...
 
void pilot_update_vals (void)
 Update PWM values. More...
 
uint32_t get_count_ms (void)
 
void reset_count_ms (void)
 

Variables

struct no_os_irq_ctrl_descstout_nvic_desc
 

Detailed Description

Pilot phase implementation file.

Author
GMois (georg.nosp@m.e.mo.nosp@m.is@an.nosp@m.alog.nosp@m..com), REtz (radu..nosp@m.etz@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright (c) 2023 Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ get_count_ms()

uint32_t get_count_ms ( void  )

Get milliseconds count

Here is the caller graph for this function:

◆ get_pwm_high_val()

uint32_t get_pwm_high_val ( void  )

Get PWM HIGH value.

Returns
PWM HIGH value

◆ get_pwm_low_flag_state()

int get_pwm_low_flag_state ( void  )

Get PWM low flag value.

Returns
flag value
Here is the caller graph for this function:

◆ get_pwm_low_val()

uint32_t get_pwm_low_val ( void  )

Get PWM LOW value.

Returns
PWM LOW value

◆ pilot_compute_average()

uint32_t pilot_compute_average ( uint8_t  high)

Compute PWM value average.

Parameters
high- 1 - HIGH PWM value
  • 0 - LOW PWM value
Returns
average value comouted from last read values
Here is the caller graph for this function:

◆ pilot_convert_to_mv()

uint32_t pilot_convert_to_mv ( uint32_t  value)

Compute ADC voltage value.

Parameters
value- rad ADC value
Returns
ADC value in mV

◆ pilot_init()

int pilot_init ( struct stout stout)

Initialize pilot phase.

Returns
0 in case of success, error code otherwise
Here is the caller graph for this function:

◆ pilot_interrupts_setup()

int pilot_interrupts_setup ( struct no_os_irq_ctrl_desc desc,
struct stout stout 
)

Set pilot CP analog read interrupts.

Parameters
desc- NVIC IRQ controller description
stout- the stout device structure
Returns
0 in case of success, error code otherwise
Here is the caller graph for this function:

◆ pilot_pwm_timer_set_duty_cycle()

void pilot_pwm_timer_set_duty_cycle ( struct stout stout,
unsigned int  duty_cycle 
)

Set PMW duty cycle.

Parameters
stout- state machine descriptor
duty_cycle- duty cycle of output PWM times 10
Returns
none
Here is the caller graph for this function:

◆ pilot_pwm_timer_setup()

void pilot_pwm_timer_setup ( unsigned int  duty_cycle)

Set PMW parameters.

Parameters
duty_cycle- duty cycle of output PWM
Returns
none
Here is the caller graph for this function:

◆ pilot_read_val()

unsigned int pilot_read_val ( void  )

Read PWM voltage value.

Returns
ADC value

◆ pilot_setup_adc()

int pilot_setup_adc ( void  )

Set PMW duty cycle.

Setup PWM voltage CP analog ADC

Returns
0 in case of success, error code otherwise
Here is the caller graph for this function:

◆ pilot_update_vals()

void pilot_update_vals ( void  )

Update PWM values.

Returns
none
Here is the caller graph for this function:

◆ pilot_write_new_values()

int pilot_write_new_values ( struct stout stout)

Update PWM values in the state machine structure.

Parameters
stout- state machine descriptor
Returns
ADC value in mV
Here is the caller graph for this function:

◆ reset_count_ms()

void reset_count_ms ( void  )

Reset milliseconds count

Here is the caller graph for this function:

◆ reset_pwm_low_flag_state()

void reset_pwm_low_flag_state ( void  )

Reset PWM low flag value.

Returns
none
Here is the caller graph for this function:

◆ TMR0_IRQHandler_CP()

void TMR0_IRQHandler_CP ( )

TMR0 ISR.

Returns
none
Here is the caller graph for this function:

◆ TMR1_IRQHandler_CP()

void TMR1_IRQHandler_CP ( )

TMR1 ISR.

Returns
none
Here is the caller graph for this function:

Variable Documentation

◆ stout_nvic_desc

struct no_os_irq_ctrl_desc* stout_nvic_desc