SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
Diff: Hardwares/ArduUTFT.cpp
- Revision:
- 56:7d3395ae022d
- Parent:
- 54:f1f5648dfacf
- Child:
- 57:0d8a155d511d
diff -r d4db9eef4a9d -r 7d3395ae022d Hardwares/ArduUTFT.cpp --- a/Hardwares/ArduUTFT.cpp Thu Apr 06 21:43:15 2017 +0000 +++ b/Hardwares/ArduUTFT.cpp Thu Apr 06 22:19:59 2017 +0000 @@ -1,6 +1,8 @@ #include "ArduUTFT.h" +#define SW_DEBUG #include "GlobalVariable.h" + #include "SWUSBServer.h" #include "ArduUTFTFont.h" @@ -33,31 +35,52 @@ inline void ardu_cam_spi_write_8(int address, int value) { +#ifdef SW_DEBUG + g_sw_spi_lock.lock(); +#endif utft_cs = 0; g_spi_port.write(address | 0x80); g_spi_port.write(value); utft_cs = 1; +#ifdef SW_DEBUG + g_sw_spi_lock.unlock(); +#endif } inline uint8_t ardu_cam_spi_read_8(int address) { +#ifdef SW_DEBUG + g_sw_spi_lock.lock(); +#endif utft_cs = 0; g_spi_port.write(address & 0x7F); uint8_t value = static_cast<uint8_t>(g_spi_port.write(0x00)); utft_cs = 1; +#ifdef SW_DEBUG + g_sw_spi_lock.unlock(); +#endif return value; } inline void ardu_utft_write_COM_internal(uint8_t VL) { +#ifdef SW_DEBUG + g_sw_spi_lock.lock(); +#endif utft_cs = 0; g_spi_port.write(0xBE); g_spi_port.write(VL); utft_cs = 1; +#ifdef SW_DEBUG + g_sw_spi_lock.unlock(); +#endif } inline void ardu_utft_write_DATA_internal(uint8_t VH, uint8_t VL) { +#ifdef SW_DEBUG + g_sw_spi_lock.lock(); +#endif utft_cs = 0; g_spi_port.write(0xBF); g_spi_port.write(VH); @@ -66,6 +89,9 @@ g_spi_port.write(0xBF); g_spi_port.write(VL); utft_cs = 1; +#ifdef SW_DEBUG + g_sw_spi_lock.unlock(); +#endif } inline void ardu_utft_write_COM_DATA_internal(uint8_t com1, uint16_t dat1) @@ -313,7 +339,11 @@ if((ch & (1 << i)) != 0) { ardu_utft_write_DATA_internal(front_color_high, front_color_low); - } + } + else + { + ardu_utft_write_DATA_internal(0x00, 0x00); + } } } temp += (font_x_size / 8);