[realtek-ambz] Fix PWM output

This commit is contained in:
Kuba Szczodrzyński
2022-06-06 14:52:11 +02:00
parent 48f6210607
commit f72dd3b7d7
4 changed files with 11 additions and 18 deletions

View File

@@ -99,27 +99,27 @@ Note: this list will probably change with each functionality update.
  | `realtek-ambz`
--------------------|---------------
Core functions | ✔️
GPIO/PWM/IRQ | ✔️//✔️
GPIO/PWM/IRQ | ✔️/✔️/✔️
Analog input | ❓
UART I/O | ✔️
Flash I/O |
Flash I/O | ✔️
**CORE LIBRARIES** |
SoftwareSerial | ❌
SPI | ❌
Wire | ❗
**OTHER LIBRARIES** |
Wi-Fi STA/AP/Mixed | ✔️
Wi-Fi Client (SSL) | ✔️ (✔️)
Wi-Fi Server | ✔️
Wi-Fi Events | ✔️
TCP Client (SSL) | ✔️ (✔️)
TCP Server | ✔️
IPv6 | ❌
HTTP Client (SSL) | ✔️ (✔️)
HTTP Server | ✔️
NVS / Preferences | ✔️
NVS / Preferences |
SPIFFS | ❌
BLE | -
NTP | ❌
OTA |
OTA | ✔️
MDNS | ✔️
MQTT | ✅
SD | ❌

View File

@@ -126,7 +126,7 @@ void analogWrite(pin_size_t pinNumber, int value) {
pwmout_t *obj;
if ((g_APinDescription[pinNumber].ulPinAttribute & PIO_PWM) == PIO_PWM) {
/* Handle */
float percent = value * 1.0 / (1 << _writeResolution);
if (g_APinDescription[pinNumber].ulPinType != PIO_PWM) {
if ((g_APinDescription[pinNumber].ulPinType == PIO_GPIO) ||
(g_APinDescription[pinNumber].ulPinType == PIO_GPIO_IRQ)) {
@@ -136,16 +136,13 @@ void analogWrite(pin_size_t pinNumber, int value) {
pwmout_t *obj = (pwmout_t *)gpio_pin_struct[pinNumber];
pwmout_init(obj, g_APinDescription[pinNumber].pinname);
pwmout_period_us(obj, _writePeriod);
pwmout_write(obj, value * 1.0 / (1 << _writeResolution));
pwmout_write(obj, percent);
g_APinDescription[pinNumber].ulPinType = PIO_PWM;
g_APinDescription[pinNumber].ulPinMode = PWM_MODE_ENABLED;
} else {
pwmout_t *obj = (pwmout_t *)gpio_pin_struct[pinNumber];
pwmout_period_us(obj, _writePeriod);
pwmout_write(obj, value * 1.0 / (1 << _writeResolution));
/* if ( g_APinDescription[pinNumber].ulPinMode == PWM_MODE_DISABLED ) {
HAL_Pwm_Enable( &obj->pwm_hal_adp );
} */
// pwmout_period_us(obj, _writePeriod);
pwmout_write(obj, percent);
}
}
}

View File

@@ -2,13 +2,9 @@
```
arm-none-eabi-gcc-ar xo lib_rtlstd.a
arm-none-eabi-objcopy -N __aeabi_fsub rtl_eabi_cast_ram.o
arm-none-eabi-objcopy -N __aeabi_fadd rtl_eabi_cast_ram.o
arm-none-eabi-objcopy -N __aeabi_ui2f rtl_eabi_cast_ram.o
arm-none-eabi-objcopy -N __aeabi_i2f rtl_eabi_cast_ram.o
rm rtl_eabi_cast_ram.o
arm-none-eabi-objcopy --strip-debug --strip-unneeded ram_libc.o
arm-none-eabi-objcopy --strip-debug --strip-unneeded ram_libgloss_retarget.o
arm-none-eabi-objcopy --strip-debug --strip-unneeded rtl_eabi_cast_ram.o
arm-none-eabi-objcopy --strip-debug --strip-unneeded rtl_math_ram.o
arm-none-eabi-gcc-ar qs lib_rtlstd_patch.a *.o
```