Bruno Allaire-Lemay
/
APP1test
df
Fork of APP1 by
UARTDisplayer.cpp@10:04822743cefe, 2017-01-15 (annotated)
- Committer:
- GaiSensei
- Date:
- Sun Jan 15 18:28:30 2017 +0000
- Revision:
- 10:04822743cefe
- Parent:
- 2:b8a20f7e2912
- Child:
- 13:bb9669053eb3
Merge displayer with accelerometer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GaiSensei | 2:b8a20f7e2912 | 1 | #include "UARTDisplayer.hpp" |
GaiSensei | 2:b8a20f7e2912 | 2 | |
GaiSensei | 10:04822743cefe | 3 | UARTDisplayer::UARTDisplayer() |
GaiSensei | 2:b8a20f7e2912 | 4 | { |
GaiSensei | 2:b8a20f7e2912 | 5 | |
GaiSensei | 2:b8a20f7e2912 | 6 | } |
GaiSensei | 2:b8a20f7e2912 | 7 | |
GaiSensei | 2:b8a20f7e2912 | 8 | void UARTDisplayer::displayAngle(float angle) |
GaiSensei | 2:b8a20f7e2912 | 9 | { |
GaiSensei | 2:b8a20f7e2912 | 10 | /* char digits[6]; |
GaiSensei | 2:b8a20f7e2912 | 11 | snprintf(digits, sizeof digits, "%f", angle); |
GaiSensei | 2:b8a20f7e2912 | 12 | |
GaiSensei | 2:b8a20f7e2912 | 13 | if(digits[1] == '.') |
GaiSensei | 2:b8a20f7e2912 | 14 | { |
GaiSensei | 2:b8a20f7e2912 | 15 | device.write(0); |
GaiSensei | 2:b8a20f7e2912 | 16 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 17 | device.write((int)digits[0] - 48); |
GaiSensei | 2:b8a20f7e2912 | 18 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 19 | device.write((int)digits[2] - 48); |
GaiSensei | 2:b8a20f7e2912 | 20 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 21 | device.write((int)digits[3] - 48); |
GaiSensei | 2:b8a20f7e2912 | 22 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 23 | } |
GaiSensei | 2:b8a20f7e2912 | 24 | else |
GaiSensei | 2:b8a20f7e2912 | 25 | { |
GaiSensei | 2:b8a20f7e2912 | 26 | device.write((int)digits[0] - 48); |
GaiSensei | 2:b8a20f7e2912 | 27 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 28 | device.write((int)digits[1] - 48); |
GaiSensei | 2:b8a20f7e2912 | 29 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 30 | device.write((int)digits[3] - 48); |
GaiSensei | 2:b8a20f7e2912 | 31 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 32 | device.write((int)digits[4] - 48); |
GaiSensei | 2:b8a20f7e2912 | 33 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 34 | } |
GaiSensei | 2:b8a20f7e2912 | 35 | |
GaiSensei | 2:b8a20f7e2912 | 36 | device.write(DECIMAL_CONTROL_REGISTER); |
GaiSensei | 2:b8a20f7e2912 | 37 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 38 | device.write(FLOATING_POINT_DOT_POSITION); |
GaiSensei | 2:b8a20f7e2912 | 39 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 40 | |
GaiSensei | 2:b8a20f7e2912 | 41 | printf("Angle displayed\n");*/ |
GaiSensei | 2:b8a20f7e2912 | 42 | } |
GaiSensei | 2:b8a20f7e2912 | 43 | |
GaiSensei | 2:b8a20f7e2912 | 44 | void UARTDisplayer::reset() |
GaiSensei | 2:b8a20f7e2912 | 45 | { |
GaiSensei | 2:b8a20f7e2912 | 46 | /*device.write(CLEAR_DISPLAY_REGISTER); |
GaiSensei | 2:b8a20f7e2912 | 47 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 48 | device.write(CURSOR_CONROL_REGISTER); |
GaiSensei | 2:b8a20f7e2912 | 49 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 50 | device.write(MOST_LEFT_DIGIT_POSITION); |
GaiSensei | 2:b8a20f7e2912 | 51 | wait(0.001); |
GaiSensei | 2:b8a20f7e2912 | 52 | |
GaiSensei | 2:b8a20f7e2912 | 53 | printf("Cursor reset\n");*/ |
GaiSensei | 2:b8a20f7e2912 | 54 | } |