mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-15 20:21:03 +00:00
update bluetooth driver (made a start)
This commit is contained in:
@@ -59,13 +59,6 @@ enum DeviceLabel
|
|||||||
DEV_DONE = 3
|
DEV_DONE = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BluetoothState
|
|
||||||
{
|
|
||||||
BT_INITIALISING = 0,
|
|
||||||
BT_CONNECTING = 1,
|
|
||||||
BT_CONNECTED = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
/* extern fonts */
|
/* extern fonts */
|
||||||
extern uint8_t BigFont[];
|
extern uint8_t BigFont[];
|
||||||
extern uint8_t SmallFont[];
|
extern uint8_t SmallFont[];
|
||||||
|
|||||||
21
due_obd2/obd2_bt.c
Normal file
21
due_obd2/obd2_bt.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include "wiring_digital.h"
|
||||||
|
#include "obd2_bt.h"
|
||||||
|
|
||||||
|
void obd2_bt_init(obd2_bt_t *bt)
|
||||||
|
{
|
||||||
|
bt->state = BT_INITIALISING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void obd2_bt_process(obd2_bt_t *bt)
|
||||||
|
{
|
||||||
|
__UINT32_TYPE__ bt_state = digitalRead(BT_STATE_PIN);
|
||||||
|
if (bt_state)
|
||||||
|
{
|
||||||
|
bt->state = BT_CONNECTED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bt->state = BT_INITIALISING;
|
||||||
|
}
|
||||||
|
bt->on_state_change();
|
||||||
|
}
|
||||||
@@ -21,4 +21,23 @@ Be sure to disconnect the TX and RX pins from the BT module when programming the
|
|||||||
#ifndef OBD2_BT_H
|
#ifndef OBD2_BT_H
|
||||||
#define OBD2_BT_H
|
#define OBD2_BT_H
|
||||||
|
|
||||||
|
#define BT_STATE_PIN 3 /* state connection pin from bluetooth module -> level high on connected */
|
||||||
|
|
||||||
|
enum BluetoothState
|
||||||
|
{
|
||||||
|
BT_INITIALISING = 0,
|
||||||
|
BT_CONNECTING = 1,
|
||||||
|
BT_CONNECTED = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct obt2_bt_tag
|
||||||
|
{
|
||||||
|
enum BluetoothState state;
|
||||||
|
void (*on_state_change)();
|
||||||
|
} obd2_bt_t;
|
||||||
|
|
||||||
|
void obd2_bt_init(obd2_bt_t *bt);
|
||||||
|
void obd2_bt_process(obd2_bt_t *bt);
|
||||||
|
|
||||||
|
|
||||||
#endif // OBD2_BT_H
|
#endif // OBD2_BT_H
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
- [FSC-DB0004 schematic and assembly](https://www.feasycom.com/wp-content/uploads/2022/04/1649387973-FSC_DB004_V1_1_Sch_and_Assembly.pdf)
|
- [FSC-DB0004 schematic and assembly](https://www.feasycom.com/wp-content/uploads/2022/04/1649387973-FSC_DB004_V1_1_Sch_and_Assembly.pdf)
|
||||||
|
|
||||||
### HC-05
|
### HC-05
|
||||||
|
- [Datasheet](https://components101.com/sites/default/files/component_datasheet/HC-05%20Datasheet.pdf)
|
||||||
- [How to configure](https://lastminuteengineers.com/hc05-at-commands-tutorial/)
|
- [How to configure](https://lastminuteengineers.com/hc05-at-commands-tutorial/)
|
||||||
|
|
||||||
### 3.5 inch TFT display
|
### 3.5 inch TFT display
|
||||||
|
|||||||
Reference in New Issue
Block a user