浏览代码

ssd1327: various functions should return values

defects 377, 378, 379, 380

Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
Jon Trulson 9 年前
父节点
当前提交
f8179328cf
共有 2 个文件被更改,包括 19 次插入13 次删除
  1. 18
    12
      src/lcd/ssd1327.cxx
  2. 1
    1
      src/lcd/ssd1327.h

+ 18
- 12
src/lcd/ssd1327.cxx 查看文件

@@ -221,7 +221,7 @@ SSD1327::home()
221 221
     return setCursor(0, 0);
222 222
 }
223 223
 
224
-mraa_result_t
224
+void
225 225
 SSD1327::setGrayLevel(uint8_t level)
226 226
 {
227 227
     grayHigh = (level << 4) & 0xF0;
@@ -236,6 +236,7 @@ SSD1327::setGrayLevel(uint8_t level)
236 236
 mraa_result_t
237 237
 SSD1327::writeChar(uint8_t value)
238 238
 {
239
+    mraa_result_t rv = MRAA_SUCCESS;
239 240
     if (value < 0x20 || value > 0x7F) {
240 241
         value = 0x20; // space
241 242
     }
@@ -250,10 +251,11 @@ SSD1327::writeChar(uint8_t value)
250 251
             data |= (bitOne) ? grayHigh : 0x00;
251 252
             data |= (bitTwo) ? grayLow : 0x00;
252 253
 
253
-            m_i2c_lcd_control.writeReg(LCD_DATA, data);
254
+            rv = m_i2c_lcd_control.writeReg(LCD_DATA, data);
254 255
             usleep(CMD_SLEEP - 2000);
255 256
         }
256 257
     }
258
+    return rv;
257 259
 }
258 260
 
259 261
 mraa_result_t
@@ -266,35 +268,39 @@ SSD1327::setNormalDisplay()
266 268
 mraa_result_t
267 269
 SSD1327::setHorizontalMode()
268 270
 {
269
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
271
+    mraa_result_t rv = MRAA_SUCCESS;
272
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
270 273
     usleep(CMD_SLEEP);
271
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x42); // horizontal mode
274
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x42); // horizontal mode
272 275
     usleep(CMD_SLEEP);
273 276
 
274 277
     // Row Address
275
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x75); // Set Row Address
278
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x75); // Set Row Address
276 279
     usleep(CMD_SLEEP);
277
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); // Start 0
280
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x00); // Start 0
278 281
     usleep(CMD_SLEEP);
279
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x5f); // End 95
282
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x5f); // End 95
280 283
     usleep(CMD_SLEEP);
281 284
 
282 285
     // Column Address
283
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); // Set Column Address
286
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x15); // Set Column Address
284 287
     usleep(CMD_SLEEP);
285
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x08); // Start from 8th Column of driver
288
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x08); // Start from 8th Column of driver
286 289
                                                // IC. This is 0th Column for OLED
287 290
     usleep(CMD_SLEEP);
288
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x37); // End at  (8 + 47)th column. Each
291
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x37); // End at  (8 + 47)th column. Each
289 292
                                                // Column has 2 pixels(or segments)
290 293
     usleep(CMD_SLEEP);
294
+    return rv;
291 295
 }
292 296
 
293 297
 mraa_result_t
294 298
 SSD1327::setVerticalMode()
295 299
 {
296
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
300
+    mraa_result_t rv = MRAA_SUCCESS;
301
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0xA0); // remap to
297 302
     usleep(CMD_SLEEP);
298
-    m_i2c_lcd_control.writeReg(LCD_CMD, 0x46); // Vertical mode
303
+    rv = m_i2c_lcd_control.writeReg(LCD_CMD, 0x46); // Vertical mode
299 304
     usleep(CMD_SLEEP);
305
+    return rv;
300 306
 }

+ 1
- 1
src/lcd/ssd1327.h 查看文件

@@ -81,7 +81,7 @@ class SSD1327 : public I2CLcd
81 81
      * @param gray level from 0-255
82 82
      * @return Result of operation
83 83
      */
84
-    mraa_result_t setGrayLevel(uint8_t level);
84
+    void setGrayLevel(uint8_t level);
85 85
     /**
86 86
      * Write a string to LCD
87 87
      *