kopia lustrzana https://github.com/OpenRTX/OpenRTX
Added to platform API a function allowing to retrieve device calibration data
rodzic
d4cdba2243
commit
774468ae46
|
@ -108,4 +108,11 @@ void platform_beepStop();
|
|||
*/
|
||||
void platform_setBacklightLevel(uint8_t level);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the device-specific calbration data,
|
||||
* application code has to cast it to the correct data structure.
|
||||
* @return pointer to device's calibration data.
|
||||
*/
|
||||
const void *platform_getCalibrationData();
|
||||
|
||||
#endif /* PLATFORM_H */
|
||||
|
|
|
@ -19,8 +19,12 @@
|
|||
|
||||
#include <platform.h>
|
||||
#include <gpio.h>
|
||||
#include "hwconfig.h"
|
||||
#include "ADC1_MDx.h"
|
||||
#include <hwconfig.h>
|
||||
#include <ADC1_MDx.h>
|
||||
#include <calibInfo_MDx.h>
|
||||
#include <nvmem.h>
|
||||
|
||||
md3x0Calib_t calibration;
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -67,6 +71,12 @@ void platform_init()
|
|||
TIM8->CCR1 = 0;
|
||||
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
||||
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
||||
|
||||
/*
|
||||
* Initialise non volatile memory manager and load calibration data.
|
||||
*/
|
||||
nvm_init();
|
||||
nvm_readCalibData(&calibration);
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
@ -85,6 +95,9 @@ void platform_terminate()
|
|||
|
||||
/* Shut down ADC */
|
||||
adc1_terminate();
|
||||
|
||||
/* Shut down NVM driver */
|
||||
nvm_terminate();
|
||||
}
|
||||
|
||||
float platform_getVbat()
|
||||
|
@ -173,3 +186,8 @@ void platform_setBacklightLevel(uint8_t level)
|
|||
{
|
||||
TIM8->CCR1 = level;
|
||||
}
|
||||
|
||||
const void *platform_getCalibrationData()
|
||||
{
|
||||
return ((const void *) &calibration);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,12 @@
|
|||
|
||||
#include <platform.h>
|
||||
#include <gpio.h>
|
||||
#include "hwconfig.h"
|
||||
#include "ADC1_MDx.h"
|
||||
#include <hwconfig.h>
|
||||
#include <ADC1_MDx.h>
|
||||
#include <calibInfo_MDx.h>
|
||||
#include <nvmem.h>
|
||||
|
||||
md3x0Calib_t calibration;
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -67,6 +71,12 @@ void platform_init()
|
|||
TIM8->CCR1 = 0;
|
||||
TIM8->EGR = TIM_EGR_UG; /* Update registers */
|
||||
TIM8->CR1 |= TIM_CR1_CEN; /* Start timer */
|
||||
|
||||
/*
|
||||
* Initialise non volatile memory manager and load calibration data.
|
||||
*/
|
||||
nvm_init();
|
||||
nvm_readCalibData(&calibration);
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
@ -85,6 +95,9 @@ void platform_terminate()
|
|||
|
||||
/* Shut down ADC */
|
||||
adc1_terminate();
|
||||
|
||||
/* Shut down NVM driver */
|
||||
nvm_terminate();
|
||||
}
|
||||
|
||||
float platform_getVbat()
|
||||
|
@ -173,3 +186,8 @@ void platform_setBacklightLevel(uint8_t level)
|
|||
{
|
||||
TIM8->CCR1 = level;
|
||||
}
|
||||
|
||||
const void *platform_getCalibrationData()
|
||||
{
|
||||
return ((const void *) &calibration);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,12 @@
|
|||
#include <platform.h>
|
||||
#include <gpio.h>
|
||||
#include <os.h>
|
||||
#include "hwconfig.h"
|
||||
#include "ADC1_MDx.h"
|
||||
#include <hwconfig.h>
|
||||
#include <ADC1_MDx.h>
|
||||
#include <calibInfo_MDx.h>
|
||||
#include <nvmem.h>
|
||||
|
||||
mduv3x0Calib_t calibration;
|
||||
|
||||
#ifdef ENABLE_BKLIGHT_DIMMING
|
||||
void TIM1_TRG_COM_TIM11_IRQHandler()
|
||||
|
@ -94,6 +98,12 @@ void platform_init()
|
|||
NVIC_SetPriority(TIM1_TRG_COM_TIM11_IRQn,15);
|
||||
NVIC_EnableIRQ(TIM1_TRG_COM_TIM11_IRQn);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialise non volatile memory manager and load calibration data.
|
||||
*/
|
||||
nvm_init();
|
||||
nvm_readCalibData(&calibration);
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
@ -112,6 +122,9 @@ void platform_terminate()
|
|||
|
||||
/* Shut down ADC */
|
||||
adc1_terminate();
|
||||
|
||||
/* Shut down NVM driver */
|
||||
nvm_terminate();
|
||||
}
|
||||
|
||||
float platform_getVbat()
|
||||
|
@ -218,3 +231,8 @@ void platform_setBacklightLevel(uint8_t level)
|
|||
gpio_clearPin(LCD_BKLIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
const void *platform_getCalibrationData()
|
||||
{
|
||||
return ((const void *) &calibration);
|
||||
}
|
||||
|
|
|
@ -22,77 +22,92 @@
|
|||
|
||||
void platform_init()
|
||||
{
|
||||
//printf("Platform init\n");
|
||||
//printf("Platform init\n");
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
{
|
||||
printf("Platform terminate\n");
|
||||
printf("Platform terminate\n");
|
||||
}
|
||||
|
||||
void platform_setBacklightLevel(uint8_t level)
|
||||
{
|
||||
//printf("platform_setBacklightLevel(%u)\n", level);
|
||||
//printf("platform_setBacklightLevel(%u)\n", level);
|
||||
}
|
||||
|
||||
// Simulate a fully charged lithium battery
|
||||
float platform_getVbat(){
|
||||
return Radio_State.Vbat;
|
||||
float platform_getVbat()
|
||||
{
|
||||
return Radio_State.Vbat;
|
||||
}
|
||||
|
||||
|
||||
float platform_getMicLevel(){
|
||||
return Radio_State.micLevel;
|
||||
float platform_getMicLevel()
|
||||
{
|
||||
return Radio_State.micLevel;
|
||||
}
|
||||
|
||||
|
||||
float platform_getVolumeLevel(){
|
||||
return Radio_State.volumeLevel;
|
||||
float platform_getVolumeLevel()
|
||||
{
|
||||
return Radio_State.volumeLevel;
|
||||
}
|
||||
|
||||
|
||||
uint8_t platform_getChSelector(){
|
||||
return Radio_State.chSelector;
|
||||
uint8_t platform_getChSelector()
|
||||
{
|
||||
return Radio_State.chSelector;
|
||||
}
|
||||
|
||||
|
||||
bool platform_getPttStatus(){
|
||||
bool platform_getPttStatus()
|
||||
{
|
||||
return Radio_State.PttStatus;
|
||||
}
|
||||
|
||||
|
||||
void platform_ledOn(led_t led){
|
||||
char* str;
|
||||
void platform_ledOn(led_t led)
|
||||
{
|
||||
char* str;
|
||||
|
||||
switch(led){
|
||||
case 0:
|
||||
str = "GREEN";
|
||||
break;
|
||||
case 1:
|
||||
str = "RED";
|
||||
break;
|
||||
case 2:
|
||||
str = "YELLOW";
|
||||
break;
|
||||
case 3:
|
||||
str = "WHITE";
|
||||
break;
|
||||
}
|
||||
switch(led)
|
||||
{
|
||||
case 0:
|
||||
str = "GREEN";
|
||||
break;
|
||||
case 1:
|
||||
str = "RED";
|
||||
break;
|
||||
case 2:
|
||||
str = "YELLOW";
|
||||
break;
|
||||
case 3:
|
||||
str = "WHITE";
|
||||
break;
|
||||
}
|
||||
|
||||
printf("platform_ledOn(%s)\n", str);
|
||||
printf("platform_ledOn(%s)\n", str);
|
||||
}
|
||||
|
||||
|
||||
void platform_ledOff(led_t led){
|
||||
printf("platform_ledOff()\n");
|
||||
void platform_ledOff(led_t led)
|
||||
{
|
||||
printf("platform_ledOff()\n");
|
||||
}
|
||||
|
||||
|
||||
void platform_beepStart(uint16_t freq){
|
||||
printf("platform_beepStart(%u)\n", freq);
|
||||
void platform_beepStart(uint16_t freq)
|
||||
{
|
||||
printf("platform_beepStart(%u)\n", freq);
|
||||
}
|
||||
|
||||
|
||||
void platform_beepStop(){
|
||||
printf("platform_beepStop()\n");
|
||||
void platform_beepStop()
|
||||
{
|
||||
printf("platform_beepStop()\n");
|
||||
}
|
||||
|
||||
const void *platform_getCalibrationData()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue