diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-05-27 07:26:59 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-05-27 07:26:59 -0600 |
commit | bec3b36f727b4bccdf9900097ae8d76fb7faa1ab (patch) | |
tree | d437009bc570af3f132ee68cd68f002b2f76f4a2 /nuttx/configs | |
parent | 168976579a7a81d31112283b23ff9fe7b7d25166 (diff) | |
download | px4-nuttx-bec3b36f727b4bccdf9900097ae8d76fb7faa1ab.tar.gz px4-nuttx-bec3b36f727b4bccdf9900097ae8d76fb7faa1ab.tar.bz2 px4-nuttx-bec3b36f727b4bccdf9900097ae8d76fb7faa1ab.zip |
Rename SLCD geometry tructure to attributes; Move MAX contrast to attributes. Add attribute and ioctl commands to get and set SLCD brightness
Diffstat (limited to 'nuttx/configs')
-rw-r--r-- | nuttx/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c | 29 | ||||
-rw-r--r-- | nuttx/configs/stm32ldiscovery/src/stm32_lcd.c | 43 | ||||
-rw-r--r-- | nuttx/configs/sure-pic32mx/src/pic32mx_lcd1602.c | 37 |
3 files changed, 53 insertions, 56 deletions
diff --git a/nuttx/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c b/nuttx/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c index e2be0a243..d12c6bdab 100644 --- a/nuttx/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c +++ b/nuttx/configs/pcblogic-pic32mx/src/pic32mx_lcd1602.c @@ -786,26 +786,28 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) switch (cmd) { - /* SLCDIOC_GEOMETRY: Get the SLCD geometry (rows x characters) + /* SLCDIOC_GETATTRIBUTES: Get the attributes of the SLCD * - * argument: Pointer to struct slcd_geometry_s in which values will be + * argument: Pointer to struct slcd_attributes_s in which values will be * returned */ - case SLCDIOC_GEOMETRY: + case SLCDIOC_GETATTRIBUTES: { - FAR struct slcd_geometry_s *geo = (FAR struct slcd_geometry_s *)((uintptr_t)arg); + FAR struct slcd_attributes_s *attr = (FAR struct slcd_attributes_s *)((uintptr_t)arg); - lcdvdbg("SLCDIOC_GEOMETRY: nrows=%d ncolumns=%d\n", LCD_NROWS, LCD_NCOLUMNS); + lcdvdbg("SLCDIOC_GETATTRIBUTES:\n"); - if (!geo) + if (!attr) { return -EINVAL; } - geo->nrows = LCD_NROWS; - geo->ncolumns = LCD_NCOLUMNS; - geo->nbars = 0; + attr->nrows = LCD_NROWS; + attr->ncolumns = LCD_NCOLUMNS; + attr->nbars = 0; + attr->maxcontrast = 0; + attr->maxbrightness = 0 } break; @@ -832,10 +834,11 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) } break; - case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */ - case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current contrast setting */ - case SLCDIOC_MAXCONTRAST: /* SLCDIOC_MAXCONTRAST: Get the maximum contrast setting */ - case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a new value */ + case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */ + case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current contrast setting */ + case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a new value */ + case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */ + case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */ default: return -ENOTTY; } diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c index 789c2694a..ee8dd17a4 100644 --- a/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c +++ b/nuttx/configs/stm32ldiscovery/src/stm32_lcd.c @@ -1310,26 +1310,28 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) switch (cmd) { - /* SLCDIOC_GEOMETRY: Get the SLCD geometry (rows x characters) + /* SLCDIOC_GETATTRIBUTES: Get the attributes of the SLCD * - * argument: Pointer to struct slcd_geometry_s in which values will be + * argument: Pointer to struct slcd_attributes_s in which values will be * returned */ - case SLCDIOC_GEOMETRY: + case SLCDIOC_GETATTRIBUTES: { - FAR struct slcd_geometry_s *geo = (FAR struct slcd_geometry_s *)((uintptr_t)arg); + FAR struct slcd_attributes_s *attr = (FAR struct slcd_attributes_s *)((uintptr_t)arg); - lcdvdbg("SLCDIOC_GEOMETRY: nrows=%d ncolumns=%d\n", SLCD_NROWS, SLCD_NCHARS); + lcdvdbg("SLCDIOC_GETATTRIBUTES:\n"); - if (!geo) + if (!attr) { return -EINVAL; } - geo->nrows = SLCD_NROWS; - geo->ncolumns = SLCD_NCHARS; - geo->nbars = SLCD_NBARS; + attr->nrows = SLCD_NROWS; + attr->ncolumns = SLCD_NCHARS; + attr->nbars = SLCD_NBARS; + attr->maxcontrast = SLCD_MAXCONTRAST; + attr->maxbrightness = 0; } break; @@ -1415,27 +1417,6 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) } break; - /* SLCDIOC_MAXCONTRAST: Get the maximum contrast setting - * - * argument: Pointer type int that will receive the maximum contrast - * setting - */ - - case SLCDIOC_MAXCONTRAST: - { - FAR int *contrast = (FAR int *)((uintptr_t)arg); - - lcdvdbg("SLCDIOC_MAXCONTRAST: contrast=%d\n", SLCD_MAXCONTRAST); - - if (!contrast) - { - return -EINVAL; - } - - *contrast = SLCD_MAXCONTRAST; - } - break; - /* SLCDIOC_SETCONTRAST: Set the contrast to a new value * * argument: The new contrast value @@ -1454,6 +1435,8 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) } break; + case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */ + case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */ default: return -ENOTTY; } diff --git a/nuttx/configs/sure-pic32mx/src/pic32mx_lcd1602.c b/nuttx/configs/sure-pic32mx/src/pic32mx_lcd1602.c index 1c51bb7af..9d48452b5 100644 --- a/nuttx/configs/sure-pic32mx/src/pic32mx_lcd1602.c +++ b/nuttx/configs/sure-pic32mx/src/pic32mx_lcd1602.c @@ -103,6 +103,14 @@ # error "CONFIG_PIC32MX_PMP is required to use the LCD" #endif +#ifndef CONFIG_LCD_MAXCONTRAST +# define CONFIG_LCD_MAXCONTRAST 100 +#endif + +#ifndef CONFIG_LCD_MAXPOWER +# define CONFIG_LCD_MAXPOWER 100 +#endif + /* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must * also be enabled. */ @@ -787,26 +795,28 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) switch (cmd) { - /* SLCDIOC_GEOMETRY: Get the SLCD geometry (rows x characters) + /* SLCDIOC_GETATTRIBUTES: Get the attributes of the SLCD * - * argument: Pointer to struct slcd_geometry_s in which values will be + * argument: Pointer to struct slcd_attributes_s in which values will be * returned */ - case SLCDIOC_GEOMETRY: + case SLCDIOC_GETATTRIBUTES: { - FAR struct slcd_geometry_s *geo = (FAR struct slcd_geometry_s *)((uintptr_t)arg); + FAR struct slcd_attributes_s *attr = (FAR struct slcd_attributes_s *)((uintptr_t)arg); - lcdvdbg("SLCDIOC_GEOMETRY: nrows=%d ncolumns=%d\n", LCD_NROWS, LCD_NCOLUMNS); + lcdvdbg("SLCDIOC_GETATTRIBUTES:\n"); - if (!geo) + if (!attr) { return -EINVAL; } - geo->nrows = LCD_NROWS; - geo->ncolumns = LCD_NCOLUMNS; - geo->nbars = 0; + attr->nrows = LCD_NROWS; + attr->ncolumns = LCD_NCOLUMNS; + attr->nbars = 0; + attr->maxcontrast = CONFIG_LCD_MAXCONTRAST; + attr->maxbrightness = CONFIG_LCD_MAXPOWER; } break; @@ -833,10 +843,11 @@ static int lcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg) } break; - case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */ - case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current contrast setting */ - case SLCDIOC_MAXCONTRAST: /* SLCDIOC_MAXCONTRAST: Get the maximum contrast setting */ - case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a new value */ + case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */ + case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current contrast setting */ + case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a new value */ + case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */ + case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */ default: return -ENOTTY; } |