TFmini(Micro LiDAR Module) library tested on mbedos5.x
Dependents: 2018NHK_gakugaku_robo 2018NHK_gaku_ver2 2019NHK_A_sensor
TFmini.h@6:3651a37efd0e, 2018-10-06 (annotated)
- Committer:
- UCHITAKE
- Date:
- Sat Oct 06 05:01:42 2018 +0000
- Revision:
- 6:3651a37efd0e
- Parent:
- 5:eeb0e5bdd8b9
- Child:
- 7:81f9d1372c45
tiny fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 0:fe2031b62770 | 1 | #ifndef TFMINI_H |
UCHITAKE | 0:fe2031b62770 | 2 | #define TFMINI_H |
UCHITAKE | 0:fe2031b62770 | 3 | |
UCHITAKE | 0:fe2031b62770 | 4 | #include "mbed.h" |
UCHITAKE | 0:fe2031b62770 | 5 | |
takeuchi |
1:12f2bfb3577a | 6 | #define TF_SERIAL_BUFFER_SIZE 9 |
takeuchi |
1:12f2bfb3577a | 7 | #define TF_HEADER_FIRST_BYTE 0x59 |
takeuchi |
1:12f2bfb3577a | 8 | #define TF_HEADER_SECOND_BYTE 0x59 |
UCHITAKE | 6:3651a37efd0e | 9 | #define TF_RECEIVE_FREQ 0.01 |
takeuchi |
1:12f2bfb3577a | 10 | #define TF_DEFAULT_BAUD 115200 |
UCHITAKE | 0:fe2031b62770 | 11 | |
UCHITAKE | 0:fe2031b62770 | 12 | class TFmini : public RawSerial { |
UCHITAKE | 0:fe2031b62770 | 13 | public : |
UCHITAKE | 0:fe2031b62770 | 14 | TFmini(PinName serialTX, PinName serialRX); |
UCHITAKE | 0:fe2031b62770 | 15 | |
UCHITAKE | 0:fe2031b62770 | 16 | int getDistance(); |
UCHITAKE | 0:fe2031b62770 | 17 | int getStrength(); |
UCHITAKE | 0:fe2031b62770 | 18 | |
UCHITAKE | 0:fe2031b62770 | 19 | private : |
UCHITAKE | 6:3651a37efd0e | 20 | void readData(); |
UCHITAKE | 0:fe2031b62770 | 21 | void assemble(); |
UCHITAKE | 0:fe2031b62770 | 22 | |
UCHITAKE | 6:3651a37efd0e | 23 | int incrementCounter(int counter); |
UCHITAKE | 6:3651a37efd0e | 24 | |
UCHITAKE | 6:3651a37efd0e | 25 | int readCounter; |
UCHITAKE | 6:3651a37efd0e | 26 | int takeCounter; |
UCHITAKE | 6:3651a37efd0e | 27 | Ticker assembleTicker; |
UCHITAKE | 0:fe2031b62770 | 28 | |
UCHITAKE | 0:fe2031b62770 | 29 | int distance; |
UCHITAKE | 0:fe2031b62770 | 30 | int strength; |
UCHITAKE | 6:3651a37efd0e | 31 | |
UCHITAKE | 6:3651a37efd0e | 32 | uint8_t *buffer; |
UCHITAKE | 6:3651a37efd0e | 33 | uint8_t *data; |
UCHITAKE | 6:3651a37efd0e | 34 | |
UCHITAKE | 6:3651a37efd0e | 35 | bool headerCheck; |
UCHITAKE | 6:3651a37efd0e | 36 | int headerPoint; |
UCHITAKE | 0:fe2031b62770 | 37 | }; |
UCHITAKE | 0:fe2031b62770 | 38 | |
takeuchi |
1:12f2bfb3577a | 39 | #endif |