MVMFirmwareCpp v0.1
hw.h
Go to the documentation of this file.
1 // hw.h
2 
3 #ifndef _HW_h
4 #define _HW_h
5 
6 #if defined(ARDUINO) && ARDUINO >= 100
7  #include "arduino.h"
8 #else
9  #include "WProgram.h"
10 #endif
11 
12 #include "generic_definitions.h"
13 #include <functional>
14 
15 #ifdef DOXYGEN
16 
17 typedef HW_V4 HW;
18 
19 #else
20 
21 class HW {
22 public:
23 
24 
25 
26  virtual bool Init();
27  virtual bool I2CWrite(t_i2cdevices device, uint8_t* wbuffer, int wlength, bool stop);
28  virtual bool I2CRead(t_i2cdevices device, uint8_t* wbuffer, int wlength, uint8_t* rbuffer, int rlength, bool stop);
29  virtual bool I2CRead(t_i2cdevices device, uint8_t* rbuffer, int rlength, bool stop);
30  virtual bool PWMSet(hw_pwm id, float value);
31  virtual bool IOSet(hw_gpio id, bool value);
32  virtual bool IOGet(hw_gpio id, bool* value);
33  virtual void __delay_blocking_ms(uint32_t ms);
34  virtual void PrintDebugConsole(String s);
35  virtual void PrintLineDebugConsole(String s);
36  virtual void Tick();
37  virtual uint64_t GetMillis();
38  virtual int64_t Get_dT_millis(uint64_t ms);
39  virtual bool DataAvailableOnUART0();
40  virtual String ReadUART0UntilEOL();
41  virtual bool WriteUART0(String s);
42  void GetPowerStatus(bool* batteryPowered, float* charge);
43  float GetPIN();
44  float GetBoardTemperature();
45  uint16_t GetSupervisorAlarms();
46 
47 private:
48 
49 };
50 
51 #endif
52 #endif
53 
54 // # # ###
55 // ## # #
56 // # # # #
57 // # # # #
58 // # # # #
59 // # ## #
60 // # # ###
61 //
62 // Nuclear Instruments 2020 - All rights reserved
63 // Any commercial use of this code is forbidden
64 // Contact info@nuclearinstruments.eu
HW_V4::Init
bool Init()
Initialize hardware peripheral in the system.
Definition: fw_board_ni_v4.cpp:36
HW_V4::PrintLineDebugConsole
void PrintLineDebugConsole(String s)
Print a message on console used for Debug with a CR+LR at end.
Definition: fw_board_ni_v4.cpp:384
HW_V4::GetSupervisorAlarms
uint16_t GetSupervisorAlarms()
API return Supervisor managed alarms.
Definition: fw_board_ni_v4.cpp:652
HW_V4::I2CRead
bool I2CRead(t_i2cdevices device, uint8_t *wbuffer, int wlength, uint8_t *rbuffer, int rlength, bool stop)
Write buffer to I2C bus and read data.
Definition: fw_board_ni_v4.cpp:182
HW_V4::ReadUART0UntilEOL
String ReadUART0UntilEOL()
Return a terminated string from communication interface.
Definition: fw_board_ni_v4.cpp:474
arduino.h
hw_gpio
hw_gpio
Definition: generic_definitions.h:33
HW_V4::PrintDebugConsole
void PrintDebugConsole(String s)
Print a message on console used for Debug.
Definition: fw_board_ni_v4.cpp:368
HW_V4::I2CWrite
bool I2CWrite(t_i2cdevices device, uint8_t *wbuffer, int wlength, bool stop)
Write buffer to I2C bus.
Definition: fw_board_ni_v4.cpp:145
HW_V4::WriteUART0
bool WriteUART0(String s)
API to write a string to the communication interfaces.
Definition: fw_board_ni_v4.cpp:463
HW_V4::Tick
void Tick()
Tick function must be called periodically.
Definition: fw_board_ni_v4.cpp:403
HW_V4::GetPowerStatus
void GetPowerStatus(bool *batteryPowered, float *charge)
API to read battery charge and power supply status.
Definition: fw_board_ni_v4.cpp:438
HW_V4::GetPIN
float GetPIN()
API return pressure on input of MVM.
Definition: fw_board_ni_v4.cpp:623
HW_V4
Driver for the Nuclear Instruments V4 Hardware Board.
Definition: fw_board_ni_v4.h:23
HW_V4::GetBoardTemperature
float GetBoardTemperature()
API return temperature of the board.
Definition: fw_board_ni_v4.cpp:633
t_i2cdevices
t_i2cdevices
Definition: generic_definitions.h:36
HW_V4::DataAvailableOnUART0
bool DataAvailableOnUART0()
API to read if on the communication interfaces there are bytes to be read.
Definition: fw_board_ni_v4.cpp:452
generic_definitions.h
HW_V4::PWMSet
bool PWMSet(hw_pwm id, float value)
Control PWM device (PV1)
Definition: fw_board_ni_v4.cpp:256
HW_V4::IOSet
bool IOSet(hw_gpio id, bool value)
Set a GPIO Status (IE Control PV6, Alarms, etc)
Definition: fw_board_ni_v4.cpp:288
HW_V4::IOGet
bool IOGet(hw_gpio id, bool *value)
Get GPIO Status.
Definition: fw_board_ni_v4.cpp:325
HW
HW_V4 HW
Definition: hw.h:17
hw_pwm
hw_pwm
Definition: generic_definitions.h:32