| Prusa MINI Firmware overview
    | 
 
 
  
  
 
#include <inttypes.h>
Go to the source code of this file.
|  | 
| int | hwio_di_get_cnt (void) | 
|  | 
| int | hwio_di_get_val (int i_di) | 
|  | 
| int | hwio_do_get_cnt (void) | 
|  | 
| void | hwio_do_set_val (int i_do, int val) | 
|  | 
| int | hwio_adc_get_cnt (void) | 
|  | 
| int | hwio_adc_get_max (int i_adc) | 
|  | 
| int | hwio_adc_get_val (int i_adc) | 
|  | 
| int | hwio_dac_get_cnt (void) | 
|  | 
| int | hwio_dac_get_max (int i_dac) | 
|  | 
| void | hwio_dac_set_val (int i_dac, int val) | 
|  | 
| int | hwio_pwm_get_cnt (void) | 
|  | 
| int | hwio_pwm_get_max (int i_pwm) | 
|  | 
| void | hwio_pwm_set_val (int i_pwm, int val) | 
|  | 
| int | hwio_pwm_get_val (int i_pwm) | 
|  | 
| void | hwio_pwm_set_period_us (int i_pwm, int T_us) | 
|  | 
| int | hwio_pwm_get_period_us (int i_pwm) | 
|  | 
| void | hwio_pwm_set_prescaler (int i_pwm, int prescaler) | 
|  | 
| int | hwio_pwm_get_prescaler (int i_pwm) | 
|  | 
| void | hwio_pwm_set_prescaler_exp2 (int i_pwm, int exp) | 
|  | 
| int | hwio_pwm_get_prescaler_log2 (int i_pwm) | 
|  | 
| int | hwio_fan_get_cnt (void) | 
|  | 
| void | hwio_fan_set_pwm (int i_fan, int val) | 
|  | 
| int | hwio_heater_get_cnt (void) | 
|  | 
| void | hwio_heater_set_pwm (int i_heater, int val) | 
|  | 
| void | hwio_jogwheel_enable (void) | 
|  | 
| void | hwio_jogwheel_disable (void) | 
|  | 
| float | hwio_beeper_get_vol (void) | 
|  | 
| void | hwio_beeper_set_vol (float vol) | 
|  | 
| void | hwio_beeper_set_pwm (uint32_t per, uint32_t pul) | 
|  | 
| void | hwio_beeper_tone (float frq, uint32_t del) | 
|  | 
| void | hwio_beeper_tone2 (float frq, uint32_t del, float vol) | 
|  | 
| void | hwio_beeper_notone (void) | 
|  | 
| void | hwio_update_1ms (void) | 
|  | 
◆ HWIO_CLS_DI
◆ HWIO_CLS_DO
◆ HWIO_CLS_ADC
      
        
          | #define HWIO_CLS_ADC   0x03 | 
      
 
 
◆ HWIO_CLS_DAC
      
        
          | #define HWIO_CLS_DAC   0x04 | 
      
 
 
◆ HWIO_CLS_PWM
      
        
          | #define HWIO_CLS_PWM   0x05 | 
      
 
 
◆ HWIO_CLS_FAN
      
        
          | #define HWIO_CLS_FAN   0x10 | 
      
 
 
◆ HWIO_CLS_HEATER
      
        
          | #define HWIO_CLS_HEATER   0x11 | 
      
 
 
◆ hwio_di_get_cnt()
      
        
          | int hwio_di_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_di_get_val()
      
        
          | int hwio_di_get_val | ( | int | i_di | ) |  | 
      
 
  199     if ((i_di >= 0) && (i_di < 
_DI_CNT))
 
 
 
 
◆ hwio_do_get_cnt()
      
        
          | int hwio_do_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_do_set_val()
      
        
          | void hwio_do_set_val | ( | int | i_do, | 
        
          |  |  | int | val | 
        
          |  | ) |  |  | 
      
 
  226     if ((i_do >= 0) && (i_do < 
_DO_CNT))
 
 
 
 
◆ hwio_adc_get_cnt()
      
        
          | int hwio_adc_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_adc_get_max()
      
        
          | int hwio_adc_get_max | ( | int | i_adc | ) |  | 
      
 
 
◆ hwio_adc_get_val()
      
        
          | int hwio_adc_get_val | ( | int | i_adc | ) |  | 
      
 
  248     if ((i_adc >= 0) && (i_adc < 
_ADC_CNT))
 
 
 
 
◆ hwio_dac_get_cnt()
      
        
          | int hwio_dac_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_dac_get_max()
      
        
          | int hwio_dac_get_max | ( | int | i_dac | ) |  | 
      
 
 
◆ hwio_dac_set_val()
      
        
          | void hwio_dac_set_val | ( | int | i_dac, | 
        
          |  |  | int | val | 
        
          |  | ) |  |  | 
      
 
 
◆ hwio_pwm_get_cnt()
      
        
          | int hwio_pwm_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_pwm_get_max()
      
        
          | int hwio_pwm_get_max | ( | int | i_pwm | ) |  | 
      
 
 
◆ hwio_pwm_set_val()
      
        
          | void hwio_pwm_set_val | ( | int | i_pwm, | 
        
          |  |  | int | val | 
        
          |  | ) |  |  | 
      
 
  393         uint32_t pulse = (val * pwm_analogWrite_max) / pwm_max;
 
 
 
 
◆ hwio_pwm_get_val()
      
        
          | int hwio_pwm_get_val | ( | int | i_pwm | ) |  | 
      
 
 
◆ hwio_pwm_set_period_us()
      
        
          | void hwio_pwm_set_period_us | ( | int | i_pwm, | 
        
          |  |  | int | T_us | 
        
          |  | ) |  |  | 
      
 
  292     if (T_us == *ptr_period_us)
 
  298     *ptr_period_us = T_us;
 
 
 
 
◆ hwio_pwm_get_period_us()
      
        
          | int hwio_pwm_get_period_us | ( | int | i_pwm | ) |  | 
      
 
 
◆ hwio_pwm_set_prescaler()
      
        
          | void hwio_pwm_set_prescaler | ( | int | i_pwm, | 
        
          |  |  | int | prescaler | 
        
          |  | ) |  |  | 
      
 
  325     *ptr_period_us = T_us;
 
 
 
 
◆ hwio_pwm_get_prescaler()
      
        
          | int hwio_pwm_get_prescaler | ( | int | i_pwm | ) |  | 
      
 
 
◆ hwio_pwm_set_prescaler_exp2()
      
        
          | void hwio_pwm_set_prescaler_exp2 | ( | int | i_pwm, | 
        
          |  |  | int | exp | 
        
          |  | ) |  |  | 
      
 
  345     uint32_t prescaler = (1 << (exp)) - 1;
 
 
 
 
◆ hwio_pwm_get_prescaler_log2()
      
        
          | int hwio_pwm_get_prescaler_log2 | ( | int | i_pwm | ) |  | 
      
 
  356     while (prescaler != 0) {
 
  358         prescaler = prescaler >> 1;
 
 
 
 
◆ hwio_fan_get_cnt()
      
        
          | int hwio_fan_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_fan_set_pwm()
      
        
          | void hwio_fan_set_pwm | ( | int | i_fan, | 
        
          |  |  | int | val | 
        
          |  | ) |  |  | 
      
 
 
◆ hwio_heater_get_cnt()
      
        
          | int hwio_heater_get_cnt | ( | void |  | ) |  | 
      
 
 
◆ hwio_heater_set_pwm()
      
        
          | void hwio_heater_set_pwm | ( | int | i_heater, | 
        
          |  |  | int | val | 
        
          |  | ) |  |  | 
      
 
 
◆ hwio_jogwheel_enable()
◆ hwio_jogwheel_disable()
◆ hwio_beeper_get_vol()
      
        
          | float hwio_beeper_get_vol | ( | void |  | ) |  | 
      
 
 
◆ hwio_beeper_set_vol()
      
        
          | void hwio_beeper_set_vol | ( | float | vol | ) |  | 
      
 
 
◆ hwio_beeper_set_pwm()
      
        
          | void hwio_beeper_set_pwm | ( | uint32_t | per, | 
        
          |  |  | uint32_t | pul | 
        
          |  | ) |  |  | 
      
 
  502             sConfigOC.
Pulse = pul;
 
  505             sConfigOC.
Pulse = per;
 
 
 
 
◆ hwio_beeper_tone()
      
        
          | void hwio_beeper_tone | ( | float | frq, | 
        
          |  |  | uint32_t | del | 
        
          |  | ) |  |  | 
      
 
  523         per = (uint32_t)(84000000.0
F / frq);
 
 
 
 
◆ hwio_beeper_tone2()
      
        
          | void hwio_beeper_tone2 | ( | float | frq, | 
        
          |  |  | uint32_t | del, | 
        
          |  |  | float | vol | 
        
          |  | ) |  |  | 
      
 
 
◆ hwio_beeper_notone()
◆ hwio_update_1ms()
 
 
int is_pwm_id_valid(int i_pwm)
Definition: hwio_a3ides_2209_02.c:269
uint32_t Period
Definition: stm32f4xx_hal_tim.h:71
int _adc_val[]
Definition: hwio_a3ides_2209_02.c:85
HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim)
const int _pwm_max[]
Definition: hwio_a3ides_2209_02.c:135
#define TIM_OCFAST_DISABLE
Definition: stm32f4xx_hal_tim.h:377
HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
void hwio_beeper_tone(float frq, uint32_t del)
Definition: hwio_a3ides_2209_02.c:514
#define _PWM_CNT
Definition: hwio_a3ides_2209_02.c:136
void _hwio_pwm_analogWrite_set_val(int i_pwm, int val)
Definition: hwio_a3ides_2209_02.c:429
uint32_t ClockDivision
Definition: stm32f4xx_hal_tim.h:75
#define _HEATER_ID_MAX
Definition: hwio_a3ides_2209_02.c:98
const uint32_t _do_pin32[]
Definition: hwio_a3ides_2209_02.c:57
int hwio_jogwheel_enabled
Definition: hwio_a3ides_2209_02.c:176
uint32_t OCPolarity
Definition: stm32f4xx_hal_tim.h:100
#define _DI_CNT
Definition: hwio_a3ides_2209_02.c:54
const int _adc_max[]
Definition: hwio_a3ides_2209_02.c:82
TIM_HandleTypeDef htim2
Definition: main.c:86
#define _HEATER_ID_MIN
Definition: hwio_a3ides_2209_02.c:97
uint32_t OCFastMode
Definition: stm32f4xx_hal_tim.h:107
void hwio_beeper_set_pwm(uint32_t per, uint32_t pul)
Definition: hwio_a3ides_2209_02.c:491
uint32_t CounterMode
Definition: stm32f4xx_hal_tim.h:68
#define _ADC_CNT
Definition: hwio_a3ides_2209_02.c:83
#define TIM_OCMODE_PWM1
Definition: stm32f4xx_hal_tim.h:365
float hwio_beeper_vol
Definition: hwio_a3ides_2209_02.c:178
TIM Output Compare Configuration Structure definition.
Definition: stm32f4xx_hal_tim.h:92
#define F(str)
Definition: UHS_macros.h:164
#define _DO_CNT
Definition: hwio_a3ides_2209_02.c:71
static int gpio_get(uint8_t pin8)
Definition: gpio.h:94
#define TIM_CLOCKDIVISION_DIV1
Definition: stm32f4xx_hal_tim.h:351
HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
#define _FAN_CNT
Definition: hwio_a3ides_2209_02.c:95
void hwio_pwm_set_prescaler(int i_pwm, int prescaler)
Definition: hwio_a3ides_2209_02.c:306
void _hwio_pwm_set_val(int i_pwm, int val)
Definition: hwio_a3ides_2209_02.c:397
#define _HEATER_CNT
Definition: hwio_a3ides_2209_02.c:99
#define _FAN_ID_MIN
Definition: hwio_a3ides_2209_02.c:93
#define TIM_COUNTERMODE_DOWN
Definition: stm32f4xx_hal_tim.h:340
#define TIM_CHANNEL_1
Definition: stm32f4xx_hal_tim.h:422
const int _dac_max[]
Definition: hwio_a3ides_2209_02.c:90
uint32_t Prescaler
Definition: stm32f4xx_hal_tim.h:65
uint32_t _pwm_get_chan(int i_pwm)
Definition: hwio_a3ides_2209_02.c:363
uint32_t Pulse
Definition: stm32f4xx_hal_tim.h:97
uint32_t OCMode
Definition: stm32f4xx_hal_tim.h:94
int _pwm_analogWrite_val[_PWM_CNT]
Definition: hwio_a3ides_2209_02.c:151
#define _FAN_ID_MAX
Definition: hwio_a3ides_2209_02.c:94
int hwio_pwm_get_max(int i_pwm)
Definition: hwio_a3ides_2209_02.c:276
#define TIM_OCPOLARITY_HIGH
Definition: stm32f4xx_hal_tim.h:386
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
uint32_t hwio_beeper_del
Definition: hwio_a3ides_2209_02.c:179
static void gpio_set(uint8_t pin8, int state)
Definition: gpio.h:98
#define TIM_OCPOLARITY_LOW
Definition: stm32f4xx_hal_tim.h:387
TIM Time Base Handle Structure definition.
Definition: stm32f4xx_hal_tim.h:287
#define _DAC_CNT
Definition: hwio_a3ides_2209_02.c:91
TIM_Base_InitTypeDef Init
Definition: stm32f4xx_hal_tim.h:290
#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__)
Gets the TIM Capture Compare Register value on runtime.
Definition: stm32f4xx_hal_tim.h:1132
int hwio_pwm_get_prescaler(int i_pwm)
Definition: hwio_a3ides_2209_02.c:327
const uint32_t _di_pin32[]
Definition: hwio_a3ides_2209_02.c:44
#define GEN_PERIOD_US(prescaler, period)
Definition: timer_defaults.h:16
#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__)
Set the TIM Prescaler on runtime.
Definition: stm32f4xx_hal_tim.h:1077
#define TIM_BASE_CLK_MHZ
Definition: timer_defaults.h:6
TIM_HandleTypeDef * _pwm_get_htim(int i_pwm)
Definition: hwio_a3ides_2209_02.c:369
const int _pwm_analogWrite_max[_PWM_CNT]
Definition: hwio_a3ides_2209_02.c:149
int *const _pwm_period_us[]
Definition: hwio_a3ides_2209_02.c:127
void hwio_beeper_set_vol(float vol)
Definition: hwio_a3ides_2209_02.c:483