platform/mikroe-stm32f4: Update for some coding standard issues.
This commit is contained in:
parent
f3dc5bea13
commit
c8ae5f1674
@ -52,26 +52,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_PLATFORM_CONFIGDATA
|
#ifdef CONFIG_PLATFORM_CONFIGDATA
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Private Types
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
@ -109,12 +89,12 @@ int platform_setconfig(enum config_data_e id, int instance,
|
|||||||
FAR const uint8_t *configdata, size_t datalen)
|
FAR const uint8_t *configdata, size_t datalen)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
||||||
FILE* fd;
|
FILE *fd;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
|
||||||
struct config_data_s config;
|
struct config_data_s config;
|
||||||
int ret;
|
int ret;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/* Try to open the /dev/config device file */
|
/* Try to open the /dev/config device file */
|
||||||
|
|
||||||
@ -127,10 +107,10 @@ int platform_setconfig(enum config_data_e id, int instance,
|
|||||||
|
|
||||||
/* Setup structure for the SETCONFIG ioctl */
|
/* Setup structure for the SETCONFIG ioctl */
|
||||||
|
|
||||||
config.id = (enum config_data_e)id;
|
config.id = (enum config_data_e)id;
|
||||||
config.instance = instance;
|
config.instance = instance;
|
||||||
config.configdata = (FAR uint8_t *) configdata;
|
config.configdata = (FAR uint8_t *) configdata;
|
||||||
config.len = datalen;
|
config.len = datalen;
|
||||||
|
|
||||||
ret = ioctl(fd, CFGDIOC_SETCONFIG, (unsigned long) &config);
|
ret = ioctl(fd, CFGDIOC_SETCONFIG, (unsigned long) &config);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -144,11 +124,13 @@ int platform_setconfig(enum config_data_e id, int instance,
|
|||||||
|
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
||||||
/* Save config data in a file on the filesystem. Try to open
|
/* Save config data in a file on the filesystem. Try to open
|
||||||
* the file. */
|
* the file.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "w+")) == NULL)
|
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "w+")) == NULL)
|
||||||
{
|
{
|
||||||
/* Error opening the file */
|
/* Error opening the file */
|
||||||
|
|
||||||
set_errno(ENOENT);
|
set_errno(ENOENT);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -167,7 +149,6 @@ int platform_setconfig(enum config_data_e id, int instance,
|
|||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
||||||
|
|
||||||
/* We are reading from a read-only system, so nothing to do. */
|
/* We are reading from a read-only system, so nothing to do. */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -220,15 +201,17 @@ int platform_getconfig(enum config_data_e id, int instance,
|
|||||||
FAR uint8_t *configdata, size_t datalen)
|
FAR uint8_t *configdata, size_t datalen)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
||||||
FILE* fd;
|
FILE *fd;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
enum config_data_e saved_id;
|
enum config_data_e saved_id;
|
||||||
int saved_instance;
|
int saved_instance;
|
||||||
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
||||||
static const uint8_t touch_cal_data[] = {
|
static const uint8_t touch_cal_data[] =
|
||||||
|
{
|
||||||
0x9a, 0x2f, 0x00, 0x00,
|
0x9a, 0x2f, 0x00, 0x00,
|
||||||
0x40, 0xbc, 0x69, 0xfe, 0x70, 0x2e, 0x00,
|
0x40, 0xbc, 0x69, 0xfe, 0x70, 0x2e, 0x00,
|
||||||
0x00, 0xb8, 0x2d, 0xdb, 0xff };
|
0x00, 0xb8, 0x2d, 0xdb, 0xff
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
|
||||||
struct config_data_s config;
|
struct config_data_s config;
|
||||||
@ -256,14 +239,14 @@ int platform_getconfig(enum config_data_e id, int instance,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else /* CONFIG_MIKROE_STM32F4_CONFIGDATA_PART */
|
#else /* CONFIG_MIKROE_STM32F4_CONFIGDATA_PART */
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case CONFIGDATA_TSCALIBRATION:
|
case CONFIGDATA_TSCALIBRATION:
|
||||||
|
|
||||||
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
#ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_FS
|
||||||
/* Load config data fram a file on the filesystem. Try to open
|
/* Load config data fram a file on the filesystem. Try to open
|
||||||
* the file. */
|
* the file.
|
||||||
|
*/
|
||||||
|
|
||||||
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "r")) == NULL)
|
if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "r")) == NULL)
|
||||||
{
|
{
|
||||||
@ -294,12 +277,7 @@ int platform_getconfig(enum config_data_e id, int instance,
|
|||||||
fclose(fd);
|
fclose(fd);
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
/* Save config data in a file on the filesystem */
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
#elif defined(CONFIG_MIKROE_STM32F4_CONFIGDATA_ROM)
|
||||||
|
|
||||||
memcpy(configdata, touch_cal_data, datalen);
|
memcpy(configdata, touch_cal_data, datalen);
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
@ -318,3 +296,4 @@ int platform_getconfig(enum config_data_e id, int instance,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_PLATFORM_CONFIGDATA */
|
#endif /* CONFIG_PLATFORM_CONFIGDATA */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user