mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Hookup PWM
This commit is contained in:
@@ -100,7 +100,7 @@ void timer0_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t
|
||||
} else if (state == TIMER_EVENT_COMP1) {
|
||||
// MSG((char *)"timer event comp1! \r\n");
|
||||
// Used to turn tip off at set point in cycle
|
||||
|
||||
PWM_Channel_Disable(PWM_Channel);
|
||||
} else if (state == TIMER_EVENT_COMP2) {
|
||||
start_adc_misc();
|
||||
// This occurs at timer rollover, so if we want to turn on the output PWM; we do so
|
||||
@@ -117,9 +117,11 @@ void timer0_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t
|
||||
if (pendingPWM > 0) {
|
||||
TIMER_SetCompValue(TIMER_CH0, TIMER_COMP_ID_1, pendingPWM - 1);
|
||||
// Turn on output
|
||||
PWM_Channel_Enable(PWM_Channel);
|
||||
} else {
|
||||
TIMER_SetCompValue(TIMER_CH0, TIMER_COMP_ID_1, 0);
|
||||
// Leave output off
|
||||
PWM_Channel_Disable(PWM_Channel);
|
||||
}
|
||||
}
|
||||
// unblock the PID controller thread
|
||||
|
||||
@@ -49,7 +49,7 @@ void setup_pwm(void) {
|
||||
BL_Err_Type err = PWM_Channel_Init(&cfg);
|
||||
uint32_t pwm_clk = peripheral_clock_get(PERIPHERAL_CLOCK_PWM);
|
||||
MSG((char *)"PWM Setup returns %d %d\r\n", err, pwm_clk);
|
||||
PWM_Channel_Enable(PWM_Channel);
|
||||
PWM_Channel_Disable(PWM_Channel);
|
||||
}
|
||||
void setup_adc(void) {
|
||||
MSG((char *)"Setting up ADC\r\n");
|
||||
|
||||
@@ -270,6 +270,7 @@ CPUFLAGS= -march=rv32imafc \
|
||||
-mabi=ilp32f \
|
||||
-mcmodel=medany -fsigned-char -fno-builtin -nostartfiles \
|
||||
-DportasmHANDLE_INTERRUPT=FreeRTOS_Interrupt_Handler -DARCH_RISCV -D__RISCV_FEATURE_MVE=0 -DportUSING_MPU_WRAPPERS=0
|
||||
# -DBFLB_USE_ROM_DRIVER=1
|
||||
DEV_LDFLAGS=-nostartfiles --specs=patch.specs -DDEBUG
|
||||
DEV_AFLAGS=
|
||||
DEV_GLOBAL_DEFS=
|
||||
|
||||
Reference in New Issue
Block a user