Skip to content

Commit 836db4e

Browse files
authored
Merge pull request #4816 from hierophect/rp2040-alarms
RP2040: add Alarm module
2 parents 0438d7f + 1f3d69d commit 836db4e

File tree

29 files changed

+891
-0
lines changed

29 files changed

+891
-0
lines changed

locale/circuitpython.pot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,7 @@ msgstr ""
17021702

17031703
#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c
17041704
#: ports/nrf/common-hal/alarm/time/TimeAlarm.c
1705+
#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c
17051706
#: ports/stm/common-hal/alarm/time/TimeAlarm.c
17061707
msgid "Only one alarm.time alarm can be set."
17071708
msgstr ""
@@ -2035,6 +2036,7 @@ msgstr ""
20352036
msgid "Size not supported"
20362037
msgstr ""
20372038

2039+
#: ports/raspberrypi/common-hal/alarm/SleepMemory.c
20382040
#: ports/stm/common-hal/alarm/SleepMemory.c
20392041
msgid "Sleep Memory not available"
20402042
msgstr ""
@@ -2179,6 +2181,7 @@ msgstr ""
21792181
msgid "Total data to write is larger than %q"
21802182
msgstr ""
21812183

2184+
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
21822185
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
21832186
msgid "Touch alarms not available"
21842187
msgstr ""

ports/raspberrypi/boards/adafruit_feather_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ bool board_requests_safe_mode(void) {
3838

3939
void reset_board(void) {
4040
}
41+
42+
void board_deinit(void) {
43+
}

ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ void reset_board(void) {
4141
// turn off any left over LED
4242
board_reset_user_neopixels(&pin_GPIO19, 12);
4343
}
44+
45+
void board_deinit(void) {
46+
}

ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ bool board_requests_safe_mode(void) {
3838

3939
void reset_board(void) {
4040
}
41+
42+
void board_deinit(void) {
43+
}

ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/cytron_maker_pi_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_keybow2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_pga2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_picolipo_16mb/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_picolipo_4mb/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_picosystem/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/pimoroni_tiny2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/raspberry_pi_pico/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ bool board_requests_safe_mode(void) {
3535

3636
void reset_board(void) {
3737
}
38+
39+
void board_deinit(void) {
40+
}

ports/raspberrypi/boards/sparkfun_micromod_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ bool board_requests_safe_mode(void) {
3838

3939
void reset_board(void) {
4040
}
41+
42+
void board_deinit(void) {
43+
}

ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ bool board_requests_safe_mode(void) {
3838

3939
void reset_board(void) {
4040
}
41+
42+
void board_deinit(void) {
43+
}

ports/raspberrypi/boards/sparkfun_thing_plus_rp2040/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ bool board_requests_safe_mode(void) {
3838

3939
void reset_board(void) {
4040
}
41+
42+
void board_deinit(void) {
43+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2021 Lucian Copeland for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include <string.h>
28+
29+
#include "py/runtime.h"
30+
#include "common-hal/alarm/SleepMemory.h"
31+
32+
void alarm_sleep_memory_reset(void) {
33+
}
34+
35+
uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) {
36+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
37+
return 0;
38+
}
39+
40+
bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t *values, uint32_t len) {
41+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
42+
return false;
43+
}
44+
45+
void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len) {
46+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
47+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2021 Lucian Copeland for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ALARM_SLEEPMEMORY_H
28+
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ALARM_SLEEPMEMORY_H
29+
30+
#include "py/obj.h"
31+
32+
typedef struct {
33+
mp_obj_base_t base;
34+
} alarm_sleep_memory_obj_t;
35+
36+
extern void alarm_sleep_memory_reset(void);
37+
38+
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ALARM_SLEEPMEMORY_H

0 commit comments

Comments
 (0)