Commit Graph

123 Commits

Author SHA1 Message Date
Kamil Tomaszewski
18668f6e28 spresense: fix spi to work with only one data pin 2021-03-11 18:06:49 +01:00
Kamil Tomaszewski
76d0870fba spresense: return error as positive value for i2c 2021-03-11 18:04:01 +01:00
Kamil Tomaszewski
7c921b808b spresense: Define LONGINT_IMPL as MPZ 2021-03-02 14:25:22 +01:00
Kamil Tomaszewski
f9d21637a3 spresense: return valid reference voltage 2021-03-02 14:25:22 +01:00
Scott Shawcroft
d0eab5c561
Merge pull request #4256 from kmatch98/bt_cleanup
Add `bitmaptools` module
2021-03-01 18:24:12 -08:00
Kamil Tomaszewski
d68fdf3a3d spresense: return the correct value for Analog In 2021-03-01 15:45:10 +01:00
Kevin Matocha
a7a4f93ff8 Updated build configs to turn off BITMAPTOOLS for smaller builds 2021-02-25 15:44:32 -06:00
Kamil Tomaszewski
e369473794 spresense: change RX and TX buffer size for CDC 2021-02-24 18:19:18 +01:00
Dan Halbert
e344c6d684 fix some builds 2021-02-18 14:24:58 -05:00
Dan Halbert
c26de0136a works! no timeouts 2021-02-16 17:39:36 -05:00
Dan Halbert
f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
Kamil Tomaszewski
c5992a3101 spresense: update Spresense SDK to 2.0.2 2021-01-25 18:40:14 +01:00
iot49
1a82555803
Merge branch 'main' into msgpack 2021-01-05 11:19:11 -08:00
Dan Halbert
8f9cd7075e
Merge pull request #3752 from jepler/gcc10
build: Update to gcc10
2020-12-17 11:03:40 -05:00
Dan Halbert
fb33c4e1c0 -ftree-vrp better diagnostics on -Os builds; -fno-inline-functions for -O2; fix struct init in HCI bleio 2020-12-15 12:23:56 -05:00
Scott Shawcroft
344d3c59cb
Merge branch 'main' into msgpack 2020-12-11 11:10:30 -08:00
Scott Shawcroft
40118bcf57
Add board_deinit for use with sleep
This changes lots of files to unify `board.h` across ports. It adds
`board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to
deinit the board before deep sleeping (even when pretending.)

Deep sleep is now a two step process for the port. First, the
port should prepare to deep sleep based on the given alarms. It
should set alarms for both deep and pretend sleep. In particular,
the pretend versions should be set immediately so that we don't
miss an alarm as we shutdown. These alarms should also wake from
`port_idle_until_interrupt` which is used when pretending to deep
sleep.

Second, when real deep sleeping, `alarm_enter_deep_sleep` is called.
The port should set any alarms it didn't during prepare based on
data it saved internally during prepare.

ESP32-S2 sleep is a bit reorganized to locate more logic with
TimeAlarm. This will help it scale to more alarm types.

Fixes #3786
2020-12-08 10:52:25 -08:00
Scott Shawcroft
608c98501b
Merge remote-tracking branch 'adafruit/main' into msgpack 2020-12-02 13:10:39 -08:00
Scott Shawcroft
d7ba641ff6
Merge pull request #3767 from dhalbert/sleep
Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented
2020-12-02 12:51:43 -08:00
Bernhard Boser
546b15bf1a
add trailing newline 2020-12-01 18:42:07 -08:00
Bernhard Boser
87d4184dd5
exclude spresense 2020-12-01 18:42:06 -08:00
Bernhard Boser
582a47d71a
rename read, write to read_bytes, write_bytes 2020-12-01 18:41:11 -08:00
Bernhard Boser
59c3e25168
disable on boards tight on memory. add stddef.h to imports (not actually needed). 2020-12-01 18:39:24 -08:00
Dan Halbert
8b7c23c1ee address review comments 2020-12-01 20:01:14 -05:00
Christian Walther
c7404a3ff8 Add movable allocation system.
This allows calls to `allocate_memory()` while the VM is running, it will then allocate from the GC heap (unless there is a suitable hole among the supervisor allocations), and when the VM exits and the GC heap is freed, the allocation will be moved to the bottom of the former GC heap and transformed into a proper supervisor allocation. Existing movable allocations will also be moved to defragment the supervisor heap and ensure that the next VM run gets as much memory as possible for the GC heap.

By itself this breaks terminalio because it violates the assumption that supervisor_display_move_memory() still has access to an undisturbed heap to copy the tilegrid from. It will work in many cases, but if you're unlucky you will get garbled terminal contents after exiting from the vm run that created the display. This will be fixed in the following commit, which is separate to simplify review.
2020-11-28 17:50:23 +01:00
Dan Halbert
104a089677 deep sleep working; deep sleep delay when connected 2020-11-26 22:06:37 -05:00
Dan Halbert
a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert
75559f35cc wip: ResetReason to microcontroller.cpu 2020-11-21 23:29:52 -05:00
Dan Halbert
cd436bad1a Merge remote-tracking branch 'adafruit/main' into sleep 2020-11-19 15:43:49 -05:00
Kamil Tomaszewski
76d4824728 spresense: Return fixed stack 2020-11-19 15:04:52 +01:00
microDev
930cf14dce
Add check for invalid io, function to disable all alarms 2020-10-27 16:17:26 -07:00
microDev
e35938971a
Add description of alarm modules 2020-10-27 16:16:55 -07:00
Dan Halbert
f51e75c1d2 cxd56 needed more precise include for __packed; needed SRC_C += on some ports 2020-10-15 15:24:24 -04:00
Jeff Epler
726dcdb60a Add some NORETURN attributes
I have a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom:
```
int find_unused_slot(void) {
    // precondition: you already verified that a slot was available
    for (int i=0; i<NUM_SLOTS; i++) {
        if( slot_free(i)) {
            return i;
        }
    }
    safe_mode_reset(MICROPY_FATAL_ERROR);
}
```
However, the compiler still gave a diagnostic, because safe_mode_reset was not declared NORETURN.

So I started by teaching the compiler that reset_into_safe_mode never returned.  This leads at least one level deeper due to reset_cpu needing to be a NORETURN function.  Each port is a little different in this area.  I also marked reset_to_bootloader as NORETURN.
Additional notes:

 * stm32's reset_to_bootloader was not implemented, but now does a bare reset.  Most stm32s are not fitted with uf2 bootloaders anyway.
 * ditto cxd56
 * esp32s2 did not implement reset_cpu at all.  I used esp_restart().  (not tested)
 * litex did not implement reset_cpu at all.  I used reboot_ctrl_write.  But notably this is what reset_to_bootloader already did, so one or the other must be incorrect (not tested).  reboot_ctrl_write cannot be declared NORETURN, as it returns unless the special value 0xac is written), so a new unreachable forever-loop is added.
 * cxd56's reset is via a boardctl() call which can't generically be declared NORETURN, so a new unreacahble "for(;;)" forever-loop is added.
 * In several places, NVIC_SystemReset is redeclared with NORETURN applied.  This is accepted just fine by gcc.  I chose this as preferable to editing the multiple copies of CMSIS headers where it is normally declared.
 * the stub safe_mode reset simply aborts.  This is used in mpy-cross.
2020-09-28 18:55:56 -05:00
Kamil Tomaszewski
61687c81d8 camera: Pass width and height to take_picture() 2020-09-16 13:55:57 +02:00
Kamil Tomaszewski
ce7ee58e92 camera: Update camera module 2020-09-14 13:12:20 +02:00
Kamil Tomaszewski
c2fc592c2c camera: Change API 2020-09-14 13:11:15 +02:00
Kamil Tomaszewski
143a1ff94a spresense: change the GC to do 32-byte blocks 2020-09-14 13:11:15 +02:00
Kamil Tomaszewski
1fde8ef9bc spresense: Add support for camera 2020-09-14 13:11:15 +02:00
Lucian Copeland
8021da08d3 Fix problematic whitespace on pulseout parameter errors 2020-08-27 11:07:47 -04:00
Scott Shawcroft
1527a3ce92
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-24 18:25:18 -07:00
Scott Shawcroft
644d2ba7a2 Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack
"extern".  Fix them up.
2020-08-21 14:39:37 -05:00
Scott Shawcroft
83deea0e03
Fix copy pasta and stub build 2020-08-21 11:17:42 -07:00
Scott Shawcroft
a5b01f7361
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-21 11:13:53 -07:00
Scott Shawcroft
400701004b
Merge pull request #3279 from hierophect/esp32-pulseinout
ESP32-S2: Add PulseOut and PulseIn
2020-08-20 11:24:08 -07:00
Kamil Tomaszewski
e2891bc7d4 spresense: call usb_background function 2020-08-20 16:21:25 +02:00
Scott Shawcroft
6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Lucian Copeland
da75445cd5 Style changes, reposition runtime errors 2020-08-18 11:42:06 -04:00
Lucian Copeland
0fc730bc5a Expand PulseOut API, debug cleanup 2020-08-14 16:36:02 -04:00
Jeff Epler
93b373d617 "pop from empty %q"
Saves 12 bytes code on trinket m0
2020-08-04 18:42:09 -05:00