summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/dac.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-18 23:28:56 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-18 23:28:56 +0100
commit38ae014e4258811d1612f9e140a35f8f9aa0ddb8 (patch)
tree2894967f48f3744515ad134f362337a3e2f64d82 /stmhal/dac.c
parent71e9bfa20dd02457e73c2bec85102b6faf527a33 (diff)
downloadmicropython-38ae014e4258811d1612f9e140a35f8f9aa0ddb8.tar.gz
micropython-38ae014e4258811d1612f9e140a35f8f9aa0ddb8.zip
stmhal: Update ADC, DAC and I2C objects to use new buffer protocol.
Main reason for expanding buffer protocol API was to support writes to a buffer in ADC module (see read_timed). With this change you can now create an array of arbitrary type and ADC.read_timed will store into that array in the correct format (byte, int, float). I wonder though if all these changes were really worth it to support just this function. Hopefully this enhanced buffer protocol API (with typecode specified) will be used elsewhere.
Diffstat (limited to 'stmhal/dac.c')
-rw-r--r--stmhal/dac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stmhal/dac.c b/stmhal/dac.c
index c018a4046a..5b2d17d889 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -169,8 +169,8 @@ mp_obj_t pyb_dac_dma(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) {
// set TIM6 to trigger the DAC at the given frequency
TIM6_Config(mp_obj_get_int(args[2]));
- buffer_info_t bufinfo;
- mp_get_buffer_raise(args[1], &bufinfo);
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ);
__DMA1_CLK_ENABLE();