kopia lustrzana https://github.com/OpenRTX/OpenRTX
In all the platforms having it, added RTC initialisation to platform_init()
rodzic
641dcc13e9
commit
142d6e90b9
|
@ -24,6 +24,7 @@
|
||||||
#include <ADC1_MDx.h>
|
#include <ADC1_MDx.h>
|
||||||
#include <calibInfo_MDx.h>
|
#include <calibInfo_MDx.h>
|
||||||
#include <toneGenerator_MDx.h>
|
#include <toneGenerator_MDx.h>
|
||||||
|
#include <interfaces/rtc.h>
|
||||||
|
|
||||||
md3x0Calib_t calibration;
|
md3x0Calib_t calibration;
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ void platform_init()
|
||||||
*/
|
*/
|
||||||
adc1_init();
|
adc1_init();
|
||||||
|
|
||||||
|
nvm_init(); /* Initialise non volatile memory manager */
|
||||||
|
nvm_readCalibData(&calibration); /* Load calibration data */
|
||||||
|
toneGen_init(); /* Initialise tone generator */
|
||||||
|
rtc_init(); /* Initialise RTC */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure TIM8 for backlight PWM: Fpwm = 100kHz with 8 bit of resolution.
|
* Configure TIM8 for backlight PWM: Fpwm = 100kHz with 8 bit of resolution.
|
||||||
* APB2 freq. is 84MHz, but timer runs at twice this frequency.
|
* APB2 freq. is 84MHz, but timer runs at twice this frequency.
|
||||||
|
@ -72,17 +78,6 @@ void platform_init()
|
||||||
TIM8->CCR1 = 0;
|
TIM8->CCR1 = 0;
|
||||||
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
||||||
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise non volatile memory manager and load calibration data.
|
|
||||||
*/
|
|
||||||
nvm_init();
|
|
||||||
nvm_readCalibData(&calibration);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise tone generator
|
|
||||||
*/
|
|
||||||
toneGen_init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_terminate()
|
void platform_terminate()
|
||||||
|
@ -99,11 +94,11 @@ void platform_terminate()
|
||||||
RCC->APB2ENR &= ~RCC_APB2ENR_TIM8EN;
|
RCC->APB2ENR &= ~RCC_APB2ENR_TIM8EN;
|
||||||
__DSB();
|
__DSB();
|
||||||
|
|
||||||
/* Shut down ADC */
|
/* Shut down all the modules */
|
||||||
adc1_terminate();
|
adc1_terminate();
|
||||||
|
|
||||||
/* Shut down NVM driver */
|
|
||||||
nvm_terminate();
|
nvm_terminate();
|
||||||
|
toneGen_terminate();
|
||||||
|
rtc_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
float platform_getVbat()
|
float platform_getVbat()
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <ADC1_MDx.h>
|
#include <ADC1_MDx.h>
|
||||||
#include <calibInfo_MDx.h>
|
#include <calibInfo_MDx.h>
|
||||||
#include <toneGenerator_MDx.h>
|
#include <toneGenerator_MDx.h>
|
||||||
|
#include <interfaces/rtc.h>
|
||||||
|
|
||||||
md3x0Calib_t calibration;
|
md3x0Calib_t calibration;
|
||||||
|
|
||||||
|
@ -50,6 +51,11 @@ void platform_init()
|
||||||
*/
|
*/
|
||||||
adc1_init();
|
adc1_init();
|
||||||
|
|
||||||
|
nvm_init(); /* Initialise non volatile memory manager */
|
||||||
|
nvm_readCalibData(&calibration); /* Load calibration data */
|
||||||
|
toneGen_init(); /* Initialise tone generator */
|
||||||
|
rtc_init(); /* Initialise RTC */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure TIM8 for backlight PWM: Fpwm = 100kHz with 8 bit of resolution.
|
* Configure TIM8 for backlight PWM: Fpwm = 100kHz with 8 bit of resolution.
|
||||||
* APB2 freq. is 84MHz, but timer runs at twice this frequency.
|
* APB2 freq. is 84MHz, but timer runs at twice this frequency.
|
||||||
|
@ -72,17 +78,6 @@ void platform_init()
|
||||||
TIM8->CCR1 = 0;
|
TIM8->CCR1 = 0;
|
||||||
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
||||||
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise non volatile memory manager and load calibration data.
|
|
||||||
*/
|
|
||||||
nvm_init();
|
|
||||||
nvm_readCalibData(&calibration);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise tone generator
|
|
||||||
*/
|
|
||||||
toneGen_init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_terminate()
|
void platform_terminate()
|
||||||
|
@ -99,11 +94,11 @@ void platform_terminate()
|
||||||
RCC->APB2ENR &= ~RCC_APB2ENR_TIM8EN;
|
RCC->APB2ENR &= ~RCC_APB2ENR_TIM8EN;
|
||||||
__DSB();
|
__DSB();
|
||||||
|
|
||||||
/* Shut down ADC */
|
/* Shut down all the modules */
|
||||||
adc1_terminate();
|
adc1_terminate();
|
||||||
|
|
||||||
/* Shut down NVM driver */
|
|
||||||
nvm_terminate();
|
nvm_terminate();
|
||||||
|
toneGen_terminate();
|
||||||
|
rtc_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
float platform_getVbat()
|
float platform_getVbat()
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <ADC1_MDx.h>
|
#include <ADC1_MDx.h>
|
||||||
#include <calibInfo_MDx.h>
|
#include <calibInfo_MDx.h>
|
||||||
#include <interfaces/nvmem.h>
|
#include <interfaces/nvmem.h>
|
||||||
|
#include <interfaces/rtc.h>
|
||||||
|
|
||||||
mduv3x0Calib_t calibration;
|
mduv3x0Calib_t calibration;
|
||||||
|
|
||||||
|
@ -69,6 +70,10 @@ void platform_init()
|
||||||
*/
|
*/
|
||||||
adc1_init();
|
adc1_init();
|
||||||
|
|
||||||
|
nvm_init(); /* Initialise non volatile memory manager */
|
||||||
|
nvm_readCalibData(&calibration); /* Load calibration data */
|
||||||
|
rtc_init(); /* Initialise RTC */
|
||||||
|
|
||||||
#ifdef ENABLE_BKLIGHT_DIMMING
|
#ifdef ENABLE_BKLIGHT_DIMMING
|
||||||
/*
|
/*
|
||||||
* Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution.
|
* Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution.
|
||||||
|
@ -98,12 +103,6 @@ void platform_init()
|
||||||
NVIC_SetPriority(TIM1_TRG_COM_TIM11_IRQn,15);
|
NVIC_SetPriority(TIM1_TRG_COM_TIM11_IRQn,15);
|
||||||
NVIC_EnableIRQ(TIM1_TRG_COM_TIM11_IRQn);
|
NVIC_EnableIRQ(TIM1_TRG_COM_TIM11_IRQn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise non volatile memory manager and load calibration data.
|
|
||||||
*/
|
|
||||||
nvm_init();
|
|
||||||
nvm_readCalibData(&calibration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_terminate()
|
void platform_terminate()
|
||||||
|
@ -120,11 +119,10 @@ void platform_terminate()
|
||||||
gpio_clearPin(GREEN_LED);
|
gpio_clearPin(GREEN_LED);
|
||||||
gpio_clearPin(RED_LED);
|
gpio_clearPin(RED_LED);
|
||||||
|
|
||||||
/* Shut down ADC */
|
/* Shut down all the modules */
|
||||||
adc1_terminate();
|
adc1_terminate();
|
||||||
|
|
||||||
/* Shut down NVM driver */
|
|
||||||
nvm_terminate();
|
nvm_terminate();
|
||||||
|
rtc_terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
float platform_getVbat()
|
float platform_getVbat()
|
||||||
|
|
Ładowanie…
Reference in New Issue