Skip to content

Commit 16c46b2

Browse files
committed
Code Format
1 parent 29472c2 commit 16c46b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+28533
-22579
lines changed

examples/Unit/CATCH/CATCH.ino

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
#include <M5Stack.h>
66

77
const int servoPin = 26;
8-
int freq = 50;
9-
int ledChannel = 0;
10-
int resolution = 10;
8+
int freq = 50;
9+
int ledChannel = 0;
10+
int resolution = 10;
1111
void setup() {
12-
// put your setup code here, to run once:
13-
M5.begin();
14-
M5.Power.begin();
15-
M5.Lcd.setCursor(100, 50, 4);
16-
M5.Lcd.println("Catch Unit");
17-
M5.Lcd.setCursor(40, 120, 4);
18-
M5.Lcd.println("Connect to the Port B");
19-
ledcSetup(ledChannel, freq, resolution);
20-
ledcAttachPin(servoPin, ledChannel);
12+
// put your setup code here, to run once:
13+
M5.begin();
14+
M5.Power.begin();
15+
M5.Lcd.setCursor(100, 50, 4);
16+
M5.Lcd.println("Catch Unit");
17+
M5.Lcd.setCursor(40, 120, 4);
18+
M5.Lcd.println("Connect to the Port B");
19+
ledcSetup(ledChannel, freq, resolution);
20+
ledcAttachPin(servoPin, ledChannel);
2121
}
2222

2323
void loop() {
24-
// High level 0.5ms is angle 0°
25-
// duty = 0.5/20ms = 0.025, 0.025*1023≈25
24+
// High level 0.5ms is angle 0°
25+
// duty = 0.5/20ms = 0.025, 0.025*1023≈25
2626
ledcWrite(ledChannel, 25);
2727
delay(2000);
28-
// High level 1ms is angle 45°
29-
// duty = 1/20ms = 0.05, 0.05*1023≈50
28+
// High level 1ms is angle 45°
29+
// duty = 1/20ms = 0.05, 0.05*1023≈50
3030
ledcWrite(ledChannel, 50);
3131
delay(2000);
3232
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
/*
22
Description: Control CAT EAR to run rainbow light show
3-
Please install library before compiling:
3+
Please install library before compiling:
44
FastLED: https://github.com/FastLED/FastLED
55
*/
66
#include <M5Stack.h>
7+
78
#include "FastLED.h"
89

9-
#define Neopixel_PIN 21
10-
#define NUM_LEDS 118
10+
#define Neopixel_PIN 21
11+
#define NUM_LEDS 118
1112

1213
CRGB leds[NUM_LEDS];
13-
uint8_t gHue = 0;
14+
uint8_t gHue = 0;
1415
static TaskHandle_t FastLEDshowTaskHandle = 0;
15-
static TaskHandle_t userTaskHandle = 0;
16+
static TaskHandle_t userTaskHandle = 0;
1617
void setup() {
17-
M5.begin();
18-
M5.Power.begin();
18+
M5.begin();
19+
M5.Power.begin();
1920

20-
M5.Lcd.clear(BLACK);
21-
M5.Lcd.setTextColor(YELLOW); M5.Lcd.setTextSize(2); M5.Lcd.setCursor(60, 160);
22-
M5.Lcd.println("CatEar Example");
23-
M5.Lcd.setTextColor(WHITE);
24-
// Neopixel initialization
25-
FastLED.addLeds<WS2811,Neopixel_PIN,GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
26-
FastLED.setBrightness(10);
27-
xTaskCreatePinnedToCore(FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2, NULL, 1);
21+
M5.Lcd.clear(BLACK);
22+
M5.Lcd.setTextColor(YELLOW);
23+
M5.Lcd.setTextSize(2);
24+
M5.Lcd.setCursor(60, 160);
25+
M5.Lcd.println("CatEar Example");
26+
M5.Lcd.setTextColor(WHITE);
27+
// Neopixel initialization
28+
FastLED.addLeds<WS2811, Neopixel_PIN, GRB>(leds, NUM_LEDS)
29+
.setCorrection(TypicalLEDStrip);
30+
FastLED.setBrightness(10);
31+
xTaskCreatePinnedToCore(FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2,
32+
NULL, 1);
2833
}
2934

30-
void loop()
31-
{
32-
33-
}
35+
void loop() {}
3436

35-
void FastLEDshowESP32()
36-
{
37+
void FastLEDshowESP32() {
3738
if (userTaskHandle == 0) {
3839
userTaskHandle = xTaskGetCurrentTaskHandle();
3940
xTaskNotifyGive(FastLEDshowTaskHandle);
40-
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
41+
const TickType_t xMaxBlockTime = pdMS_TO_TICKS(200);
4142
ulTaskNotifyTake(pdTRUE, xMaxBlockTime);
4243
userTaskHandle = 0;
4344
}
4445
}
4546

46-
void FastLEDshowTask(void *pvParameters)
47-
{
48-
for(;;) {
49-
fill_rainbow(leds, NUM_LEDS, gHue, 7);// rainbow effect
50-
FastLED.show();// must be executed for neopixel becoming effective
51-
EVERY_N_MILLISECONDS( 20 ) { gHue++; }
47+
void FastLEDshowTask(void *pvParameters) {
48+
for (;;) {
49+
fill_rainbow(leds, NUM_LEDS, gHue, 7); // rainbow effect
50+
FastLED.show(); // must be executed for neopixel becoming effective
51+
EVERY_N_MILLISECONDS(20) { gHue++; }
5252
}
5353
}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
/*
2-
Description: The command data of the USB UART is forwarded to the GPS Unit for debugging and functional verification.
2+
Description: The command data of the USB UART is forwarded to the GPS Unit
3+
for debugging and functional verification.
34
*/
45
#include <M5Stack.h>
56

67
HardwareSerial GPSRaw(2);
78

89
void setup() {
9-
10-
M5.begin();
11-
M5.Power.begin();
12-
GPSRaw.begin(9600);
10+
M5.begin();
11+
M5.Power.begin();
12+
GPSRaw.begin(9600);
1313

14-
Serial.println("hello");
15-
termInit();
16-
M5.Lcd.setTextFont(4);
17-
M5.Lcd.setCursor(50, 100, 4);
18-
M5.Lcd.println(("GPS Raw Example"));
19-
}
14+
Serial.println("hello");
15+
termInit();
16+
M5.Lcd.setTextFont(4);
17+
M5.Lcd.setCursor(50, 100, 4);
18+
M5.Lcd.println(("GPS Raw Example"));
19+
}
2020

2121
void loop() {
22-
// put your main code here, to run repeatedly:
23-
if(Serial.available()) {
24-
int ch = Serial.read();
25-
GPSRaw.write(ch);
26-
}
22+
// put your main code here, to run repeatedly:
23+
if (Serial.available()) {
24+
int ch = Serial.read();
25+
GPSRaw.write(ch);
26+
}
2727

28-
if(GPSRaw.available()) {
29-
int ch = GPSRaw.read();
30-
Serial.write(ch);
31-
termPutchar(ch);
32-
}
28+
if (GPSRaw.available()) {
29+
int ch = GPSRaw.read();
30+
Serial.write(ch);
31+
termPutchar(ch);
32+
}
3333
}

0 commit comments

Comments
 (0)