Fix several coding standard issues in the generic SPI LCD driver.

This commit is contained in:
Gregory Nutt 2020-01-28 08:49:15 -06:00 committed by Alan Carvalho de Assis
parent e99a8d192d
commit f27152a1af
2 changed files with 27 additions and 47 deletions

View File

@ -4,7 +4,7 @@
* Generic Driver interface for the Single Chip LCD driver connected * Generic Driver interface for the Single Chip LCD driver connected
* via spi driver * via spi driver
* *
* Copyright (C) 2019 Greg Nutt. All rights reserved. * Copyright (C) 2020 Gregory Nutt. All rights reserved.
* Author: Dave Marples <dave@marples.net> * Author: Dave Marples <dave@marples.net>
* Based on work from Marco Krahl <ocram.lhark@gmail.com> * Based on work from Marco Krahl <ocram.lhark@gmail.com>
* *
@ -56,17 +56,13 @@
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcddrv_spiif.h> #include <nuttx/lcd/lcddrv_spiif.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Type Definition * Private Type Definition
****************************************************************************/ ****************************************************************************/
struct lcddrv_spiif_lcd_s struct lcddrv_spiif_lcd_s
{ {
/* Publically visible device structure */ /* Publicly visible device structure */
struct lcddrv_lcd_s dev; struct lcddrv_lcd_s dev;
@ -75,18 +71,6 @@ struct lcddrv_spiif_lcd_s
struct spi_dev_s *spi; struct spi_dev_s *spi;
}; };
/****************************************************************************
* Private Function Protototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -106,7 +90,7 @@ struct lcddrv_spiif_lcd_s
* *
****************************************************************************/ ****************************************************************************/
static int lcddrv_spiif_backlight(struct lcddrv_lcd_s *lcd, int level) static int lcddrv_spiif_backlight(FAR struct lcddrv_lcd_s *lcd, int level)
{ {
return spiif_backlight(lcd, level); return spiif_backlight(lcd, level);
} }
@ -203,7 +187,7 @@ static int lcddrv_spiif_sendmulti(FAR struct lcddrv_lcd_s *lcd,
****************************************************************************/ ****************************************************************************/
static int lcddrv_spiif_recv(FAR struct lcddrv_lcd_s *lcd, static int lcddrv_spiif_recv(FAR struct lcddrv_lcd_s *lcd,
uint8_t *param) FAR uint8_t *param)
{ {
FAR struct lcddrv_spiif_lcd_s *priv = (FAR struct lcddrv_spiif_lcd_s *)lcd; FAR struct lcddrv_spiif_lcd_s *priv = (FAR struct lcddrv_spiif_lcd_s *)lcd;
@ -309,10 +293,10 @@ static int lcddrv_spiif_recvmulti(FAR struct lcddrv_lcd_s *lcd,
* *
****************************************************************************/ ****************************************************************************/
FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize(struct spi_dev_s *spi) FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize(FAR struct spi_dev_s *spi)
{ {
FAR struct lcddrv_spiif_lcd_s *priv = FAR struct lcddrv_spiif_lcd_s *priv = (FAR struct lcddrv_spiif_lcd_s *)
(struct lcddrv_spiif_lcd_s *)kmm_zalloc(sizeof(struct lcddrv_spiif_lcd_s)); kmm_zalloc(sizeof(struct lcddrv_spiif_lcd_s));
if (!priv) if (!priv)
{ {

View File

@ -1,7 +1,7 @@
/***************************************************************************** /****************************************************************************
* include/nuttx/lcd/lcddrv_spiif.h * include/nuttx/lcd/lcddrv_spiif.h
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2020 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org> * Authors: Gregory Nutt <gnutt@nuttx.org>
* Dave Marples <dave@marples.net> * Dave Marples <dave@marples.net>
* *
@ -44,10 +44,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
@ -56,7 +52,7 @@ struct lcddrv_lcd_s
{ {
/* Interface to control the ILI9341 lcd driver /* Interface to control the ILI9341 lcd driver
* *
* - select Select the device (as neccessary) before performing * - select Select the device (as necessary) before performing
* any operations. * any operations.
* - deselect Deselect the device (as necessary). * - deselect Deselect the device (as necessary).
* - send Send specific parameter to the LCD driver. * - send Send specific parameter to the LCD driver.
@ -74,19 +70,19 @@ struct lcddrv_lcd_s
CODE void (*deselect)(FAR struct lcddrv_lcd_s *lcd); CODE void (*deselect)(FAR struct lcddrv_lcd_s *lcd);
CODE int (*sendcmd)(FAR struct lcddrv_lcd_s *lcd, const uint8_t cmd); CODE int (*sendcmd)(FAR struct lcddrv_lcd_s *lcd, const uint8_t cmd);
CODE int (*sendparam)(FAR struct lcddrv_lcd_s *lcd, const uint8_t param); CODE int (*sendparam)(FAR struct lcddrv_lcd_s *lcd, const uint8_t param);
CODE int (*recvparam)(FAR struct lcddrv_lcd_s *lcd, uint8_t *param); CODE int (*recvparam)(FAR struct lcddrv_lcd_s *lcd, FAR uint8_t *param);
CODE int (*recvgram)(FAR struct lcddrv_lcd_s *lcd, CODE int (*recvgram)(FAR struct lcddrv_lcd_s *lcd,
uint16_t *wd, uint32_t nwords); FAR uint16_t *wd, uint32_t nwords);
CODE int (*sendgram)(FAR struct lcddrv_lcd_s *lcd, CODE int (*sendgram)(FAR struct lcddrv_lcd_s *lcd,
const uint16_t *wd, uint32_t nwords); FAR const uint16_t *wd, uint32_t nwords);
CODE int (*backlight)(FAR struct lcddrv_lcd_s *lcd, int level); CODE int (*backlight)(FAR struct lcddrv_lcd_s *lcd, int level);
/* mcu interface specific data following */ /* MCU interface specific data following */
}; };
/***************************************************************************** /****************************************************************************
* Public Data * Public Data
*****************************************************************************/ ****************************************************************************/
#ifdef __cplusplus #ifdef __cplusplus
#define EXTERN extern "C" #define EXTERN extern "C"
@ -96,11 +92,11 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
/***************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
*****************************************************************************/ ****************************************************************************/
/***************************************************************************** /****************************************************************************
* Name: spiif_backlight * Name: spiif_backlight
* (Provided by integrating platform) * (Provided by integrating platform)
* *
@ -116,7 +112,7 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
extern int spiif_backlight(struct lcddrv_lcd_s *lcd, int level); extern int spiif_backlight(FAR struct lcddrv_lcd_s *lcd, int level);
/**************************************************************************** /****************************************************************************
* Name: FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize * Name: FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize
@ -125,7 +121,7 @@ extern int spiif_backlight(struct lcddrv_lcd_s *lcd, int level);
* Initialize the device structure to control the LCD Single chip driver. * Initialize the device structure to control the LCD Single chip driver.
* *
* Input Parameters: * Input Parameters:
* path : path to spi device to use * path : path to SPI device to use
* *
* Returned Value: * Returned Value:
* On success, this function returns a reference to the LCD control object * On success, this function returns a reference to the LCD control object
@ -134,7 +130,7 @@ extern int spiif_backlight(struct lcddrv_lcd_s *lcd, int level);
* *
****************************************************************************/ ****************************************************************************/
FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize(struct spi_dev_s *spi); FAR struct lcddrv_lcd_s *lcddrv_spiif_initialize(FAR struct spi_dev_s *spi);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus