BusRepeater_NXP_Arduino 1.0.1
Temperature sensor device operation sample code for Arduino
Loading...
Searching...
No Matches
PCA9617ADP_ARD_LDO.cpp
Go to the documentation of this file.
2
3LDO_control::LDO_control( int s0, int s1, int en ) : _s0( s0 ), _s1( s1 ), _en( en )
4{
5 pinMode( _s0, OUTPUT );
6 pinMode( _s1, OUTPUT );
7 pinMode( _en, OUTPUT );
8}
9
10void LDO_control::set( int v )
11{
12 digitalWrite( _s0, v & 0x01 );
13 digitalWrite( _s1, (v >> 1) & 0x01 );
14 if ( 0xFF != _en ) {
15 digitalWrite( _en, (v >> 2) & 0x01 );
16 }
17
18 _settting = v;
19};
20
21float LDO1::voltage( void )
22{
23 return voltage_values[ _settting ];
24}
25
26float LDO2::voltage( void )
27{
28 return voltage_values[ _settting ];
29}
30
31LDO1::LDO1() : LDO_control( LDO1::S0, LDO1::S1, LDO1::EN_B ) {}
32LDO2::LDO2() : LDO_control( LDO2::S0, LDO2::S1, LDO2::EN_B ) {}
33
34float LDO1::voltage_values[ LDO1::VOLTAGES ] = { 1.8, 2.5, 3.3, 4.96, 0.8 };
35float LDO2::voltage_values[ LDO2::VOLTAGES ] = { 2.5, 3.0, 3.3, 4.96 };
float voltage(void)
static float voltage_values[VOLTAGES]
static float voltage_values[VOLTAGES]
float voltage(void)
LDO_control(int s0, int s1, int en)