lancaster-university / codal-core Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
If bufferIndex < bufferLen
is false, we lost a character.
https://github.com/lancaster-university/codal-core/blob/master/source/driver-models/Serial.cpp#L653
We currently have events per driver in jacdac. Would be nice to have "top level" events:
The Event has a 64bit timestamp that also gets sent over the network. Can we use a dedicated struct here?
Maybe we can reuse the infrastructure built in PXT to use docker.
James already found the issue but I could not resist assigning a bug :)
There are temperature and light sensors on the BrainPad using AnalogSensor class. It is good values when I use only temperature(I mean, LightSensor doesn't init). But, when both are inited, temperature value changes on the light.
https://github.com/VictorDuma/codal-brainpad-1/blob/sensors/samples/main.cpp
I checked this case in other environments and it works well.
I need to send the entire state of each driver "device" to MakeCode side to create a debugger UI. Can you add a function to JDProtocol to list drivers?
We call this method to launch the accelerometer - it should be defined on the base class.
/**
* Reads the acceleration data from the accelerometer, and stores it in our buffer.
* This only happens if the accelerometer indicates that it has new data via int1.
*
* On first use, this member function will attempt to add this component to the
* list of fiber components in order to constantly update the values stored
* by this object.
*
* This technique is called lazy instantiation, and it means that we do not
* obtain the overhead from non-chalantly adding this component to fiber components.
*
* @return DEVICE_OK on success, DEVICE_I2C_ERROR if the read request fails.
*/
int updateSample();
The compiler complains:
../libraries/codal-core/source/drivers/HIDKeyboard.cpp: In member function 'int codal::USBHIDKeyboard::keyDown(uint8_t, uint8_t)':
../libraries/codal-core/source/drivers/HIDKeyboard.cpp:219:66: warning: 'newIndex' may be used uninitialized in this function [-Wmaybe-uninitialized]
keyStateConsumer[newIndex] = HID_KEYBOARD_KEY_OFF; //we could not make the change
I don't understand why it is OR with the driverclass. So each driver gets a unique serial number on the bus? I thaught the serial number was per device.
codal-core/inc/JACDAC/JDProtocol.h
Line 201 in ea674a6
The joys of mixing versions of Windows. Is CODAL on python2 or 3? Is there a way to specify which version to use?
I'm working on a fork of the target codal-stm32 to support the STM32L475. I'm trying to implements Serial class and I stuck on some apparently simple problem but from now I don't understand if the distinction between PinName and PinNumber.
In the constructor of the class Serial
, the type of the parameters is PinName
:
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/Serial.h#L113
But in the abstraction of pins, the type PinNumber is used :
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/Pin.h#L115
To add to my confusion, the abstraction for the I2C uses the Pin class which seems more natural :
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/I2C.h#L43
Should not we refactor the serial class to gain homogeneity? I guess with MBed the problem does not arise but in my case my goal is precisely not to depend on Mbed ^^
If I prepare a PR with the refactoring introducing Pin in place of PinName, is there any chance that it will be integrated?
Should accelerometer return an error code in updateSample when it has no data available? perhaps DEVICE_NO_DATA
It seems that the throggle 0 is mapped to Axis 4, Axis 5 in HTML5 gamepad tester. throttle 1 is not detected.
Here is the makecode test program (with Metro M0 Express)
Just like the RJ45 ports, we could support an optional jacdac LED to display the status of the bus on the device.
Calibration of cap touch is qute tricky. Using aluminium foil + battery, it basically does not work "out of box". I had to write this calibration sequence below with small threshold bounds to get it working. Did you observe the same behaviors?
input.pinA3.onEvent(ButtonEvent.Down, function () {
light.showRing(
`blue blue blue blue blue blue blue blue blue blue`
)
})
input.pinA5.onEvent(ButtonEvent.Down, function () {
light.showRing(
"red red red red red red red red red red"
)
})
let pA3 = input.pinA3.value();
let pA5 = input.pinA5.value();
for (let i = 0; i < 10; ++i) {
pA5 = pA5 * 0.9 + input.pinA5.value() * 0.1;
pA3 = pA3 * 0.9 + input.pinA3.value() * 0.1;
}
input.pinA5.setThreshold(pA5 * 1.1 + 50)
input.pinA3.setThreshold(pA3 * 1.1 + 50)
JACDAC should no longer send control packets for each driver, but rather provide a composition of drivers for a device. I propose the following revision to a ControlPacket
:
struct DriverInfo
{
uint8_t length;
uint8_t address; // the address assigned by the logic driver
uint16_t flags; // various flags, upper eight bits are reserved for control usage, lower 8 remain free for driver use.
uint32_t driver_class; // the class of the driver
uint8_t payload[]; // optional additional data
} __attribute((__packed__));
struct ControlPacket
{
uint8_t packet_type; // indicates the type of the packet, normally just HELLO
uint32_t serial_number; // the "unique" serial number of the device.
uint8_t data[]; // you would place driver info here for a HELLO_PACKET
} __attribute((__packed__));
To justify this design change let me perform some back of the envelope calculations. Pretend we have variable sized packets, and we have 3 drivers running on a single device:
This means that 48 bytes are transmitted every 500 ms or 96 bytes every second, and 4 of those bytes are wasted sending duplicate serial_number information. At each baud you can compute the percentage of the bus spent on control packets for those three drivers:
Using the new way of transmitting control packets:
At each baud the picture looks like this:
This also means that the bus will perform better at scale as the number of control packets sent is now proportional to the devices on the bus and not the number of drivers.
These numbers do not include the time taken for bus arbitration, but by reducing the number of packets sent, we also reduce the time spent on bus arbitration.
@pelikhan @tballmsft @sehodges @mmoskal @finneyj thoughts?
codal-core/source/drivers/HIDKeyboard.cpp
Line 539 in 1a16ec9
[1/181] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/AsciiKeyMap.cpp.obj
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
};
^
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::seq' [-Wmissing-field-initializers]
../libraries/codal-core/source/drivers/AsciiKeyMap.cpp:554:1: warning: missing initializer for member 'codal::KeySequence::length' [-Wmissing-field-initializers]
For diagnosis purposes, jacdac control packets could also have a status code, similar to automation codes. This would allow a driver to expose a lightweight status.
Ok, battery low, malfunction, etc... highest code wins and gets transmitted
This panic code overlaps with MakeCode 909 code. Could you define all error codes used by JACDAC?
codal-core/source/JACDAC/JACDAC.cpp
Line 14 in e75d756
Would be great to be able to play some raw sound buffer. I guess we also need a muxing node that allows to merge multiple nodes.
The I2C function signatures in codal-core and codal-mbedos are different (uint16_t vs uint32_t). This breaks i2c in mbedos since all base class function are noops.
https://github.com/lancaster-university/codal-core/blob/master/inc/driver-models/I2C.h#L115
vs
https://github.com/lancaster-university/codal-mbedos/blob/master/inc/MbedI2C.h#L81
Is this intentional?
When connecting multiple devices, I am seeing more serial numbers than devices.
To repro: connect multiple jacdac devices running a log broadcast service and list the serial numbers from the driver list.
codal-core/inc/JACDAC/JACDAC.h
Line 34 in 2e9caab
When creating jacdac messages, occasionally you will have scenarios where the value of a jacdac message on one device will not have the same jacdac message value on another device. This will affect how the listener will work on either side.
For example:
Device 1 can have
enum JacDacMessage {
message1,
SHAKE1,
SHAKE2,
SHAKE3
}
and Device 2 can have
enum JacDacMessage {
SHAKE1,
}
Just checking if this fix has been applied to CODAL as well.
I have a log broadcast drivers. I can see all the drivers connecting successfully but they never go out of the "connected" mode after unplugging the jacks.
I think we have a case of stack corruption with the most recent changes to the fiber scheduler, specifically when launching fibers from within a 2 deep fiber context:
#1 <signal handler called>
#2 0x00000000 in ?? ()
#3 0x0000483e in codal::JDControlService::timerCallback (this=0x200005d4 <cplay+1164>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/JACDAC/control/JDControlService.cpp:168
#4 0x0000416e in codal::MemberFunctionCallback::methodCall<codal::JDControlService> (
object=<optimized out>, method=<optimized out>, e=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/./inc/core/MemberFunctionCallback.h:111
---Type <return> to continue, or q <return> to quit---
#5 0x00006bc2 in codal::MemberFunctionCallback::fire (this=this@entry=0x20000fd4, e=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/MemberFunctionCallback.cpp:48
#6 0x00006590 in async_callback (param=0x20000fa8)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:119
#7 0x00005b6c in codal::invoke (entry_fn=entry_fn@entry=0x64f5 <async_callback(void*)>,
param=param@entry=0x20000fa8)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:621
#8 0x0000683e in codal::MessageBus::process (this=this@entry=0x200001b8 <cplay+112>, evt=...,
urgent=urgent@entry=false)
---Type <return> to continue, or q <return> to quit---
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:379
#9 0x000068e6 in codal::MessageBus::idle (this=0x200001b8 <cplay+112>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:288
#10 0x00006362 in codal::MemberFunctionCallback::methodCall<codal::MessageBus> (object=<optimized out>,
method=<optimized out>, e=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/./inc/core/MemberFunctionCallback.h:111
#11 0x00006bc2 in codal::MemberFunctionCallback::fire (this=this@entry=0x20000dfc, e=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/MemberFunctionCallback.cpp:48
---Type <return> to continue, or q <return> to quit---
#12 0x00006590 in async_callback (param=0x20000dd0)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:119
#13 0x00006834 in codal::MessageBus::process (this=this@entry=0x200001b8 <cplay+112>, evt=...,
urgent=urgent@entry=true)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:377
#14 0x00006854 in codal::MessageBus::queueEvent (this=0x200001b8 <cplay+112>, evt=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/MessageBus.cpp:164
#15 0x000068c2 in codal::MessageBus::send (this=<optimized out>, evt=...)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/drivers/Mess---Type <return> to continue, or q <return> to quit---
ageBus.cpp:331
#16 0x00006936 in codal::Event::fire (this=0x20007fd4, this@entry=0x200001b8 <cplay+112>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:126
#17 codal::Event::Event (this=this@entry=0x20007fd4, mode=codal::CREATE_AND_FIRE, value=<optimized out>,
source=<optimized out>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:70
#18 0x0000695c in codal::Event::Event (this=0x20007fd4, source=<optimized out>, value=<optimized out>,
mode=<optimized out>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/types/Event.cpp:69
---Type <return> to continue, or q <return> to quit---
#19 0x0000586a in codal::idle ()
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:966
#20 0x00005be2 in codal::idle_task ()
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:989
#21 0x00005bd8 in codal::launch_new_fiber_param (ep=<optimized out>, cp=<optimized out>,
pm=<optimized out>)
at /Users/James/Desktop/VM/jacdac-usb/jacdac-cplay-usb-driver/libraries/codal-core/source/core/CodalFiber.cpp:673
The xpsr, lr, psp values point to stack corruption according to my workings:
(gdb) print/x $xpsr
$6 = 0x1000003
(gdb) print $lr
$7 = (void (*)()) 0xfffffff9
(gdb) print $psp
$8 = (void *) 0xd464db9c
(gdb) print/x $control
$9 = 0x0
My simple, reproducible test is the following C++:
#include "CircuitPlayground.h"
#include "JDTestService.h"
#include "CodalDmesg.h"
CircuitPlayground cplay;
JDTestService test("T", HostService);
void send_event()
{
while(1)
{
cplay.sleep(20);
Event(0xBEEF,0xBEEF);
}
}
int main()
{
cplay.jacdac.start();
int state = 0;
while(1)
{
cplay.io.led.setDigitalValue(state);
fiber_sleep(500);
state = !state;
}
}
With the CodalConfig option DEVICE_FIBER_USER_DATA
enabled, the program hardfaults after two LED blinks, with it disabled the LED blinks continuously.
Of course it's more likely I'm doing something weird in my JACDAC code, but from my inspections the device hard faults on a function call suggesting something more sinister.
JACDAC could support 1 or 2 dedicated LEDs to display status (bus conntected / comms).
If a fiber is waiting of readUntil and the RX is full, it never receives triggers and the serial is effectively locked.
codal-core/inc/JACDAC/JACDAC.h
Line 181 in 839e9bc
Use "JD" as a prefix for types for JACDAC consistently. Sometimes it is "JACDAC".
codal-core/inc/JACDAC/JACDAC.h
Line 252 in f2b9522
Assume 1 host and 1 virtual connected, everything good. Then the host goes away and a new host comes on the bus. This should kind of be immediate but it does not appear to work.
Using our playTone(frequency, ms) method, if you type in a value for the interval that is above 3000 ms, the behaviour on the physical device starts being weird.
Repro in makecode:
loops.forever(() => {
music.playTone(262, 5000)
music.playTone(Note.A, 1000)
})
The above code doesn't play the initial tone for 5 seconds, but for a time much shorter.
If you try to play a tone for around 3000, it will play it forever.
It seems this is because we're expecting the user to type in a value in ms, and then codal converts that to microseconds and later nano seconds, causing an integer overflow, with such low values for the time we want to play a tone.
current might be null
codal-core/source/JACDAC/JDLogicDriver.cpp
Line 320 in 9d644e6
Constants help with bridge values between C++ and MakeCode.
codal-core/inc/JACDAC/JACDAC.h
Line 112 in ea674a6
If you have two drivers with the same class, they will have the same lower byte. Move to an incrementing count.
Hello!
I can no longer get Circuit Playground to enumerate on Windows 10. Works on Linux, Mac, iOS. It does work on the Makecode live site, but does not work when I compile regular codal from the current master branch.
Note that I tried reverting my recent PR #32
it still does not work
here is the code I am using:
#include "CircuitPlayground.h"
#include "USB_HID_Keys.h"
#include "HIDKeyboard.h"
CircuitPlayground cplay;
CodalUSB usb;
USBHIDKeyboard hid;
static const char *string_descriptors[] = {
"Example Corp.", "PXT Device", "42424242",
};
void typeDot(Event)
{
hid.type(".");
}
void typeDash(Event)
{
hid.type("-");
}
int main()
{
usb.stringDescriptors = string_descriptors;
usb.add(hid);
usb.start();
//we need a bit of a delay for USB
cplay.sleep(500);
cplay.messageBus.listen(DEVICE_ID_BUTTON_A,DEVICE_BUTTON_EVT_CLICK,typeDot);
cplay.messageBus.listen(DEVICE_ID_BUTTON_B,DEVICE_BUTTON_EVT_CLICK,typeDash);
release_fiber();
}
Cannot pass NULL to setBridge to clear the bridge.
In file included from /home/build/prjclone/libraries/codal-core/source/drivers/AsciiKeyMap.cpp:1:0:
/home/build/prjclone/libraries/codal-core/./inc/drivers/AsciiKeyMap.h:1:20: fatal error: KeyMap.h: No such file or directory
#include "KeyMap.h"
Creating libraries folder
Cloning into: https://github.com/lancaster-university/codal-circuit-playground
Cloning into 'codal-circuit-playground'...
Checking out branch: v1.3.2
HEAD is now at e595933... Snapshot v1.3.2
�[1;35mSet target: codal-circuit-playground �[m
Using target-locked.json
�[1;34mTargeting codal-circuit-playground�[m
Installing dependencies...
Cloning into: https://github.com/lancaster-university/codal-core
Cloning into 'codal-core'...
Checking out branch: d5869d5ebe7c69754065b0c46c9db09dd96aa6fe
HEAD is now at d5869d5... Merge pull request #9 from adafruit/master
Cloning into: https://github.com/lancaster-university/mbed-classic
Cloning into 'mbed-classic'...
Checking out branch: 9100ba3f433129b176c535311afb5fad3b2f9e26
HEAD is now at 9100ba3... Use alt SERCOM for PA12 (to allow SPI on Zero-like boards)
Cloning into: https://github.com/lancaster-university/codal-samd21
Cloning into 'codal-samd21'...
Checking out branch: 87e1b872c041c9b21f575a1d6f3970c7e0a60d7c
HEAD is now at 87e1b87... Remove clock init code from USB.cpp (it's now in CPX target)
Cloning into: https://github.com/lancaster-university/codal-mbed
Cloning into 'codal-mbed'...
Checking out branch: 52b5a26ed40a6e8d33a8f06b7bec9764730045ef
HEAD is now at 52b5a26... Fix Pin reference in SPI
�[1;32mUsing library: codal-circuit-playground�[m
�[1;32mUsing library: codal-core�[m
�[1;32mUsing library: mbed-classic�[m
�[1;32mUsing library: codal-samd21�[m
�[1;32mUsing library: codal-mbed�[m
In file included from /home/build/prjclone/libraries/codal-core/source/drivers/AsciiKeyMap.cpp:1:0:
/home/build/prjclone/libraries/codal-core/./inc/drivers/AsciiKeyMap.h:1:20: fatal error: KeyMap.h: No such file or directory
#include "KeyMap.h"
^
compilation terminated.
Seems that the new serial impl is incompatible with existing codal-mbed/codal-mbedos repos
What data range should be for accelerometer output? For LIS3DH I find this "// Normalize the data in the 0..1024 range." Is it correct?
We need a better "dynamic" orchestration of sercoms. We had an issue of I2C clashing with neopixel SPIs.
@mmoskal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.