Skip to content

Commit e29a81e

Browse files
author
Clang Robot
committed
Committing clang-format changes
1 parent b14609d commit e29a81e

File tree

6 files changed

+122
-115
lines changed

6 files changed

+122
-115
lines changed

src/include/Frontlight.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#include "Frontlight.h"
2020
#include "defines.h"
2121

22-
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || defined(ARDUINO_INKPLATE6FLICK)
22+
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || \
23+
defined(ARDUINO_INKPLATE6FLICK)
2324

2425
/**
2526
* @brief setFrontlight function sets frontlight intensity for inkplate

src/include/Frontlight.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
#ifndef __FRONTLIGHT_H__
1919
#define __FRONTLIGHT_H__
2020

21-
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || defined(ARDUINO_INKPLATE6FLICK)
21+
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || \
22+
defined(ARDUINO_INKPLATE6FLICK)
2223

2324
#include "Arduino.h"
2425
#include "Wire.h"

src/include/System.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
#define RTC_7PF 0
7777
#define RTC_12_5PF 1
7878

79-
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || defined(ARDUINO_INKPLATE6FLICK)
79+
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || \
80+
defined(ARDUINO_INKPLATE6FLICK)
8081
#include "Frontlight.h"
8182
#ifdef ARDUINO_INKPLATE6FLICK
8283
#include "TouchCypress.h"
@@ -106,7 +107,8 @@ class System : public Esp,
106107
virtual public Expander,
107108
#endif
108109

109-
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || defined(ARDUINO_INKPLATE6FLICK)
110+
#if defined(ARDUINO_INKPLATE6PLUS) || defined(ARDUINO_INKPLATE6PLUSV2) || defined(ARDUINO_INKPLATE4TEMPERA) || \
111+
defined(ARDUINO_INKPLATE6FLICK)
110112
public Touch,
111113
public Frontlight,
112114
#endif

src/include/TouchCypress.cpp

Lines changed: 57 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#ifdef ARDUINO_INKPLATE6FLICK
2222

2323
// Macro helpers.
24-
#define TS_GET_BOOTLOADERMODE(reg) (((reg) & 0x10) >> 4)
24+
#define TS_GET_BOOTLOADERMODE(reg) (((reg)&0x10) >> 4)
2525

2626
/**
2727
* @brief touchInArea checks if touch occured in given rectangle area
@@ -39,7 +39,6 @@
3939
*/
4040
bool Touch::touchInArea(int16_t x1, int16_t y1, int16_t w, int16_t h)
4141
{
42-
4342
}
4443

4544
/**
@@ -64,7 +63,8 @@ bool Touch::tsInit(uint8_t _pwrState)
6463
tsReset();
6564

6665
// Try to ping it.
67-
if(!tsPing(5)) return false;
66+
if (!tsPing(5))
67+
return false;
6868

6969
// Issue a SW reset.
7070
tsSendCommand(0x01);
@@ -121,12 +121,11 @@ void Touch::tsShutdown()
121121
*
122122
* @param uint8_t *b
123123
* pointer to store register content
124-
*
124+
*
125125
* @note Array must be at least 15 bytes long.
126126
*/
127127
void Touch::tsGetRawData(uint8_t *b)
128128
{
129-
130129
}
131130

132131
/**
@@ -145,25 +144,25 @@ void Touch::tsGetRawData(uint8_t *b)
145144
*/
146145
uint8_t Touch::tsGetData(uint16_t *xPos, uint16_t *yPos)
147146
{
148-
149147
}
150148

151149
/**
152150
* @brief Set power mode of the Touchscreen Controller. There are 3 modes
153151
* CYPRESS_TOUCH_OPERATE_MODE - Normal mode (fast response, higher accuracy, higher power consumption).
154152
* Current ~ 15mA.
155-
* CYPRESS_TOUCH_LOW_POWER_MODE - After few seconds of inactivity, TSC goes into low power ode and periodically
156-
* goes into operating mode to check for touch event. Current ~4mA.
157-
* CYPRESS_TOUCH_DEEP_SLEEP_MODE - Disable TSC. Current ~25uA.
158-
*
153+
* CYPRESS_TOUCH_LOW_POWER_MODE - After few seconds of inactivity, TSC goes into low power ode and
154+
* periodically goes into operating mode to check for touch event. Current ~4mA. CYPRESS_TOUCH_DEEP_SLEEP_MODE - Disable
155+
* TSC. Current ~25uA.
156+
*
159157
* @param uint8_t _s
160-
* Power mode - Can only be CYPRESS_TOUCH_OPERATE_MODE, CYPRESS_TOUCH_LOW_POWER_MODE or CYPRESS_TOUCH_DEEP_SLEEP_MODE.
161-
* [defined in TouchCypress.h]
158+
* Power mode - Can only be CYPRESS_TOUCH_OPERATE_MODE, CYPRESS_TOUCH_LOW_POWER_MODE or
159+
* CYPRESS_TOUCH_DEEP_SLEEP_MODE. [defined in TouchCypress.h]
162160
*/
163161
void Touch::tsSetPowerState(uint8_t _s)
164162
{
165163
// Check for the parameters.
166-
if ((_s == CYPRESS_TOUCH_DEEP_SLEEP_MODE) || (_s == CYPRESS_TOUCH_LOW_POWER_MODE) || (_s == CYPRESS_TOUCH_OPERATE_MODE))
164+
if ((_s == CYPRESS_TOUCH_DEEP_SLEEP_MODE) || (_s == CYPRESS_TOUCH_LOW_POWER_MODE) ||
165+
(_s == CYPRESS_TOUCH_OPERATE_MODE))
167166
{
168167
// Set new power mode setting.
169168
tsSendCommand(_s);
@@ -196,7 +195,8 @@ uint8_t Touch::tsGetPowerState()
196195
bool Touch::tsAvailable()
197196
{
198197
// Check for the handshake.
199-
if (_tsFlag) tsHandshake();
198+
if (_tsFlag)
199+
tsHandshake();
200200
bool _temp = _tsFlag;
201201
_tsFlag = false;
202202
return _temp;
@@ -206,7 +206,7 @@ bool Touch::tsAvailable()
206206
// Private members.
207207
/**
208208
* @brief Enable or disable power to the Touchscreen Controller.
209-
*
209+
*
210210
* @param bool _pwr
211211
* true - Enable power to the Touchscreen/Touchscreen Controller.
212212
* false - Disable power to the Touchscreen/Touchscreen Controller to reduce power
@@ -242,9 +242,9 @@ void Touch::tsPower(bool _pwr)
242242
}
243243

244244
/**
245-
* @brief Disable touchscreen. Detach interrupt, clear interrput flag, disable power to the
245+
* @brief Disable touchscreen. Detach interrupt, clear interrput flag, disable power to the
246246
* Touchscreen Controller.
247-
*
247+
*
248248
*/
249249
void Touch::tsEnd()
250250
{
@@ -260,7 +260,7 @@ void Touch::tsEnd()
260260

261261
/**
262262
* @brief Method does a HW reset by using RST pin on the Touchscreen/Touchscreen Controller.
263-
*
263+
*
264264
*/
265265
void Touch::tsReset()
266266
{
@@ -275,7 +275,7 @@ void Touch::tsReset()
275275

276276
/**
277277
* @brief Method executes a SW reset by using I2C command.
278-
*
278+
*
279279
*/
280280
void Touch::tsSwReset()
281281
{
@@ -288,11 +288,11 @@ void Touch::tsSwReset()
288288

289289
/**
290290
* @brief Function reads bootloader registers from the Touchscreen Controller.
291-
*
291+
*
292292
* @param struct cyttspBootloaderData *_blDataPtr
293293
* Defined in TouchCypressTypedefs.h, pointer to the struct cyttspBootloaderData to
294294
* store bootloader registers data.
295-
*
295+
*
296296
* @return bool
297297
* true - Loading bootloader data register was successfull.
298298
* false - Loading bootloader data from the registers has failed.
@@ -302,7 +302,8 @@ bool Touch::tsLoadBootloaderRegs(struct cyttspBootloaderData *_blDataPtr)
302302
// Bootloader temp. registers array.
303303
uint8_t _bootloaderData[16];
304304

305-
if (!tsReadI2CRegs(CYPRESS_TOUCH_BASE_ADDR, _bootloaderData, 16)) return false;
305+
if (!tsReadI2CRegs(CYPRESS_TOUCH_BASE_ADDR, _bootloaderData, 16))
306+
return false;
306307

307308
// Parse Bootloader data into typedef struct.
308309
memcpy(_blDataPtr, _bootloaderData, 16);
@@ -313,23 +314,22 @@ bool Touch::tsLoadBootloaderRegs(struct cyttspBootloaderData *_blDataPtr)
313314
/**
314315
* @brief Method forces Touchscreen Controller to exit bootloader mode and enters normal
315316
* operating mode - to load preloaded firmware (possibly TTSP - TrueTouch Standard Product Firmware).
316-
*
317+
*
317318
* @return bool
318319
* true - Touchscreen Controller quit bootloader mode and loaded TTSP FW that is currently executing.
319320
* false - Touchscreen Controller failed to exit bootloader mode.
320-
*
321+
*
321322
* @note It exiting bootloader mode fails reading touch events will fail. Do not go further with the code for the
322323
* Touchscreen.
323324
*/
324325
bool Touch::tsExitBootLoaderMode()
325326
{
326327
// Bootloader command array.
327-
uint8_t _blCommandArry[] =
328-
{
329-
0x00, // File offset.
330-
0xFF, // Command.
331-
0xA5, // Exit bootloader command.
332-
0, 1, 2, 3, 4, 5, 6, 7 // Default keys.
328+
uint8_t _blCommandArry[] = {
329+
0x00, // File offset.
330+
0xFF, // Command.
331+
0xA5, // Exit bootloader command.
332+
0, 1, 2, 3, 4, 5, 6, 7 // Default keys.
333333
};
334334

335335
// Write bootloader settings.
@@ -344,23 +344,24 @@ bool Touch::tsExitBootLoaderMode()
344344
tsLoadBootloaderRegs(&_bootloaderData);
345345

346346
// Check for validity.
347-
if (TS_GET_BOOTLOADERMODE(_bootloaderData.bl_status)) return false;
347+
if (TS_GET_BOOTLOADERMODE(_bootloaderData.bl_status))
348+
return false;
348349

349350
// If everything went ok return true.
350351
return true;
351352
}
352353

353354
/**
354355
* @brief Set Touchscreen Controller into System Info mode.
355-
*
356+
*
356357
* @param struct cyttspSysinfoData *_sysDataPtr
357358
* Defined cypressTouchTypedefs.h, pointer to the struct for the system info registers.
358-
*
359+
*
359360
* @return bool
360361
* true - System Info mode usccessfully set.
361362
* false - System Info mode failed.
362-
*
363-
* @note As soon as this fails, stop the Touchscreen from executing, touch data will be invalid.
363+
*
364+
* @note As soon as this fails, stop the Touchscreen from executing, touch data will be invalid.
364365
*/
365366
bool Touch::tsSetSysInfoMode(struct cyttspSysinfoData *_sysDataPtr)
366367
{
@@ -397,14 +398,14 @@ bool Touch::tsSetSysInfoMode(struct cyttspSysinfoData *_sysDataPtr)
397398

398399
/**
399400
* @brief Set System info registers into their default state.
400-
*
401+
*
401402
* @param struct cyttspSysinfoData *_sysDataPtr
402403
* Defined in TouchCypressTypedefs.h, poinet to the struct for the system info registers.
403-
*
404+
*
404405
* @return bool
405406
* true - Registers are set successfully.
406407
* false - Setting registers has failed.
407-
*
408+
*
408409
* @note Stop the tuchscreen code from executing if this fails, touch data will be invalid.
409410
*/
410411
bool Touch::tsSetSysInfoRegs(struct cyttspSysinfoData *_sysDataPtr)
@@ -417,7 +418,8 @@ bool Touch::tsSetSysInfoRegs(struct cyttspSysinfoData *_sysDataPtr)
417418
uint8_t _regs[] = {_sysDataPtr->act_intrvl, _sysDataPtr->tch_tmout, _sysDataPtr->lp_intrvl};
418419

419420
// Send the registers to the I2C. Check if failed. If failed, return false.
420-
if (!tsWriteI2CRegs(0x1D, _regs, 3)) return false;
421+
if (!tsWriteI2CRegs(0x1D, _regs, 3))
422+
return false;
421423

422424
// Wait a little bit.
423425
delay(20);
@@ -429,7 +431,7 @@ bool Touch::tsSetSysInfoRegs(struct cyttspSysinfoData *_sysDataPtr)
429431
/**
430432
* @brief Method does handshake for the Touchscreen/Touchscreen Controller to confirm successfull read
431433
* new touch report data.
432-
*
434+
*
433435
* @note Handshake must be done on every new touch event from the Interrupt.
434436
*/
435437
void Touch::tsHandshake()
@@ -472,18 +474,18 @@ bool Touch::tsPing(int _retries)
472474

473475
/**
474476
* @brief Method sends I2C command to the Touchscreen Controller IC.
475-
*
477+
*
476478
* @param uint8_t _cmd
477-
* I2C command for the Touchscreen Controller IC.
478-
*
479+
* I2C command for the Touchscreen Controller IC.
480+
*
479481
* @return true - Command is succesfully send and executed.
480482
* false - I2C command send failed.
481483
*/
482484
bool Touch::tsSendCommand(uint8_t _cmd)
483485
{
484486
// Init I2C communication.
485487
Wire.beginTransmission(CPYRESS_TOUCH_I2C_ADDR);
486-
488+
487489
// I'm not sure about this?
488490
// Write I2C sub-address (register address).
489491
Wire.write(CYPRESS_TOUCH_BASE_ADDR);
@@ -495,23 +497,23 @@ bool Touch::tsSendCommand(uint8_t _cmd)
495497
delay(20);
496498

497499
// Send to I2C!
498-
return Wire.endTransmission() == 0?true:false;
500+
return Wire.endTransmission() == 0 ? true : false;
499501
}
500502

501503
/**
502504
* @brief Method reads multiple I2C registers at once from the touchscreen controller and save them into buffer.
503-
*
505+
*
504506
* @param uint8_t _cmd
505507
* I2C command for the Touchscreen Controller.
506508
* @param uint8_t *_buffer
507-
* Buffer for the bytes read from the Touchscreen Controller.
509+
* Buffer for the bytes read from the Touchscreen Controller.
508510
* @param int _len
509511
* How many bytes to read from the I2C (Touchscreen Controller).
510-
*
512+
*
511513
* @return bool
512514
* true - I2C register read was successfull.
513515
* false - I2C register read failed.
514-
*
516+
*
515517
* @note More than 32 bytes can be read at the same time.
516518
*/
517519
bool Touch::tsReadI2CRegs(uint8_t _cmd, uint8_t *_buffer, int _len)
@@ -534,12 +536,12 @@ bool Touch::tsReadI2CRegs(uint8_t _cmd, uint8_t *_buffer, int _len)
534536
while (_len > 0)
535537
{
536538
// Check for the size of the remaining buffer.
537-
int _i2cLen = _len > 32?32:_len;
539+
int _i2cLen = _len > 32 ? 32 : _len;
538540

539541
// Read the bytes from the I2C.
540542
Wire.requestFrom(CPYRESS_TOUCH_I2C_ADDR, _i2cLen);
541543
Wire.readBytes(_buffer + _index, _i2cLen);
542-
544+
543545
// Update the buffer index position.
544546
_index += _i2cLen;
545547

@@ -553,18 +555,18 @@ bool Touch::tsReadI2CRegs(uint8_t _cmd, uint8_t *_buffer, int _len)
553555

554556
/**
555557
* @brief Method writes multiple I2C registers at once to the touchscreen controller from buffer provided.
556-
*
558+
*
557559
* @param uint8_t _cmd
558560
* I2C command for the Touchscreen Controller.
559561
* @param uint8_t *_buffer
560-
* Buffer for the bytes that needs to be sent to the Touchscreen Controller.
562+
* Buffer for the bytes that needs to be sent to the Touchscreen Controller.
561563
* @param int _len
562564
* How many bytes to write to the I2C (Touchscreen Controller).
563-
*
565+
*
564566
* @return bool
565567
* true - I2C register write was successfull.
566568
* false - I2C register write failed.
567-
*
569+
*
568570
* @note More than 32 bytes can be written at the same time.
569571
*/
570572
bool Touch::tsWriteI2CRegs(uint8_t _cmd, uint8_t *_buffer, int _len)

0 commit comments

Comments
 (0)