Pārlūkot izejas kodu

analogWriteResolution() returns prior setting

teensy4-core
PaulStoffregen pirms 7 gadiem
vecāks
revīzija
77e813b2a6
2 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  1. +2
    -2
      teensy3/core_pins.h
  2. +4
    -1
      teensy3/pins_teensy.c

+ 2
- 2
teensy3/core_pins.h Parādīt failu

@@ -1918,8 +1918,8 @@ static inline uint8_t digitalReadFast(uint8_t pin)
void pinMode(uint8_t pin, uint8_t mode);
void init_pins(void);
void analogWrite(uint8_t pin, int val);
void analogWriteRes(uint32_t bits);
static inline void analogWriteResolution(uint32_t bits) { analogWriteRes(bits); }
uint32_t analogWriteRes(uint32_t bits);
static inline uint32_t analogWriteResolution(uint32_t bits) { return analogWriteRes(bits); }
void analogWriteFrequency(uint8_t pin, float frequency);
void analogWriteDAC0(int val);
void analogWriteDAC1(int val);

+ 4
- 1
teensy3/pins_teensy.c Parādīt failu

@@ -899,14 +899,17 @@ void analogWrite(uint8_t pin, int val)
}


void analogWriteRes(uint32_t bits)
uint32_t analogWriteRes(uint32_t bits)
{
uint32_t prior_res;
if (bits < 1) {
bits = 1;
} else if (bits > 16) {
bits = 16;
}
prior_res = analog_write_res;
analog_write_res = bits;
return prior_res;
}



Notiek ielāde…
Atcelt
Saglabāt