- Added first draft of housing
This commit is contained in:
@@ -61,6 +61,7 @@ add_executable(Firmware
|
||||
Easings.c
|
||||
UI_Control.c
|
||||
I2C_Master.c
|
||||
INA260.c
|
||||
|
||||
Display_Default_Configurations.c
|
||||
Display_Message_Box_Icons.c
|
||||
|
||||
@@ -9,19 +9,14 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "I2C_Master.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define INA260_I2CADDR_DEFAULT 0x40 ///< INA260 default i2c address
|
||||
#define INA260_REG_CONFIG 0x00 ///< Configuration register
|
||||
#define INA260_REG_CURRENT 0x01 ///< Current measurement register (signed) in mA
|
||||
#define INA260_REG_BUSVOLTAGE 0x02 ///< Bus voltage measurement register in mV
|
||||
#define INA260_REG_POWER 0x03 ///< Power calculation register in mW
|
||||
#define INA260_REG_MASK_ENABLE 0x06 ///< Interrupt/Alert setting and checking register
|
||||
#define INA260_REG_ALERT_LIMIT 0x00 ///< Alert limit value register
|
||||
#define INA260_REG_MFG_UID 0xFE ///< Manufacturer ID Register
|
||||
#define INA260_REG_DIE_UID 0xFF ///< Die ID and Revision Register
|
||||
|
||||
#define UINT8_ARR_TO_UINT16(_U8_) ((uint16_t)(_U8_[0]) << 8) | (uint16_t)(_U8_[1])
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
@@ -88,7 +83,16 @@ typedef enum _INA260_AlertLatch {
|
||||
*******************************************************************/
|
||||
void INA260_Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint16_t INA260_Test_Read(uint8_t reg_address)
|
||||
{
|
||||
uint8_t Receive_Data[2];
|
||||
|
||||
I2CM_Packet_Receive(INA260_I2CADDR_DEFAULT, reg_address, 1, Receive_Data, 2);
|
||||
|
||||
return UINT8_ARR_TO_UINT16(Receive_Data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,21 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define INA260_REG_CONFIG 0x00 ///< Configuration register
|
||||
#define INA260_REG_CURRENT 0x01 ///< Current measurement register (signed) in mA
|
||||
#define INA260_REG_BUSVOLTAGE 0x02 ///< Bus voltage measurement register in mV
|
||||
#define INA260_REG_POWER 0x03 ///< Power calculation register in mW
|
||||
#define INA260_REG_MASK_ENABLE 0x06 ///< Interrupt/Alert setting and checking register
|
||||
#define INA260_REG_ALERT_LIMIT 0x00 ///< Alert limit value register
|
||||
#define INA260_REG_MFG_UID 0xFE ///< Manufacturer ID Register
|
||||
#define INA260_REG_DIE_UID 0xFF ///< Die ID and Revision Register
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
@@ -22,4 +33,6 @@
|
||||
// Function Declarations
|
||||
void INA260_Init();
|
||||
|
||||
uint16_t INA260_Test_Read(uint8_t reg_address);
|
||||
|
||||
#endif // INA260_H
|
||||
@@ -1 +1 @@
|
||||
6
|
||||
11
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
#include "INA260.h"
|
||||
#include "I2C_Master.h"
|
||||
#include "UI_Control.h"
|
||||
#include "Rotary_Encoder.h"
|
||||
@@ -89,6 +90,9 @@ int main(void)
|
||||
// I2C Master =============================================
|
||||
I2CM_Init(false);
|
||||
|
||||
// INA 260 =============================================
|
||||
INA260_Init();
|
||||
|
||||
// UI Control =================================================
|
||||
UI_Control_Init();
|
||||
|
||||
@@ -161,6 +165,12 @@ void Check_For_Serial_Input(void)
|
||||
USB_SERIAL_SEND_TERMINATOR();
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
USB_Serial_Send_Int_Hex(INA260_REG_MFG_UID, 2, true); USB_SERIAL_SEND_STRING(": "); USB_Serial_Send_Int_Hex(INA260_Test_Read(INA260_REG_MFG_UID), 4, true); USB_SERIAL_SEND_TERMINATOR();
|
||||
USB_Serial_Send_Int_Hex(INA260_REG_DIE_UID, 2, true); USB_SERIAL_SEND_STRING(": "); USB_Serial_Send_Int_Hex(INA260_Test_Read(INA260_REG_DIE_UID), 4, true); USB_SERIAL_SEND_TERMINATOR();
|
||||
USB_SERIAL_SEND_TERMINATOR();
|
||||
break;
|
||||
|
||||
default:
|
||||
USB_SERIAL_SEND_STRING("Unknown Command: ");
|
||||
USB_Serial_Put_Char(USB_Data);
|
||||
|
||||
Reference in New Issue
Block a user