[meowbit] change board.BUZZ type to PWMAudioOut,

as advised in #4257
This commit is contained in:
Artyom Skrobov 2021-04-03 13:32:17 -04:00
parent b40d072648
commit 4ee781227f
2 changed files with 11 additions and 3 deletions

View File

@ -27,15 +27,15 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
#include "shared-bindings/board/__init__.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
#include "shared-bindings/busio/SPI.h"
#include "supervisor/spi_flash_api.h"
displayio_fourwire_obj_t board_display_obj;
audiopwmio_pwmaudioout_obj_t board_buzz_obj;
#define DELAY 0x80
@ -113,6 +113,11 @@ void board_init(void) {
60, // native_frames_per_second
true, // backlight_on_high
false); // SH1107_addressing
board_buzz_obj.base.type = &audiopwmio_pwmaudioout_type;
common_hal_audiopwmio_pwmaudioout_construct(&board_buzz_obj,
&pin_PB08, NULL, 0x8000);
never_reset_pin_number(pin_PB08.port, pin_PB08.number);
}
bool board_requests_safe_mode(void) {

View File

@ -1,8 +1,11 @@
#include "shared-bindings/board/__init__.h"
#include "supervisor/spi_flash_api.h"
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
#include "shared-module/displayio/__init__.h"
extern audiopwmio_pwmaudioout_obj_t board_buzz_obj;
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PB05) },
@ -15,7 +18,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_DISP_RST), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_DISP_BL), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&board_buzz_obj) },
{ MP_ROM_QSTR(MP_QSTR_BTNA), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_BTNB), MP_ROM_PTR(&pin_PC03) },
{ MP_ROM_QSTR(MP_QSTR_RIGHT), MP_ROM_PTR(&pin_PB02) },