Simulated the CD changer of a Saab to implement a bluetooth connection to the car stereo. Control of playback device (phone) with steering wheel buttons. Needs a RN52 bluetooth transciever and a CAN transiever. So far only audio playback and control via steering wheel buttons implemented. Hands free calling planned.
CDC.h@9:9a4c81493a3d, 2016-01-15 (annotated)
- Committer:
- petter
- Date:
- Fri Jan 15 21:27:42 2016 +0000
- Revision:
- 9:9a4c81493a3d
- Parent:
- 6:c454f88524d6
- Child:
- 10:8be92db98bf4
Fixed bug with last char in display being random.; Preparation for writing on both rows of display.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
petter | 0:6cf6e566c0da | 1 | |
petter | 0:6cf6e566c0da | 2 | |
petter | 0:6cf6e566c0da | 3 | #ifndef CDC_H |
petter | 0:6cf6e566c0da | 4 | #define CDC_H |
petter | 0:6cf6e566c0da | 5 | |
petter | 0:6cf6e566c0da | 6 | #include "mbed.h" |
petter | 0:6cf6e566c0da | 7 | |
petter | 0:6cf6e566c0da | 8 | typedef enum |
petter | 0:6cf6e566c0da | 9 | { |
petter | 0:6cf6e566c0da | 10 | IBUS_NO_MESSAGE, |
petter | 0:6cf6e566c0da | 11 | IBUS_OTHER_MESSAGE, |
petter | 0:6cf6e566c0da | 12 | IBUS_DOORS_LOCKED, |
petter | 0:6cf6e566c0da | 13 | IBUS_DOORS_UNLOCKED, |
petter | 0:6cf6e566c0da | 14 | IBUS_CDC_ON, |
petter | 0:6cf6e566c0da | 15 | IBUS_CDC_OFF, |
petter | 0:6cf6e566c0da | 16 | IBUS_NEXT, |
petter | 0:6cf6e566c0da | 17 | IBUS_VOLUME_UP, |
petter | 0:6cf6e566c0da | 18 | IBUS_VOLUME_DOWN, |
petter | 0:6cf6e566c0da | 19 | IBUS_SKIP_FW, |
petter | 0:6cf6e566c0da | 20 | IBUS_SKIP_BW, |
petter | 0:6cf6e566c0da | 21 | IBUS_SET, |
petter | 0:6cf6e566c0da | 22 | IBUS_CLEAR, |
petter | 0:6cf6e566c0da | 23 | |
petter | 0:6cf6e566c0da | 24 | IBUS_COMMAND_LAST |
petter | 0:6cf6e566c0da | 25 | |
petter | 0:6cf6e566c0da | 26 | } IBUS_COMMAND; |
petter | 0:6cf6e566c0da | 27 | |
petter | 0:6cf6e566c0da | 28 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 29 | // CLASS |
petter | 0:6cf6e566c0da | 30 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 31 | |
petter | 0:6cf6e566c0da | 32 | class CDC |
petter | 0:6cf6e566c0da | 33 | { |
petter | 0:6cf6e566c0da | 34 | public: |
petter | 0:6cf6e566c0da | 35 | void init(); |
petter | 0:6cf6e566c0da | 36 | IBUS_COMMAND get_cmd(); |
petter | 0:6cf6e566c0da | 37 | IBUS_COMMAND get_ihu_cmd(); |
petter | 0:6cf6e566c0da | 38 | IBUS_COMMAND get_steering_wheel_cmd(); |
petter | 9:9a4c81493a3d | 39 | void display(char text[], char row); |
petter | 0:6cf6e566c0da | 40 | void display_update(); |
petter | 2:10c60edc8573 | 41 | void update_elapsed_time(); |
petter | 2:10c60edc8573 | 42 | void reset_elapsed_time(); |
petter | 2:10c60edc8573 | 43 | void start_elapsed_time(); |
petter | 2:10c60edc8573 | 44 | void stop_elapsed_time(); |
petter | 6:c454f88524d6 | 45 | void set_track(char track_number); |
petter | 0:6cf6e566c0da | 46 | void send_can_frame(int message_id, int *msg); |
petter | 0:6cf6e566c0da | 47 | void print_can_frame(CANMessage *msg); |
petter | 0:6cf6e566c0da | 48 | void CAN_wrFilter(uint32_t ctrl, uint32_t id); |
petter | 0:6cf6e566c0da | 49 | }; |
petter | 0:6cf6e566c0da | 50 | |
petter | 0:6cf6e566c0da | 51 | #endif |