Commit Graph

356 Commits

Author SHA1 Message Date
Scott Shawcroft
6797ec6ed3
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors.

Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly
useful for the SSD1306.

Fixes #1828. Fixes #1956
2019-07-19 16:06:11 -07:00
Hierophect
43e8a4110f Add missing files for DigitalIO 2019-07-17 14:18:01 -04:00
Dan Halbert
364ee62d10 Address review comments. 2019-07-16 19:53:36 -04:00
Dan Halbert
1cf8a3e8d8 Merge remote-tracking branch 'adafruit/master' into ble-scanner 2019-07-11 18:42:16 -04:00
Scott Shawcroft
6fad383367
Merge pull request #1925 from C47D/rgb_status
Initial support for RGB led as Status indicator, fixes #1382
2019-07-09 10:31:34 -07:00
Dan Halbert
6a001786a9 merge from master 2019-07-09 08:58:49 -04:00
Dan Halbert
118b26b335 UARTClient now works both directions 2019-07-09 00:21:46 -04:00
Dan Halbert
09ddff8df1 WIP: Need descriptors for Central CCCD discovery; not done yet 2019-07-07 00:07:47 -04:00
Scott Shawcroft
5610e05b8c
Fix up nrf so that it is initialized properly. Also, do not reset
it's pins.
2019-07-06 12:48:16 -07:00
iot49
6e5d70fa19 changed type of receiver_buffer_size to uint16_t 2019-07-03 12:02:01 -07:00
Dan Halbert
bf8a35b2f8 WIP: CharacteristicBuffer for Central; not working: need to set remote Characteristic Service 2019-07-02 22:34:54 -04:00
Dan Halbert
6ea01ea9b0 Central is connecting; characteristics can be read and written 2019-06-29 00:20:06 -04:00
Dan Halbert
140904ec84 getting Scanner to work 2019-06-22 22:10:15 -04:00
Dan Halbert
4881e1ff55 WIP: Central compiles; now will test 2019-06-21 18:04:04 -04:00
Dan Halbert
23bd861c9a nrf: fix neopixel_write pwm buf size calc 2019-06-20 18:02:14 -04:00
Dan Halbert
24ac1fdcab WIP: backup only; not compiled 2019-06-19 21:54:28 -04:00
Dan Halbert
a1b5d800f3 Update copyrights; get ready for Central 2019-06-19 10:42:36 -04:00
Dan Halbert
35b9191857 Don't operate directly on bleio objects in shared-bindings: use common_hal
routines instead. Changes made but not yet tested.
2019-06-18 23:46:20 -04:00
Dan Halbert
bed6d43a76 merge from upstream; WIP redo Address; no more AddressType 2019-06-13 21:55:07 -04:00
Dan Halbert
1905d90eaa Make advertising data buffers long-lived 2019-06-05 20:08:53 -04:00
Dan Halbert
613e12f99f Replace Broadcaster with enhanced Peripheral 2019-06-03 20:40:05 -04:00
Dan Halbert
63ac37946d 1. Remove advertising data construction in C: it's all done in Python now
2. Add scan response capability to advertising.
2019-06-02 23:21:30 -04:00
Dan Halbert
12f1d9d30c fix advertisement length check; add Service.secondary attribute 2019-05-31 18:03:05 -04:00
Dan Halbert
6cec81bcb5 Need to enable ble before scanning 2019-05-23 22:05:16 -04:00
Dan Halbert
1639354e5f Scanner working, but not very first time 2019-05-23 16:07:54 -04:00
Dan Halbert
15b7946fc4 Off-by-one error for usage of MAX_TX_IN_PROGRESS 2019-04-22 22:07:48 -04:00
Nick Moore
9c42a72275 Fix up single-byte access to nvm.ByteArray 2019-04-16 14:53:44 +10:00
Nick Moore
83dad37562 Fixups for adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore
02dd32da60 Make some space for NVM adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore
66e8ceafad switch nvm.ByteArray to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-16 14:53:44 +10:00
Nick Moore
d0e5af3b09 Working flash pages for nvm.ByteArray adafruit/circuitpython#1042
import microcontroller

def dump(n = microcontroller.nvm):
    for i in range(0,len(n)):
        print ("%02X " % n[i], end="")
        if i % 16 == 15: print('')

microcontroller.nvm[0:4096] = bytes([1,2,3,4,5,6,7,8]) * 512
microcontroller.nvm[4096:8192] = bytes([16,17,18,19]) * 1024
microcontroller.nvm[4090:4101] = b'thisisatest'
microcontroller.nvm[100:105] = b'hello'
microcontroller.nvm[8000:8007] = b'goodbye'
dump()
2019-04-16 14:53:44 +10:00
Nick Moore
933500c448 nvm.ByteArray reads & writes but no sensible erase yet adafruit/circuitpython#1042 2019-04-16 14:53:44 +10:00
Nick Moore
df89156f2f Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet) 2019-04-16 14:53:44 +10:00
Scott Shawcroft
254d0a53ac
Revert "nrf nvm: touchups to nickzoic PR #1768" 2019-04-15 18:50:33 -07:00
Dan Halbert
864910559b fix subscripting 2019-04-10 21:41:55 -04:00
Nick Moore
18908c21f7 Fixups for adafruit/circuitpython#1042 2019-04-09 12:53:11 +10:00
Nick Moore
fdaff00c78 Make some space for NVM adafruit/circuitpython#1042 2019-04-09 10:56:53 +10:00
Nick Moore
bc92441803 switch nvm.ByteArray to use new nrf_nvm_safe_flash_page_write
adafruit/circuitpython#1610
2019-04-09 10:55:39 +10:00
Nick Moore
8e7fee2246 Working flash pages for nvm.ByteArray adafruit/circuitpython#1042
import microcontroller

def dump(n = microcontroller.nvm):
    for i in range(0,len(n)):
        print ("%02X " % n[i], end="")
        if i % 16 == 15: print('')

microcontroller.nvm[0:4096] = bytes([1,2,3,4,5,6,7,8]) * 512
microcontroller.nvm[4096:8192] = bytes([16,17,18,19]) * 1024
microcontroller.nvm[4090:4101] = b'thisisatest'
microcontroller.nvm[100:105] = b'hello'
microcontroller.nvm[8000:8007] = b'goodbye'
dump()
2019-04-09 10:55:39 +10:00
Nick Moore
492431a694 nvm.ByteArray reads & writes but no sensible erase yet adafruit/circuitpython#1042 2019-04-09 10:54:11 +10:00
Nick Moore
f8e5e2da64 Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet) 2019-04-09 10:54:11 +10:00
Scott Shawcroft
049b9ca094
Remove terse TODOs 2019-04-08 14:46:45 -07:00
Radomir Dopieralski
8323721232 Stop hard-coding SPI frequency in FourWire
Instead remember and use the frequency, polarity and phase that was
set when the bus was first created.
2019-04-06 15:15:29 +02:00
Nick Moore
781d301bb6 Remove unnecessary MP_WEAK declarations 2019-04-02 13:33:22 +11:00
Nick Moore
94bda3bde1 Change nRF RTC implementation to use RTC2 #1046
(to avoid interference with Bluetooth Softdevice. See
https://github.com/adafruit/circuitpython/pull/1534#issuecomment-478776240
with thanks to @bboser for pointing it out)
2019-04-02 13:28:22 +11:00
Nick Moore
6afe23d0b0 There isn't really a good way to calibrate this RTC adafruit/circuitpython#1046 2019-04-02 13:28:03 +11:00
Nick Moore
6206fa9a82 adafruit/circuitpython#1046 handle overflows in the RTC counter 2019-04-02 13:27:45 +11:00
Nick Moore
f846fa109e enable NRFX RTC adafruit/circuitpython#1046 2019-04-02 13:27:28 +11:00
Nick Moore
f88f9fd748 more fake RTC code ... adafruit/circuitpython#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
2019-04-02 13:27:13 +11:00
Nick Moore
4a5c52fbd6 starting on #1046 rtc for nRF 2019-04-02 13:27:00 +11:00
Dan Halbert
0653bca323
Revert "Circuitpython nickzoic 1046 nrf rtc" 2019-03-29 16:41:29 -04:00
Nick Moore
71622a4515 There isn't really a good way to calibrate this RTC adafruit/circuitpython#1046 2019-03-28 09:50:09 +11:00
Nick Moore
28254def0b adafruit/circuitpython#1046 handle overflows in the RTC counter 2019-03-28 09:50:09 +11:00
Nick Moore
b09d2c3c62 enable NRFX RTC adafruit/circuitpython#1046 2019-03-28 09:50:09 +11:00
Nick Moore
69cf33e6a1 more fake RTC code ... adafruit/circuitpython#1046
(works if MP_WEAK common_hal_rtc_get_time is removed)
2019-03-28 09:50:09 +11:00
Nick Moore
77f307c642 starting on #1046 rtc for nRF 2019-03-28 09:50:09 +11:00
Radomir Dopieralski
f440e41819 Really fix the error messages in bleio, this time 2019-03-25 14:04:50 +01:00
Radomir Dopieralski
bb10a8aaa1 Fix error messages in bleio 2019-03-25 09:19:48 +01:00
Dan Halbert
fe555a4098 Allow NFC pins to be used for other purposes. 2019-03-21 11:22:58 -04:00
Dan Halbert
99da3b9646 Use critical section, not lock, in CharacteristicBuffer; use a root pointer for ble_drv list 2019-02-21 00:19:31 -05:00
Dan Halbert
a345ef28f2 finish Makefile refactoring; nrf builds work 2019-02-15 18:55:10 -05:00
Dan Halbert
ab4194f752 don't allocate DMA buffer as long-lived 2019-02-13 19:49:57 -05:00
Dan Halbert
e92d90ce9c Add second UARTE to busio.UART. Init uarts on startup. 2019-02-12 22:34:05 -05:00
Scott Shawcroft
37b9cd5974
Merge pull request #1521 from nickzoic/circuitpython-nickzoic-1045-nrf-rotaryio
Circuitpython nickzoic 1045 nrf rotaryio
2019-02-07 10:38:20 -08:00
Nick Moore
b9db977a2d Change pin mode to pullup for adafruit/circuitpython#1045 2019-02-07 09:47:56 +11:00
Nick Moore
a7c349bc6e Add quarter-click logic to adafruit/circuitpython#1045 2019-02-05 16:41:33 +11:00
Nick Moore
95454ecde0 useful output from rotaryio adafruit/circuitpython#1045 2019-02-05 16:41:33 +11:00
Nick Moore
21eb7e8e64 GPIOTE handlers for rotaryio.IncrementalEncoder adafruit/circuitpython#1045 2019-02-05 14:15:13 +11:00
Nick Moore
ee21cc163f Start on rotaryio.IncrementalEncoder adafruit/circuitpython#1045 (does nothing yet!) 2019-02-05 14:15:03 +11:00
Scott Shawcroft
ec03887040
Fix hallowing and nrf builds 2019-01-31 11:42:15 -08:00
hathach
164e1e2341 re-init usb hardware when enable/disable SD 2019-01-30 14:13:07 +07:00
Scott Shawcroft
765d877dfa
Merge pull request #1499 from nickzoic/nickzoic/circuitpython-nrf-touchin-1048
Nickzoic/circuitpython nrf touchin 1048
2019-01-28 00:22:34 -08:00
Nick Moore
294b026aca Automatically set a default threshold for touchio.TouchIn channels 2019-01-28 18:22:57 +11:00
Nick Moore
539aaf08b5 speed up measurement loop 2019-01-27 21:54:59 +11:00
Nick Moore
4a093294ac hugely simplified version of the touchio.TouchIn.get_raw_reading code (adafruit/circuitpython#1048) 2019-01-27 15:08:03 +11:00
Dan Halbert
7998a7696d also handle BLE_GATTS_EVT_SYS_ATTR_MISSING: fixes Android: 2019-01-23 22:12:38 -05:00
Dan Halbert
b1f1bb1389 support BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST, sent by newer devices 2019-01-23 21:07:23 -05:00
Dan Halbert
e170e03f8c Merge remote-tracking branch 'adafruit/master' into bleio2 2019-01-21 20:38:26 -05:00
Dan Halbert
28cfd8a513 CharacteristicBuffer: make it be a stream class; add locking 2019-01-19 19:45:35 -05:00
Scott Shawcroft
edc8383e22
Improvements thanks to danh's review 2019-01-18 16:37:06 -08:00
Scott Shawcroft
fddc98858a
fix nonetype handling and nrf never reset 2019-01-17 18:51:40 -08:00
Scott Shawcroft
6404aaf411
Fix up nrf and using board.SPI in FourWire 2019-01-17 18:19:07 -08:00
Scott Shawcroft
760bd8d8a4
share fourwire and make nrf compile 2019-01-17 15:15:59 -08:00
Dan Halbert
50ee5ef24c merge translations; add bleio comments; fix minor sphinx issues in midi 2019-01-10 21:12:17 -05:00
hathach
f366e3feea Merge branch 'master' into nrf52_pulsein 2019-01-09 20:39:35 +07:00
hathach
cfc4c8cbfa
minor clean up 2019-01-09 15:43:54 +07:00
hathach
db82160eef
fix pulsein incorrect compute 2019-01-09 15:15:30 +07:00
Dan Halbert
13d607698e m_tx_in_progress might underflow (check on this) 2019-01-08 16:37:14 -05:00
Dan Halbert
50641c4152 remove debugging printf's 2019-01-08 15:52:21 -05:00
Dan Halbert
f66f55b4ed add CharacteristicBuffer; UART seems to work! 2019-01-07 22:46:20 -05:00
hathach
215008f78c
clean up neopixel write !! 2019-01-08 00:21:31 +07:00
Dan Halbert
a77b2363ef evt handler list bugs; unique evt handler names; remove uuid128_reference 2019-01-03 21:42:42 -05:00
Dan Halbert
8dea6f53bb forgot to store data when reading a gatts value 2019-01-03 14:16:41 -05:00
Dan Halbert
87c6f33bcc Broadcaster now takes whole packet. Also should be scannable 2019-01-01 14:11:59 -05:00
Dan Halbert
b6b5ed9c89 Remove nRF52832 support 2018-12-30 22:49:20 -05:00
Dan Halbert
1dc3957e72 LocalPeripheral is now Peripheral; more work on basic GATTS support; UART not working yet 2018-12-30 22:33:49 -05:00
Dan Halbert
ef39e72c7c free event handlers on reset; fix typo in Broadcaster 2018-12-29 13:55:10 -05:00
Dan Halbert
145e110915 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-29 00:00:39 -05:00
Dan Halbert
4d1f0ec07b Add Broadcaster. Reset correctly on reload. 2018-12-28 23:34:23 -05:00
hathach
6b0d93cea3
correct i2c max len 2018-12-28 21:14:27 +07:00
hathach
a4ee80832a
fix #1422 correct i2c max xfer len (size in bits) 2018-12-28 16:30:11 +07:00
hathach
3ee766bc01
put received bytes to fifo when error 2018-12-28 01:05:30 +07:00
hathach
d092722ae8
fix #1407 keep receiving in case of error 2018-12-28 00:40:29 +07:00
Dan Halbert
4167bf5b24 wip: advertising works, but not connection 2018-12-27 00:04:04 -05:00
hathach
6752266673 added pulsein using gpiote (gpio interrupt) 2018-12-18 22:05:17 +07:00
Dan Halbert
bfa66861ef Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-13 16:33:15 -05:00
hathach
b37b2fa7e7 overwrite old data if fifo is full 2018-12-13 23:56:06 +07:00
hathach
e136222ae2 use rbuf for busio uart 2018-12-13 23:48:53 +07:00
Nick Moore
1dc4c4757e touchio.TouchIn sensing working on a single pin! adafruit/circuitpython#1048 2018-12-11 14:33:35 +11:00
Nick Moore
901db4797e progress on NRF touchio.TouchIn #1048 2018-12-09 16:48:33 +11:00
Dan Halbert
a7a24096f4 bleio WIP: redo for more immutability; use sd_* routines for internal flash write 2018-12-07 16:52:47 -05:00
Scott Shawcroft
6ef8639971
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes #1034. Fixes #990. Fixes #615.
2018-12-06 14:24:20 -08:00
Dan Halbert
125901e4e2 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-12-06 12:41:38 -05:00
Dan Halbert
63cd9209f1 allow KeyboardInterrupt on UART read; fix nrf UART pin claiming; rename feather 52840 UART pins 2018-12-04 15:05:39 -05:00
Nick Moore
452a622459 Set up structure for touchio adafruit/circuitpython#1048 (does nothing yet) 2018-12-04 17:12:02 +11:00
Dan Halbert
80db2cec99 UART changes: timeout in secs, write bytes, etc. 2018-12-03 12:04:32 -05:00
Dan Halbert
3164b16196 WIP: debug; add hash and __eq__ to UUID 2018-11-26 21:09:17 -05:00
Dan Halbert
6fb7590280 Merge remote-tracking branch 'adafruit/master' into bleio-rev 2018-11-26 10:16:29 -05:00
Scott Shawcroft
15eeac5d4b
A few fixes for nRF52840 feather QSPI and neopixel 2018-11-23 14:22:07 -08:00
Dan Halbert
1763ffe245 More UUID work; use mp_raise for exceptions 2018-11-20 23:04:58 -05:00
Dan Halbert
31cc71f7fb WIP: bleio revisions 2018-11-20 09:36:45 -05:00
Scott Shawcroft
9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
arturo182
4bc24c4f60 bleio: Fix errors after rebase 2018-10-21 17:15:27 +02:00
arturo182
eceb21a017 bleio: Don't register the services until needed
Because of the very specific way nRF requires service registration
(characteristics can be added only to last added service), we would
have to write the Python code in a specific way. With this patch the
user has more freedom.
2018-10-21 16:00:04 +02:00
arturo182
19fab4af5a bleio: Remove deep copy constructor for UUID 2018-10-21 15:59:50 +02:00
arturo182
b5e5805bb4 bleio: Remove redundant struct field 2018-10-21 15:59:46 +02:00
arturo182
c7b42d80b3 bleio: A bit of cleanup 2018-10-21 15:59:42 +02:00
arturo182
17f13ecc2c nrf: Cleanup of the ble driver
Moved the functions to classes that they belong to.
2018-10-21 15:54:13 +02:00
arturo182
77eeecbfd9 nrf: BLE driver cleanup 2018-10-21 15:52:36 +02:00
arturo182
6545aa99a9 nrf: Remove the ble drv specific characteristic struct 2018-10-21 15:51:04 +02:00
arturo182
98aa8c5923 nrf: Remove the ble drv specific service struct 2018-10-21 15:51:01 +02:00
arturo182
3df7dea2cc nrf: Remove the ble drv specific advertisement data struct 2018-10-21 15:50:59 +02:00
arturo182
4b344812bf nrf: Remove the ble drv specific address struct 2018-10-21 15:50:56 +02:00
arturo182
3bd65fbae5 nrf: Move the Peripheral class to bleio as Device
This was the last class from ubluepy and so that module is now gone.
The Device class offers both Peripheral and Central functionality.
See the inline docs for more info.
2018-10-21 15:50:45 +02:00
arturo182
bda734223e nrf: Move the Service class from ubluepy to the shared bleio module 2018-10-21 15:43:51 +02:00
arturo182
cc78249226 nrf: Move the Characteristic class from ubluepy to the shared bleio module 2018-10-21 15:43:48 +02:00
arturo182
1c6bf9a150 bleio: Move the Scanner class to a shared module 2018-10-21 15:43:29 +02:00
arturo182
345334aaf1 bleio: Add a new Address class
Use the new in the Adapter singleton.
2018-10-21 15:43:21 +02:00
arturo182
20b8d5169d nrf: Move the Descriptor class from ubluepy to the shared bleio module 2018-10-21 15:43:13 +02:00
arturo182
f4940c9aec nrf: Move the UUID class from ubluepy to the shared bleio module
Also added a UUIDType enum-like class for determining UUID type.
2018-10-21 15:43:08 +02:00
Dan Halbert
b3c7746a7f fix copyright notice 2018-10-16 11:09:37 -04:00
Dan Halbert
2262efc311 PulseOut working 2018-10-16 11:05:02 -04:00
Dan Halbert
8d58093328
Merge pull request #1259 from dhalbert/nrf-pwmout
Allow variable freq PWMOut; use multiple channels if same freq
2018-10-10 12:27:27 -04:00
Scott Shawcroft
df80ad8e6e
Merge pull request #1193 from ATMakersBill/master
Add supervisor.runtime.serial_bytes_available so that input() can be used without blocking.
2018-10-09 23:58:43 -07:00
Dan Halbert
ca737e6f7c Don't disable tempoarily in deinit(). 2018-10-09 21:23:47 -04:00
Dan Halbert
91a88cf568 Allow variable freq PWMOut; use multiple channels if same freq 2018-10-09 20:52:55 -04:00
ATMakersBill
9f94712ad1 replacing change to input() with separate method to check for USB Serial input 2018-10-09 18:37:52 -04:00
Dan Halbert
6049776b26
Merge branch 'master' into nrf52_uart_io 2018-10-03 13:31:48 -04:00
hathach
b8884ccc8b Merge branch 'master' into nrf52_uart_io 2018-10-03 23:13:56 +07:00
hathach
08cbb03bdd implement common_hal_busio_uart_clear_rx_buffer 2018-10-03 11:39:01 +07:00