GHI Electronics
/
Official_PowerMate
The preloaded firmware shipped on the PowerMate
character_display/character_display.h@1:ea25641678f7, 2014-12-04 (annotated)
- Committer:
- Experiment626
- Date:
- Thu Dec 04 19:10:52 2014 +0000
- Revision:
- 1:ea25641678f7
- Parent:
- 0:c0f091562db4
Changed the voltage output precision to two places.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Experiment626 | 0:c0f091562db4 | 1 | /* |
Experiment626 | 0:c0f091562db4 | 2 | Copyright 2013 GHI Electronics LLC |
Experiment626 | 0:c0f091562db4 | 3 | |
Experiment626 | 0:c0f091562db4 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
Experiment626 | 0:c0f091562db4 | 5 | you may not use this file except in compliance with the License. |
Experiment626 | 0:c0f091562db4 | 6 | You may obtain a copy of the License at |
Experiment626 | 0:c0f091562db4 | 7 | |
Experiment626 | 0:c0f091562db4 | 8 | http://www.apache.org/licenses/LICENSE-2.0 |
Experiment626 | 0:c0f091562db4 | 9 | |
Experiment626 | 0:c0f091562db4 | 10 | Unless required by applicable law or agreed to in writing, software |
Experiment626 | 0:c0f091562db4 | 11 | distributed under the License is distributed on an "AS IS" BASIS, |
Experiment626 | 0:c0f091562db4 | 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Experiment626 | 0:c0f091562db4 | 13 | See the License for the specific language governing permissions and |
Experiment626 | 0:c0f091562db4 | 14 | limitations under the License. |
Experiment626 | 0:c0f091562db4 | 15 | */ |
Experiment626 | 0:c0f091562db4 | 16 | |
Experiment626 | 0:c0f091562db4 | 17 | #pragma once |
Experiment626 | 0:c0f091562db4 | 18 | #include "mbed.h" |
Experiment626 | 0:c0f091562db4 | 19 | |
Experiment626 | 0:c0f091562db4 | 20 | class character_display{ |
Experiment626 | 0:c0f091562db4 | 21 | |
Experiment626 | 0:c0f091562db4 | 22 | public: |
Experiment626 | 0:c0f091562db4 | 23 | |
Experiment626 | 0:c0f091562db4 | 24 | character_display( |
Experiment626 | 0:c0f091562db4 | 25 | PinName lcd_rs |
Experiment626 | 0:c0f091562db4 | 26 | ,PinName lcd_e |
Experiment626 | 0:c0f091562db4 | 27 | ,PinName lcd_d4 |
Experiment626 | 0:c0f091562db4 | 28 | ,PinName lcd_d5 |
Experiment626 | 0:c0f091562db4 | 29 | ,PinName lcd_d6 |
Experiment626 | 0:c0f091562db4 | 30 | ,PinName lcd_d7 |
Experiment626 | 0:c0f091562db4 | 31 | ); |
Experiment626 | 0:c0f091562db4 | 32 | |
Experiment626 | 0:c0f091562db4 | 33 | void send_nibble(unsigned char b); |
Experiment626 | 0:c0f091562db4 | 34 | void send_byte(unsigned char b); |
Experiment626 | 0:c0f091562db4 | 35 | void send_command(unsigned char c); |
Experiment626 | 0:c0f091562db4 | 36 | void print(const char* string); |
Experiment626 | 0:c0f091562db4 | 37 | void print(char character); |
Experiment626 | 0:c0f091562db4 | 38 | void clear(); |
Experiment626 | 0:c0f091562db4 | 39 | void cursor_home(); |
Experiment626 | 0:c0f091562db4 | 40 | void set_cursor(unsigned char row, unsigned char col); |
Experiment626 | 0:c0f091562db4 | 41 | |
Experiment626 | 0:c0f091562db4 | 42 | private: |
Experiment626 | 0:c0f091562db4 | 43 | |
Experiment626 | 0:c0f091562db4 | 44 | static const uint8_t DISP_ON = 0xC; //Turn visible LCD on |
Experiment626 | 0:c0f091562db4 | 45 | static const uint8_t CLR_DISP = 1; //Clear display |
Experiment626 | 0:c0f091562db4 | 46 | static const uint8_t CUR_HOME = 2; //Move cursor home and clear screen memory |
Experiment626 | 0:c0f091562db4 | 47 | static const uint8_t SET_CURSOR = 0x80; //SET_CURSOR + X : Sets cursor position to X |
Experiment626 | 0:c0f091562db4 | 48 | static const uint8_t FUNCTION_SET = 0x20; // 001 4 bit bus, 1 line, font 5x7 |
Experiment626 | 0:c0f091562db4 | 49 | static const uint8_t MODE_SET = 0x06; // mode, direction,... |
Experiment626 | 0:c0f091562db4 | 50 | static const uint8_t CUR_V_SHIFT = 0x14; // cursor right |
Experiment626 | 0:c0f091562db4 | 51 | |
Experiment626 | 0:c0f091562db4 | 52 | |
Experiment626 | 0:c0f091562db4 | 53 | DigitalOut lcd_rs; |
Experiment626 | 0:c0f091562db4 | 54 | DigitalOut lcd_e; |
Experiment626 | 0:c0f091562db4 | 55 | DigitalOut lcd_d4; |
Experiment626 | 0:c0f091562db4 | 56 | DigitalOut lcd_d5; |
Experiment626 | 0:c0f091562db4 | 57 | DigitalOut lcd_d6; |
Experiment626 | 0:c0f091562db4 | 58 | DigitalOut lcd_d7; |
Experiment626 | 0:c0f091562db4 | 59 | |
Experiment626 | 0:c0f091562db4 | 60 | }; |