Apply loop shorthand macros (#17159)
This commit is contained in:
@ -197,7 +197,7 @@ void spiBegin() {
|
||||
// output pin high - like sending 0xFF
|
||||
WRITE(MOSI_PIN, HIGH);
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
LOOP_L_N(i, 8) {
|
||||
WRITE(SCK_PIN, HIGH);
|
||||
|
||||
nop; // adjust so SCK is nice
|
||||
@ -224,7 +224,7 @@ void spiBegin() {
|
||||
void spiSend(uint8_t data) {
|
||||
// no interrupts during byte send - about 8µs
|
||||
cli();
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
LOOP_L_N(i, 8) {
|
||||
WRITE(SCK_PIN, LOW);
|
||||
WRITE(MOSI_PIN, data & 0x80);
|
||||
data <<= 1;
|
||||
|
@ -682,7 +682,7 @@
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
double rounding = 0.5;
|
||||
for (uint8_t i = 0; i < digits; ++i) rounding *= 0.1;
|
||||
LOOP_L_N(i, digits) rounding *= 0.1;
|
||||
number += rounding;
|
||||
|
||||
// Extract the integer part of the number and print it
|
||||
|
@ -167,7 +167,7 @@ void set_pwm_frequency(const pin_t pin, int f_desired) {
|
||||
uint16_t prescaler[] = { 0, 1, 8, /*TIMER2 ONLY*/32, 64, /*TIMER2 ONLY*/128, 256, 1024 };
|
||||
|
||||
// loop over prescaler values
|
||||
for (uint8_t i = 1; i < 8; i++) {
|
||||
LOOP_S_L_N(i, 1, 8) {
|
||||
uint16_t res_temp_fast = 255, res_temp_phase_correct = 255;
|
||||
if (timer.n == 2) {
|
||||
// No resolution calculation for TIMER2 unless enabled USE_OCR2A_AS_TOP
|
||||
|
@ -70,12 +70,12 @@
|
||||
|
||||
void PRINT_ARRAY_NAME(uint8_t x) {
|
||||
char *name_mem_pointer = (char*)pgm_read_ptr(&pin_array[x].name);
|
||||
for (uint8_t y = 0; y < MAX_NAME_LENGTH; y++) {
|
||||
LOOP_L_N(y, MAX_NAME_LENGTH) {
|
||||
char temp_char = pgm_read_byte(name_mem_pointer + y);
|
||||
if (temp_char != 0)
|
||||
SERIAL_CHAR(temp_char);
|
||||
else {
|
||||
for (uint8_t i = 0; i < MAX_NAME_LENGTH - y; i++) SERIAL_CHAR(' ');
|
||||
LOOP_L_N(i, MAX_NAME_LENGTH - y) SERIAL_CHAR(' ');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void u8g_spiSend_sw_AVR_mode_0(uint8_t val) {
|
||||
volatile uint8_t *outData = u8g_outData,
|
||||
*outClock = u8g_outClock;
|
||||
U8G_ATOMIC_START();
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
LOOP_L_N(i, 8) {
|
||||
if (val & 0x80)
|
||||
*outData |= bitData;
|
||||
else
|
||||
@ -108,7 +108,7 @@ void u8g_spiSend_sw_AVR_mode_3(uint8_t val) {
|
||||
volatile uint8_t *outData = u8g_outData,
|
||||
*outClock = u8g_outClock;
|
||||
U8G_ATOMIC_START();
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
LOOP_L_N(i, 8) {
|
||||
*outClock &= bitNotClock;
|
||||
if (val & 0x80)
|
||||
*outData |= bitData;
|
||||
|
Reference in New Issue
Block a user